Decorates a kernel or helper. Launch a kernel with kernel[grid](*args, **constexprs, num_warps=4).
Host APIReference pages
Reference
Host API
The functions and classes in the enceladus module that compile, launch, and tune kernels, allocate tensors, and exchange memory with other frameworks. To call them inside a kernel, use the language builtins instead.
Compile and launch
Compiles one specialization without launching it. The result has msl, ir, num_warps, and threadgroup_memory_bytes.
Prints and returns the compiler's layout, register, and backend decisions.
Compiles hand-written MSL. Launch with kernel[grid, threads_per_group](*args).
Returns ceil(x / div), the number of blocks that cover x.
Returns the smallest power of two that is at least n.
Autotuning
Picks the fastest config for each distinct set of key values and argument dtypes.
One autotuning candidate: constexpr values plus launch options.
Computes constexpr values from the kernel's arguments.
Returns the shipped matmul candidates for float32, float16, or bfloat16.
Returns the shipped flash attention candidates.
Times fn with GPU timestamps and returns milliseconds.
Streams and interop
Waits for all work on the default stream.
Lets launches with NumPy arrays return before the GPU finishes.
Returns strides in elements for Enceladus, NumPy, PyTorch, or MLX arrays.
Returns the element type of an Enceladus, NumPy, PyTorch, or MLX array as a NumPy dtype.
Allocates an array of the same framework and device as like. dtype can be a NumPy dtype.
Like new_empty, and fills the array with zeros.
Returns the process-wide Metal device and its capabilities.
A context manager that records GPU work to a .gputrace bundle.
Tensors
An enceladus.Tensor lives in memory that the CPU and GPU share. Slicing returns a view.
Returns an uninitialized tensor.
Returns a tensor filled with zeros or ones.
Returns a tensor filled with value.
Returns standard normal or uniform [0, 1) samples.
Returns a range tensor, like np.arange.
Returns a tensor with the shape of t.
Shares a's memory when it's C-contiguous and 16 KB page-aligned, and copies otherwise.
Waits for pending GPU work and returns the data on the host.
Errors
Raised for a construct that Enceladus can't compile, with the source location and a fix.
An AssertionError subclass raised when tl.device_assert fails.
Raised for a Metal runtime error, such as a failed command buffer.
jit.