Build a PyTorch ReLU Kernel with Hugging Face Kernels (CPU + Metal)
- Source
- youtube.com
- Author
- Hugging Face
- Date
Context
The kernels library, shown in a video demo and talk, distributes compiled GPU and CPU code, called kernels, that a PyTorch program loads while it runs. A user points to a repository of prebuilt files and a version, rather than installing the kernel with pip.
The loader picks the build that matches the user's PyTorch version, Python version and hardware, such as CUDA or Apple Metal. Because kernels are not installed into the Python environment, several versions of a kernel with the same name can coexist, and registering the operation as a native PyTorch operation lets torch.compile capture it. In the demo, the presenter builds a ReLU kernel for CPU and Metal, producing four builds (CPU and Metal for each of PyTorch 2.9 and 2.10), then loads it from a local path, where the runtime picks the PyTorch 2.10 Metal build.
Checking sign-in…
Loading comments…






