using-metal-validation
Installation
SKILL.md
Using Metal Validation
Overview
Metal provides two validation modes, both configured via environment variables read at MTLDevice creation:
- API validation (
MTL_DEBUG_LAYER) — CPU-side. Cheap; enable broadly during development. - Shader validation (
MTL_SHADER_VALIDATION) — GPU-side. Potentially significant perf cost; enable selectively or per-pipeline.
Env vars must be set before any MTLDevice is created. Changes after device creation have no effect.
Step 1: Read the man page
The man page is the authoritative reference for all env vars, their valid mode values, and pipeline scoping syntax. Read it before configuring anything beyond the quick-start:
man MetalValidation | col -b