metalworking
GitHub (opens in a new tab)
/glossary/war-stories/cheap-tricks

Cheap Tricks

Three measured, zero-code or near-zero-code wins that belong in every Apple Silicon practitioner's kit, plus the reminder that they carry the platform's signature risk.

Raise the GPU wired-memory ceiling. By default macOS caps how much of unified memory the GPU may wire; sudo sysctl iogpu.wired_limit_mb=N raises it (the classic thread (opens in a new tab)). A 192 GB machine goes from ~140 GB to ~184 GB of usable "VRAM", the difference between a 70B model fitting or not. Undocumented, resets on reboot, occasionally moved between sysctl names across macOS versions: the async-copy story in miniature, run knowingly.

Read the bandwidth line on the spec sheet before profiling anything. Across M-series tiers, decode tokens/sec tracks memory bandwidth almost linearly (M5 Max megathread (opens in a new tab)), because decode is bandwidth. Practical uses: hardware buying decisions (the Max's 4× bandwidth over the base chip buys ~4× decode; extra GPU cores beyond that buy prefill, not chat latency), and sanity checks (if your tok/s is far off bandwidth ÷ model bytes, something is broken: go look).

Control thermals or your benchmark lies. MTPLX measured long-run throughput decay dropping from 50% to 6.7% just by locking fans to max. Laptop and fanless chips throttle under sustained ML load; a benchmark's first ten seconds and its steady state are different machines. Fan control (or a Mac Studio) is part of measurement methodology here.

One honorable mention: the ANE exists. The Neural Engine, the third matrix engine on the die after the GPU and AMX, reaches ~6.6 TFLOPS/watt (vs ~1 for the GPU) but speaks only Apple's model frameworks (Core ML, and from macOS 27 Core AI, Apple's new framework for neural-network models, whose converter can bundle custom Metal 4 kernels into a model); the community's reverse-engineering effort (opens in a new tab) to train on it through private APIs is equal parts impressive and cautionary. For Metal work its main relevance is knowing that some workloads (quantized-conv-shaped inference at low power) have a better home than the GPU, and that Apple's own frameworks may route there without telling you.

That ends the reference entries. The last section reads whole inference engines for where their speed comes from; SOURCES.md (opens in a new tab) has the full annotated list of repos, writeups, and people worth following to stay current.