Mapping Honeykrisp decode: +27%, and where the other half lives
An M2 Ultra decodes a 4B model at half the rate of a machine with a third of its bandwidth. Two environment variables recover 27%, and six further experiments rule out the conventional explanations. The remaining 2x lies below the kernel source and the compiler schedule.

An M2 Ultra decodes a 4B quantized model at 38.5 tokens per second through Vulkan. A Strix Halo, with a third of the memory bandwidth on paper, decodes the same file at 78. Each candidate explanation for the gap was tested by one experiment. Two environment variables recover +27%, and the measurements place the rest of the gap outside the kernel source, the arithmetic and the compiler's instruction schedule. This post lists every experiment with its numbers.
Transcript
An M2 Ultra decodes a 4B model at 38.5 tokens per second through Vulkan. A Strix Halo, with a third of the memory bandwidth on paper, decodes the same file at 78.
Two environment variables take the M2 Ultra from 38.5 to 48.9 tokens per second. That's plus 27 percent.
llama.cpp tunes its matrix-vector kernels per GPU vendor. Honeykrisp, Mesa's Vulkan driver for Apple silicon, matches no vendor, so it gets 32-thread workgroups. With 128-thread workgroups, 4 subgroups share each row: plus 21.3 percent on its own.
Where does the rest go? Every dispatch pays about 34 microseconds before its first byte streams. At 250 dispatches per token, that's about 8.5 of a 20.6 millisecond token: 41 percent of every token is overhead, not work.
The usual suspects were measured and closed. Apple's own Metal arithmetic, ported: minus 17.5 percent. Deleting the math entirely, and keeping the loads: only plus 14.4.
Apple's compiler builds the same scalar kernel, so the remaining 2x lies below the kernel source and the compiler schedule. For now, two variables recover 27 percent. The full write-up is at boracode.ai.
Test bench
Upstream defaults leave half the decode rate
The kernel dispatch code in ggml-vulkan.cpp tunes two values per driver: rows per workgroup (AMD GCN and Intel get raised values) and a shader_core_count that several memory heuristics consume. Mesa's Honeykrisp reports VK_VENDOR_ID_MESA, which matches neither vendor branch. It therefore receives 32-thread workgroups and a core count of zero, and every heuristic downstream of those two values runs at its floor.
The two knobs compose multiplicatively: 1.213 × 1.038 = 1.259, measured 1.258. Throughput rises monotonically with parallelism per row. Raising rows per workgroup loses 7–34% because there are fewer groups, doubling the groups gains 7%, and the four-subgroup cooperative form is best. Strix Halo's driver makes the equivalent choice for its hardware, and Honeykrisp has no such branch.
Per-shape bandwidth
With the two knobs set, a perf-logger decomposition of one decode token shows the whole token inside matrix-vector kernels. Per-shape effective bandwidth accounts for the rest of the gap:
| shape | per dispatch | effective |
|---|---|---|
| gate+up 9728×2560 | 81.9 µs | 171 GB/s · 4864 workgroups |
| down 2560×9728 | 84.6 µs | 165 GB/s |
| q-proj 4096×2560 | 55.0 µs | 107 GB/s |
| kv 1024×2560 | 38.7 µs | 38 GB/s · 512 workgroups |
| output head q6_K | 1582 µs | 202 GB/s |
| — machine peak | 800 GB/s |
Useful FLOPs run at 0.5–2.1% of the 27 TFLOPS peak. Issued instructions, counting the full dequantization overhead of ~12.8 scalar operations per weight, reach ~13% of issue capacity. An ALU-ablation run (same loads, checksum instead of the arithmetic) gains exactly +14.4%, which matches that ceiling. Neither pipe is saturated, so the kernel is latency-bound.
Fitting the six shapes gives t ≈ 34 µs + bytes/290 GB/s. Every dispatch pays a fixed cost before the first byte streams. At 250 matvec dispatches per token, that fixed cost is ~8.5 ms of a 20.6 ms token, so 41% of every token is dispatch overhead and not work.
Closed by measurement
Each row of the ladder is an experiment. Two need detail.
Metal ports. Porting Apple's own Metal kernel for this operation, first its geometry and then separately its arithmetic, loses on Honeykrisp: −10% and −17.5% respectively, 991/991 correct both times. The generic kernel's structure already suits this machine, and Apple's source suits Apple's compiler.
Gate/up pair fusion. The host patch fuses all 36 layers. The perf logger shows MUL_MAT_PAIR_GATE_UP at 36 dispatches replacing 72, and the pair itself runs 19% faster. End to end, however, the gain is only +1.1% where the fixed-cost model predicted +6%. The fixed cost partly overlaps other work, and removing dispatches converts to wall-clock time at only ~18% of the naive rate. Dispatch-count estimates should be priced at that measured conversion and not at the nominal saving.
Apple compiles the same scalar kernel
ggml's Metal kernel compiles on a Mac with xcrun -sdk macosx metal -S -O3. The optimized IR of the reference q4_0 matvec is scalar throughout: 2-byte nibble loads, element-by-element activation reads, one simd_sum, no vector loads and no exotic intrinsics. The Vulkan shader here has the same structure.
The Mesa compiler flags point the same way. Disabling the backend optimizer entirely (AGX_MESA_DEBUG=noopt) or the scheduler (nosched) moves decode by less than half a percent. The gap to Apple's ~2x on the same silicon is therefore not in the kernel source or the instruction schedule.
Remaining work
Two layers sit below everything eliminated so far. The first is Apple's final AIR-to-AGX lowering, which is invisible from Linux. It could be captured by running macOS as a guest under the m1n1 hypervisor, tracing what the driver uploads, and decoding it with Asahi's own disassembler. The second is the kernel-driver submission pipeline, where the 34 µs fixed cost lives. It is open source on this machine and can be profiled. A debug Mesa build (26.1.5, same commit as the release driver) supplies the other side of the comparison: this machine's own compiled machine code for the same kernel, dumpable with AGX_MESA_DEBUG=shaders. The plan is to disassemble both, diff the structure, and patch what the diff identifies.
Reproducing the +27%
Power and thermals were monitored throughout (system draw, SoC rail, fans, every temperature channel the SMC exposes). Full decode drew 75.6 W mean and 88.9 W peak against a ~370 W envelope, with the fans unmoved. Nothing here is power- or thermally-limited, and the ceiling is structural.
Update, 2026-09-14: the follow-up campaign ran, starting with the graph chain and then the quant. Decode reached 7.7 t/s on this machine. An imported "optimization table" turned out to be wrong in a lane that only the get-rows gate reads, and a control arm was measuring a CPU fallback and not the best existing path. The full account, including the attribution matrix that cleared the kernels and a second case of the page cache returning wrong data, is in the update to Raising the Honeykrisp memory cap.
