← all posts
October 19, 2026·Ronald Adonyo· 12 min read

Naming the instrument: a +6% win, a vanished baseline, and 546 launches per token

We shipped a decode optimization worth +6%, went to quote it against our baseline, and discovered the baseline had quietly become unreproducible. Chasing that turned up the most useful thing we learned all week: half of our numbers were measuring something other than what we thought.

73.5443 / 76.5982 tok/sbaseline reproduced
+6.00%decode pack, stock stack
546 → 474kernel launches per token
2376 = 72 × 33whole-run identity
gpuvulkanasahibenchmarkingllama.cpp

This ⁠post ‌is ‌about ‌a ​day ‌in ​which ‌we ‌did ​something ​ordinary ‌— ‌shipped ‌a measured ​optimization ​— ​and ‌then ​spent ​the ‌rest ‌of ​it ‌discovering ​that ‌we could ‌not ​say ​what ‌our ‌own ​headline ​number ​meant.

The ​optimization ​was ‌real. ​It ‌passed ​a ‌byte-exact ⁠correctness ⁠gate ‌and ‌an interleaved ‌A/B, ​and ‌it ​is ‌retained. ‌But ​when ​we ‌went ‌to ‌quote ​it ​against ​the campaign's ‌baseline, ​the ​baseline ‌would ‌not ​come ‌back. ​Chasing ‌that ‌turned ​up the ​most ‌useful ‌thing ​we ​learned ​all ​week, ​and ‌it ​was ‌not ​about ‌the ⁠GPU.

The win, and the gate that licenses it

The ⁠campaign's ‌central ‌finding ‌has ​been ‌that ​decode ‌is ‌dominated ​by ​the ‌cost of ‌handing ‌work ​to ​the ​GPU ‌in ​small ​pieces. ‌One ‌concrete ​lever: ‌Qwen3's attention ​projects ‌Q, ‌K ​and ​V ‌with ‌three ​separate ​matrix-vector ​multiplies ​per layer, ​and ‌the ​graph ‌carries ​them ‌as ⁠three ⁠nodes. ‌If ‌the ‌weights ​were ‌packed into ​one ‌tensor, ‌one ​dispatch ​could ‌do ‌all ‌three.

The ​packing ​is ​not ‌free ​and ​not ‌obvious. ‌We ​read ‌the ​GGUF's ‌actual ‌tensor layout ​first, ​and ‌it ‌decided ​the ​design: ​there ​is ​no ‌contiguous ​Q|K|V region ‌to ​point ‌at, ⁠and ⁠attn_output's ‌row ‌stride ‌(2304 ​bytes) ‌differs ​from q/k/v's ‌(1440), ‌which ​defeats ​any ‌stride ‌trick ‌that ​tries ​to ​skip ‌holes. ​So the ​weights ‌have ‌to ​be ‌copied ​once, ‌at ‌load ​time, ​into ‌a ‌fresh ​tensor. ​The copy ​is ​padding-free: ​4096 ‌+ ​1024 ‌+ ​1024 ‌rows ⁠× ⁠1440 ‌bytes ‌= ‌8,847,360 ​bytes per ‌layer, ​× ‌36 ‌layers ​= ​318,504,960 ‌bytes ‌— ‌which ​is ​exactly ​the ‌width the ​driver's ​ABI ‌requires ‌for ​a ‌Q4_0 ​weight ‌of ‌that ​shape, ​a ‌coincidence ‌that is ​really ​a ​consistency ​check.

The ​dependency ‌question ​mattered ‌more. ​Q, ‌K ⁠and ⁠V ‌are ‌siblings ‌reading ​the same ‌activation ​with ‌no ‌producer-consumer ​edge ​between ‌them, ‌so ‌consolidating them ​removes ​two ​nodes ‌and ​two ​dispatches ‌per ‌layer ​without ‌removing ​any dependency ‌edge. ‌That ​is ​why ‌the ‌byte-exact ​gate ​is ​the ​right ​gate:

  • 256 ‌greedy ​tokens, ‌both ​arms, ‌identical ⁠output: ⁠785 ‌bytes, ‌tail ‌SHA-256 00fc6e01c8e283357d4a514e610cc4d15c2438ace69e5b2d6bb93c4b7bf7ee6f.
  • Interleaved ​tg32 ‌A/B, ​flag ‌off ‌vs ​on: ​49.5458 ‌→ ‌52.5175 ‌tok/s, ​+6.00%, every ​candidate ​arm ‌above ​every ​control ‌arm ‌across ​two ‌rounds.

Retained. ​And ‌then ‌the ​interesting ​part ‌started.

The baseline that would not come back

To ‌put ​+6% ​in ​the ​campaign's ​frame ‌we ​re-measured ‌the ​baseline: ‌the ⁠retained figure ⁠is ‌73.34 ‌clean ‌/ ​75.97 ‌tok/s ​with ‌a ‌barrier-mask ​arm. ​The ‌same harness ‌on ‌the ​same ​machine ​returned ‌49.5.

