ME

metal-kernel

Implement native Metal shaders for PyTorch operators on Apple Silicon.

Install

mkdir -p .claude/skills/metal-kernel && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2590" && unzip -o skill.zip -d .claude/skills/metal-kernel && rm skill.zip

Installs to .claude/skills/metal-kernel

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Write Metal/MPS kernels for PyTorch operators. Use when adding MPS device support to operators, implementing Metal shaders, or porting CUDA kernels to Apple Silicon. Covers native_functions.yaml dispatch, host-side operators, and Metal kernel implementation.
258 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • →Update native_functions.yaml for MPS dispatch
  • →Implement Metal kernels using c10/metal/ infrastructure
  • →Create host-side stubs for operator dispatch
  • →Register unary and binary operations
  • →Handle complex number types in Metal

How it works

It uses the c10/metal/ infrastructure to register custom Metal kernels and host-side stubs, replacing legacy MPSGraph implementations.

Inputs & outputs

You give it
TensorIteratorBase
You get back
Device-side tensor operation

When to use metal-kernel

  • →Implement new MPS operators
  • →Port CUDA kernels to Apple Silicon
  • →Optimize PyTorch performance

About metal-kernel

Guides the implementation of native Metal kernels via the `c10/metal/` infrastructure. It covers dispatch updates, kernel writing, and host-side stub creation.

Write Metal/MPS kernels for PyTorch operators. Use when adding MPS device support to operators, implementing Metal shaders, or porting CUDA kernels to Apple Silicon. Covers native_functions.yaml dispatch, host-side operators, and Metal kernel implementation.

When not to use it

  • →Using MPSGraph for new operator implementation
  • →Performing host-side synchronization for error checking

Prerequisites

PyTorch development environmentApple Silicon hardware

Limitations

  • →Requires native Metal kernel implementation
  • →No support for V100 or CPU inference

How it compares

This approach provides native Metal control and performance, avoiding the overhead and limitations of MPSGraph.

Compared to similar skills

metal-kernel side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
metal-kernel (this skill)36moReviewAdvanced
gguf-quantization610moReviewIntermediate
pytorch-fsdp269moNo flagsAdvanced
huggingface-accelerate310moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

gguf-quantization

davila7

GGUF format and llama.cpp quantization for efficient CPU/GPU inference. Use when deploying models on consumer hardware, Apple Silicon, or when needing flexible quantization from 2-8 bit without GPU requirements.

629

pytorch-fsdp2

Orchestra-Research

Adds PyTorch FSDP2 (fully_shard) to training scripts with correct init, sharding, mixed precision/offload config, and distributed checkpointing. Use when models exceed single-GPU memory or when you need DTensor-based sharding with DeviceMesh.

627

huggingface-accelerate

davila7

Simplest distributed training API. 4 lines to add distributed support to any PyTorch script. Unified API for DeepSpeed/FSDP/Megatron/DDP. Automatic device placement, mixed precision (FP16/BF16/FP8). Interactive config, single launch command. HuggingFace ecosystem standard.

328

model-pruning

davila7

Reduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsity with minimal accuracy loss, or enabling faster inference on hardware accelerators. Covers unstructured pruning, structured pruning, N:M sparsity, magnitude pruning, and one-shot methods.

222

optimizing-attention-flash

davila7

Optimizes transformer attention with Flash Attention for 2-4x speedup and 10-20x memory reduction. Use when training/running transformers with long sequences (>512 tokens), encountering GPU memory issues with attention, or need faster inference. Supports PyTorch native SDPA, flash-attn library, H100 FP8, and sliding window attention.

316

serving-llms-vllm

davila7

Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency/throughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ/AWQ/FP8), and tensor parallelism.

66

Search skills

Search the agent skills registry