Getting 50 GB/s Back Out of the ANE
Introduction
An RTL performance erratum in the Apple M3 Neural Engine throttles DRAM weight streaming throughput down to 17–19 GB/s from the nominal 45–60 GB/s, whenever the total weight size is an integer multiple of 1 MiB, which currently affects 7 of ANEMLL’s 15 models. Avoiding the problematic path in the kernel DMA engine's speculative prefetch ring increased Llama 3.2 1B token throughput from 10.0 to 24.3 tokens/s (DRAM usage from 24.7 to 60.0 GB/s), and Qwen3-8B from 1.36 to 2.97 tokens/s (DRAM usage from 22.4 to 48.7 GB/s).
Discovery
I was profiling the neural engine's DRAM weight streaming throughput (GB/s) for single token decode:
At \(N=4096\), I noticed that \(D=1536\) ran nearly 3× faster than \(D=2048\), the default used in Llama 3.2.
STATIC (pure KernelDMA) median µs per replica, N=4096:
D 576 768 1024 1280 1536 2048 rep a 150.4 196.8 238.1 293.8 310.9 997.6 rep b 157.8 190.2 250.1 288.3 326.8 995.0 rep c 148.7 189.6 249.4 275.2 316.5 995.4
Sweeping the D around the neighborhood of D = 2048:
Huh?
... continue reading