Skip to content
Kitbay
Submit
Skill

metal-kernel

NOASSERTIONUpdated on Nov 11, 2026105,390GitHub stars

A maintainer skill in the PyTorch repository for writing native Metal kernels that run PyTorch operators on Apple Silicon GPUs, preferred over MPSGraph for control and speed.

What the skill teaches

A maintainer skill in the PyTorch repository for writing native Metal kernels that run PyTorch operators on Apple Silicon GPUs, preferred over MPSGraph for control and speed. The agent adds the MPS entry to the operator's dispatch definitions, writes the kernel as a templated functor registered with the project's unary or binary macros, adds a host-side stub that runs it and removes any old MPSGraph implementation, then builds with ninja. It covers complex and boolean arguments, very large tensors and error reporting from inside kernels, how to take the operator off the MPS skip and expected-failure lists so its tests run, and testing single shaders with the compile_shader helper.

Capabilities

  • Add MPS dispatch for a PyTorch operator
  • Write and register a native Metal kernel
  • Migrate an operator off MPSGraph
  • Enable and run the operator's MPS tests