metal-kernel

Implement Metal kernels and host stubs for PyTorch operators on Apple Silicon.

1|Updated Apr 5, 2026
One-click install
npx skills add https://github.com/steleman/pytorch-cuda-2.11.0 --skill metal-kernel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: metal-kernel
Source: https://github.com/steleman/pytorch-cuda-2.11.0/tree/main/.claude/skills/metal-kernel
Command: npx skills add https://github.com/steleman/pytorch-cuda-2.11.0 --skill metal-kernel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Metal kernel development for PyTorch on Apple Silicon to enable native GPU acceleration of operators.

Core Features & Use Cases

  • Implement Metal kernels for PyTorch operators in aten/src/ATen/native/mps/kernels/.
  • Add Dispatch mappings to native_functions.yaml for MPS support and ensure proper host-side stubs are wired in aten/src/ATen/native/mps/operations/.
  • Provide battle-tested host-side integration via TensorIterator-based workflows and stepwise migration from MPSGraph to native Metal.

Quick Start

Run the task to implement a Metal kernel and a corresponding host stub for a new PyTorch operator.

Frequently Asked Questions about metal-kernel

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement Metal kernels for PyTorch operators on Apple Silicon?

Implement Metal kernels for PyTorch operators by writing kernel code in aten/src/ATen/native/mps/kernels/ and wiring host-side stubs in Operations to enable native Apple Silicon GPU acceleration.

How do I add MPS dispatch mappings to native_functions.yaml?

Add MPS dispatch mappings to native_functions.yaml to register new PyTorch operators, ensuring proper host-side stubs are integrated in aten/src/ATen/native/mps/operations/ for correct dispatch routing.

Can I port existing CUDA kernels to Metal for MPS support?

Porting CUDA kernels to Metal for MPS support involves migrating to native Metal implementations in kernels/ and replacing MPSGraph workflows with TensorIterator-based host-side integration.

What is the process for migrating from MPSGraph to native Metal in PyTorch?

Migrating from MPSGraph to native Metal requires writing Metal kernels in kernels/ and implementing TensorIterator-based host-side workflows to achieve native Apple Silicon acceleration for PyTorch operators.

Do I need host-side stubs to wire Metal kernels into PyTorch?

Host-side stubs are required to wire Metal kernels into PyTorch, ensuring the Operations layer correctly interfaces with the kernel implementations and updates native_functions.yaml dispatch mappings.

Why use native Metal kernels instead of MPSGraph for PyTorch operators?

Native Metal kernels provide battle-tested host-side integration and stepwise migration from MPSGraph, enabling optimized native Apple Silicon acceleration directly within the PyTorch operator stack.