That ​is ​a ‌1.48× ‌discrepancy, ​which ‌is ​not ‌noise. ‌Our ​first ​explanation ‌was ‌the driver. ​The ​baseline's ​receipt ​names ​its ‌own ​stack ‌— ​a ‌specific ⁠Vulkan ⁠driver build ‌plus ‌two ‌injected ​companion ‌objects ​— ‌and ‌none ​of ​it ‌was ‌installed ‌on ​the machine ​any ​more. ‌We ​found ​the ‌exact ‌bytes ​in ‌a ​pre-recovery ‌disk ‌image, restored ​them, ​verified ‌every ‌SHA-256 ​at ​the ​destination, ​and ​re-ran.

57.9. ‌Still ​not ‌73.3.

The ​driver ‌was ⁠necessary ⁠and ‌not ‌sufficient. ‌What ​we ‌had ​not ‌understood ‌is ​how the ​injection ‌decides ‌whether ‌to ​engage ​at ​all. ‌Its ​key ​is ‌not ‌a ​hash ‌of ​the compiled ‌shader, ‌or ​of ​the ‌injected ‌binary, ​or ​of ​the ​companion ​blob. ‌It ​is ‌a BLAKE3 ​over ‌a ⁠serialized ⁠NIR ‌blob ‌— ‌the ​driver's ‌own ​intermediate representation, ‌after ‌preprocessing ​and ​before ‌stage-specific ‌lowering. ‌Which means ​the ​key ​is ‌a ​function ​of ‌the ‌application's ​embedded ‌SPIR-V, ​and therefore ‌of ‌which ​build ​of ‌the ‌inference ​engine ​you ​are ​running.

We ​had ‌been ​running ‌a ​newer ‌build ⁠of ⁠llama.cpp ‌than ‌the ‌campaign's. ​Different embedded ‌shaders, ​different ‌NIR, ‌different ​key. ​Every ‌companion ‌admission failed ‌silently ​— ​the ​driver ‌just ​logged ​no match ‌and ‌ran ​its ‌native ​path. Restoring ‌the ‌campaign's ​own ​engine ‌build ‌took ​the ​number ​to ​73.5443 ​/ 76.5982, ‌within ​0.3–0.8% ‌of ​the ‌retained ⁠baseline, ⁠with ‌34,338 ‌admitted companion ‌selections ​where ‌the ​earlier ‌attempt ‌had ​zero.

The ​lesson ‌generalizes ‌beyond ‌our ​project: ​the ​instrument ‌was ​a ​pair ‌— ‌a driver ​build ‌and ​an ‌engine ‌build ​— ​and ‌neither ‌alone ​reproduces ​the ​number. We ​had ​been ‌calling ​it ‌"the ​driver" ‌for ⁠weeks.

stepcheckresult
1same harness, today's driver49.5 tok/s against a 73.34 baseline
2restore the baseline's driver DSO and companions57.9: still short
3read what the injection key hashesBLAKE3 of serialized NIR, so admission depends on the app's SPIR-V
4restore the campaign's own engine build73.54 / 76.60: reproduced

Three numbers, one of which was measuring the wrong thing

With ⁠the ‌baseline ‌back, ‌we ​turned ‌to ​the ‌mechanism. ‌The ​claim ​we ‌wanted ‌to test ‌was ​that ​the ​pack ‌removes ​72 ​dispatches ‌per ‌token ​— ‌2 ​per ‌layer ‌× ​36 layers.

Counting ​dispatches ‌turned ‌out ​to ​be ​its ​own ​adventure. ‌The ​kernel ‌on ​this machine ‌has ⁠no ⁠tracing ‌infrastructure ‌left: ‌no ​function ‌tracers, ​no ‌kprobes, no ‌BTF, ​no ​bpftrace. ‌The ‌archived ‌method ​from ​an ​earlier ‌phase ​was ​simply ‌dead here. ‌So ​the ‌census ​was ‌rebuilt ‌in ​userspace: ​an ‌LD_PRELOAD ‌interposer ​on ioctl() ​that ​counts ​calls ​by ‌request ​number ‌and ​walks ‌the ⁠payload ⁠of ‌every submit, ‌parsing ‌the ​command ‌headers ​inside. ‌It ‌resolved ​14,819 ​submits ‌with zero ‌parse ‌failures, ​and ​it ​agreed ‌with ​two ​independent ‌counters ‌— ​the driver's ‌own ​accounting ‌and ‌the ​control-stream ​count ‌— ‌in ​every ​arm.

Three ​counts ​had ​been ‌floating ​around ‌the ​campaign, ‌and ⁠they ⁠disagreed:

countwhat it actually is
~11 submits/tokensubmit ioctls — what an entry-only tracer sees
48 commandsa forecast that matched nothing measured
72 dispatcheskernel launches — the graph-level quantity

The ‌census ‌settled ‌it ​with ‌an ​exact ‌identity:

text
23102 − 20726 = 2376 = 72 × 33 decoded tokens

