
Description
metal-kernel is an agent skill from the PyTorch repository that guides the writing of Metal kernels for PyTorch operators on Apple Silicon, so that operators run on the Metal Performance Shaders (MPS) device. It covers two workflows: adding MPS support to a new operator from scratch, and migrating an operator that uses MPSGraph to native Metal. The skill is firm about the approach. Its goal is to use native Metal capabilities through the c10/metal infrastructure, not MPSGraph, because native Metal kernels offer better control, performance and maintainability. Both workflows involve the same three parts. The first is updating dispatch in the native functions YAML file, aten/src/ATen/native/native_functions.yaml. The second is writing the Metal kernel in aten/src/ATen/native/mps/kernels. The third is implementing the host-side stub in aten/src/ATen/native/mps/operations. The skill is organized as numbered steps, starting with the native functions file. It is listed on skills.sh, with its security audit results shown there. It suits contributors to PyTorch who work on the Apple GPU backend and need a consistent procedure for kernel work.…
Highlights
- Native Metal kernels via c10/metal
- Two workflows: new support and MPSGraph migration
- Dispatch, kernel and host stub steps
- Guidance for Apple Silicon operators
Ratings & Reviews
No ratings yet
Be the first to rate metal-kernel.
People also visit
metal-kernel FAQ
What does the metal-kernel skill do?
It guides writing Metal kernels for PyTorch operators on Apple Silicon, for the MPS device.
How do I install it?
Run: npx skills add https://github.com/pytorch/pytorch --skill metal-kernel
Why native Metal instead of MPSGraph?
The skill says native Metal kernels offer better control, performance and maintainability, and it uses the c10/metal infrastructure for them.
Which files are involved?
The native functions YAML, the Metal kernels folder under the MPS directory, and the host-side stub in the MPS operations folder.
What security checks has it passed?
skills.sh lists three audits: Gen Agent Trust Hub Pass, Socket Pass and Snyk Pass.
What are the best metal-kernel alternatives?
Popular alternatives to metal-kernel include pytorch-patterns, pr-review and pytorch-lightning. See all metal-kernel alternatives








