Launch service, not kernel work: decode from 62.61 to 123.52 tokens/s
The first family measurement of the decode pass found the normalisation family at 49.4 % of it, acquitted the matrix-vector family of the contraction-loop pathology that cost prefill 61 %, and closed the split-K lever arithmetically. The one variable the measurement named — launch granularity — then doubled decode: 62.61 to 123.52 tokens/s behind the same 984-id gate.
A kernel-replay engine runs a 4-bit 4-billion-parameter model on an Apple M2 Ultra. The previous post covered prefill — the pass that digests the prompt — where splitting the contraction dimension of the matrix multiply took throughput from 516.523 to 833.559 tokens/s (/blog/agx-split-k-emission). This post covers the other half of the same day: decode, the pass that generates one token at a time.
Decode doubled. 62.61 to 123.52 tokens/s (+97.3 %, ranges disjoint), behind the same 984-position token-id gate as every other admitted result, with both arms at 983 of 984 and the mismatch set identical to the control's. Against the matched Metal bar — a vendor's Metal backend on the same machine, same model file, same frozen prompt, at about 144.6 tokens/s — decode moved from 0.43× to 0.85×. The larger remaining gap is now prefill, at 0.45×.
The change was not a kernel. It moved one thing: launch granularity. The cost the measurement found was launch service, not kernel work.
The pass had never been measured by family
Decode generates tokens one at a time; its graph is 2,093 operations per token. Family attribution splits that pass by kernel family — norms, matrix-vector products, attention, and the small elementwise ops — and measures each family's share of the pass directly, one GPU job at a time.
Until this session, the record carried only a bound: an inference that norms cost 24–43 % of the 15.94 ms pass. The first measured table:
| family | launches | work ms | share of pass |
|---|---|---|---|
norms (rms_norm_mul) | 1,513 | 7.8155 | 49.4 % |
matvec (mul_mv, 248 q4_0 + 4 q4_1 + 1 q6_K head) | 253 | 6.1783 | 39.0 % |
| attention vector | 36 | 0.5010 | 3.2 % |
set_rows | 72 | 0.4425 | 2.8 % |
| everything else | 219 | 0.8844 | 5.6 % |
The model reconciles: the measured native pass is 15.8242 ms against the admitted 15.9394 — a residual of −0.72 %, with a per-compute-command cost of 2.5495 µs consistent with the earlier chunk campaign's 1.43–1.88 µs.
The bound had been low. The normalisation family is 7.8155 ms of a 15.8242 ms pass — 49.4 %, above the inferred 24–43 % band. Measurement beat inference again, and by enough to change the plan: the biggest single cost in decode was not the matrix work at all.
One caveat attaches to this table: it is one sample per arm. Every arm reproduced the admitted token stream exactly, and the reconciliation closes to under one percent, but the family split rests on single samples.
The matvec family acquitted the k-loop
Prefill's whole win came from a contraction-loop pathology: the captured matrix-multiply kernel walked the contraction dimension inside too few threadgroups — the GPU's scheduling units — so narrow shapes streamed their weights at a fraction of the rate the same silicon reaches. Decode's projections run the same M×K shapes, so the obvious worry was that the same pathology hid here too.
It does not. Decode's projections are matvecs, not matrix multiplies, and they run wide:
| shape (M:K) | workgroups/launch | decode GB/s | prefill GB/s |
|---|---|---|---|
| 1024:2560 | 128 | 126.3 | 11.8 |
| 2560:4096 | 320 | 326.5 | 24.4 |
| 2560:9728 | 320 | 433.8 | 45.4 |
| 9728:2560 | 1,216 | 434.7 | 73.9 |
The same shapes run 5.9 to 13.4 times faster in decode than they did in prefill's matrix multiplies.
The matvec family streams its 2.369 GB of weights at 383.4 GB/s in aggregate — 2.7× the 141.2 GB/s marginal rate the matrix-multiply tiles reached on the same silicon — and the per-launch rate saturates at 430–435 GB/s once a launch has 320 workgroups. The head matvec, at 37,984 workgroups, reaches 542.8 GB/s. Only one shape, 1024:2560 at 128 workgroups and 126.3 GB/s, still shows the parallelism-limit signature that split-K attacks.
The contraction-loop pathology that cost prefill 61 % is measured absent at six of the seven decode shapes. The one place prefill's disease existed in decode is the one shape too narrow to matter much.
A lever that closed
Could prefill's trick transfer anyway? The question deserved an answer, and the answer is no, arithmetically.
The decode graph contains zero matrix-multiply kernels. Its 253 layer projections are matvecs on a 40/44-word uniform push — a different kernel, a different ABI from the matrix multiply's 48 words — so the prefill machinery does not select a single shape on this graph. A matvec k-split was derived from scratch, with the fail-closed rule honoured: a shape whose reduce is not validated is not split.
The reduce exists at one row count only, so just two shapes are even eligible — and both are already at 326.5 and 433.8 GB/s. Drive both to the head's 542.8 GB/s and the saving is 0.4667 ms of a 15.8242 ms pass. The reduce itself costs 0.569 to 1.089 ms in launches. Net: −0.10 to −0.62 ms. The reduce costs more than the ceiling pays, before counting the extra partial traffic a split would write and read.
An open ABI question — whether one push word is an independent stride or recomputed from another — does not change the verdict: one branch makes the split expressible and arithmetic-negative, the other makes it inexpressible. Both close the lever. Decode split-K is recorded as closed, and the ceiling of 71.4 tokens/s if every matvec reached the head's rate is stated as a ceiling only, never a claim.
A closed lever, stated as closed, is part of the record. The measurement said the pass was norm-bound, not matvec-bound — so the lever was never the matrix work.
The one variable the measurement named
The pre-registered arm changed exactly one thing: launch granularity. The 1,513 normalisation workgroups kept their complete work; only the launch boundaries moved, 1,513 launches to 145 — a push-only change, the same captured kernels, no new binary. The control ran first, behind the same 984-position token-id gate as every arm of this campaign.
| configuration | launches/pass | decode tok/s, N=5 |
|---|---|---|
| ungrouped (control) | 2,093 | 62.605652 [61.9118, 62.8175] |
| grouped | 725 | 123.515805 [123.2488, 123.9972] |
| delta | −1,368 | +97.29 %, −7.877 ms |
Per token, the pass fell from 15.9730 to 8.0961 ms. The ranges are disjoint — the grouped arm's worst sample beats the control's best by more than sixty tokens. The control reproduces the admitted 62.737683 tokens/s to −0.21 %, and both arms pass the gate at 983 of 984 with the mismatch set identical: the one disagreement is the reference's own known departure.
The saving is 7.877 ms, against a measured normalisation family of 7.8155 ms. The norm family's cost was almost entirely launch service — the price of issuing 1,513 tiny launches — not kernel execution. The byte-count floor anticipated this: the norms move about 31 MB, which is roughly 0.6 ms at 50 GB/s, not 7.8 ms of work.
That is the whole result: the cost was launch service, not kernel work.
Where decode stands
| bar | decode tok/s | this engine / bar |
|---|---|---|
| vendor's Vulkan backend (matched) | 48.68 | 2.54× |
| this engine, ungrouped (admitted at publication) | 62.74 | 1.29× |
| this engine, grouped (this arm) | 123.52 | — |
| vendor's Metal backend (matched, 4 replicates) | 141.70–145.02 (~144.6) | 0.854× |
The decode gap to the strongest matched bar narrows from about 2.3× to 1.17×. Prefill — 833.559 against about 1836 — is now the larger of the two gaps at 0.45×, and its story is the previous post's (/blog/agx-split-k-emission); the barrier-drain work that started this line is /blog/agx-barrier-drain-and-the-accidental-rebuild.
How you find a defect every arithmetic check passes
The method thread that connects both halves of the day deserves its own telling, because the prefill bug was found with instruments this campaign had to build on the way.
Every arithmetic hypothesis died by measurement, one at a time: the slice arithmetic, the reduce's extent, push words and geometry — all exonerated, the reduce proven exact on the real bytes at the real addresses to one fp32 ulp. The barrier flags under insertion: 688 of 688 identical. The seed plan under insertion: all four implicated regions with identical claimers.
One reading died because its diagnostic form was invalid. A per-operation read of the first divergent operation reported total divergence — every element differing — but it had been taken in a stripped-down form that, without the position fields, degenerates past the first operations. The reading was withdrawn, and with it the ordering story built on it. Two readings of the same buffer disagreed with each other, and the rule that settled it: an end-of-pass dump cannot arbitrate a buffer that every layer rewrites.
What found the real defect was a per-operation read at the operation's own
turn — built as a separate, read-only diagnostic binary whose digest is
barred from producing any gate or timing number, with the pinned binary of
record running every measurement arm. That read found a slice's declared
weight window reaching past its own tensor into the next one in the pool,
zeroing the following norm's 512-byte scale vector. The norm computed
x · 0 · rstd = 0, and every later operation diverged — while every
projection stayed exact, because the projection was never wrong.
The fix was one line: a slice beyond the first declares its own weight extent. The lesson is the reason this post exists: a replay engine must declare ranges it did not measure, and no arithmetic check can see a range that is wrong.
What this does not say
- These are not certified performance numbers. The platform exposes no way to pin or verify GPU clocks, so every receipt records the clock state as unassertable. The numbers are internally consistent and gated, but they carry that standing caveat.
- This is short-prompt decode. The paired protocol is a two-token prompt with 31 decode intervals; it is not a long-context result.
- The grouped configuration changes the decode graph only. No joint prefill-and-decode configuration is claimed, and prefill's numbers are unchanged by this arm.
- The family table is one sample per arm, with repeats pending.
- Output coherence beyond the admitted scope is unverified. The gate's one mismatch is a known departure carried by every admitted arm of this campaign.
