KernelEntry

Contents

KernelEntry#

class brainevent.KernelEntry(backend, platform, kernel_generator)[source]#

A registered kernel implementation for a specific backend and platform.

KernelEntry is a lightweight data class used internally by XLACustomKernel to store a single kernel implementation together with the backend and platform it targets.

Parameters:
  • backend (str) – The backend name (e.g., 'numba', 'warp', 'pallas', 'triton', 'cuda_raw', 'numba_cuda').

  • platform (str) – The hardware platform name (e.g., 'cpu', 'gpu', 'tpu').

  • kernel_generator (Callable[..., Callable]) – A callable that accepts keyword arguments (forwarded from the primitive bind call) and returns a concrete kernel function ready to be invoked with the input arrays.

See also

XLACustomKernel

The kernel manager that creates and stores KernelEntry instances.

XLACustomKernel.def_kernel

Method used to register a new KernelEntry.

Notes

KernelEntry instances are created internally by XLACustomKernel.def_kernel() and stored in a nested dictionary keyed by (platform, backend). Users typically do not need to instantiate this class directly.

Examples

>>> entry = KernelEntry(
...     backend='numba',
...     platform='cpu',
...     kernel_generator=my_kernel_generator,
... )
>>> entry.backend
'numba'
>>> entry.platform
'cpu'