sgl-kernel/csrc/metal/README.md
Custom Apple Metal kernels for the MLX backend on Apple Silicon. Shader sources (*.metal) and C++ host / nanobind sources (*.cpp) in this directory are compiled by sgl-kernel/setup_metal.py into the sgl_kernel._metal extension and the sgl_metal_kernels.metallib archive, and exposed through Python wrappers in python/sgl_kernel/metal.py.
| Kernel | Description | Tested on |
|---|---|---|
| none yet | — | — |
csrc/metal/<kernel>.metal.csrc/metal/<kernel>.cpp, exporting the entry point on the sgl_kernel._metal module.metal_shader_sources and cxx_sources in sgl-kernel/setup_metal.py.python/sgl_kernel/metal.py that validates input shapes/dtypes and calls mx.eval on its operands before invoking the AOT C++ entry point.sgl-kernel/tests/ and update the Kernels table above with a short description and the hardware / OS / MLX version the kernel was validated on.placeholder.metal / placeholder.cppplaceholder.metal and placeholder.cpp are intentionally empty. They exist only so that setup_metal.py has at least one shader source and one C++ source to compile, allowing the sgl_kernel._metal extension and the sgl_metal_kernels.metallib archive to build successfully before any real Metal kernels have been added. Both files (and their entries in metal_shader_sources / cxx_sources in setup_metal.py) MUST be removed once the first real kernel lands.