interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / docs / inference / evidence / cta1024-20261012T0315Z / FINDINGS.md

512 lines · 40588 bytes Raw Blame History Rendered
1# Matmul CTA budget 1024 on GB10: Qwen3-8B decode shapes (2026-10-12, hold ade3c837-decode-speed 03:15Z)
2
3Tool: omega `tests/gpu_matmul_api_test --timing` built from omega main 781e98d8 (physics lock pinned, PINS), sha256 ef7ca687...;
4shapes `OMEGA_GPU_MATMUL_SHAPES="1,4096,4096;1,4096,1024;1,4096,12288;1,12288,4096;1,4096,151936"` (Qwen3-8B q/o, k/v, gate/up, down,
5lm_head at m=1, bf16). Median of 100 calls per shape. Effective GB/s = weight bytes / median. Receipts: `*.json`, logs `*.log`, exit codes `*.rc`.
6
7| shape (k x n) | MB | budget 64 (omega default) | 512 | 1024 |
8|---|---|---|---|---|
9| 4096x4096 | 33.5 | 0.822 ms, 41 GB/s | 0.211 ms, 159 | 0.212 ms, 158 (grid capped at 512) |
10| 4096x1024 | 8.4 | 0.312 ms, 27 | 0.211 ms, 40 (grid 128) | 0.211 ms, 40 (launch floor) |
11| 4096x12288 | 100.7 | 2.251 ms, 45 | 0.522 ms, 193 | 0.420 ms, 240 |
12| 12288x4096 | 100.7 | 2.154 ms, 47 | 0.526 ms, 191 | 0.526 ms, 191 (grid capped at 512) |
13| 4096x151936 | 1245 | 24.3 ms, 51 | 6.31 ms, 197 | 6.91 ms, 180 |
14
15Runs: base-r1..3 (budget 64), cta512-r1..3, cta1024-r1..3, unroll2-r1..3 (control: unroll 2 is no faster than 4, 41 to 58 GB/s),
16mutant (wrong kernel, last K step dropped): parity FAIL as required, "mutant killed", rc 0. Parity ok and repeat_mismatch 0 on every timing run.
17The lm_head line is reported FAIL by the tool only because its median exceeds the tool's 5 ms ceiling check; its parity passed.
18
19Per generated token, matmul only (36 layers: 2x q/o, 2x k/v, 2x gate/up, 1x down; + lm_head), from the medians above:
2064: 36 x 9.12 + 24.3 = 353 ms; 512: 36 x 2.20 + 6.3 = 85.5 ms; 1024: 36 x 2.00 + 6.9 = 79 ms. The daemon served v7 at 256 (not in this
21sweep; the 2026-10-07 sweep at 256 gave about 120 GB/s on the 4B shapes, matching the 128 ms/token observed in v7).
22The end-to-end check is `ab-smoke.sh` (smoke binary, budget 256 vs 1024, golden ids p1/p2, p3 tok/s): results in smoke-cta*.json.
23Hardware figure: 273 GB/s LPDDR5X (https://docs.nvidia.com/dgx/dgx-spark/hardware.html, docs-read 2026-10-12).
24
25## End-to-end check on the real model (smoke binary, 03:30-03:38Z, two holds of under 4 minutes each)
26
27`ab-smoke.sh`: `qwen3_8b_smoke` built from this branch with the pinned GB10 engine (`build-gb10.sh`, sha256 in `smoke-binary.sha256`),
28Qwen/Qwen3-8B, greedy, prompts p1/p2 of SMOKE-8B-v1 (golden-checked) plus p3 "Describe how a bicycle works, in about 250 words."
29(256 tokens, `AIEN_SMOKE_LONG=1`). Leg 1 `AIEN_OMEGA_CTA_BUDGET=256` (the daemon default until this change), leg 2 unset (new default 1024).
30
31| binary | budget | spin window | p1 (30 prompt tokens, 1 out) | p3 256 tokens | p3 tok/s | decode-only ms/token (p3 minus p1) | p1/p2 vs golden | p3 ids |
32|---|---|---|---|---|---|---|---|---|
33| nospin-attempt (no spin applied) | 256 | 50 us sleep-poll | 819 ms | 40 223 ms | 6.36 | 155 | EQUAL | A |
34| nospin-attempt | 1024 | 50 us sleep-poll | - | 37 825 ms | 6.77 | 145 | EQUAL | A |
35| final (`smoke-cta256.json`) | 256 | 2000 us (daemon default) | 819 ms | 30 513 ms | 8.39 | 116 | EQUAL | A |
36| final (`smoke-cta1024.json`) | 1024 | 2000 us | 701 ms | 26 117 ms | 9.80 | 100 | EQUAL | A |
37
38fallback_count 0 in every leg; the p3 reply ids are identical across all four legs (one token sequence "A"). The first pair is kept in
39`nospin-attempt/` with a note: the smoke example did not yet apply the daemon's spin window, so those legs timed a path the daemon never runs.
40The smoke example now applies both daemon defaults (budget and spin) and records them in its JSON (`cta_budget`, `spin_us`).
41
42Verdict: 256 -> 1024 gives +17% decode on the real model (116 -> 100 ms/token), answers unchanged. The 13 tok/s target (77 ms/token) is
43not reached by this change alone; the next candidates are fusing the q/k/v and gate/up launches (the k/v shape sits on the launch floor)
44and the n=4096 shapes whose grid is capped at n/8 = 512 blocks. `stub-attempt/` is an INVALID record (binary without the engine, rc 3, no chip time).
45
46## Where a decode token's time goes (per-op timing, 03:43-03:47Z, one hold, `timing-leg.sh`)
47
48Same binary plus a per-operation timing table in the GPU backend (wall time around each chip call and the chip's own
49launch-to-completion time), reset before p3. Budget 1024, spin 2000 us, fallback 0, p1/p2 equal to the golden, p3 26 666 ms for
5037 prompt tokens + 256 generated (255 decode steps after the prefill token). Full table: `smoke-timing-ops.txt`.
51
52| op (per decode step, 36 layers) | calls/step | wall ms/step | chip ms/step | effective GB/s (chip) |
53|---|---|---|---|---|
54| matmul gate+up 4096x12288 (2/layer, 100.7 MB each) | 72 | 36.4 | 34.0 | 213 |
55| matmul down 12288x4096 (100.7 MB) | 36 | 19.5 | 16.6 | 218 |
56| matmul q+o 4096x4096 (2/layer, 33.5 MB each) | 72 | 14.2 | 12.2 | 198 |
57| matmul k+v 4096x1024 (2/layer, 8.4 MB each) | 72 | 9.3 | 7.4 | 82 (grid 128 blocks: too small to fill the chip) |
58| lm_head 4096x151936 (1245 MB) | 1 | 6.6 | 6.5 | 192 |
59| paged_attention (gathered: Fp32 pool, host gathers K/V every call) | 36 | 6.6 | 5.2 | grows with context |
60| rmsnorm (2/layer + final) | 83 | 2.9 | 2.5 | |
61| swiglu | 36 | 1.0 | 0.6 | |
62| rmsnorm_heads (q/k norm) | 72 | 0.9 | 0.7 | |
63| rope | 36 | 0.5 | 0.3 | |
64| sum | 516 | 97.9 | 86.0 | |
65
66Decode wall per step (p3 minus the p1 prompt read, over 255 steps) is 101.8 ms, so the chip calls account for 98 of it; host work outside
67the backend is about 4 ms. Matmuls are 86 ms wall (80 chip) for 15.1 GB per token: 176 GB/s average against the 273 GB/s ceiling and
68the 240 GB/s the kernel reaches on a well-filled grid. The 13 tok/s target needs 77 ms per step: 25 ms to find.
69
70Prefill (37 tokens) runs attention per token (gqa_attention 1332 = 37 x 36 calls, 46 ms) and the m=37 matmuls at 2 to 4x the m=1 time;
71the prompt read is about 0.7 s and is not the bound here.
72
73Next fixes, in order of ms saved: (1) one fused q/k/v matmul per layer (n=6144, 50.3 MB at ~213 GB/s = 0.24 ms vs 0.46 ms now: ~8 ms/step);
74(2) one fused gate+up matmul (n=24576: ~6 ms/step at 240 GB/s); (3) bf16 KV pool so attention uses the paged kernel instead of the host
75gather (5 ms here, much more on the 700 to 1000-token document tasks of the campaign); (4) split-K for the n=4096 shapes (grid capped at 512).
76
77## Fused q|k|v and gate|up launches (03:51-03:55Z, one hold, `N=smoke-fused-cta1024 timing-leg.sh`)
78
79Same settings (budget 1024, spin 2000 us), the resident loader also uploads one stacked q|k|v matrix (n=6144) and one gate|up matrix
80(n=24576) per layer and the forward paths launch those (`smoke-fused-cta1024.json`, binary sha in `smoke-fused-cta1024-binary.sha256`).
81p1/p2 equal to the golden, p3 ids identical to every earlier leg, fallback 0. p3 24 260 ms (was 26 666): decode 92.4 ms/step (was 101.8).
82
83| op (per decode step) | before: wall ms | after: wall ms | chip GB/s after |
84|---|---|---|---|
85| q, k, v -> q\|k\|v (n=6144, 50.3 MB) | 7.1 + 9.3 = 16.4 | 10.1 | 224 |
86| gate, up -> gate\|up (n=24576, 201 MB) | 36.4 | 34.8 | 219 |
87| o (4096x4096) | 7.1 | 7.2 | 196 |
88| down (12288x4096) | 19.5 | 19.6 | 217 |
89| lm_head | 6.6 | 6.4 | 199 |
90| paged_attention (gathered) | 6.6 | 6.0 | |
91| rmsnorm + swiglu + rmsnorm_heads + rope | 5.3 | 5.3 | |
92| matmul total | 86.0 | 78.1 | 15.1 GB at 193 GB/s average |
93
94Launches per step 516 -> 408. The two matrices that still lag are the n=4096 shapes (o, down: grid capped at 512 blocks) and the
95host-gathered attention. Cumulative today: 116 -> 92 ms/step (8.4 -> 10.8 tok/s on p3), replies unchanged.
96
97## bf16 KV pool: paged attention kernel instead of the host gather (04:02-04:07Z, one hold, `N=smoke-bf16kv-cta1024 timing-leg.sh`)
98
99Same settings and fused launches; the shared KV pool is now stored as bf16 (`SHARED_KV_DTYPE = Bf16` in `aien-runtime/src/shared_kv.rs`),
100so decode attention runs `paged_attention_bf16` on the chip instead of gathering an f32 pool on the host, and the pool takes half the
101bytes (`smoke-bf16kv-cta1024.json`, binary sha in `smoke-bf16kv-cta1024-binary.sha256`). p1/p2 equal to the golden, fallback 0.
102p3 23 275 ms (was 24 260): decode 88.7 ms/step (was 92.4), 11.3 tok/s.
103
104Numerics: K and V are rounded to bf16 when written, so a long greedy reply may take a different branch. p3's 256 ids equal the fused leg
105for the first 158 tokens, then diverge at token 159 (both replies stay on topic; the pinned golden p1/p2 are unchanged). This is a
106declared numerics change, recorded here; the campaign golden covers p1/p2 and still holds.
107
108| op (per decode step) | before: wall ms | after: wall ms |
109|---|---|---|
110| attention: gathered f32 -> paged_attention_bf16 (9180 calls) | 6.0 | 4.6 (chip 3.7) |
111| gate\|up (n=24576) | 34.8 | 34.6 |
112| down (12288x4096) | 19.6 | 19.6 |
113| q\|k\|v (n=6144) | 10.1 | 10.1 |
114| o (4096x4096) | 7.2 | 7.2 |
115| lm_head | 6.4 | 6.7 |
116| rmsnorm + swiglu + rmsnorm_heads + rope | 5.3 | 5.2 |
117
118The attention saving grows with context (37-token prompt here; the campaign's document tasks run 700 to 1000 tokens, where the host gather
119was linear in context). Cumulative today: 116 -> 88.7 ms/step (8.4 -> 11.3 tok/s on p3). Remaining to the 77 ms target: the n=4096
120shapes (o, down: grid capped at 512 blocks, ~5 ms at 240 GB/s), the small elementwise launches (~5 ms), lm_head (~1 ms).
121
122## Long context: where a campaign token's time goes (04:55-05:00Z, one hold, `N=smoke-ctx-cta1024 ctx-leg.sh`)
123
124Same build as the bf16 KV leg plus a fourth smoke prompt (`AIEN_SMOKE_CTX=1`: 32 numbered library rules, 1268 prompt tokens, 64 new
125tokens; the campaign's document tasks decode at 700 to 1000 tokens of context). Golden p1/p2 equal, p3 ids identical to the bf16 KV leg,
126fallback 0. The smoke's p3 (37-token prompt) does not measure what the campaign pays; p4 does.
127
128| prompt | prompt tokens | new tokens | wall | per decode token |
129|---|---|---|---|---|
130| p3 | 37 | 256 | 23.2 s | 88.7 ms |
131| p4 | 1268 | 64 | 63.7 s (prompt read about 56 s, decode about 7 s) | about 110 ms |
132
133Decode at 1268 context (per token): matmuls about 71 ms (unchanged), `paged_attention_bf16` 2268 calls, 1884 ms wall: 0.83 ms per
134call, 30 ms per token (4.6 ms at 37 tokens). The call reads 1268 keys x 8 kv heads x 128 x 2 (K and V) bf16 = 5.2 MB in 0.83 ms:
135about 6 GB/s against a 273 GB/s memory. The kernel launches one CTA per q head (32 CTAs of 128 threads, thread t owns token t), so a
136warp's K loads touch 32 different token rows per instruction; it is latency and sector bound, not bandwidth bound.
137
138Prompt read of 1268 tokens (about 56 s, 44 ms per prompt token): `gqa_attention` 45 648 calls (one per token per layer) 24.5 s wall;
139matmuls at m=128 15.7 s chip (the fragment kernel re-reads B once per 16-row tile: 8x the weight traffic, no reuse, about 1 TFLOP/s);
140per-token elementwise launches: rmsnorm 95 905 calls 3.2 s, swiglu 47 916 calls 1.3 s, rmsnorm_heads 95 832 calls 1.0 s, rope 0.6 s.
141
142What this means for the campaign (v7 D1: first reply 95.8 s of the 120 s budget): about 45 s of that is the prompt read and the rest
143is decode at about 110 ms per token. The 13 tok/s target from the speed-bound memo was computed on the short-context decode and would
144not by itself bring D1 inside its budget. The fixes that move the campaign, in order of size: (1) the attention kernel's memory
145access pattern (prompt read 24.5 s -> about 1 s, decode attention 30 ms -> about 2 ms per token at 1000 context); (2) batched
146elementwise launches in the prompt read (about 6 s); (3) a prefill matmul kernel with B reuse (15.7 s -> a few s).
147
148## Attention kernel with batched loads, on the real model (05:32-05:34Z, one hold, `N=smoke-ctx-attn ctx-leg.sh`)
149
150Same smoke binary source as the long-context leg, omega pin 6c6180cf -> c74fe6e5 (omega#405: the attention kernel generator issues its
151global and shared loads in batches of up to four per scoreboard instead of waiting after each one; between the two pins only the omega
152Makefile changed among the GPU library sources). Build from the pinned checkout, fallback 0, CTA budget 1024. Every reply is identical
153to the previous leg: p1, p2, p3 (256 tokens) and p4 (64 tokens) output ids equal, so the kernel change is numerically silent here.
154
155| prompt | prompt tokens | new tokens | wall before | wall after |
156|---|---|---|---|---|
157| p3 | 37 | 256 | 23.2 s | 23.0 s |
158| p4 | 1268 | 64 | 63.7 s | 51.6 s |
159
160Attention launches, before -> after (wall, chip in brackets):
161
162| op | prompt | calls | before | after | per call after |
163|---|---|---|---|---|---|
164| `paged_attention_bf16` (decode at 1268 context) | p4 | 2268 | 1884 ms (1446) | 925 ms (481) | 0.41 ms wall, 0.21 ms chip |
165| `paged_attention_bf16` (decode at 37 to 293 context) | p3 | 9180 | 1238 ms (988) | 803 ms (555) | 0.087 ms wall |
166| `gqa_attention` (prompt read, one launch per token) | p4 | 45648 | 24.5 s (18.8) | 15.5 s (9.9) | 0.34 ms wall, 0.22 ms chip |
167
168Decode attention at 1268 context went from 30 ms to 14.7 ms per token (chip time 3.0x faster, wall 2.0x: the fixed launch and wait
169cost, about 0.2 ms per call, is now half of the wall time, so the next gain in decode attention comes from fewer launches, not a faster
170kernel). The prompt read went from about 56 s to about 45 s. [INFERRED, high] decode at campaign context is now about 95 ms per token
171(110 ms minus the attention saving); the matmuls (71 ms) dominate again.
172
173Where the 45 s prompt read goes now (p4, wall): m=128 prefill matmuls 20.2 s (8.8 + 6.1 + 3.0 + 2.3; the fragment kernel re-reads B per
17416-row tile), per-token `gqa_attention` 15.5 s (9.9 s chip; the rest is the host K/V upload each call makes), per-token elementwise
1756.0 s (rmsnorm 3.2, swiglu 1.3, rmsnorm_heads 1.0, rope 0.6). For v7 D1 (95.8 s first reply) this leg predicts about 88 s
176[INFERRED, medium]: inside the 120 s budget but leaving under the 30 s a second attempt needs, so v8 stays cut. Next fixes, by size:
177(1) a prefill matmul with B reuse (20 s -> a few s); (2) prompt-read attention over the chip-resident bf16 pool in one launch per chunk
178per layer instead of one per token (15.5 s -> about 1 s); (3) batched elementwise launches per chunk (6 s -> under 1 s).
179
180## Batched prompt-read norms and SwiGLU (05:50-05:52Z, one hold, `N=smoke-ctx-ew ctx-leg.sh`)
181
182Same pins as the leg above; the chunked prompt read now normalizes a chunk's rows in one `rmsnorm_rows` launch per layer (two per
183layer: input and post-attention), runs the q/k head norm once per tensor per chunk, and the SwiGLU once per chunk (the fused
184gate|up rows are un-interleaved into two planes first). Every reply identical to the leg above (p1, p2, p3, p4), fallback 0.
185
186| op (p4) | calls before | calls after | wall before | wall after |
187|---|---|---|---|---|
188| rmsnorm | 95905 | 5329 | 3.19 s | 0.52 s |
189| rmsnorm_heads | 95832 | 5256 | 1.01 s | 0.51 s |
190| swiglu | 47916 | 2628 | 1.26 s | 1.12 s |
191| rope (still per token) | 47916 | 47916 | 0.58 s | 0.59 s |
192
193p4 51.6 -> 50.2 s. The remaining elementwise cost is not launches: a chunk SwiGLU (128 x 12288 values, 6 MB in and out) takes about
1943 ms, a chunk rmsnorm (2 MB) about 1.4 ms, which is the host-to-chip copy each elementwise call makes on both sides (about 4 GB/s), not
195chip time (swiglu chip 0.54 s of 1.12 s wall). Keeping those tensors on the chip between launches is a later cut. The prompt read is
196now about 44 s: per-token `gqa_attention` 15.9 s, m=128 matmuls 21.4 s, elementwise 2.7 s.
197
198## Prompt-read attention as one rows call per chunk and layer (06:10-06:12Z, N=smoke-ctx-rows)
199
200omega#406 (`omega_gpu_gqa_attention_rows_f32`, branch head 6b524626, tree be9cad0d) plus the sovereign-core
201`TensorBackend::gqa_attention_rows`: the paged prompt read hands each chunk's query rows to the chip in one
202call per layer (the KV staged once, rows in launches of 1024 CTAs = 32 rows) instead of one `gqa_attention`
203call per token. Same binary otherwise as N=smoke-ctx-ew. Replies identical on p1-p4 (output_ids equal).
204
205| leg | p4 (1268-token prompt + 64) | p4 prompt-read attention | p3 (37 + 256) |
206|---|---|---|---|
207| smoke-ctx-ew (before) | 50.2 s | gqa_attention 45648 calls, 15.9 s wall, 10.4 s chip | 23.0 s |
208| smoke-ctx-rows (after) | 36.4 s | gqa_attention_rows 360 calls, 3.0 s wall, 2.8 s chip | 22.5 s |
209
210The launch and staging overhead is gone (wall - chip 5.6 s -> 0.2 s); what is left is the kernel itself at
2111268 rows x causal context (2.8 s). p4 now: the three m=128 prefill matmuls 18.2 s wall (12.2 s chip),
212attention 3.0 s, elementwise (swiglu + rope + two rmsnorm families) 2.8 s, decode paged attention 1.0 s.
213Next by size: the prefill matmul kernel.
214
215Receipts: smoke-ctx-rows.{start,end,rc,raw,err,json,binary.sha256}; built against omega 6b524626 (omega.lock
216at that sha for the leg; re-pinned to the squash-merge sha of omega#406, same tree, before this PR merges).
217
218## Prefill matmuls on the blocked kernel (06:53-06:54Z, N=smoke-ctx-mmblock)
219
220omega#407 (`omega_blackwell_codegen_matmul_frag_block`, branch head 0e11df67): for row counts whose 16-row tile
221count divides by 2 or 4, one warp owns 4 row tiles x 4 column tiles of the output over all of K (4x4 at m = 128),
222so each loaded weight fragment feeds four tensor ops and each activation fragment four, instead of one each.
223Decode rows (m = 1) keep the single-tile kernel byte for byte. No sovereign-core code change: the pin moved.
224Same binary source as N=smoke-ctx-rows. Replies identical on p1-p4 (output_ids equal).
225
226| leg | p4 (1268-token prompt + 64) | p4 m=128 matmuls (wall / chip) | p3 (37 + 256) |
227|---|---|---|---|
228| smoke-ctx-rows (before) | 36.4 s | 18.2 s / 12.2 s | 22.5 s |
229| smoke-ctx-mmblock (after) | 23.1 s | 8.9 s / 2.0 s | 23.0 s |
230
231Per shape at p4 (324 calls each): k=12288 n=4096 6.2 s / 3.0 s -> 3.7 s / 0.56 s; k=4096 n=24576 8.8 / 7.2 -> 2.6 / 1.0;
232k=4096 n=6144 3.2 / 2.0 -> 1.4 / 0.26; k=4096 n=4096 (not timed before) 1.3 / 0.21. Standalone
233(`gpu_matmul_api_test --timing --cta-budget 1024`, median of 100): 128x4096x24576 20.9 -> 5.7 ms, 128x12288x4096
23411.7 -> 3.2 ms, 128x4096x6144 5.6 -> 2.0 ms; parity sweep 18/18, mutant killed on every shape (omega#407 receipts).
235
236The chip side of the prefill matmuls is now 2.0 s; the 6.9 s above it is the host side of every m=128 call
237(packing the 1 MB activation block into fragment order, poisoning and copying out the f32 result, up to
23812.6 MB per call). p4 now: prefill matmul host side 6.9 s, chunk attention rows 3.1 s (2.9 s chip), decode m=1
239matmuls ~4.4 s for 64 tokens, elementwise (swiglu, rope, two rmsnorm families) 2.7 s, decode paged attention 1.0 s,
240prefill matmul chip 2.0 s. Next by size: the host side of the m=128 matmul calls, then elementwise.
241
242Receipts: smoke-ctx-mmblock.{start,end,rc,raw,err,json,binary.sha256}; built against omega 0e11df67 (omega.lock
243at that sha for the leg; re-pinned to the squash-merge sha aa1c4af2 of omega#407, same tree 38409d6d). Host-scope
244abi-qualify PASS at the pin: abi-qual-host-aa1c4af2.json (records sovereign-core 4c551f34, the commit before this
245evidence file and the crumb data were folded in).
246
247## Prefill activations packed on the host in one pass (08:02-08:03Z, N=smoke-ctx-mmpack)
248
249omega#409 (`omega_matmul_frag_pack_a_f32`, squash 1339759c): the f32 activation rows of every m = 128 prompt-read
250matmul call are packed straight into HMMA fragment order with an inline round-to-nearest-even bf16 conversion that is
251bit for bit the compiler's cast (checked in `gpu_matmul_api_test --host-only` on ties, denormals, inf and NaN
252payloads). Before, gcc 13 on aarch64 emitted the `(__bf16)f` cast as a call to the soft-float routine `__truncsfbf2`
253per element, after which the packer did six divisions per element: about 2.5 ms per MB of activations, 9.6 ms of host
254time on each 128 x 12288 call whose chip time is 1.7 ms. Kernels and launch shapes are unchanged (omega#407). No
255sovereign-core code change: the pin moved. Same binary source as N=smoke-ctx-mmblock. Replies identical on p1-p4
256(output_ids equal, same hash b2edfcdb).
257
258| leg | p4 (1268-token prompt + 64) | p4 m=128 matmuls (wall / chip) | p3 (37 + 256) |
259|---|---|---|---|
260| smoke-ctx-mmblock (before) | 23.1 s | 8.9 s / 2.0 s | 23.0 s |
261| smoke-ctx-mmpack (after) | 16.9 s | 3.8 s / 2.1 s | 21.3 s |
262
263Per shape at p4 (324 calls each, wall / chip): k=12288 n=4096 3.7 s / 0.56 s -> 1.08 s / 0.59 s; k=4096 n=24576
2642.6 / 1.0 -> 1.73 / 1.00; k=4096 n=6144 1.4 / 0.26 -> 0.54 / 0.27; k=4096 n=4096 1.3 / 0.21 -> 0.42 / 0.21. Host
265stopwatch of the packer alone (omega#409 receipts, best of 20): 128 x 4096 2.94 -> 0.68 ms, 128 x 12288 8.82 -> 0.91 ms.
266
267p4 now: chunk attention rows 2.9 s (2.7 s chip), decode m=1 matmuls 4.7 s for 64 tokens (chip 4.6 s, the weight
268read near the memory roof), prefill matmuls 3.8 s (2.1 s chip; the remaining host side is the f32 result poison and
269copy-out, up to 12.6 MB per call), swiglu 1.1 s (0.53 s chip), decode paged attention 0.92 s (0.47 s chip), rope
2700.58 s over 47916 launches, rmsnorm 0.52 s, rmsnorm_heads 0.51 s. The prompt read is now about 10 s of the 16.9 s;
271the decode token at this context is about 110 ms, of which the paged-attention call stages the layer's KV slices
272into scratch on every call (about 5 MB per layer at 1268 tokens) and the small elementwise launches cost about
27390 us of wall each. Next by size for the campaign rows: a resident KV pool for the paged attention (no per-call
274staging), then fewer and cheaper elementwise launches per token.
275
276Receipts: smoke-ctx-mmpack.{start,end,rc,raw,err,json,binary.sha256}; built against omega 1339759c (omega.lock and
277the native-artifacts.lock lines at that sha). Host-scope abi-qualify PASS at the pin: abi-qual-host-1339759c.json.
278
279Stale archive found at this pin, and the rerun. The first leg (07:45Z, p4 17.1 s, same replies) was linked while the
280crate build dir reused across pins still held two compose objects (rx_compose.o, rxc_host_abi.o) compiled at the
281previous pin: omega#408 grew a Cortex struct in rx_cortex.h and omega's compose-library rule did not include its
282objects' dependency files, so they were not rebuilt. The mixed archive failed abi-qualify's compose step (first
283rxc_host_run refused with RX_ERR_AUTHORITY, five callbacks tests Code -4); clean rebuilds of the same commit pass
284(archive digest 209b95bd reproduced twice from detached checkouts, now the lock line). The smoke example links none
285of the compose objects, so its binary digest is the same before and after (d93f117e) and the leg was rerun against
286the clean archive for the record: p1-p4 301, 2546, 21337, 16885 ms. Fixes: omega#410 includes the dependency
287files; here, both omega crate build scripts stamp the build dir with the omega commit and wipe it when the stamp
288differs (fresh_out_dir in aien-abi-conformance, unit-tested), so a reused dir cannot carry objects across pins.
289
290## Decode attention reads a resident KV pool (08:33-08:34Z, N=smoke-ctx-resident)
291
292omega#411 (squash 809c0aa6): the engine hands out one GPU-uncached, host-visible pool
293(`omega_gpu_attention_pool_alloc`) and a paged attention call whose pool pointer is that allocation reads the KV
294blocks where they live (slot table = physical block ids, slot stride = block stride, base = pool + layer offset).
295The kernel is unchanged; its slot offset math is 32-bit, so the engine checks every referenced block id against
296that limit per call and stages as before when it does not fit (`info.kv_source` RESIDENT 1 / STAGED 0; for this
297model's geometry block 1819 fits and 1820 does not). Sovereign-core side (this branch): the GPU backend asks the
298engine for the pool when the shared KV runtime is built (`TensorBackend::alloc_kv_pool`, a `LinuxMemoryKind::External`
299buffer released through the engine), with the host-mapped pool and staged attention as the recorded fallback; the
300smoke's pool is 1536 blocks (24k tokens) so every id passes. The timing line now ends with
301`kv_staged_bytes_total` and `kv_resident_calls_total`. Replies identical on p1-p4 (output_ids equal).
302
303| leg | p4 (1268-token prompt + 64) | p4 decode paged attention (wall / chip) | p3 (37 + 256) |
304|---|---|---|---|
305| smoke-ctx-mmpack (before) | 16.9 s | 0.92 s / 0.47 s | 21.3 s |
306| smoke-ctx-resident (after) | 17.1 s | 0.61 s / 0.60 s | 21.0 s |
307
308Every decode attention call of the run read the pool in place: `kv_resident_calls_total=12312` (342 decode steps
309x 36 layers), `fallback_count` 0. The 2.14 GB of `kv_staged_bytes_total` is the prompt-read rows path
310(`gqa_attention_rows`, host-gathered contiguous K/V per chunk), which cut E does not touch. The wall saving on the
3112268 p4 decode calls is 0.31 s (about 4.8 ms per token at this context); the chip time of the same calls rose from
3120.47 to 0.60 s because the kernel now reads GPU-uncached memory instead of the staging scratch, which gives back
313part of the copy saved. The p4 total did not move (16.9 -> 17.1 s): the prompt-read rows attention (2.9 -> 3.1 s,
314chip 2.7 -> 2.9 s) and the small m=128 matmuls drifted up by about the same amount while the decode m=1 matmul chip
315times match to 0.5%, so that drift reads as run-to-run noise [INFERRED, one leg each]. A GPU-cached pool would need
316an L2 invalidate before every read because the host writes the new K/V each token (the E1 trap, nvos.h
317`NVOS32_ATTR2_GPU_CACHEABLE`); not taken here.
318
319Decode at 1268 tokens of context is now about 105 ms per token, of which the m=1 weight reads are 73 ms (near the
320memory roof) and the elementwise launches (swiglu 1.1 s, rope 0.59 s, rmsnorm 0.52 s, rmsnorm_heads 0.52 s over
32164 tokens, about 42 ms per token, each launch about 90 us of wall for a few us of chip time) are the largest
322remaining lever. Next: fewer launches per token (q+k rope in one launch, q+k head norms in one launch, one swiglu
323launch), and the host side of each launch.
324
325Receipts: smoke-ctx-resident.{start,end,rc,raw,err,json,binary.sha256}; built against omega 809c0aa6 (omega.lock and
326the native-artifacts.lock lines at that sha). Host-scope abi-qualify at the pin: abi-qual-host-809c0aa6.json.
327
328## Decode attention split over several CTAs per head (09:14-09:18Z, N=smoke-ctx-split)
329
330omega#412 (squash 247f3522, cut F): the paged attention call no longer walks the whole context with one CTA of
331128 threads per query head (32 CTAs per layer call at any context). Each (sequence, head) is split over up to 8
332CTAs along the context; each sequence derives its own split count from its own context inside the kernel
333(largest power of two <= min(8, chunks / 2), chunks = ceil(ctx / hd)), every CTA writes an unnormalised partial
334(acc[hd], running max, running sum) and the host combines the partials in the log2 domain without the math
335library. A sequence's result never depends on its batch-mates (extra CTAs of shorter sequences write empty
336partials that add exact zeros). ABI unchanged (`OmegaGpuAttnInfo` 176 bytes; `ctas_last_launch` shows the
337split). Sovereign-core side: pin only. Output tokens identical on p1-p4 (output_ids equal to smoke-ctx-resident).
338
339| leg | p4 (1268-token prompt + 64) | p4 decode paged attention (wall / chip) | p3 (37 + 256) | p3 decode paged attention (wall / chip) |
340|---|---|---|---|---|
341| smoke-ctx-resident (before) | 17.1 s | 0.61 s / 0.60 s | 21.0 s | 0.41 s / 0.38 s |
342| smoke-ctx-split (after) | 16.4 s | 0.38 s / 0.34 s | 21.1 s | 0.46 s / 0.40 s |
343
344At 1268 tokens of context the kernel takes 4 splits of 384 tokens (128 CTAs per layer call): chip time per call
345266 -> 150 us, about 35 GB/s of KV reads instead of 20; per token the decode attention falls from 9.6 to 6.0 ms of
346wall (chip 9.4 -> 5.3). The 40 ms between wall and chip on the 2268 p4 calls is the host combine (32 heads x 4
347partials of 130 floats, about 18 us per call). At short context (p3, at most 3 chunks, one split) the call pays
348the partial write and the combine for nothing: +0.1 ms per token of chip and +0.2 ms of wall over 256 tokens,
349run-to-run noise aside [OBSERVED, one leg each]. The other operations match the previous leg to 1%.
350
351Correction to the previous section: the "elementwise launches about 42 ms per token" figure was read from the
352p4 table, which also holds the 1268-token prompt read (10 chunks x 36 layers of rope, head norms and swiglu).
353Per decode token the elementwise cost is small: on p3 (37 + 256 tokens, decode-dominated) rmsnorm 2.5 ms,
354swiglu 1.0, rmsnorm_heads 0.8, rope 0.5 per token, against 73.5 ms of m=1 matmuls (187-220 GB/s against the
355273 GB/s roof, about 27 us fixed per launch). The next lever is the m=1 matmul bandwidth, not the launches.
356
357Receipts: smoke-ctx-split.{start,end,rc,raw,err,json,binary.sha256}; built against omega 247f3522 (omega.lock
358and the native-artifacts.lock lines at that sha). Host-scope abi-qualify at the pin, clean tree:
359abi-qual-host-247f3522.json (PASS, dirty=false). Kernel battery receipts (sim and chip, including the first
360version's failures) in the decode-speed investigation folder, receipts/cut-f.
361
362## Single-token norms and rope on the host (09:28-09:30Z, N=smoke-ctx-host)
363
364Sovereign-core only (no engine change, pin unchanged at omega 247f3522). The GB10 backend routes an elementwise
365op to the reference implementation by size (`HOST_ELEMENTWISE_MAX` = 16384 f32 values): a one-row rmsnorm (the
366model width, 4096), one token's q/k head norms (32 + 8 heads of 128) and one token's rope (5120 values). Measured
367on the host (X925, release build): rmsnorm 4.2 us, head norms 1.1 to 4.3 us, rope 4.1 us including its table,
368against 34.2 / 11.3 / 12.2 us of wall per chip launch in the previous leg (the chip launches copy the row in and
369out of uncached memory for a few microseconds of arithmetic; the rmsnorm kernel itself took 29.7 us of chip
370time). The routed ops are the golden maths (the reference backend defines the smoke golden), tallied as
371`<op>_host` in the timing table and counted in `host_ops`; they are not fallbacks (`fallback_count` stays 0,
372`native_fallbacks` unchanged). Prefill rows (`rmsnorm_rows` at 128 x 4096 and more) and swiglu at every size
373stay on the chip (host f64 exp over 12288 values 25.8 us against 28.2 us wall on the chip: no gain, not routed).
374
375| leg | p3 (37 + 256) | p3 rmsnorm + head norms + rope per token | p4 (1268-token prompt + 64) |
376|---|---|---|---|
377| smoke-ctx-split (before) | 21.1 s | 2.49 + 0.81 + 0.50 = 3.80 ms (chip) | 16.4 s |
378| smoke-ctx-host (after) | 20.2 s | 0.19 + 0.12 + 0.07 = 0.38 ms (host) | 16.5 s |
379
380p3 falls by 0.89 s over 256 tokens (3.5 ms per token, the predicted 3.1 plus the chip lock and tally overhead
381the launches carried). In the table the host rows cost 2.6 / 1.7 / 1.7 us per call. The remaining chip rows of
382those names are the prefill-sized calls (72 `rmsnorm` of 128 rows at 160 us, 72 `rmsnorm_heads` at 197 us).
383Output tokens identical on p1-p4 (output_ids equal to smoke-ctx-split and smoke-ctx-resident). p4 within noise
384(prefill-dominated). Decode at short context is now about 79 ms per token: m=1 matmuls 73.5, attention 1.8,
385swiglu 1.0, host ops 0.4, the rest host time between calls.
386
387Receipts: smoke-ctx-host.{start,end,rc,raw,err,json,binary.sha256}; abi-qualify host scope at the pin on the
388committed tree: abi-qual-host-247f3522-hostroute.json. Unit tests: `single_token_norms_and_rope_run_on_the_host_without_a_fallback`
389(reference equality, host_ops 4, fallback 0, chip calls 0) and the updated `elementwise_chip_errors_are_counted_fallbacks`.
390
391## One-row activation pack straight into the chip buffer (09:51-09:53Z, N=smoke-ctx-row0)
392
393Pin moved to omega dec2577d (omega#413, cut H). Every matmul call used to pack the activation rows into a
394malloc'd block, copy it into the uncached activation buffer and free it; at one row (145 calls per decode token)
395that moved 128 KB per call to carry 8 KB, because the 15 padding rows of each 16-row block are zero on every
396call. Now the pack writes straight into the buffer, and a one-row call whose buffer already holds a one-row pack
397of the same width rewrites row 0 only. ABI unchanged; omega's chip battery 25/25 and host battery 136/136 before
398the pin (omega#413). Same binary settings as the previous leg (CTA budget 1024, spin 2000 us); the clock times in
399this heading come from the leg's own `.start`/`.end` files (the previous heading was corrected to its files as
400well: 09:28-09:30Z, not 09:58-10:02Z).
401
402| leg | p1 | p2 | p3 (37 + 256) | p4 (1268-token prompt + 64) | replies |
403|---|---|---|---|---|---|
404| smoke-ctx-host (omega 247f3522) | 276 ms | 2364 ms | 20233 ms | 16480 ms | golden |
405| smoke-ctx-row0 (omega dec2577d) | 283 ms | 2355 ms | 19944 ms | 16272 ms | identical, all four |
406
407Per-call wall minus chip on the one-row matmuls in p3 (9180 calls each; the lm_head 256 calls), microseconds:
408
409| shape | host leg | row0 leg |
410|---|---|---|
411| k 4096, n 24576 | 19.2 | 17.4 |
412| k 12288, n 4096 | 15.9 | 11.8 |
413| k 4096, n 6144 | 8.8 | 7.2 |
414| k 4096, n 4096 | 7.5 | 5.4 |
415| k 4096, n 151936 (lm_head) | 105 | 103 |
416
417One-row matmul wall per p3 token 72.8 -> 72.2 ms; p3 overall 79.0 -> 77.9 ms per token; fallback 0,
418`host_ops` unchanged from the host leg. One run per leg: the 1 ms per token is consistent with the per-call
419gaps but is not a rate. ABI requalification on the committed pin: `abi-qual-host-dec2577d.json` PASS, scope
420host, tree clean. What remains of the per-call gap (5 to 17 us) is the launch protocol and the result readback,
421not the pack. Next levers are on the chip side: more splits (8) or two warps per CTA in decode attention, and a
422k-split for the latency-bound small shapes (n 4096 and 6144, 512 and 768 CTAs for 1024 seats).
423
424## Matmul result sentinels: one poison word per tile (10:29-10:30Z, N=smoke-ctx-sent)
425
426Pin moved to omega 536870f1 (omega#414, cut I). Before each matmul launch the host wrote a poison word into
427every result word it would later check (m x n words), and after the launch read every one of them back before
428accepting the result. With one row that was 24576 host writes and reads on the widest shape, per call. Now the
429host poisons and checks one word per 16x8 tile (the last word the kernel writes in that tile), so the check
430still catches a tile that never ran, with 128x fewer host words. ABI unchanged; omega chip battery and host
431battery green before the pin. One run per leg, same binary settings (CTA budget 1024, spin 2000 us).
432
433| leg | p1 | p2 | p3 (37 + 256) | p4 (1268-token prompt + 64) | replies |
434|---|---|---|---|---|---|
435| smoke-ctx-row0 (omega dec2577d) | 283 ms | 2355 ms | 19944 ms | 16272 ms | golden |
436| smoke-ctx-sent (omega 536870f1) | 265 ms | 2392 ms | 20137 ms | 15502 ms | identical, all four |
437
438p4 gained 770 ms (the prefill matmuls carry m up to 256 rows, so their poison sets were the largest); p3 moved
439within the run-to-run spread of the one-row path (one run, not a rate). Fallback 0. ABI requalification on the
440committed pin: `abi-qual-host-536870f1.json` PASS, scope host, tree clean.
441
442## Decode attention: one whole chunk per context split, cap 16 (10:44-10:45Z, N=smoke-ctx-chunk)
443
444Pin moved to omega 3d3d7cfc (omega#415, cut J). The split-context decode attention kernel used to hand each
445CTA a span that could straddle KV chunks, so every CTA walked chunk boundaries; now each split is exactly one
446resident chunk and the split count is capped at 16. Chip split-timing in the standalone harness showed the
447kernel at 180 us per call at 1268 tokens of context either way: the time is in reading K and V (21 MB per call,
448once per query head, from a GPU-uncached pool that L2 cannot dedupe), not in the walk.
449
450| leg | p1 | p2 | p3 (37 + 256) | p4 (1268-token prompt + 64) | replies |
451|---|---|---|---|---|---|
452| smoke-ctx-sent (omega 536870f1) | 265 ms | 2392 ms | 20137 ms | 15502 ms | golden |
453| smoke-ctx-chunk (omega 3d3d7cfc) | 267 ms | 2519 ms | 20053 ms | 16308 ms | identical, all four |
454
455Decode attention chip time per call: p3 (short context) 44.9 -> 36.9 us, p4 (1268 context) 154.6 -> 151.9 us.
456p4 overall moved 15502 -> 16308 ms, inside the spread of the f32 prefill attention rows kernel (2.7 to 3.3 s per
4571268-token prompt across the last three legs, one run each). Fallback 0. ABI requalification on the committed pin:
458`abi-qual-host-3d3d7cfc.json` PASS, scope host, tree clean. Conclusion: at campaign context the decode attention
459is traffic-bound by the four-fold GQA read of the same K and V; the next cut reads them once per group.
460
461## Attention: one CTA per GQA group, K and V read once (11:21-11:22Z, N=smoke-ctx-gqa)
462
463Pin moved to omega aa9b7c5c (omega#417, cut K). Qwen3-8B has 32 query heads over 8 kv heads (GQA 4). Every
464attention CTA used to serve one query head and read the whole K and V of its kv head, so each kv head's data
465crossed the memory bus four times per call; at 1268 tokens of context that is 21 MB per decode call from a
466GPU-uncached pool that L2 cannot share. Now, at head_dim 128, one CTA serves the four query heads of a kv head
467(grid 8 CTAs per split instead of 32), keeps four running maxima, sums and accumulators, and reads K and V
468once. The same group kernel serves the f32 prefill attention rows call. Shared memory per CTA 6656 B, 84
469registers (budget raised 64 -> 96; the blocked prefill matmul already launches at 108). head_dim 64 and GQA 1
470emit the old program unchanged (the hd64 digest fixtures still pass). Omega batteries before the pin: host
471107/107, simulator hd64 219/219 and hd128 227/227, chip hd128 225/225 and hd64 219/219; standalone chip
472split-timing at 1268 tokens 180 -> 64 us per call. One run per leg, same binary settings.
473
474| leg | p1 | p2 | p3 (37 + 256) | p4 (1268-token prompt + 64) | replies |
475|---|---|---|---|---|---|
476| smoke-ctx-chunk (omega 3d3d7cfc) | 267 ms | 2519 ms | 20053 ms | 16308 ms | golden |
477| smoke-ctx-gqa (omega aa9b7c5c) | 265 ms | 2519 ms | 20318 ms | 13345 ms | identical, all four |
478
479p4 chip time per call: prefill attention rows (360 calls) 8578 -> 2018 us, decode attention at 1268 context
480(2268 calls) 151.9 -> 78.2 us. p3 decode attention at short context 36.9 -> 39.4 us per call (8 CTAs per
481split instead of 32 at 37 to 293 tokens of context: fewer seats busy, inside the one-run spread). Fallback 0,
482`host_ops` unchanged. ABI requalification on the committed pin: `abi-qual-host-aa9b7c5c.json` PASS, scope host,
483tree clean. The campaign-context token now costs about 73 ms of one-row matmul plus 2 ms of attention; the
484prompt read of 1268 tokens costs about 1 s of attention instead of 3 s. Next levers: the one-row matmul
485itself (A re-read per column tile, launch gaps of 5 to 17 us on 145 calls per token) and the prefill
486elementwise gaps (swiglu and rmsnorm_heads wall about twice their chip time in p4).
487
488## Elementwise launch cap 64 -> 1024 CTAs (11:57-11:58Z, N=smoke-ctx-ewcap)
489
490Pin moved to omega 4d0bb369 (omega#418, cut L). A perf profile of the cut K binary (one run, same phase times
491as its leg) showed the decode host 96% spin-waiting on the chip with no host hot spot, and the prompt-read
492side paying for launch count: omega's elementwise launcher capped a launch at 64 CTAs (the 2026-10-03 lost-tile
493envelope, whose root cause, the GPU-cached completion marker, has been fixed since), so one prefill swiglu
494(128 x 12288) was 192 launches (1.4 ms chip + 1.5 ms host per call, 360 calls per 1268-token prompt),
495rmsnorm_heads 64 launches per call, decode swiglu 2. The cap is now 1024, the CTA budget the matmul path has
496run every serving leg at through the same session launcher; the poison scan of every output word stays as the
497lost-tile detector. Omega batteries before the pin: host-only 24/24 + 119/119, chip 35/35 (swiglu 1572864 =
49812 launches, mutant caught) + reconvergence 235/235. One run per leg, same binary settings.
499
500| leg | p1 | p2 | p3 (37 + 256) | p4 (1268-token prompt + 64) | replies |
501|---|---|---|---|---|---|
502| smoke-ctx-gqa (omega aa9b7c5c) | 265 ms | 2519 ms | 20318 ms | 13345 ms | golden |
503| smoke-ctx-ewcap (omega 4d0bb369) | 248 ms | 2444 ms | 20053 ms | 12829 ms | identical, all four |
504
505p4 chip time per 1268-token prompt: swiglu 551 -> 99 ms (wall 1132 -> 656), rmsnorm_heads 282 -> 26 ms (wall
506473 -> 210), rmsnorm 52 -> 37 ms. p3 decode swiglu 29 -> 20 us wall per call (one launch instead of two), about
5071 ms per token over the 36 layers. Fallback 0, `host_ops` unchanged. ABI requalification on the committed pin:
508`abi-qual-host-4d0bb369.json` PASS, scope host, tree clean. What remains of the elementwise wall is the host
509side of the API (staging copies in, poison fill, copy out, scan: ~1.5 ms per 128 x 12288 call). The D1 estimate
510from these legs is 2 x (969 x 6.1 ms + 655 x 82 ms) = 2 x (5.9 + 53.7) = 119 s against the 120 s budget: no margin.
511The decode matmul (73 ms of the 82) runs at 207 to 218 GB/s, the same ceiling three other kernels reach on this
512chip (about 220 GB/s observed); the levers left on the bf16 candidate are each worth 1 to 4 s of the 119.