The ‌pack ​removes ​exactly ‌72 ‌kernel ‌launches ​per ​decoded ​token ‌— ​to ​the unit, ‌across ‌the ​whole ‌run. ​Steady ‌state: ‌546 ​launches/token ​→ ‌474.

But ‌the ​submit ​count ​moved ​by ​one. ‌The ​Vulkan ‌backend ​packs ‌a ⁠~500-node graph ⁠into ‌roughly ‌ten ‌control ​streams ‌per ​token, ‌so ‌stream ​counts ​are ‌far ‌too coarse ‌to ​see ​a ​72-node ‌consolidation, ​while ​the ‌launch ‌counter ​sees ‌it exactly. ​Anyone ‌quoting ‌"10 ​commands ​per ‌token" ‌was ​measuring ​the ​wrong ​layer of ​the ‌stack ​— ‌including ​us, ‌in ⁠an ⁠earlier ‌post.

Why we now write the instrument's name next to every number

At ‌~15.8 ‌µs ​per ‌launch, ​546 ‌launches ‌is ​roughly ​8.6 ‌ms ‌of ‌a ​~20.2 ​ms ​token ‌— about ​43% ​of ‌the ‌time, ​which ‌lines ​up ‌with ‌the ​gap ​this ‌campaign ‌has ​been chasing ​between ​the ​open ​driver ‌and ​Apple's ‌Metal ​path. ‌That ⁠number ⁠is ‌an inference ‌from ‌two ​measurements, ‌not ​a ‌direct ‌one, ​and ​we ‌have ‌marked ‌it ​as such.

The ​habit ​we ‌adopted ​is ​boring ‌and ‌it ​is ‌the ​whole ‌point: ‌before ​treating ​two numbers ‌as ‌a ​conflict, ​establish ​what ​each ​instrument ‌measures. ​In ‌one ​day, three ‌apparent ⁠contradictions ⁠dissolved ‌into ‌scope ‌differences ​rather ‌than disagreements:

  • a ​dispatch ‌share ‌measured ​in ​a ‌capture ‌regime ‌vs ​the ​same ​op ‌measured ​in isolation ​(a ‌40.4% ‌figure ​vs ‌a ​9.06× ‌deficit);
  • an ‌op-file ​listing ​vs ‌a ‌per-token ​census ​(725 ​vs ​547);
  • and ​a ‌reference ​row ‌from ​an ‌absent ⁠configuration ⁠vs ‌the ‌real ‌baseline (84.68 ​vs ‌73.34).

None ​of ‌those ‌were ​bugs. ​All ‌of ‌them ‌would ​have ​been, ​if ‌we ​had ​quoted ‌them ‌as if ​they ‌were ​the ‌same ‌thing.

Where this goes: 100, then Metal

The ​campaign's ​near-term ‌target ‌is ​100 ​tok/s ​on ​the ​same ‌machine, ​and ‌past that, ​matching ‌and ⁠beating ⁠Metal's ‌145.9–151.9 ‌on ‌identical ​work.

Getting ‌there ​is ‌now ‌a ​list ​of ‌measured ‌quantities ‌rather ​than ​a ​list ‌of theories. ​The ​retained ‌baseline ‌is ​73.34 ‌clean ​/ ‌75.97 ‌with ​the ​barrier ‌mask, and ‌it ​reproduces. ​The ​levers ​in ​front ‌of ​us:

  • Kernel-side ‌amortization. ​The ‌546 ⁠launches/token ⁠and ‌the ‌~15.8 ‌µs ​each are ‌measured; ​the ‌pack ‌removed ​72 ​of ‌them ‌for ‌+6% ​on ​the ​stock ‌stack. ​The same ​measurement, ‌re-run ‌on ​the ‌companion ​stack, ‌is ‌the ​number ​that ‌belongs in ‌the ​goal ​frame ​— ​and ​it ‌is ​running.
  • Flash ‌attention, ​the ‌largest ⁠per-op ⁠gap: ‌9.06× ‌against ‌Metal ​on ‌identical bytes, ​measured ‌same-binary ‌and ​same-driver.
  • Composition ​is ‌not ‌additive. ‌Combining ​the ​decode ​pack ‌with ​the companion-injection ​work ‌cannot ‌be ​estimated ‌by ​adding ‌percentages; ‌it ​has to ​be ‌measured ‌as ​one ​combined ​A/B.

None ​of ​that ‌is ​a ‌forecast. ​It ‌is ⁠a ⁠queue ‌of ‌measurements ‌with ​named instruments ‌— ​which, ‌after ‌this ​week, ​is ‌the ‌only ‌kind ​of ​number ​we ‌are ​willing to ​put ‌in ‌a ​headline.

boracode.ai · Ronald Adonyo · naming-the-instrument
content hash eb389acc1568
A wide horizon at dusk: layered hills in muted plum and ochre above a lake that holds the last light, a family of crested cranes at the water's edge, an acacia in silhouette and a single bright star above the ridge.