Enceladus v0.1.0 · alpha
Apple siliconMetalPython 3.11+

Triton-style GPU kernels, compiled for your Mac.

Enceladus compiles Python tile programs to Metal Shading Language while your program runs. You don't need Xcode or the Metal toolchain. Kernels accept NumPy arrays, PyTorch mps tensors, and MLX arrays.

uv add enceladus
0.46 msto compile a vector add from Python to MSL
3.4 µshost cost of an asynchronous launch
M1 and latermacOS 15 or later, any Apple GPU
import numpy as np

import enceladus
import enceladus.language as tl


@enceladus.jit
def add_kernel(x_ptr, y_ptr, out_ptr, n, BLOCK: tl.constexpr):
    offs = tl.program_id(0) * BLOCK + tl.arange(0, BLOCK)
    mask = offs < n
    x = tl.load(x_ptr + offs, mask=mask)
    y = tl.load(y_ptr + offs, mask=mask)
    tl.store(out_ptr + offs, x + y, mask=mask)


x = np.random.default_rng(0).standard_normal(100_000, dtype=np.float32)
y = np.ones_like(x)
out = np.empty_like(x)
add_kernel[(enceladus.cdiv(x.size, 1024),)](x, y, out, x.size, BLOCK=1024)
np.testing.assert_allclose(out, x + y)
The generated.metal tab is real compiler output for this kernel. Each of the 128 threads holds 8 of the 1,024 tile elements in registers.