Build a PyTorch ReLU Kernel with Hugging Face Kernels (CPU + Metal)
In this video, I walk through the Hugging Face Kernels Library and build a real PyTorch ReLU kernel end to end. You’ll see how to package kernels, publish compiled artifacts, and load the right kernel at runtime based on your environment. What we cover: - What the Hugging Face Kernels Library is and why it exists - Kernel builder workflow (source → build matrix → artifacts) - CPU + Metal implementation walkthrough - Torch extension + Python wrapper setup - Nix-based deterministic builds and caching - Runtime kernel selection with get_local_kernel Chapters: 00:00 Intro 00:31 What the Kernels Library does 02:35 Why use it 04:42 Kernel project structure 06:04 Live demo: ReLU kernel (CPU + Metal) 08:02 Torch extension and Python wrapper 09:36 Build process with Nix + cache 10:49 Build outputs and artifact matrix 12:00 Local usage and runtime selection 13:42 Docs and wrap-up