One admission key: how a stalled GPU campaign found 16.8% in an afternoon
Sixteen hours of measurement moved decode by half a percent. The correction was organizational: stop auditing, dispatch three parallel fix agents against the already-diagnosed wins, and gate them lightly. One fix was a single missing hash key for Apple's own kernel binary, worth 17% end to end.

The previous post ended with three of the project's own forecasts refuted by measurement. Decode sat at 72.8 tokens/second against Metal's 148.5 on the same Apple M2 Ultra. The next sixteen hours added more instrumentation and moved the number by half a percent. This post covers the afternoon that changed that: 84.04 tok/s, one admission key, and the change in process that made it possible.
Transcript
Decode on an Apple M2 Ultra sat at 72.8 tokens per second, against 148.5 for Metal, Apple's own graphics stack. Sixteen hours of measurement moved it half a percent. One afternoon took it to 84.04.
Every result was correct, and none was progress. A kernel patch: minus 0.002 percent. A config flip: minus 2 percent. A fusion candidate: 36 percent slower.
The fix was organisational: three agents, one diagnosed win each, gated only by what that work risks. A geometry theory was refuted in 13 minutes. The flush mask reached its floor at plus 4.75 percent.
The biggest item, the feed-forward gate/up multiply, was 72 dispatches per token at 57.9 microseconds each, run natively. Apple's captured kernel, the companion, had been recorded under another shader class's key. One added key fixed that, and all 18,362 gate/up dispatches ran the companion.
In a clean A/B run, the control made 71.95 tokens per second and the companion 84.04: plus 16.8 percent, with byte-exact output.
From 38 tokens per second stock, that's plus 121 percent, and the gap to Metal is down to 1.77 times. The full write-up is at boracode.ai.
The stall
By then the project had a large measurement apparatus. Hardware timestamp buffers read per-command GPU time at half a percent overhead. Firmware telemetry streamed power states. A same-binary differential ran against macOS Metal. An eighteen-hypothesis elimination framework carried pre-registered signatures. Every experiment had a receipt, every failure was preserved, and every claim traced to a file and a line.
The queue of results looked like this:
- A kernel patch measured -0.002%.
- A config flip that isolated benchmarks put at +1.8% measured -2% in vivo.
- A fusion candidate, proven engaged, ran 36% slower.
Each null result was correct and each post-mortem was honest, but together they were no progress. The operator's assessment was "We are clearly still missing a 2x somewhere — are you actually driving this?", followed by "This is getting silly and costly."
The diagnosis was procedural. Auditing had displaced fixing. Three already-diagnosed wins sat in a serial queue behind correctness checks built for kernel modules, although the fixes themselves were at the level of environment variables. With one agent running one gated experiment per hour, the biggest identified wins never reached the front of the queue.
Parallel fix wave
The reorganization took one message. Three background agents each received one diagnosed win. Each was gated only by what Tier-1 work actually risks: an engagement proof, byte-exact greedy decode (the pinned output hash), and an interleaved A/B. Read-only questions no longer needed isolated trees, and environment variables no longer needed a review queue. A standing rule from an earlier critique stayed in force: nothing read-only takes more than thirty minutes.
Refuted: the geometry theory (13 minutes)
The leading theory was that Metal's pipeline metadata records maxTotalThreadsPerThreadgroup: 640 for the q4_0 matvec, while the injected launches showed 64-thread workgroups. A tenfold parallelism difference sitting in a metadata file looked like the missing 2x.
Thirteen minutes of source review refuted it. The 640 is a register-derived ceiling logged at pipeline creation. Metal's actual dispatch, from the archived host source, is ceil(rows/8) threadgroups of 64 threads, which is the geometry already being launched. The disassembly confirmed it. The work-assignment stride is baked into the machine code, so launching 640-thread groups would have done tenfold redundant work while passing the correctness oracle vacuously, because duplicates write identical values. The agent recognized that validation trap and avoided it. The refutation cost no GPU time.
Exhausted: the flush mask (+4.75% kept)
The driver stamps a global flush mask of 0xfffff, all twenty cache domains, at 366 command boundaries per token, where precise flushes would do. An earlier phase of the campaign had found a narrower mask worth +3.9%, so the agent ran the whole family:
- The narrower
0x270reproduces at +4.75%, byte-exact. - Dropping bit 9 produces degenerate one-byte tokens. The model still decodes but emits garbage, in two independent runs. This is an instant rejection and a new fact: the compute test suite never needs bit 9, and live decode does.
- Dropping bit 5 gains +0.14%, which is noise.
The mask lever has reached its floor.
The fix: one hash key, seventeen percent
The largest single item in the decode graph is the feed-forward gate/up matvec: 72 dispatches per token at 57.9 µs each. It ran natively because its companion admission failed. The captured Apple binary's recorded key did not match the live shader's.
The root cause took one focused pass. ggml-vulkan selects the dequantized matvec pipeline class by row count. At m ≤ 8192 it compiles the LARGE-workgroup specialization, and above that the SUBGROUP one. The sidecar recorded the key for the LARGE class. The live gate/up shader (m = 9728) compiles SUBGROUP, which yields a different serialized NIR, a different hash, and no admission. The captured Apple binary is m-generic, because the row count travels in uniforms and the grid override already recomputes Metal's geometry from it.
The fix added the missing admission key, so the same binary is admitted at the slot it was already generic enough to serve. The gates were:
- a strict oracle at 9728×2560 (max error 2.6e-05);
- byte-exact greedy decode against the pinned hash;
- an engagement proof showing all 18,362 gate/up dispatches in a full 256-token decode running the companion.
The first A/B attempt was contaminated. A sibling agent collided on the GPU, and the corrupted arms showed 2x contention and were preserved as evidence. The clean rerun:
The gain is +16.8%. The arithmetic cross-checks: 72 dispatches × 57.9 µs was 4.17 ms of every 13.6 ms token, the companion runs that class at roughly 1.65x, and the graph agrees.
Current state
The stock stack runs at 38 tok/s, and the campaign's retained, reproducible baseline is 73.34 clean / 75.97 mask-0x270 tok/s (tg32, byte-exact ABBA) — which reproduces as of 2026-10-18/19 at 73.5443/76.5982 (+0.28 %/+0.83 %). This post's own A/B winner is 84.04 tok/s against its paired control at 71.95, a +16.8% within-post result; it is internally consistent and byte-exact, but it is not the campaign's level, and it should not be read as one. Every step has a receipt, and decode output stayed byte-identical to the pinned contract throughout. Absolute numbers here need their stack named: the retained instrument is a (driver DSO, backend build) pair — the R3 Vulkan DSO dffafef7… plus the backend q40-shift-elision-isolated-r4/build-off — and a tok/s figure quoted without both halves is meaningless (campaign pins 162/166). The flush mask stacks orthogonally because it acts at the driver level, so the combined configuration should reach 87–88. That figure is a projection and has not been measured as a combined run. The gap to Metal's 148.5 is down to 1.77x from 84.04.
The next experiment is to run Apple's own binaries at Metal's measured per-dispatch speed on the most direct dispatch path available. The binary, geometry and work assignment are already shown to be identical, so whatever remains is the environment the driver provides.
Lesson
The instruments were necessary, and every refutation in this post came from them. The failure mode is that each new instrument feels like progress while each diagnosed fix waits in a queue built for riskier work. The remedy was to match the gates to the risk, run the independent fixes in parallel, and have the measurement apparatus serve the fixes. Sixteen hours of auditing bought half a percent. One afternoon of parallel fixing bought seventeen.
Corrected 2026-10-19: the title and stats originally claimed this arc as "73 to 84 tok/s" and "38 → 84 tok/s | +121% over the stock stack". The 84.04 tok/s figure is this post's own A/B winner (B1 84.04, B2 83.77, control A2 71.95) and is internally consistent, but it is a within-post A/B result, not the campaign's level. The retained, reproducible campaign baseline is 73.34 clean / 75.97 mask-0x270 tok/s (tg32, byte-exact ABBA), which reproduces as of 2026-10-18/19 at 73.5443/76.5982 (+0.28 %/+0.83 %). The similar-sounding 84.68 tok/s figure is an absent-config reference row and must never be used as a baseline.
