Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
About Files History Releases Proposed changes Issues For developers
Prefill attention hd256 chip PASS + encoder keeps scheduled control words (omega-mv#545)
merged b21044840be3890d #553 · opened 2026-10-18 15:22 UTC · closed 2026-10-24 17:56 UTC · merged 2026-10-24 17:56 UTC
Imported from GitHub aien-dev/omega-mv#553, by drakestapleton
Base 7bda76611e606b4d2b2f0336b2d2dda56dd950a0 · Head 2ef40a1538c6cf85b39fc511da35cb85f13c5649
Merged on GitHub as b11bd1f632afab7f7ec5368f8a618b04179fed63 ; reachable from main c7acd2607139eedfabeac16b6042cefe8ede431f (observed 2026-11-18T16:35:56Z)
drakestapleton wrote on 2026-10-18 15:22 UTC
What this is
Causal prefill attention for head_dim 256 (Qwen3.8-27B full-attention layers) on GB10, plus the fix for the shared-encoder bug that made it fault on the chip. Closes the chip-fault half of omega-mv#545.
The fault and its root cause
Symptom: Xid 13 "Invalid Address Space" and a marker-wait timeout, mostly on the second wave of CTAs (141 tokens from pos 37, 2048 from 0). Short shapes passed. The simulator passed the failing shape.
Root cause: encode_single_insn wrote a fixed word 3 for IADD3 (0x010fca00, stall 5 + wait SB4), both ISETP_GE forms and EXIT, and ignored insn->control. In attend, IR 55 (IADD3) was scheduled to wait on the Q-load scoreboards (0x3) and got 0x10 instead. The MOV RZ at IR 88/89 then zeroed R22:R23, the address of the 16 queued LDG.E.128 Q loads, while those loads were still waiting behind the previous CTA's stores. The loads went to address 0.
Method: NOP-range shrinking, NOP-stall to separate content from timing, then nvdisasm -b SM121 plus a control-field decode of our own raw bytes. Theories ruled out by experiment: QMD word 19, a membar before exit, and BSSY. The investigation folder is investigations/2026-10-18-pattn256-hang.
Changes
src/omega_blackwell_codegen.c: those four opcodes now use insn->control and keep the old word only as the fallback when it is zero.
tests/bw_encode_control_test.c + make test-bw-encode-control: a class-wide check that every opcode and form carries the emitter's control word. It failed red on the old encoder (24 of 480 encodings, ops 10/14/45) and passes on the new one (480/0).
tests/gpu_attention_test.c: six kernel pins re-pinned. Only the IADD3 and EXIT word-3s changed; reverting just those words reproduces the old digests.
tests/gpu_prefill_attn256_test.c: adds --poison and --sim-point. The k-row ruler now accepts a 1-ulp bf16 flip or a gap within 8 f32 roundings of the row max. The 0x36f0 vs 0x36f3 case is f32 cancellation measured against a double oracle, and it is bit-equal to the decode path.
tools/run_gpu_prefill_attn256_chip.sh: runs the encoder control test first.
Evidence
evidence/pattn256-chip-20261018T1331Z/: red on the unfixed encoder.
evidence/pattn256-chip-20261018T1517Z/: chip PASS 50/50, main 93/93, and all four mutants caught.
Per 2048-token chunk, attend time: 9.99 ms at pos 0, 38.5 ms at 6144, 150.5 ms at 30720, 591.3 ms at 129024 (231 GB/s of K/V streamed against 273 nominal).
evidence/encoder-fix-sweep-20261018T1512Z/: GPU sweep 18/19 PASS. gpu_tern_test fails only its GB/s gates, and the old encoder fails the same 4 gates on the same load (A/B in the investigation folder).
Host tests 42/42. crumb verify OK.
Not merged
MERGE-PAUSE is in effect (Drake). The encoder fix (e3a26848 ) touches every kernel and can be cherry-picked to main on its own.
🤖 Generated with Claude Code
Fetch it
A git bundle of the pull request's head, 67484 bytes.
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/b21044840be3890d .bundle -o b21044840be3890d .bundle
git fetch b21044840be3890d .bundle refs/pull/553/head
Raw bundle · Diff
Provenance
This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:
github-import 1
aien-dev/omega-mv
553
2ef40a1538c6cf85b39fc511da35cb85f13c5649
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":553,"url":"https://github.com/aien-dev/omega-mv/pull/553","export_sha256":"7319147b350ad908bf0b731068ec3be7b8dee848041dc862f71455e8e4680140 ","imported_utc":"2026-11-18T16:35:56Z"}
Changes
diff --git a/.crumb b/.crumb
index 4787696e0 ..2662ceb59 100644
--- a/.crumb
+++ b/.crumb
@@ -77,33 +77,33 @@
"purpose": "Directory spec. Purpose not yet described by a human."
},
{
- "digest": "088de32c7f661acdf7e4c352240dd318dc4d01f510983bc90971ac39e23ca9be ",
- "last_commit": "d146cbde ",
+ "digest": "fbe222132e0f413ae3f4230a7b3389a2c0fcca3a56fe1371eac7406658b21843 ",
+ "last_commit": "e3a26848 ",
"name": "src",
"purpose": "Directory src. Purpose not yet described by a human."
},
{
- "digest": "6947682ecc9b0f6e6704ae8d7ba4121075d6b219d6317b17acf7fe7b412f3892 ",
- "last_commit": "d146cbde ",
+ "digest": "ef8690a977452cb604669c5e0f11a801b873f033c617e8530fa90b4a0074c111 ",
+ "last_commit": "acdeff74 ",
"name": "tests",
"purpose": "Directory tests. Purpose not yet described by a human."
},
{
- "digest": "db3d0e54d63e2ca868e85392d6b71a612b2a49ff95948f9e1f13b1e7072f46e8 ",
- "last_commit": "d146cbde ",
+ "digest": "e4a329c378a5873cf01d3636c85097718dcfb3e4ff4da8a1bf45801d2db96d21 ",
+ "last_commit": "acdeff74 ",
"name": "tools",
"purpose": "Directory tools. Purpose not yet described by a human."
}
],
- "children_root": "sha256:8fe11fe2763ac2e0ccc34bad971867e59b4d2ef6129835906a07f8e5c9d97a04 ",
- "compiled_at": "2026-10-18T13:07:31Z",
+ "children_root": "sha256:a51accb120e9d3d8528c58b834196e71a63f5479c2bd16ad51c52732cee216a5 ",
+ "compiled_at": "2026-10-18T15:21:47Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:9851fb41a577aac6cbabc967fe2ee03883fd3ac15bfb90a1d54df7797b035604 ",
- "evidence_files": 11188,
- "evidence_root": "sha256:56b420a42f7e56c28eff90264946fa81efd40deb372e4b3a1c0ec7563c0182d7 ",
- "files": 14181,
- "generated_at_commit": "806336b0d63812e6821cb090087cabdc88fd75af ",
- "source_tree": "sha256:58da3511c25bc84e05a5530afb7bc5b2419f61925d27ef26172f86d531ab3125 "
+ "digest": "sha256:2212d906a596f2560a3da6697cf4b31463d4bf348f2edd64db7475c9e7df7a80 ",
+ "evidence_files": 11245,
+ "evidence_root": "sha256:30a0ca91b7c3c0edbbae3712f5e1aef5cb5721cdd47ed5b628ceaf6f1a2d7997 ",
+ "files": 14245,
+ "generated_at_commit": "acdeff745c292cebb3b22cc7ae298409a0b7ee64 ",
+ "source_tree": "sha256:d89bdfc1e5b91f5891e76f2a3c7cd6991c2c3ffd82a99f1027abdf8d9403dbd4 "
},
"owner_lane": "",
"provenance": {
diff --git a/Makefile b/Makefile
index bc0ef2aa2 ..e2b958d72 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,8 @@ SRCS += src/omega_blackwell_codegen_moe2.c
SRCS += src/omega_blackwell_codegen_attn.c src/omega_gpu_decode_attn_api.c
# Qwen3.8-27B (omega-mv#544, 2026-10-18): decode attention head_dim 256, new files only
SRCS += src/omega_blackwell_codegen_attn256.c src/omega_gpu_decode_attn256_api.c
+# Qwen3.8-27B (omega-mv#545, 2026-10-18): prefill attention head_dim 256 on the decode cache, new files only
+SRCS += src/omega_blackwell_codegen_pattn256.c src/omega_gpu_prefill_attn256_api.c
# OWN-30B (2026-10-13): libm-free host math (omega_gpu_hostmath.h) so libomega_gpu.a links without -lm
SRCS += src/omega_gpu_hostmath.c
# OWN-30B cut 8 item 2 (2026-10-13): one-launch MoE router (omega_gpu_router_api.h), new files only
@@ -2420,6 +2422,15 @@ $(GPU_EW_TEST): tests/gpu_elementwise_test.c src/omega_gpu_elementwise_api.h $(O
test-gpu-elementwise: $(GPU_EW_TEST)
./$(GPU_EW_TEST) --host-only
+# omega-mv#545: every opcode the encoder accepts carries the emitter's control word (stall, scoreboards, wait mask)
+# into instruction word 3. Host only; the golden-word checks compare words 0..2, so this is the check for word 3.
+.PHONY: test-bw-encode-control
+BW_ENCODE_CONTROL_TEST = $(OUT_DIR)/bw_encode_control_test
+$(BW_ENCODE_CONTROL_TEST): tests/bw_encode_control_test.c src/omega_blackwell_codegen.h $(OUT_DIR)/libomega_gpu.a
+ $(CC) $(CFLAGS) -o $@ tests/bw_encode_control_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
+test-bw-encode-control: $(BW_ENCODE_CONTROL_TEST)
+ ./$(BW_ENCODE_CONTROL_TEST)
+
# omega #308: structured warp reconvergence (BSSY/BSYNC regions). test-gpu-reconv is
# host-only (encoder goldens, region bookkeeping, refusals, nvdisasm listing, every probe
# kernel through the SIMT warp simulator tests/bw_warp_sim.h against the oracle, mutation
@@ -2585,6 +2596,11 @@ $(GPU_TC_PEAK_TEST): tests/gpu_tc_peak_test.c tests/bw_hmma_model.h tests/bw_war
GPU_PATTN_TEST = $(OUT_DIR)/gpu_prefill_attn_test
$(GPU_PATTN_TEST): tests/gpu_prefill_attn_test.c tests/bw_hmma_model.h tests/bw_warp_sim_pa.h src/omega_gpu_prefill_attn_api.h src/omega_blackwell_codegen_pattn.h $(OUT_DIR)/libomega_gpu.a
$(CC) $(CFLAGS) -ffp-contract=off -DWS_MAX_THREADS=256 -Itests -o $@ tests/gpu_prefill_attn_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
+# Qwen3.8-27B (omega-mv#545, 2026-10-18): head_dim 256 prefill attention on the decode cache. --host-only and --sim
+# are host proofs; the chip run is the default mode (under the GB10 lock).
+GPU_PATTN256_TEST = $(OUT_DIR)/gpu_prefill_attn256_test
+$(GPU_PATTN256_TEST): tests/gpu_prefill_attn256_test.c tests/bw_hmma_model.h tests/bw_warp_sim_pa.h src/omega_gpu_prefill_attn256_api.h src/omega_blackwell_codegen_pattn256.h src/omega_blackwell_codegen_attn256.h $(OUT_DIR)/libomega_gpu.a
+ $(CC) $(CFLAGS) -ffp-contract=off -DWS_MAX_THREADS=256 -Itests -o $@ tests/gpu_prefill_attn256_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
# OWN-30B T3b (2026-10-13): device-resident prefill module tests (host sim first; chip parts under the GB10 lock)
GPU_PF_MEM_TEST = $(OUT_DIR)/gpu_pf_mem_test
$(GPU_PF_MEM_TEST): tests/gpu_pf_mem_test.c tests/bw_warp_sim_tc.h src/omega_gpu_prefill.h src/omega_blackwell_codegen_pf.h $(OUT_DIR)/libomega_gpu.a
diff --git a/README.md b/README.md
index 3afd93acd ..4c588b15b 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Research-grade and pre-alpha. Plainly:
- **Omega Systems Core compiler:** OSC-0 is frozen as a design. OSC-1 and OSC-2 are implemented with host receipts and are NOT QUALIFIED. OSC-3 is in progress ([OSC-3-DESIGN](docs/osc/OSC-3-DESIGN.md)). It is not self-hosting and there is no general Omega compiler yet; the old Milestone 6 "self-host" result was a fixed-output self-copy check, not compilation ([note](docs/osc/OSC-1-SELF-HOST-STATEMENT.md)).
- **Reaction runtime:** the R1 to R16 qualification ladder passed on builds that predate the composition modules (omega#126), a historical result. Requalification at `3108fc2 ` recorded R15 FAIL (14 of 16 gates: G1, G15) and R16 FAIL (`evidence/REQUAL-3108fc2 /`); the R16 receipt `22d7a79a ` at `850fc54 ` is invalid as a current claim because its script was later found defective; none of R1 to R16 is requalified on the current candidate, and the ladder rerun is in progress. The R16 loop-site inventory was reconciled on the candidate tree (502 sites, 0 unclassified, 0 stale, PR #279); that is the inventory gate only, not R16. The current living build is IMPLEMENTED / NOT QUALIFIED until re-qualified. Composition, Capability Graph, Skill Router, J-Space and Cortex run on the host; the Fabric interface is a host-only loopback with no network; none of this is on silicon as a qualified system.
- **Numerics (E1):** closed 2026-10-02 on the GB10 chip campaign (Gate 5 26/26 with 47 parity lines, reductions SUM/MAX/MIN/MEAN, nine transcendental ops over all 2^32 inputs each, 148 load/store kernels), consolidated receipt `evidence/E1-CLOSURE/e7851c69d34ac777a9436af16d0bdd5d69264c8528c62d562b600f5d89153061 .json`; exclusions (natural-base EXP/LOG have no GB10 kernel) are listed in [E1_GAP_TABLE](docs/numeric/E1_GAP_TABLE.md).
-- **Qwen3.8-27B kernels (GB10, 2026-10-18):** each one is checked on the chip against a double-precision reference with deliberately broken variants that must fail, and none is joined into a serving engine yet. FP8 matrix-vector and the tensor-core prefill GEMM now take k up to 32768, which covers the 27B down projection at k = 17408 (`evidence/fp8-k32768-20261018 /`, omega#541). The Gated DeltaNet decode step (the recurrent layer used by 48 of the 64 layers) runs as one launch per layer and matches the reference to about 2e-7; it takes 125.7 us per layer, which moves its 6.29 MB of state at 50.1 GB/s against 273 GB/s nominal (`evidence/gdn-decode-20261018 /`, omega#542). The DeltaNet prefill reads a whole prompt in three launches per layer and hands its state to the decode step, which carries on exactly; at 2048 tokens it takes 3.80 us per token per layer, and the recurrent scan in it does about 2.4 trillion operations a second, against a chip peak for that kind of math that has not been measured yet (`evidence/gdn-prefill-20261018 /`, omega#543). The full-attention decode step for the other 16 layers (24 query heads over 4 key-value heads, 256 numbers per head, rotation on the first 64 only, done by reordering the numbers once at load) runs as one launch per layer, matches the reference at each tested context (1, 7, 256, 301, 1024, 4096, 8192, 32768 and 131072 tokens) with all five broken variants caught, and at 32768 tokens of context takes 2.10 ms per layer, streaming its 134 MB of cached keys and values at 63.8 GB/s against 273 GB/s nominal (`evidence/QWEN38-DATTN256-8bb4494e -20261018 /`, omega#544).
+- **Qwen3.8-27B kernels (GB10, 2026-10-18):** each one is checked on the chip against a double-precision reference with deliberately broken variants that must fail, and none is joined into a serving engine yet. FP8 matrix-vector and the tensor-core prefill GEMM now take k up to 32768, which covers the 27B down projection at k = 17408 (`evidence/fp8-k32768-20261018 /`, omega#541). The Gated DeltaNet decode step (the recurrent layer used by 48 of the 64 layers) runs as one launch per layer and matches the reference to about 2e-7; it takes 125.7 us per layer, which moves its 6.29 MB of state at 50.1 GB/s against 273 GB/s nominal (`evidence/gdn-decode-20261018 /`, omega#542). The DeltaNet prefill reads a whole prompt in three launches per layer and hands its state to the decode step, which carries on exactly; at 2048 tokens it takes 3.80 us per token per layer, and the recurrent scan in it does about 2.4 trillion operations a second, against a chip peak for that kind of math that has not been measured yet (`evidence/gdn-prefill-20261018 /`, omega#543). The full-attention decode step for the other 16 layers (24 query heads over 4 key-value heads, 256 numbers per head, rotation on the first 64 only, done by reordering the numbers once at load) runs as one launch per layer, matches the reference at each tested context (1, 7, 256, 301, 1024, 4096, 8192, 32768 and 131072 tokens) with all five broken variants caught, and at 32768 tokens of context takes 2.10 ms per layer, streaming its 134 MB of cached keys and values at 63.8 GB/s against 273 GB/s nominal (`evidence/QWEN38-DATTN256-8bb4494e -20261018 /`, omega#544). The prefill attention for those 16 layers reads a 2048-token chunk of a prompt in two launches per layer and leaves cache rows bit-equal to the ones the decode step would have written; it matches the reference at every tested point up to 129024 + 2048 tokens with all four broken variants caught, and a 2048-token chunk takes 10.0 ms per layer at the start of a prompt and 591 ms at the end of a 128k one, streaming cached keys and values at 230.6 GB/s against 273 GB/s nominal (`evidence/pattn256-chip-20261018T1517Z/`, omega#545). Getting it to run found a bug every kernel shared: the encoder wrote the integer add, one compare and the exit instruction with a fixed timing word, so the waits the code generator scheduled on them never reached the chip. The encoder now keeps them, `make test-bw-encode-control` checks every instruction type, and 18 of 19 kernel families pass their chip tests with the fix (the ternary family fails only its speed gates, which the old encoder fails the same way on the same load; `evidence/encoder-fix-sweep-20261018T1512Z/`).
- **Hardware:** results on the DGX Spark GB10 are tied to the exact commit in each receipt. Host and emulator passes are never reported as hardware qualification.
The live status is owned by [aien-architecture](https://github.com/aien-spark/aien-architecture): [CURRENT_EXECUTION_PLAN.md](https://github.com/aien-spark/aien-architecture/blob/main/CURRENT_EXECUTION_PLAN.md) and [doctrine/ROADMAP.md](https://github.com/aien-spark/aien-architecture/blob/main/doctrine/ROADMAP.md). This file does not restate numbers that drift. Historical milestone receipts (for example Milestone 4, `OMEGA_SEMANTICS`, 12 of 12 gates) stay in `evidence/` unchanged as history.
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_attention_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_attention_test.log
new file mode 100644
index 000000000 ..d725af6b5
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_attention_test.log
@@ -0,0 +1,65 @@
+PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=120001 call_ns=83690969 calls=1 unwritten=0 kv_staged=2048/2048 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00189431 chip_ns=104816 call_ns=246401 calls=1 unwritten=0 kv_staged=34816/34816 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00189409 chip_ns=214512 call_ns=426449 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.0028582 chip_ns=759939 call_ns=1486694 calls=1 unwritten=0 kv_staged=4194304 /4194304 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=2041) NO_RESCALE:CAUGHT(rc=OK,bad=1959) Q_ROW:CAUGHT(rc=OK,bad=2048) OUT_ROW:CAUGHT(rc=OK,bad=2048)
+PASS gqa_f32_tinyllama_32q4kv_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00174821 chip_ns=104000 call_ns=213088 calls=1 unwritten=0 kv_staged=133120/133120 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00197914 chip_ns=103457 call_ns=108321 calls=1 unwritten=0 kv_staged=262144/262144 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00177573 chip_ns=103200 call_ns=107792 calls=1 unwritten=0 kv_staged=264192/264192 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00259576 chip_ns=206161 call_ns=216305 calls=1 unwritten=0 kv_staged=614400/614400 blocks=1/1 | mutants 0/0
+PASS gqa_f32_tinyllama_32q4kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00247545 chip_ns=311569 call_ns=353505 calls=1 unwritten=0 kv_staged=2048000 /2048000 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=103968 call_ns=233057 calls=1 unwritten=0 kv_staged=4096/4096 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00174276 chip_ns=102705 call_ns=105905 calls=1 unwritten=0 kv_staged=69632/69632 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048)
+PASS gqa_f32_llama32_1b_32q8kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00161378 chip_ns=105136 call_ns=220016 calls=1 unwritten=0 kv_staged=1048576 /1048576 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.0029454 chip_ns=517522 call_ns=1935128 calls=1 unwritten=0 kv_staged=8388608 /8388608 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1904) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042)
+PASS gqa_f32_llama32_1b_32q8kv_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.0014332 chip_ns=103904 call_ns=202769 calls=1 unwritten=0 kv_staged=266240/266240 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00186415 chip_ns=103393 call_ns=111745 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00185519 chip_ns=103137 call_ns=111585 calls=1 unwritten=0 kv_staged=528384/528384 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00162705 chip_ns=103920 call_ns=125680 calls=1 unwritten=0 kv_staged=1228800 /1228800 blocks=1/1 | mutants 0/0
+PASS gqa_f32_llama32_1b_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00330327 chip_ns=206913 call_ns=316849 calls=1 unwritten=0 kv_staged=4096000 /4096000 blocks=1/1 | mutants 0/0
+PASS gqa_rows_f32_tinyllama_32q4kv_base0_rows1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=103441 call_ns=229825 calls=1 unwritten=0 kv_staged=2048/2048 blocks=1/1 | mutants 0/0
+PASS gqa_rows_f32_tinyllama_32q4kv_base17_rows5 n=10240 rc=OK violations=0 worst_scaled_err=0.00298047 chip_ns=103424 call_ns=333617 calls=1 unwritten=0 kv_staged=45056/225280 blocks=1/5 | mutants 0/0
+PASS gqa_rows_f32_tinyllama_32q4kv_base300_rows40 n=81920 rc=OK violations=0 worst_scaled_err=0.00332929 chip_ns=734051 call_ns=1122564 calls=2 unwritten=0 kv_staged=696320/27852800 blocks=1/40 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=81807) NO_RESCALE:CAUGHT(rc=OK,bad=64191) Q_ROW:CAUGHT(rc=OK,bad=81812) OUT_ROW:CAUGHT(rc=OK,bad=81812)
+PASS gqa_rows_f32_llama32_1b_32q8kv_base0_rows1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=104384 call_ns=192241 calls=1 unwritten=0 kv_staged=4096/4096 blocks=1/1 | mutants 0/0
+PASS gqa_rows_f32_llama32_1b_32q8kv_base17_rows5 n=10240 rc=OK violations=0 worst_scaled_err=0.00177684 chip_ns=103553 call_ns=112529 calls=1 unwritten=0 kv_staged=90112/450560 blocks=1/5 | mutants 0/0
+PASS gqa_rows_f32_llama32_1b_32q8kv_base300_rows40 n=81920 rc=OK violations=0 worst_scaled_err=0.00325614 chip_ns=932051 call_ns=1020164 calls=2 unwritten=0 kv_staged=1392640 /55705600 blocks=1/40 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=81806) NO_RESCALE:CAUGHT(rc=OK,bad=65973) Q_ROW:CAUGHT(rc=OK,bad=81824) OUT_ROW:CAUGHT(rc=OK,bad=81824)
+PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.0830785 chip_ns=208897 call_ns=314017 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 1/1 NO_MAX:CAUGHT(rc=OK,bad=2048)
+PASS gqa_f32_mha_16q16kv_ctx300 n=1024 rc=OK violations=0 worst_scaled_err=0.00184 chip_ns=105361 call_ns=272529 calls=1 unwritten=0 kv_staged=2457600 /2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1024) OUT_ROW:CAUGHT(rc=OK,bad=1020) KV_HEAD:CAUGHT(rc=OK,bad=1023)
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=104768 call_ns=211201 calls=1 unwritten=0 kv_staged=16384/16384 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048)
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00158694 chip_ns=103521 call_ns=198817 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2047)
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00106953 chip_ns=104097 call_ns=221697 calls=1 unwritten=0 kv_staged=262144/262144 blocks=16/16 | mutants 0/0
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.000545881 chip_ns=212929 call_ns=469554 calls=1 unwritten=0 kv_staged=2097152 /2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2047) SLOT:CAUGHT(rc=OK,bad=2038) NO_RESCALE:CAUGHT(rc=OK,bad=1901) Q_ROW:CAUGHT(rc=OK,bad=2046) OUT_ROW:CAUGHT(rc=OK,bad=2046)
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00144367 chip_ns=104337 call_ns=218081 calls=1 unwritten=0 kv_staged=81920/81920 blocks=5/5 | mutants 0/0
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00159999 chip_ns=103953 call_ns=111329 calls=1 unwritten=0 kv_staged=131072/131072 blocks=8/8 | mutants 0/0
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00170812 chip_ns=104464 call_ns=111616 calls=1 unwritten=0 kv_staged=147456/147456 blocks=9/9 | mutants 0/0
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00140672 chip_ns=193376 call_ns=316513 calls=1 unwritten=0 kv_staged=311296/311296 blocks=19/19 | mutants 0/0
+PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00143935 chip_ns=216945 call_ns=370769 calls=1 unwritten=0 kv_staged=163840/1032192 blocks=10/63 | mutants 0/0
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=106144 call_ns=215409 calls=1 unwritten=0 kv_staged=32768/32768 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048)
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00205197 chip_ns=103729 call_ns=200881 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048)
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00105953 chip_ns=104928 call_ns=230753 calls=1 unwritten=0 kv_staged=524288/524288 blocks=16/16 | mutants 0/0
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.00055855 chip_ns=209185 call_ns=578530 calls=1 unwritten=0 kv_staged=4194304 /4194304 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2044) NO_RESCALE:CAUGHT(rc=OK,bad=1963) Q_ROW:CAUGHT(rc=OK,bad=2048) OUT_ROW:CAUGHT(rc=OK,bad=2048)
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00171737 chip_ns=103712 call_ns=218945 calls=1 unwritten=0 kv_staged=163840/163840 blocks=5/5 | mutants 0/0
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00153626 chip_ns=103552 call_ns=112832 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00162582 chip_ns=103681 call_ns=113505 calls=1 unwritten=0 kv_staged=294912/294912 blocks=9/9 | mutants 0/0
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00144548 chip_ns=104464 call_ns=233841 calls=1 unwritten=0 kv_staged=622592/622592 blocks=19/19 | mutants 0/0
+PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00094646 chip_ns=207489 call_ns=391954 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0
+PASS paged_bf16_split1_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.0028454 chip_ns=308514 call_ns=486626 calls=1 unwritten=0 kv_staged=2064384 /2064384 blocks=63/63 | mutants 0/0
+PASS paged_bf16_split2_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00202911 chip_ns=110000 call_ns=199600 calls=1 unwritten=0 kv_staged=2064384 /2064384 blocks=63/63 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2041)
+PASS paged_bf16_split4_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00111551 chip_ns=223745 call_ns=368353 calls=1 unwritten=0 kv_staged=2064384 /2064384 blocks=63/63 | mutants 0/0
+PASS paged_bf16_split8_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.000737182 chip_ns=210592 call_ns=360161 calls=1 unwritten=0 kv_staged=2064384 /2064384 blocks=63/63 | mutants 0/0
+PASS paged_bf16_split16_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.000577315 chip_ns=214721 call_ns=384913 calls=1 unwritten=0 kv_staged=2064384 /2064384 blocks=63/63 | mutants 0/0
+PASS paged_bf16_split1_32q8kv_ctx100 n=2048 rc=OK violations=0 worst_scaled_err=0.0018292 chip_ns=103072 call_ns=204416 calls=1 unwritten=0 kv_staged=65536/229376 blocks=2/7 | mutants 0/0
+PASS paged_bf16_split2_32q8kv_ctx100 n=2048 rc=OK violations=0 worst_scaled_err=0.00134618 chip_ns=103361 call_ns=109841 calls=1 unwritten=0 kv_staged=65536/229376 blocks=2/7 | mutants 0/0
+PASS paged_bf16_split4_32q8kv_ctx100 n=2048 rc=OK violations=0 worst_scaled_err=0.00134618 chip_ns=102592 call_ns=112928 calls=1 unwritten=0 kv_staged=65536/229376 blocks=2/7 | mutants 0/0
+PASS paged_bf16_split8_32q8kv_ctx100 n=2048 rc=OK violations=0 worst_scaled_err=0.00134618 chip_ns=102609 call_ns=121473 calls=1 unwritten=0 kv_staged=65536/229376 blocks=2/7 | mutants 0/0
+PASS paged_bf16_split16_32q8kv_ctx100 n=2048 rc=OK violations=0 worst_scaled_err=0.00134618 chip_ns=102640 call_ns=137408 calls=1 unwritten=0 kv_staged=65536/229376 blocks=2/7 | mutants 0/0
+PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00173417 chip_ns=205889 call_ns=217617 calls=2 unwritten=0 kv_staged=229376/229376 blocks=7/7 | mutants 4/4 KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4095) Q_ROW:CAUGHT(rc=OK,bad=4092) OUT_ROW:CAUGHT(rc=OK,bad=4092)
+PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00136352 chip_ns=103424 call_ns=214177 calls=1 unwritten=0 kv_staged=155648/401408 blocks=19/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2046)
+PASS paged_bf16_shared_prefix_4seq_32q8kv_10pre n=8192 rc=OK violations=0 worst_scaled_err=0.00205105 chip_ns=207648 call_ns=363889 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8190) SLOT:CAUGHT(rc=OK,bad=8186)
+mutant NO_MAX: caught 1 of 1
+mutant KV_HEAD: caught 12 of 12
+mutant SLOT: caught 12 of 12
+mutant NO_RESCALE: caught 6 of 6
+mutant Q_ROW: caught 8 of 8
+mutant OUT_ROW: caught 8 of 8
+device_opens=1
+PASS: 219 checks, 0 failed
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_bf16_gemv_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_bf16_gemv_test.log
new file mode 100644
index 000000000 ..44073577c
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_bf16_gemv_test.log
@@ -0,0 +1,9 @@
+upload 151936 x 2048 bf16 (622 MB): rc=OK 234 ms ()
+parity: 0 of 151936 rows differ from the f32 emulation (bit compare); worst error vs double oracle 2.36e-08 of the term scale (y -1.416); argmax chip 74730 oracle 74730
+second call: bit-identical
+bf16-x entry: bit-identical to the emulation
+timing (medians of 1, evict 1): rows 1 warps 16 depth 8 ctas 96: chip 2930.6 us = 212.4 GB/s on 622 MB; call 3034.4 us = 205.1 GB/s
+chip mutant 1: caught (4096 of 4096 rows differ)
+chip mutant 2: caught (4096 of 4096 rows differ)
+chip mutant 3: caught (4096 of 4096 rows differ)
+gpu_bf16_gemv_test: 12 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_cmdlist_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_cmdlist_test.log
new file mode 100644
index 000000000 ..eb45e92e4
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_cmdlist_test.log
@@ -0,0 +1,11 @@
+L=64: baseline 102.8 us/launch (chip 102.8 us, wall 103.1 us per launch); PCAS ok 3.19 us/launch (wall 3.20, 1 submits); INLINE ok 4.79 us/launch (1 submits)
+L=289: baseline 102.8 us/launch (chip 102.8 us, wall 103.1 us per launch); PCAS ok 3.17 us/launch (wall 3.17, 1 submits); INLINE ok 3.89 us/launch (4 submits)
+L=1024: baseline 102.8 us/launch (chip 102.8 us, wall 103.1 us per launch); PCAS ok 2.87 us/launch (wall 2.88, 1 submits); INLINE ok 3.89 us/launch (13 submits)
+negative control skip_launch=33: rc -1 first_missing 32 sems_done 63/64 x x0+63a
+heavy chain (32 x 1M elements): WFI rc 0 0 differ 1452.2 us; BARRIER_NONE rc 0 17760 differ 1451.5 us (informational: grids overlapped without the barrier: the WFI is load-bearing)
+glue list tie 0: rc 0, 5 launches in 1 submit(s) 111.0 us chip; x identical, y 0 bad, act 0 bad, argmax 45508 (ref 45508)
+glue list tie 1: rc 0, 5 launches in 1 submit(s) 108.0 us chip; x identical, y 0 bad, act 0 bad, argmax 1007 (ref 1007)
+chip mutant 1: rc 0, x same, y 2048 bad, argmax 1007 (ref 1007): caught
+chip mutant 2: rc 0, x differs, y 2047 bad, argmax 1007 (ref 1007): caught
+chip mutant 3: rc 0, x same, y 0 bad, argmax 83730 (ref 1007): caught
+chip: 31 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_attn256_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_attn256_test.log
new file mode 100644
index 000000000 ..e6a5e90a1
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_attn256_test.log
@@ -0,0 +1,15 @@
+cache alloc (1 layer, 32768 positions, 128 MiB): rc=OK 178.9 ms ()
+chip context 1 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=1x4 per_split=256 depth=4 kv_bytes=4096 fill=0.0ms chip_med=50.3us (0.1 GB/s) call_med=52.9us reps=20
+chip context 7 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=1x4 per_split=256 depth=4 kv_bytes=28672 fill=0.0ms chip_med=55.3us (0.5 GB/s) call_med=57.9us reps=20
+chip context 256 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=1x4 per_split=256 depth=4 kv_bytes=1048576 fill=0.0ms chip_med=102.2us (10.3 GB/s) call_med=105.0us reps=20
+chip context 301 sharp q rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=2x4 per_split=256 depth=4 kv_bytes=1232896 fill=0.1ms chip_med=115.3us (10.7 GB/s) call_med=117.9us reps=20
+chip context 301 sharp q mutant 1: caught (rc=OK bad=4815 worst=17.399)
+chip context 301 sharp q mutant 2: caught (rc=OK bad=5666 worst=40.991)
+chip context 301 sharp q mutant 3: caught (rc=OK bad=899 worst=3.363)
+chip context 301 sharp q mutant 4: caught (rc=OK bad=2752 worst=30.582)
+chip context 301 sharp q mutant 5: caught (rc=OK bad=2937 worst=78.730)
+chip context 1024 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=4x4 per_split=256 depth=4 kv_bytes=4194304 fill=0.2ms chip_med=122.9us (34.1 GB/s) call_med=125.6us reps=20
+chip context 4096 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=16x4 per_split=256 depth=4 kv_bytes=16777216 fill=0.7ms chip_med=289.4us (58.0 GB/s) call_med=292.1us reps=20
+chip context 8192 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=32x4 per_split=256 depth=4 kv_bytes=33554432 fill=1.5ms chip_med=541.2us (62.0 GB/s) call_med=543.7us reps=20
+chip context 32768 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=128x4 per_split=256 depth=4 kv_bytes=134217728 fill=5.7ms chip_med=1846.7us (72.7 GB/s) call_med=1849.3us reps=20
+gpu_decode_attn256_test: 30 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_attn_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_attn_test.log
new file mode 100644
index 000000000 ..b5af56ff4
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_attn_test.log
@@ -0,0 +1,14 @@
+cache alloc (1 layer, 32768 positions): rc=OK 290.4 ms ()
+chip context 1 rc=OK bad=0 worst=0.000 rows=ok (1 one-ulp k flips) grid=1x4 per_split=256 depth=4 kv_bytes=2048 fill=0.0ms chip_med=39.1us (0.1 GB/s) call_med=41.3us reps=20
+chip context 7 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=1x4 per_split=256 depth=4 kv_bytes=14336 fill=0.0ms chip_med=43.8us (0.3 GB/s) call_med=45.9us reps=20
+chip context 256 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=1x4 per_split=256 depth=4 kv_bytes=524288 fill=0.0ms chip_med=68.3us (7.7 GB/s) call_med=70.4us reps=20
+chip context 301 sharp q rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=2x4 per_split=256 depth=4 kv_bytes=616448 fill=0.0ms chip_med=72.3us (8.5 GB/s) call_med=74.2us reps=20
+chip context 301 sharp q mutant 1: caught (rc=OK bad=3630 worst=25.864)
+chip context 301 sharp q mutant 2: caught (rc=OK bad=3773 worst=40.263)
+chip context 301 sharp q mutant 3: caught (rc=OK bad=820 worst=6.838)
+chip context 301 sharp q mutant 4: caught (rc=OK bad=2010 worst=18.655)
+chip context 1024 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=4x4 per_split=256 depth=4 kv_bytes=2097152 fill=0.0ms chip_med=77.4us (27.1 GB/s) call_med=79.4us reps=20
+chip context 4096 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=16x4 per_split=256 depth=4 kv_bytes=8388608 fill=0.2ms chip_med=175.9us (47.7 GB/s) call_med=177.8us reps=20
+chip context 8192 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=32x4 per_split=256 depth=4 kv_bytes=16777216 fill=0.5ms chip_med=354.5us (47.3 GB/s) call_med=356.8us reps=20
+chip context 32768 rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=128x4 per_split=256 depth=4 kv_bytes=67108864 fill=2.8ms chip_med=1209.3us (55.5 GB/s) call_med=1211.3us reps=20
+gpu_decode_attn_test: 29 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_graph_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_graph_test.log
new file mode 100644
index 000000000 ..a1d778b86
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_decode_graph_test.log
@@ -0,0 +1,21 @@
+dgraph prefetch 0 (red 0)
+fp8 knobs: variant 1 barrier 0 (wfi+inval_all) cta_budget 0 shape 0/0/0 cached 0
+model built in 1.3 s (layers 2, vocab 151936, pos 300)
+ok: A (baseline, host glue) 20 reps ran
+ok: A deterministic over 20 reps (token 62700)
+A: token 62700 logit 5.820572, runner-up 107672 logit 5.779164 (gap 0.0414)
+ok: C (one list per token) 20 reps ran: 22 launches in 1 submission(s)
+ok: C deterministic over 20 reps (token 62700)
+A vs C: token 62700 vs 62700, logits max |d| 1.19e-06 (scale 6.03, rel 1.98e-07, tol 1e-04), x max rel 1.4e-07, hidden max rel 1.57e-07
+ok: argmax token identical: A 62700, C 62700
+ok: logits A vs C within 1e-04 of max|logit| (max |d| 1.19e-06, scale 6.03)
+ok: B (one launch per submission) 20 reps ran: 22 launches in 22 submissions
+ok: B bit-identical to C (x, hidden, logits, token) in every rep
+ok: negative control: SWIGLU mutant fails the comparison (token 107672 vs 62700, max |d| 1.35 = 0.223 of scale)
+ok: negative control: COMBINE mutant fails the comparison (token 62700 vs 62700, max |d| 0.124 = 0.0205 of scale)
+ok: C after the mutants bit-identical to the first C
+ok: timeline: rc 0, 22 stamps for 22 launches, monotonic 1, span 3837.8 us <= chip 3846.8 us, token and logits unchanged
+TIMELINE (2 layers, pos 300): norm x1 6.0 us qkv x2 134.3 us attn x2 142.2 us o_proj x2 124.0 us res_add x2 10.5 us router x2 50.8 us gate_up x2 297.7 us swiglu x2 6.6 us down x2 180.8 us combine_norm x2 20.5 us lm_head x1 2847.5 us argmax x2 16.8 us
+ok: timeline off: token rc 0, stamps accessor refuses (-1)
+PER TOKEN (median of 20, 2 layers): A host-glue 13 launches 4988.3 us | C one list 22 launches 3965.9 us (chip 3962.8 us, record 2.5 us) | B per-launch submits 22 launches 5320.8 us (chip sum 5310.3 us)
+chip: 13 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_elementwise_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_elementwise_test.log
new file mode 100644
index 000000000 ..bd51f02b6
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_elementwise_test.log
@@ -0,0 +1,17 @@
+PASS ex2_probe n=4096 rc=OK violations=0 worst_scaled_err=0.152538 chip_ns=216945 calls=1 unwritten=0 | mutant rc=OK violations=4096 CAUGHT
+PASS shared_xchg_probe n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=103424 calls=1 unwritten=0 | mutant rc=OK violations=4096 CAUGHT
+PASS rmsnorm_4x2048 n=8192 rc=OK violations=0 worst_scaled_err=0.0244808 chip_ns=103808 calls=1 unwritten=0 | mutant rc=OK violations=8192 CAUGHT
+PASS rmsnorm_1x256 n=256 rc=OK violations=0 worst_scaled_err=0.0206888 chip_ns=202225 calls=1 unwritten=0 | mutant rc=OK violations=256 CAUGHT
+PASS rmsnorm_2x8192 n=16384 rc=OK violations=0 worst_scaled_err=0 chip_ns=105217 calls=1 unwritten=0 | mutant rc=OK violations=16384 CAUGHT
+PASS rope_32h_64d_pos17_theta10000 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=103936 calls=1 unwritten=0 | mutant rc=OK violations=1024 CAUGHT
+PASS rope_4h_64d_pos17_theta10000 n=256 rc=OK violations=0 worst_scaled_err=0 chip_ns=102929 calls=1 unwritten=0 | mutant rc=OK violations=128 CAUGHT
+PASS rope_32h_64d_pos1023_theta500000 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=103152 calls=1 unwritten=0 | mutant rc=OK violations=1024 CAUGHT
+PASS rope_8h_64d_pos1023_theta500000 n=512 rc=OK violations=0 worst_scaled_err=0 chip_ns=102912 calls=1 unwritten=0 | mutant rc=OK violations=256 CAUGHT
+PASS swiglu_5632 n=5632 rc=OK violations=0 worst_scaled_err=0.0196297 chip_ns=102896 calls=1 unwritten=0 | mutant rc=OK violations=5630 CAUGHT
+PASS swiglu_8192 n=8192 rc=OK violations=0 worst_scaled_err=0.0177689 chip_ns=103281 calls=1 unwritten=0 | mutant rc=OK violations=8192 CAUGHT
+PASS swiglu_1000 n=1000 rc=OK violations=0 worst_scaled_err=0.017264 chip_ns=103056 calls=1 unwritten=0 | mutant rc=OK violations=1000 CAUGHT
+PASS swiglu_131073 n=131073 rc=OK violations=0 worst_scaled_err=0.0236441 chip_ns=213170 calls=2 unwritten=0 | mutant rc=OK violations=131059 CAUGHT
+PASS swiglu_1572864 n=1572864 rc=OK violations=0 worst_scaled_err=0.0250368 chip_ns=1259060 calls=12 unwritten=0 | mutant rc=OK violations=1572612 CAUGHT
+PASS icache_reuse_rotation n=20 rc=OK violations=0 worst_scaled_err=0 chip_ns=2026472 calls=20 unwritten=0 | mutant rc=OK violations=0 CAUGHT
+device_opens=1
+PASS: 35 checks, 0 failed
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_fp8_api_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_fp8_api_test.log
new file mode 100644
index 000000000 ..0da742a1b
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_fp8_api_test.log
@@ -0,0 +1,31 @@
+chip one-hot conversion: rc=OK 256/256 rows exact (subnormal codes 0x01..0x07 included: no flush to zero)
+chip k256 n128 variant=1 rc=OK bad=0 worst_rel=3.713e-08 grid=16x1 lb=8 rows=1 warps=8 depth=1 bytes=32776 upload=0.1ms chip_med=16.8us (2.0 GB/s) call_med=22.8us (1.4 GB/s) reps=20
+chip k768 n256 variant=1 rc=OK bad=0 worst_rel=2.681e-08 grid=32x1 lb=8 rows=1 warps=8 depth=3 bytes=196656 upload=0.3ms chip_med=16.3us (12.1 GB/s) call_med=25.6us (7.7 GB/s) reps=20
+chip k2048 n384 variant=1 rc=OK bad=0 worst_rel=2.689e-08 grid=48x1 lb=16 rows=1 warps=8 depth=4 bytes=786624 upload=0.5ms chip_med=20.3us (38.8 GB/s) call_med=36.0us (21.9 GB/s) reps=20
+chip gate 768x2048 variant=1 rc=OK bad=0 worst_rel=3.011e-08 grid=96x1 lb=16 rows=1 warps=8 depth=4 bytes=1573248 upload=0.8ms chip_med=20.0us (78.5 GB/s) call_med=35.6us (44.3 GB/s) reps=20
+chip gate+up 1536x2048 variant=1 rc=OK bad=0 worst_rel=2.434e-08 grid=192x1 lb=16 rows=1 warps=8 depth=4 bytes=3146496 upload=1.6ms chip_med=31.7us (99.4 GB/s) call_med=48.0us (65.5 GB/s) reps=20
+chip gate+up 1536x2048 mutant 1: caught (rc=OK bad=1536 worst_rel=2.507e-01)
+chip gate+up 1536x2048 mutant 2: caught (rc=OK bad=1535 worst_rel=1.913e-01)
+chip gate+up 1536x2048 mutant 4: caught (rc=OK bad=1536 worst_rel=2.507e-01)
+chip down 2048x768 variant=1 rc=OK bad=0 worst_rel=4.271e-08 grid=256x1 lb=8 rows=1 warps=8 depth=3 bytes=1573248 upload=0.8ms chip_med=40.6us (38.7 GB/s) call_med=51.5us (30.5 GB/s) reps=20
+chip q_proj 4096x2048 variant=1 rc=OK bad=0 worst_rel=2.705e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=8390656 upload=3.8ms chip_med=74.2us (113.1 GB/s) call_med=78.4us (107.0 GB/s) reps=20
+chip k_proj 512x2048 variant=1 rc=OK bad=0 worst_rel=2.309e-08 grid=64x1 lb=16 rows=1 warps=8 depth=4 bytes=1048832 upload=0.6ms chip_med=25.5us (41.2 GB/s) call_med=40.9us (25.7 GB/s) reps=20
+chip o_proj 2048x4096 variant=1 rc=OK bad=0 worst_rel=2.168e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=8390656 upload=3.6ms chip_med=59.6us (140.9 GB/s) call_med=63.3us (132.6 GB/s) reps=20
+chip qkv fused 5120x2048 variant=1 rc=OK bad=0 worst_rel=3.281e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=10488320 upload=4.5ms chip_med=69.3us (151.4 GB/s) call_med=74.8us (140.3 GB/s) reps=20
+chip 8 experts gate+up shared x variant=1 rc=OK bad=0 worst_rel=3.010e-08 grid=6x8 lb=16 rows=1 warps=32 depth=0 bytes=25171968 upload=10.9ms chip_med=146.8us (171.5 GB/s) call_med=154.9us (162.5 GB/s) reps=20
+chip 8 experts gate+up shared x mutant 1: caught (rc=OK bad=12288 worst_rel=2.601e-01)
+chip 8 experts gate+up shared x mutant 2: caught (rc=OK bad=12287 worst_rel=2.790e-01)
+chip 8 experts gate+up shared x mutant 3: caught (rc=OK bad=12288 worst_rel=4.290e-01)
+chip 8 experts gate+up shared x mutant 4: caught (rc=OK bad=12288 worst_rel=2.601e-01)
+chip 8 experts down per-group x variant=1 rc=OK bad=0 worst_rel=4.885e-08 grid=6x8 lb=8 rows=1 warps=32 depth=0 bytes=12585984 upload=5.4ms chip_med=91.9us (136.9 GB/s) call_med=104.0us (121.0 GB/s) reps=20
+chip 8 of 16 experts gate+up variant=1 rc=OK bad=0 worst_rel=3.255e-08 grid=6x8 lb=16 rows=1 warps=32 depth=0 bytes=25171968 upload=21.7ms chip_med=148.5us (169.5 GB/s) call_med=156.5us (160.8 GB/s) reps=20
+chip large 16384x2048 variant=1 rc=OK bad=0 worst_rel=3.250e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=33562624 upload=14.5ms chip_med=176.3us (190.3 GB/s) call_med=186.8us (179.7 GB/s) reps=20
+chip q38 gate 17408x5120 variant=1 rc=OK bad=0 worst_rel=2.265e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=89150720 upload=38.5ms chip_med=443.7us (200.9 GB/s) call_med=455.7us (195.6 GB/s) reps=20
+chip q38 down 5120x17408 variant=1 rc=OK bad=0 worst_rel=1.367e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=89150720 upload=38.5ms chip_med=501.5us (177.8 GB/s) call_med=509.8us (174.9 GB/s) reps=20
+chip q38 q_proj 12288x5120 variant=1 rc=OK bad=0 worst_rel=2.324e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=62929920 upload=27.6ms chip_med=313.1us (201.0 GB/s) call_med=322.5us (195.2 GB/s) reps=20
+chip q38 k_proj 1024x5120 variant=1 rc=OK bad=0 worst_rel=2.100e-08 grid=128x1 lb=16 rows=1 warps=8 depth=0 bytes=5244160 upload=2.4ms chip_med=56.9us (92.1 GB/s) call_med=59.6us (88.0 GB/s) reps=20
+chip q38 in_proj_qkv 10240x5120 variant=1 rc=OK bad=0 worst_rel=2.163e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=52441600 upload=22.9ms chip_med=254.4us (206.2 GB/s) call_med=262.4us (199.9 GB/s) reps=20
+chip q38 in_proj_z 6144x5120 variant=1 rc=OK bad=0 worst_rel=2.183e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=31464960 upload=13.5ms chip_med=166.3us (189.2 GB/s) call_med=171.8us (183.1 GB/s) reps=20
+chip q38 out_proj 5120x6144 variant=1 rc=OK bad=0 worst_rel=1.806e-08 grid=256x1 lb=16 rows=1 warps=8 depth=0 bytes=31464960 upload=13.6ms chip_med=158.0us (199.1 GB/s) call_med=163.2us (192.9 GB/s) reps=20
+chip width cap 256x32768 variant=1 rc=OK bad=0 worst_rel=1.208e-08 grid=32x1 lb=16 rows=1 warps=8 depth=0 bytes=8390656 upload=3.6ms chip_med=142.6us (58.8 GB/s) call_med=151.7us (55.3 GB/s) reps=20
+gpu_fp8_api_test: 30 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_fp8gemm_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_fp8gemm_test.log
new file mode 100644
index 000000000 ..7d1eebbb0
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_fp8gemm_test.log
@@ -0,0 +1,45 @@
+== gateup: 128 experts, n 1536, k 2048, 64 tokens x top-8
+upload 403 MB: rc=OK 206 ms
+parity vs per-row GEMV (512 calls, 30 ms): 0 of 786432 outputs differ (bit-identical)
+4 sampled outputs: 0 differ from the host emulation, worst relative error vs the double oracle 1.62e-08
+second call: bit-identical
+chip mutant 1: caught (786432 of 786432 outputs differ)
+chip mutant 2: caught (786432 of 786432 outputs differ)
+chip mutant 3: caught (784896 of 786432 outputs differ)
+GEMM (medians of 1, evict 1): mt 4 warps 16 ctas 2 x 126 segments, 512 rows, up to 3 passes: chip 3556.0 us, call 4514.3 us; streams 563 MB (distinct experts 396 MB) = 158.3 GB/s on streamed, 111.5 GB/s on distinct
+per-token grouped GEMV baseline (64 tokens, medians of 1): chip 9647.6 us, call 10689.1 us => GEMM is 2.71x faster (chip), 2.37x (call)
+per token: GEMM chip 55.6 us/token, call 70.5 us/token
+== down: 128 experts, n 2048, k 768, 64 tokens x top-8
+upload 201 MB: rc=OK 85 ms
+parity vs per-row GEMV (512 calls, 28 ms): 0 of 1048576 outputs differ (bit-identical)
+4 sampled outputs: 0 differ from the host emulation, worst relative error vs the double oracle 1.23e-08
+second call: bit-identical
+chip mutant 1: caught (1048576 of 1048576 outputs differ)
+chip mutant 2: caught (1048576 of 1048576 outputs differ)
+chip mutant 3: caught (1048576 of 1048576 outputs differ)
+GEMM (medians of 1, evict 1): mt 4 warps 16 ctas 2 x 126 segments, 512 rows, up to 3 passes: chip 1648.8 us, call 2794.1 us; streams 272 MB (distinct experts 198 MB) = 165.0 GB/s on streamed, 120.2 GB/s on distinct
+per-token grouped GEMV baseline (64 tokens, medians of 1): chip 5785.7 us, call 7098.1 us => GEMM is 3.51x faster (chip), 2.54x (call)
+per token: GEMM chip 25.8 us/token, call 43.7 us/token
+== qkv: 1 experts, n 5120, k 2048, 64 tokens x top-1
+upload 10 MB: rc=OK 4 ms
+parity vs per-row GEMV (64 calls, 5 ms): 0 of 327680 outputs differ (bit-identical)
+4 sampled outputs: 0 differ from the host emulation, worst relative error vs the double oracle 8.42e-09
+second call: bit-identical
+chip mutant 1: caught (327680 of 327680 outputs differ)
+chip mutant 2: caught (327680 of 327680 outputs differ)
+chip mutant 3: caught (327680 of 327680 outputs differ)
+GEMM (medians of 1, evict 1): mt 8 warps 16 ctas 96 x 1 segments, 64 rows, up to 8 passes: chip 2438.5 us, call 3046.4 us; streams 84 MB (distinct experts 10 MB) = 34.4 GB/s on streamed, 4.3 GB/s on distinct
+per-token grouped GEMV baseline (64 tokens, medians of 1): chip 4457.1 us, call 4824.0 us => GEMM is 1.83x faster (chip), 1.58x (call)
+per token: GEMM chip 38.1 us/token, call 47.6 us/token
+== o: 1 experts, n 2048, k 4096, 64 tokens x top-1
+upload 8 MB: rc=OK 4 ms
+parity vs per-row GEMV (64 calls, 5 ms): 0 of 131072 outputs differ (bit-identical)
+4 sampled outputs: 0 differ from the host emulation, worst relative error vs the double oracle 4.26e-09
+second call: bit-identical
+chip mutant 1: caught (131072 of 131072 outputs differ)
+chip mutant 2: caught (131072 of 131072 outputs differ)
+chip mutant 3: caught (131072 of 131072 outputs differ)
+GEMM (medians of 1, evict 1): mt 8 warps 16 ctas 96 x 1 segments, 64 rows, up to 8 passes: chip 1961.0 us, call 2508.2 us; streams 67 MB (distinct experts 8 MB) = 34.2 GB/s on streamed, 4.3 GB/s on distinct
+per-token grouped GEMV baseline (64 tokens, medians of 1): chip 4347.0 us, call 4616.2 us => GEMM is 2.22x faster (chip), 1.84x (call)
+per token: GEMM chip 30.6 us/token, call 39.2 us/token
+gpu_fp8gemm_test: 36 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_gdn_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_gdn_test.log
new file mode 100644
index 000000000 ..7caab7b02
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_gdn_test.log
@@ -0,0 +1,21 @@
+gdn alloc (2 layers): rc=OK 54.0 ms ()
+chip layer 1, 5 steps rc=OK err out 2.34e-07 tail 0 state 3.23e-07
+chip layer 0, 5 steps, in 2^-10 out 2^64 rc=OK err out 3.03e-07 tail 0 state 3.64e-07
+chip mutant 1 rc=OK err out 0.913 tail 0 state 0.983
+chip mutant 2 rc=OK err out 0.509 tail 0 state 0.973
+chip mutant 3 rc=OK err out 1.46 tail 0 state 2.24e-07
+chip mutant 4 rc=OK err out 1.02 tail 1.79 state 0.844
+chip record path, 2 chained steps err out 2.3e-07 tail 0 state 2.19e-07
+chip prefill layer 1, T 37, then 3 decode steps rc=OK err out 2.25e-07 tail 0 state 3.69e-07
+chip prefill layer 0, T 3, then 1 decode step rc=OK err out 2.1e-07 tail 0 state 2.55e-07
+chip prefill layer 0, T 41, in 2^-10 out 2^64 rc=OK err out 3.04e-07 tail 0 state 4.03e-07
+chip prefill mutant 1 rc=OK err out 0.967 tail 0 state 2
+chip prefill mutant 2 rc=OK err out 0.677 tail 0 state 1.68
+chip prefill mutant 3 rc=OK err out 0.969 tail 0 state 5.47e-07
+chip prefill mutant 4 rc=OK err out 3.57e-07 tail 1.79 state 5.47e-07
+chip record path, prefill 37 + 1 decode step err out 2.2e-07 tail 0 state 3.06e-07
+timing prefill T 512 (medians of 5): prep 414.7 us, scan 1447.0 us, post 219.9 us, chip total 2081.6 us = 4.07 us/token, call 5684.4 us; insns 287/534/90, registers 96/104/28
+timing prefill T 2048 (medians of 5): prep 1592.3 us, scan 5362.0 us, post 852.3 us, chip total 7806.6 us = 3.81 us/token, call 22541.6 us; insns 287/534/90, registers 96/104/28
+timing prefill T 8192 (medians of 5): prep 12692.7 us, scan 21604.5 us, post 7093.0 us, chip total 41390.2 us = 5.05 us/token, call 100797.1 us; insns 287/534/90, registers 96/104/28
+timing (medians of 50): chip 124.9 us (state read + write 6.29 MB -> 50.4 GB/s; 273 GB/s nominal), call 127.7 us; 665 insns, 116 registers
+gpu_gdn_test: 54 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_matmul_api_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_matmul_api_test.log
new file mode 100644
index 000000000 ..fc5766f96
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_matmul_api_test.log
@@ -0,0 +1,19 @@
+PASS 16x16x16 rc=OK chip_ns=215025 call_ms=55.931 wall_ms=56.0 max_abs=2.08616e-07 max_rel=4.51833e-08 mismatches=0 e2e_rel=4.51833e-08 e2e_bad=0 grid=2x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 32x32x32 rc=OK chip_ns=103424 call_ms=0.422 wall_ms=0.4 max_abs=4.47035e-07 max_rel=5.60462e-08 mismatches=0 e2e_rel=5.60462e-08 e2e_bad=0 grid=1x1 calls=1 rows_per_call=32 cache_hit2=1 err=""
+PASS 64x64x64 rc=OK chip_ns=103777 call_ms=1.792 wall_ms=1.8 max_abs=1.00583e-06 max_rel=6.11591e-08 mismatches=0 e2e_rel=6.11591e-08 e2e_bad=0 grid=2x1 calls=1 rows_per_call=64 cache_hit2=1 err=""
+PASS 128x128x128 rc=OK chip_ns=109696 call_ms=10.841 wall_ms=11.0 max_abs=2.89083e-06 max_rel=9.41787e-08 mismatches=0 e2e_rel=9.41787e-08 e2e_bad=0 grid=4x2 calls=1 rows_per_call=128 cache_hit2=1 err=""
+PASS 256x256x256 rc=OK chip_ns=107520 call_ms=82.962 wall_ms=83.6 max_abs=8.43406e-06 max_rel=1.30669e-07 mismatches=0 e2e_rel=1.30669e-07 e2e_bad=0 grid=8x4 calls=1 rows_per_call=256 cache_hit2=1 err=""
+PASS 512x512x512 rc=OK chip_ns=227489 call_ms=657.831 wall_ms=660.8 max_abs=2.39611e-05 max_rel=1.82928e-07 mismatches=0 e2e_rel=1.82928e-07 e2e_bad=0 grid=16x8 calls=1 rows_per_call=512 cache_hit2=1 err=""
+PASS 1x1024x1024 rc=OK chip_ns=108273 call_ms=6.741 wall_ms=12.5 max_abs=3.67463e-05 max_rel=1.48922e-07 mismatches=0 e2e_rel=1.48922e-07 e2e_bad=0 grid=128x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 1x256x1024 rc=OK chip_ns=108177 call_ms=1.869 wall_ms=3.2 max_abs=4.94719e-06 max_rel=7.52664e-08 mismatches=0 e2e_rel=7.52664e-08 e2e_bad=0 grid=128x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 16x1024x256 rc=OK chip_ns=106016 call_ms=21.134 wall_ms=22.5 max_abs=3.72902e-05 max_rel=1.45806e-07 mismatches=0 e2e_rel=1.45806e-07 e2e_bad=0 grid=32x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 8x1024x8 rc=OK chip_ns=106544 call_ms=0.674 wall_ms=0.8 max_abs=3.00165e-05 max_rel=1.18908e-07 mismatches=0 e2e_rel=1.18908e-07 e2e_bad=0 grid=1x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 1024x16x128 rc=OK chip_ns=56768 call_ms=10.922 wall_ms=11.0 max_abs=4.39584e-07 max_rel=9.37062e-08 mismatches=0 e2e_rel=9.37062e-08 e2e_bad=0 grid=4x16 calls=1 rows_per_call=1024 cache_hit2=1 err=""
+PASS 192x16x192 rc=OK chip_ns=105808 call_ms=3.356 wall_ms=3.4 max_abs=4.61936e-07 max_rel=1.0078e-07 mismatches=0 e2e_rel=1.0078e-07 e2e_bad=0 grid=6x3 calls=1 rows_per_call=192 cache_hit2=1 err=""
+PASS 512x16x64 rc=OK chip_ns=104160 call_ms=2.975 wall_ms=3.0 max_abs=4.32134e-07 max_rel=7.64946e-08 mismatches=0 e2e_rel=7.64946e-08 e2e_bad=0 grid=2x8 calls=1 rows_per_call=512 cache_hit2=1 err=""
+PASS 256x16x256 rc=OK chip_ns=104033 call_ms=5.608 wall_ms=5.6 max_abs=4.47035e-07 max_rel=9.74134e-08 mismatches=0 e2e_rel=9.74134e-08 e2e_bad=0 grid=8x4 calls=1 rows_per_call=256 cache_hit2=1 err=""
+PASS 128x16x512 rc=OK chip_ns=104801 call_ms=5.616 wall_ms=5.7 max_abs=4.47035e-07 max_rel=8.99603e-08 mismatches=0 e2e_rel=8.99603e-08 e2e_bad=0 grid=16x2 calls=1 rows_per_call=128 cache_hit2=1 err=""
+PASS 1x2048x8192 rc=OK chip_ns=244097 call_ms=109.693 wall_ms=201.9 max_abs=0.000129104 max_rel=2.62102e-07 mismatches=0 e2e_rel=2.62102e-07 e2e_bad=0 grid=1024x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 1x8192x2048 rc=OK chip_ns=287793 call_ms=115.798 wall_ms=208.2 max_abs=0.00123078 max_rel=5.96705e-07 mismatches=0 e2e_rel=5.96705e-07 e2e_bad=0 grid=256x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS 1x2048x128256 rc=OK chip_ns=2562906 call_ms=1520.774 wall_ms=2971.3 max_abs=0.000163585 max_rel=3.1728e-07 mismatches=0 e2e_rel=3.1728e-07 e2e_bad=0 grid=1024x1 calls=1 rows_per_call=16 cache_hit2=1 err=""
+PASS: 97 checks, 0 failed
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_moe_window_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_moe_window_test.log
new file mode 100644
index 000000000 ..988f422b1
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_moe_window_test.log
@@ -0,0 +1,72 @@
+== small_m1_unaligned_cols: k=48 n=1000 m=1 cols=13 windows=3
+ upload classic 47 ms, moe 0 ms (0 MB bf16)
+ whole: 0.412 ms call, chip 0.217 ms, grid 125x1
+ window 0 col0=8: mismatches vs whole 0/13, oracle worst 3.23e-08 bad 0, chip 0.103 ms, grid 2x1, hit=1
+ window 1 col0=16: mismatches vs whole 0/13, oracle worst 2.91e-08 bad 0, chip 0.103 ms, grid 2x1, hit=1
+ window 2 col0=976: mismatches vs whole 0/13, oracle worst 2.54e-08 bad 0, chip 0.103 ms, grid 2x1, hit=1
+ timing: 3 windows/call median 0.309 ms (103.0 us/window, chip mean 101.6 us/window, 0.0 GB/s); single window median 0.103 ms (0.0 GB/s, chip mean 102.7 us); 0.00 MB per window
+== small_m5: k=48 n=1000 m=5 cols=200 windows=2
+ upload classic 0 ms, moe 0 ms (0 MB bf16)
+ whole: 0.109 ms call, chip 0.105 ms, grid 125x1
+ window 0 col0=792: mismatches vs whole 0/1000, oracle worst 5.16e-08 bad 0, chip 0.104 ms, grid 25x1, hit=1
+ window 1 col0=0: mismatches vs whole 0/1000, oracle worst 7.30e-08 bad 0, chip 0.103 ms, grid 25x1, hit=1
+ timing: 2 windows/call median 0.207 ms (103.7 us/window, chip mean 102.6 us/window, 0.2 GB/s); single window median 0.104 ms (0.2 GB/s, chip mean 102.8 us); 0.02 MB per window
+== gate_up_16_experts: k=2048 n=24576 m=1 cols=1536 windows=8
+ upload classic 28 ms, moe 28 ms (96 MB bf16)
+ whole: 1.227 ms call, chip 0.581 ms, grid 1024x1
+ window 0 col0=15360: mismatches vs whole 0/1536, oracle worst 2.21e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 1 col0=18432: mismatches vs whole 0/1536, oracle worst 2.64e-07 bad 0, chip 0.078 ms, grid 192x1, hit=1
+ window 2 col0=6144: mismatches vs whole 0/1536, oracle worst 2.67e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 3 col0=21504: mismatches vs whole 0/1536, oracle worst 2.46e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 4 col0=16896: mismatches vs whole 0/1536, oracle worst 2.19e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 5 col0=0: mismatches vs whole 0/1536, oracle worst 2.55e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 6 col0=10752: mismatches vs whole 0/1536, oracle worst 2.57e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 7 col0=4608: mismatches vs whole 0/1536, oracle worst 2.58e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ timing: 8 windows/call median 0.832 ms (104.0 us/window, chip mean 103.7 us/window, 60.5 GB/s); single window median 0.105 ms (59.9 GB/s, chip mean 102.7 us); 6.29 MB per window
+== gate_up_128_experts: k=2048 n=196608 m=1 cols=1536 windows=8
+ upload classic 242 ms, moe 230 ms (768 MB bf16)
+ whole: 5.922 ms call, chip 4.449 ms, grid 1024x1
+ window 0 col0=38400: mismatches vs whole 0/1536, oracle worst 2.31e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 1 col0=132096: mismatches vs whole 0/1536, oracle worst 2.23e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 2 col0=113664: mismatches vs whole 0/1536, oracle worst 2.23e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 3 col0=98304: mismatches vs whole 0/1536, oracle worst 2.92e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 4 col0=139776: mismatches vs whole 0/1536, oracle worst 2.48e-07 bad 0, chip 0.104 ms, grid 192x1, hit=1
+ window 5 col0=49152: mismatches vs whole 0/1536, oracle worst 3.04e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 6 col0=21504: mismatches vs whole 0/1536, oracle worst 2.87e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 7 col0=150528: mismatches vs whole 0/1536, oracle worst 2.47e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ timing: 8 windows/call median 0.832 ms (104.0 us/window, chip mean 102.5 us/window, 60.5 GB/s); single window median 0.105 ms (59.8 GB/s, chip mean 102.4 us); 6.29 MB per window
+== down_128_experts: k=768 n=262144 m=1 cols=2048 windows=8
+ upload classic 111 ms, moe 111 ms (384 MB bf16)
+ whole: 4.266 ms call, chip 1.944 ms, grid 1024x1
+ window 0 col0=141312: mismatches vs whole 0/2048, oracle worst 1.39e-07 bad 0, chip 0.104 ms, grid 256x1, hit=1
+ window 1 col0=98304: mismatches vs whole 0/2048, oracle worst 1.81e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ window 2 col0=188416: mismatches vs whole 0/2048, oracle worst 1.39e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ window 3 col0=0: mismatches vs whole 0/2048, oracle worst 1.57e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ window 4 col0=147456: mismatches vs whole 0/2048, oracle worst 1.95e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ window 5 col0=65536: mismatches vs whole 0/2048, oracle worst 1.42e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ window 6 col0=106496: mismatches vs whole 0/2048, oracle worst 1.78e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ window 7 col0=22528: mismatches vs whole 0/2048, oracle worst 1.56e-07 bad 0, chip 0.103 ms, grid 256x1, hit=1
+ timing: 8 windows/call median 0.832 ms (104.0 us/window, chip mean 102.4 us/window, 30.2 GB/s); single window median 0.105 ms (30.1 GB/s, chip mean 102.7 us); 3.15 MB per window
+== gate_up_16_experts_m16: k=2048 n=24576 m=16 cols=1536 windows=8
+ upload classic 30 ms, moe 29 ms (96 MB bf16)
+ whole: 0.621 ms call, chip 0.524 ms, grid 1024x1
+ window 0 col0=13824: mismatches vs whole 0/24576, oracle worst 2.62e-07 bad 0, chip 0.104 ms, grid 192x1, hit=1
+ window 1 col0=12288: mismatches vs whole 0/24576, oracle worst 2.81e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 2 col0=10752: mismatches vs whole 0/24576, oracle worst 3.33e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 3 col0=0: mismatches vs whole 0/24576, oracle worst 2.89e-07 bad 0, chip 0.104 ms, grid 192x1, hit=1
+ window 4 col0=9216: mismatches vs whole 0/24576, oracle worst 3.06e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 5 col0=3072: mismatches vs whole 0/24576, oracle worst 2.89e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 6 col0=19968: mismatches vs whole 0/24576, oracle worst 3.03e-07 bad 0, chip 0.103 ms, grid 192x1, hit=1
+ window 7 col0=16896: mismatches vs whole 0/24576, oracle worst 2.94e-07 bad 0, chip 0.105 ms, grid 192x1, hit=1
+ timing: 8 windows/call median 0.879 ms (109.9 us/window, chip mean 103.7 us/window, 57.2 GB/s); single window median 0.125 ms (50.1 GB/s, chip mean 102.9 us); 6.29 MB per window
+== gate_up_1_expert_standalone: k=2048 n=1544 m=1 cols=1536 windows=1
+ upload classic 2 ms, moe 2 ms (6 MB bf16)
+ whole: 0.372 ms call, chip 0.211 ms, grid 193x1
+ window 0 col0=0: mismatches vs whole 0/1536, oracle worst 2.06e-07 bad 0, chip 0.204 ms, grid 192x1, hit=1
+ timing: 1 windows/call median 0.105 ms (105.0 us/window, chip mean 102.9 us/window, 59.9 GB/s); single window median 0.105 ms (59.8 GB/s, chip mean 103.8 us); 6.29 MB per window
+== down_1_expert_standalone: k=768 n=2056 m=1 cols=2048 windows=1
+ upload classic 1 ms, moe 1 ms (3 MB bf16)
+ whole: 0.211 ms call, chip 0.108 ms, grid 257x1
+ window 0 col0=0: mismatches vs whole 0/2048, oracle worst 1.34e-07 bad 0, chip 0.104 ms, grid 256x1, hit=1
+ timing: 1 windows/call median 0.105 ms (104.5 us/window, chip mean 102.8 us/window, 30.1 GB/s); single window median 0.105 ms (30.1 GB/s, chip mean 102.8 us); 3.15 MB per window
+PASS: 143 checks, 0 failed
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_pfgemm_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_pfgemm_test.log
new file mode 100644
index 000000000 ..a0bb87164
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_pfgemm_test.log
@@ -0,0 +1,33 @@
+spec k 2048 rt 8 ct 2 warps 16 aqn 1 epi 0 direct 0: built, 798 instructions, peak 120, declared 128 -> fits
+spec k 2048 rt 8 ct 2 warps 16 aqn 1 epi 1 direct 0: built, 994 instructions, peak 120, declared 128 -> fits
+spec k 768 rt 8 ct 2 warps 16 aqn 1 epi 0 direct 1: built, 795 instructions, peak 120, declared 128 -> fits
+spec k 4096 rt 8 ct 2 warps 16 aqn 1 epi 0 direct 0: built, 798 instructions, peak 120, declared 128 -> fits
+spec k 2048 rt 8 ct 2 warps 16 aqn 2 epi 0 direct 0: built, 798 instructions, peak 124, declared 128 -> fits
+spec k 2048 rt 8 ct 2 warps 16 aqn 2 epi 1 direct 0: built, 994 instructions, peak 124, declared 128 -> fits
+spec k 768 rt 8 ct 2 warps 16 aqn 2 epi 0 direct 1: built, 795 instructions, peak 124, declared 128 -> fits
+spec k 2048 rt 4 ct 2 warps 8 aqn 2 epi 0 direct 0: built, 550 instructions, peak 92, declared 96 -> fits
+SWIGLU layout + emulation vs double oracle on the original weights: worst relative error 0.00379 (bf16 output: < 1e-2 expected)
+SWIGLU reference vs chip-observed MUFU.RCP flush window: 6/6 match; control g -87 -> a73e (nonzero), g -89 -> 8000 (-0): ok
+sim case 0 (E 3 n 256 k 256 M 70 F32 rt 8 warps 16 aqn 1) order 0: ran, 0 differ
+sim case 0 (E 3 n 256 k 256 M 70 F32 rt 8 warps 16 aqn 1) order 1: ran, 0 differ
+sim case 0 mutant 1: caught
+sim case 0 mutant 2: caught
+sim case 0 mutant 3: caught
+sim case 0 mutant 4: caught
+sim case 1 (E 3 n 256 k 384 M 70 SWIGLU rt 8 warps 16 aqn 1) order 0: ran, 0 differ
+sim case 1 (E 3 n 256 k 384 M 70 SWIGLU rt 8 warps 16 aqn 1) order 1: ran, 0 differ
+sim case 1 mutant 1: caught
+sim case 1 mutant 2: caught
+sim case 1 mutant 3: caught
+sim case 1 mutant 4: caught
+sim case 2 (E 3 n 256 k 256 M 150 F32 direct rt 8 warps 16 aqn 1) order 0: ran, 0 differ
+sim case 2 (E 3 n 256 k 256 M 150 F32 direct rt 8 warps 16 aqn 1) order 1: ran, 0 differ
+sim case 3 (E 2 n 256 k 256 M 40 F32 rt 4 warps 8 aqn 2) order 0: ran, 0 differ
+sim case 3 (E 2 n 256 k 256 M 40 F32 rt 4 warps 8 aqn 2) order 1: ran, 0 differ
+sim case 4 (E 2 n 512 k 128 M 300 SWIGLU rt 8 warps 16 aqn 2) order 0: ran, 0 differ
+sim case 4 (E 2 n 512 k 128 M 300 SWIGLU rt 8 warps 16 aqn 2) order 1: ran, 0 differ
+sim case 5 (E 3 n 512 k 256 M 150 SWIGLU rt 4 warps 16 aqn 1) order 0: ran, 0 differ
+sim case 5 (E 3 n 512 k 256 M 150 SWIGLU rt 4 warps 16 aqn 1) order 1: ran, 0 differ
+sim case 6 (E 3 n 256 k 384 M 130 F32 direct rt 4 warps 16 aqn 1) order 0: ran, 0 differ
+sim case 6 (E 3 n 256 k 384 M 130 F32 direct rt 4 warps 16 aqn 1) order 1: ran, 0 differ
+GPU_PFGEMM: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_prefill_attn_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_prefill_attn_test.log
new file mode 100644
index 000000000 ..a2f454910
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_prefill_attn_test.log
@@ -0,0 +1,51 @@
+codegen warps 4 mode 0: 917 instructions, 120 registers (declared 128, 128 threads -> 16384 of 65536), 16 placeholders patched
+codegen warps 4 mode 1: 174 instructions, 56 registers (declared 64, 128 threads -> 8192 of 65536), 0 placeholders patched
+codegen warps 4 mode 2: 782 instructions, 124 registers (declared 128, 128 threads -> 16384 of 65536), 16 placeholders patched
+codegen warps 8 mode 0: 866 instructions, 120 registers (declared 128, 256 threads -> 32768 of 65536), 16 placeholders patched
+codegen warps 8 mode 1: 174 instructions, 56 registers (declared 64, 256 threads -> 16384 of 65536), 0 placeholders patched
+codegen warps 8 mode 2: 731 instructions, 124 registers (declared 128, 256 threads -> 32768 of 65536), 16 placeholders patched
+codegen warps 8 APPEND + mirror: 187 instructions, 56 registers
+path: split APPEND + ATTEND, ATTEND reads the GPU-cached K/V mirror, warps 8, warm 0, dev buffers session (uncached)
+chip pos0 0 m 1: parity bad=0 worst=0.000; rows vs emulation k 0 (max 0 ulp) v 0; chunks 2 grid 1x4 x256 thr; chip 0.218 ms call 10.503 ms
+ gate 2 vs 1 decode steps: rows k 0 v 0 differ; outputs worst 0.000 of tol; decode loop chip 0.105 ms call 0.309 ms
+chip pos0 37 m 19: parity bad=0 worst=0.134; rows vs emulation k 0 (max 0 ulp) v 0; chunks 2 grid 3x4 x256 thr; chip 0.271 ms call 3.889 ms
+ gate 2 vs 19 decode steps: rows k 0 v 0 differ; outputs worst 0.134 of tol; decode loop chip 1.950 ms call 2.035 ms
+chip pos0 0 m 64: parity bad=0 worst=0.231; rows vs emulation k 0 (max 0 ulp) v 0; chunks 2 grid 8x4 x256 thr; chip 0.207 ms call 1.758 ms
+ reps chip ms (in order, 0 untimed warm calls first): 0.207 0.206 0.207 0.206 0.206 0.206 0.206 0.206 0.206
+ slowest rep, per launch ms (2 launches): 0.103 0.104
+ timing prefill pos0 0 m 64: chip median 0.206 ms (min 0.206) call median 0.396 ms; 0.17 useful TFLOPS on chip time
+ gate 2 vs 64 decode steps: rows k 0 v 0 differ; outputs worst 0.231 of tol; decode loop chip 6.497 ms call 6.648 ms
+ speed: prefill 0.206 ms vs decode loop 6.497 ms chip time: 31.6x
+chip pos0 100 m 70: parity bad=0 worst=0.086; rows vs emulation k 1 (max 1 ulp) v 0; chunks 2 grid 9x4 x256 thr; chip 0.272 ms call 1.755 ms
+ gate 2 vs 70 decode steps: rows k 0 v 0 differ; outputs worst 0.086 of tol; decode loop chip 7.179 ms call 7.342 ms
+chip pos0 200 m 64: parity bad=0 worst=0.061; rows vs emulation k 0 (max 0 ulp) v 0; chunks 2 grid 8x4 x256 thr; chip 0.264 ms call 0.888 ms
+ gate 2 vs 64 decode steps: rows k 0 v 0 differ; outputs worst 0.061 of tol; decode loop chip 6.851 ms call 7.007 ms
+chip pos0 0 m 512: parity bad=0 worst=0.237; rows vs emulation k 2 (max 1 ulp) v 0; chunks 2 grid 64x4 x256 thr; chip 0.519 ms call 8.168 ms
+ reps chip ms (in order, 0 untimed warm calls first): 0.515 0.514 0.512 0.512 0.511 0.514 0.513 0.513 0.513
+ slowest rep, per launch ms (2 launches): 0.106 0.408
+ timing prefill pos0 0 m 512: chip median 0.513 ms (min 0.511) call median 2.269 ms; 4.20 useful TFLOPS on chip time
+ gate 2 vs 512 decode steps: rows k 0 v 0 differ; outputs worst 0.237 of tol; decode loop chip 53.538 ms call 56.666 ms
+ speed: prefill 0.513 ms vs decode loop 53.538 ms chip time: 104.4x
+chip pos0 4032 m 64: parity bad=0 worst=0.011; rows vs emulation k 0 (max 0 ulp) v 0; chunks 2 grid 8x4 x256 thr; chip 0.529 ms call 5.737 ms
+ reps chip ms (in order, 0 untimed warm calls first): 0.411 0.410 0.410 0.410 0.410 0.410 0.410 0.410 0.410
+ slowest rep, per launch ms (2 launches): 0.104 0.306
+ timing prefill pos0 4032 m 64: chip median 0.410 ms (min 0.410) call median 0.602 ms; 10.39 useful TFLOPS on chip time
+ gate 2 vs 64 decode steps: rows k 0 v 0 differ; outputs worst 0.011 of tol; decode loop chip 13.207 ms call 13.404 ms
+ speed: prefill 0.410 ms vs decode loop 13.207 ms chip time: 32.2x
+chip pos0 0 m 2048: parity bad=0 worst=0.247; rows vs emulation k 8 (max 1 ulp) v 0; chunks 4 grid 128x4 x256 thr; chip 2.226 ms call 24.831 ms
+ reps chip ms (in order, 0 untimed warm calls first): 2.146 2.143 2.143 2.145 2.244 2.143 2.145 2.144 5.195
+ slowest rep, per launch ms (4 launches): 0.104 0.815 0.206 4.071
+ timing prefill pos0 0 m 2048: chip median 2.145 ms (min 2.143) call median 9.393 ms; 16.03 useful TFLOPS on chip time
+chip dev pos0 100 m 70: outputs vs host entry: 0 unwritten, 0 differ; rows k 0 v 0 differ; launches 2 grid 9x4; chip 0.441 ms call 0.810 ms
+chip dev pos0 0 m 2048: outputs vs host entry: 0 unwritten, 0 differ; rows k 0 v 0 differ; launches 2 grid 256x4; chip 2.047 ms call 3.430 ms
+ dev reps chip ms: 2.043 2.037 2.036 2.038 2.057 2.036 2.034 2.034 2.034
+ timing dev pos0 0 m 2048: chip median 2.036 ms (min 2.034) call median 2.038 ms; 16.89 useful TFLOPS on chip time
+chip dev pos0 4096 m 1500: outputs vs host entry: 0 unwritten, 0 differ; rows k 0 v 0 differ; launches 2 grid 188x4; chip 5.276 ms call 10.096 ms
+ dev reps chip ms: 6.410 3.660 3.557 3.556 3.557 3.557 3.558 3.557 3.558
+ timing dev pos0 4096 m 1500: chip median 3.557 ms (min 3.556) call median 3.558 ms; 33.48 useful TFLOPS on chip time
+chip continuation (prefill 300, decode 5, prefill 64, rewrite, prefill 32): mirror valid 369; outputs differ mirror vs none: 0; stale control 32768 differ (must be > 0); after invalidate 0 differ
+chip mutant 1: caught (rc OK, bad 83432, worst 41.54, rows k 7851 v 0)
+chip mutant 2: caught (rc OK, bad 75048, worst 66.80, rows k 0 v 0)
+chip mutant 3: caught (rc OK, bad 0, worst 0.08, rows k 12288 v 12288)
+chip mutant 4: caught (rc OK, bad 53792, worst 183.29, rows k 0 v 0)
+gpu_prefill_attn_test: 164 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_qgemm_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_qgemm_test.log
new file mode 100644
index 000000000 ..c55f2641b
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_qgemm_test.log
@@ -0,0 +1,26 @@
+quantiser reference: PASS (amax/scale in (224, 448], error within half an e4m3 ulp)
+qgemm emulation vs double oracle (plain): worst error 2.31e-07 of the sum of |terms| PASS
+qgemm emulation vs double oracle (swiglu_nat): worst error 2.19e-07 of the sum of |terms| PASS
+sim quantiser k 2048 f32: ran, 0 differ
+sim quantiser k 768 bf16: ran, 0 differ
+sim quantiser k 4096 f32: ran, 0 differ
+sim quantiser k 128 bf16: ran, 0 differ
+sim quantiser mutant 1: caught
+sim quantiser mutant 2: caught
+sim qgemm case 0 (n 256 k 384 M 300 swiglu indexed rt 4 warps 8) order 0: ran, 0 differ
+sim qgemm case 0 (n 256 k 384 M 300 swiglu indexed rt 4 warps 8) order 1: ran, 0 differ
+sim qgemm case 0 mutant 1: caught
+sim qgemm case 0 mutant 2: caught
+sim qgemm case 0 mutant 3: caught
+sim qgemm case 0 mutant 4: caught
+sim qgemm case 1 (n 256 k 256 M 200 f32 direct rt 4 warps 8) order 0: ran, 0 differ
+sim qgemm case 1 (n 256 k 256 M 200 f32 direct rt 4 warps 8) order 1: ran, 0 differ
+sim qgemm case 1 mutant 1: caught
+sim qgemm case 1 mutant 2: caught
+sim qgemm case 1 mutant 3: caught
+sim qgemm case 1 mutant 4: caught
+sim qgemm case 2 (n 256 k 128 M 150 f32 indexed rt 4 warps 8) order 0: ran, 0 differ
+sim qgemm case 2 (n 256 k 128 M 150 f32 indexed rt 4 warps 8) order 1: ran, 0 differ
+sim qgemm case 3 (n 512 k 1024 M 140 swiglu direct rt 4 warps 8) order 0: ran, 0 differ
+sim qgemm case 3 (n 512 k 1024 M 140 swiglu direct rt 4 warps 8) order 1: ran, 0 differ
+GPU_QGEMM: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_reconv_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_reconv_test.log
new file mode 100644
index 000000000 ..985d4173f
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_reconv_test.log
@@ -0,0 +1,20 @@
+codegen rc_diamond: 37 insns, 14 gprs, 1 regions
+codegen rc_loopbreak: 41 insns, 14 gprs, 1 regions
+codegen rc_nested: 49 insns, 15 gprs, 2 regions
+codegen rc_exit_bar: 40 insns, 18 gprs, 1 regions
+codegen rc_depth16: 107 insns, 14 gprs, 16 regions
+nvdisasm diamond: rc=0 insns=40 undecodable=0 missing=0 (/tmp/omega_rc_diamond_326606.sass)
+nvdisasm depth16: rc=0 insns=112 undecodable=0 missing=0 (/tmp/omega_rc_depth16_326606.sass)
+nvdisasm sieve_div2: rc=0 insns=72 undecodable=0 missing=0 (/tmp/omega_rc_sieve_div2_326606.sass)
+nvdisasm forms: rc=0 insns=4 undecodable=0 missing=0 (/tmp/omega_rc_forms_326606.sass)
+model rc_diamond n=4096: warp_issues=4736 lane_util=0.878 splits=128 max_frags=2 peak_bars=1
+model rc_diamond n=4096: warp_issues=4736 lane_util=0.878 splits=128 max_frags=2 peak_bars=1
+model rc_loopbreak n=4096: warp_issues=115685 lane_util=0.193 splits=2889 max_frags=28 peak_bars=1
+model rc_loopbreak n=4096: warp_issues=116847 lane_util=0.195 splits=2876 max_frags=2 peak_bars=1
+model rc_nested n=4096: warp_issues=92819 lane_util=0.150 splits=1739 max_frags=20 peak_bars=2
+model rc_nested n=4096: warp_issues=91594 lane_util=0.148 splits=1694 max_frags=2 peak_bars=2
+model rc_exit_bar n=4096: warp_issues=5120 lane_util=0.963 splits=128 max_frags=2 peak_bars=1
+model rc_exit_bar n=4096: warp_issues=5120 lane_util=0.962 splits=128 max_frags=2 peak_bars=1
+model rc_depth16 n=4096: warp_issues=13696 lane_util=0.640 splits=128 max_frags=2 peak_bars=16
+model rc_depth16 n=4096: warp_issues=13696 lane_util=0.637 splits=128 max_frags=2 peak_bars=16
+PASS: 235 checks, 0 failed
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_router_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_router_test.log
new file mode 100644
index 000000000 ..188b386b4
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_router_test.log
@@ -0,0 +1,28 @@
+router alloc (2 layers): rc=OK 53.2 ms ()
+parity 0 (norm 1, out_scale 1, x scale 0.01): ok ids equal, w max abs 3.70e-08, x' max abs 1.66e-07 (of 1.98), tables ok, margin 7.98e-03
+second call: bit-identical
+parity 1 (norm 1, out_scale 1, x scale 1): ok ids equal, w max abs 3.62e-08, x' max abs 2.32e-07 (of 2.05), tables ok, margin 3.88e-02
+parity 2 (norm 1, out_scale 1, x scale 40): ok ids equal, w max abs 2.09e-08, x' max abs 1.65e-07 (of 2.04), tables ok, margin 1.40e-02
+parity 24 (norm 0, out_scale 1, x scale 0.01): ok ids equal, w max abs 1.95e-08, x' max abs 2.90e-07 (of 2.05), tables ok, margin 7.60e-02
+parity 25 (norm 0, out_scale 1, x scale 1): ok ids equal, w max abs 1.29e-08, x' max abs 1.34e-07 (of 2.06), tables ok, margin 3.20e-02
+parity 26 (norm 0, out_scale 1, x scale 40): ok ids equal, w max abs 8.15e-09, x' max abs 2.93e-07 (of 2.03), tables ok, margin 8.03e-02
+parity 27 (norm 0, out_scale 1, x scale 0.01): ok ids equal, w max abs 6.59e-09, x' max abs 1.52e-07 (of 2.07), tables ok, margin 5.37e-02
+parity 28 (norm 0, out_scale 1, x scale 1): ok ids equal, w max abs 9.86e-09, x' max abs 1.80e-07 (of 2.03), tables ok, margin 1.24e-02
+parity 29 (norm 0, out_scale 1, x scale 40): ok ids equal, w max abs 3.25e-08, x' max abs 1.26e-07 (of 2.04), tables ok, margin 3.17e-02
+parity 30 (norm 0, out_scale 1, x scale 0.01): ok ids equal, w max abs 3.96e-08, x' max abs 2.52e-07 (of 2.03), tables ok, margin 1.30e-01
+parity 31 (norm 0, out_scale 1, x scale 1): ok ids equal, w max abs 1.79e-08, x' max abs 1.48e-07 (of 2.05), tables ok, margin 3.20e-02
+parity 32 (norm 1, out_scale 2^64, x scale 40): ok ids equal, w max abs 1.81e-07, x' max abs 3.07e-07 (of 2.05), tables ok, margin 1.48e-02
+parity 33 (norm 1, out_scale 2^64, x scale 0.01): ok ids equal, w max abs 5.09e-08, x' max abs 1.33e-07 (of 2.01), tables ok, margin 3.39e-02
+parity 34 (norm 1, out_scale 2^64, x scale 1): ok ids equal, w max abs 3.93e-08, x' max abs 2.49e-07 (of 2.08), tables ok, margin 3.67e-02
+parity 35 (norm 1, out_scale 2^64, x scale 40): ok ids equal, w max abs 6.79e-08, x' max abs 3.01e-07 (of 2.06), tables ok, margin 1.47e-01
+chip parity: 0 of 36 mismatches, 0 margin cases (recorded, oracle margin below 1e-04)
+chip mutant 1: caught (bad mask 5) ids DIFFER, w max abs 0.00e+00, x' max abs 3.30e-01 (of 2.04), tables ok, margin 1.04e-01
+chip mutant 2: caught (bad mask 1) ids DIFFER, w max abs 0.00e+00, x' max abs 2.10e-07 (of 2.04), tables ok, margin 1.04e-01
+chip mutant 3: caught (bad mask 8) ids equal, w max abs 5.10e-08, x' max abs 2.10e-07 (of 2.04), tables WRONG, margin 1.04e-01
+chip mutant 4: caught (bad mask 2) ids equal, w max abs 7.51e-01, x' max abs 2.10e-07 (of 2.04), tables ok, margin 1.04e-01
+fp8 upload gate+up 384 MB + down 24 MB: rc OK / OK, 188 ms
+e2e router layer 1: ok ids equal, w max abs 6.92e-08, x' max abs 2.50e-07 (of 2.02), tables ok, margin 7.28e-02
+e2e grouped gate+up (8 experts, 1536 x 2048): device table/x' vs host table: bit-identical; chip 153.3 us vs 151.2 us, call 426.2 us vs 169.4 us
+e2e group 3 vs fp8 oracle: worst rel 2.33e-08
+timing (medians of 1, evict 1, warps 32 depth 4): router chip 48.4 us, router call 53.3 us, grouped gate+up dev chip 149.3 us, router+gate+up sequence 213.0 us
+gpu_router_test: 17 checks, 0 failed: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_tcgemm_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_tcgemm_test.log
new file mode 100644
index 000000000 ..5bdadb1f0
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_tcgemm_test.log
@@ -0,0 +1,33 @@
+placeholder patch self-test: ok (SHFL.BFLY x2, SHFL.DOWN x1, F2FP.BF16.F32.PACK_AB x1 match the oracle bits)
+shape k 2048 rt 4 ct 2 warps 8: rc 0, 539 instructions, peak 124, declared 128, shared 16384, span 128: ok
+shape k 768 rt 4 ct 2 warps 8: rc 0, 539 instructions, peak 124, declared 128, shared 16384, span 128: ok
+shape k 4096 rt 4 ct 2 warps 8: rc 0, 539 instructions, peak 124, declared 128, shared 16384, span 128: ok
+shape k 2048 rt 4 ct 1 warps 8: rc 0, 392 instructions, peak 88, declared 96, shared 16384, span 64: ok
+shape k 2048 rt 2 ct 2 warps 4: rc 0, 411 instructions, peak 96, declared 104, shared 8192, span 64: ok
+shape k 2048 rt 4 ct 2 warps 4: rc -1, 0 instructions, peak 0, declared 8, shared 16384, span 64: REFUSED
+shape k 768 rt 4 ct 2 warps 4: rc -1, 0 instructions, peak 0, declared 8, shared 16384, span 64: REFUSED
+shape k 5120 rt 4 ct 2 warps 8: rc 0, 539 instructions, peak 124, declared 128, shared 16384, span 128: ok
+shape k 17408 rt 4 ct 2 warps 8: rc 0, 539 instructions, peak 124, declared 128, shared 16384, span 128: ok
+shape k 32768 rt 4 ct 2 warps 8: rc 0, 539 instructions, peak 124, declared 128, shared 16384, span 128: ok
+emulation vs double oracle: worst |err| / sum|terms| = 2.46e-07 (ok, bound 1e-6)
+host-only: PASS
+sim E 3 n 256 k 256 M 40 rt 4 ct 2 warps 8 order 0: ok 0 of 10240 differ from the emulation, 0 unwritten (bit-identical)
+sim E 3 n 256 k 256 M 40 rt 4 ct 2 warps 8 order 1: ok 0 of 10240 differ from the emulation, 0 unwritten (bit-identical)
+sim E 2 n 128 k 384 M 70 rt 4 ct 2 warps 8 order 0: ok 0 of 8960 differ from the emulation, 0 unwritten (bit-identical)
+sim E 2 n 128 k 384 M 70 rt 4 ct 2 warps 8 order 1: ok 0 of 8960 differ from the emulation, 0 unwritten (bit-identical)
+sim E 4 n 128 k 128 M 37 rt 2 ct 2 warps 4 order 0: ok 0 of 4736 differ from the emulation, 0 unwritten (bit-identical)
+sim E 4 n 128 k 128 M 37 rt 2 ct 2 warps 4 order 1: ok 0 of 4736 differ from the emulation, 0 unwritten (bit-identical)
+sim E 2 n 256 k 256 M 20 rt 4 ct 1 warps 8 order 0: ok 0 of 5120 differ from the emulation, 0 unwritten (bit-identical)
+sim E 2 n 256 k 256 M 20 rt 4 ct 1 warps 8 order 1: ok 0 of 5120 differ from the emulation, 0 unwritten (bit-identical)
+sim E 2 n 128 k 256 M 33 rt 1 ct 4 warps 4 order 0: ok 0 of 4224 differ from the emulation, 0 unwritten (bit-identical)
+sim E 2 n 128 k 256 M 33 rt 1 ct 4 warps 4 order 1: ok 0 of 4224 differ from the emulation, 0 unwritten (bit-identical)
+sim E 1 n 512 k 256 M 64 rt 4 ct 2 warps 8 order 0: ok 0 of 32768 differ from the emulation, 0 unwritten (bit-identical)
+sim E 1 n 512 k 256 M 64 rt 4 ct 2 warps 8 order 1: ok 0 of 32768 differ from the emulation, 0 unwritten (bit-identical)
+sim E 1 n 128 k 17408 M 64 rt 4 ct 2 warps 8 order 0: ok 0 of 8192 differ from the emulation, 0 unwritten (bit-identical)
+sim E 1 n 128 k 17408 M 64 rt 4 ct 2 warps 8 order 1: ok 0 of 8192 differ from the emulation, 0 unwritten (bit-identical)
+sim mutant 1: caught (6400 of 6400 differ)
+sim mutant 2: caught (6400 of 6400 differ)
+sim mutant 3: caught (6016 of 6400 differ)
+sim mutant 4: caught (6400 of 6400 differ)
+sim: PASS
+GPU_TCGEMM: PASS
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/gpu_tern_test.log b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_tern_test.log
new file mode 100644
index 000000000 ..f9c2c0555
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/gpu_tern_test.log
@@ -0,0 +1,18 @@
+chip: random rows 20000, rows differing from oma_rz_oracle 0
+chip: MA grid 36 points (49932 rows), rows differing 0
+chip: BitNet shapes x 2 layouts, rows differing 0
+chip: rows checked against oma_rz_oracle 115500
+chip: mutant 1 caught (512 of 512 rows differ from oma_rz_oracle)
+chip: mutant 3 caught (511 of 512 rows differ from oma_rz_oracle)
+chip: f32 q|k|v segments, rows differing from the host formula 0
+chip: mutant 2 caught (1919 of 3840 rows take the wrong scale)
+chip: in-list launch floor (8 x 256, 512 B) median 3.52 us, min 3.39 us
+chip: cold 3840x2560 (2457600 B x 41 launches = 96.1 MiB per list): 24.54 us per launch -> 100.1 GB/s = 0.367 of 273 spec, 0.422 of 237.2 practical; minus the launch floor 21.02 us -> 116.9 GB/s (0.493 of 237.2)
+FAIL: cold GB/s minus the launch floor at 3840x2560: 116.9 (100.1 with it), gate >= 180
+chip: cold 2560x2560 (1638400 B x 62 launches = 96.9 MiB per list): 15.62 us per launch -> 104.9 GB/s = 0.384 of 273 spec, 0.442 of 237.2 practical; minus the launch floor 12.10 us -> 135.4 GB/s (0.571 of 237.2)
+FAIL: cold GB/s minus the launch floor at 2560x2560: 135.4 (104.9 with it), gate >= 180
+chip: cold 13824x2560 (8847360 B x 12 launches = 101.2 MiB per list): 53.54 us per launch -> 165.3 GB/s = 0.605 of 273 spec, 0.697 of 237.2 practical; minus the launch floor 50.02 us -> 176.9 GB/s (0.746 of 237.2)
+FAIL: cold GB/s minus the launch floor at 13824x2560: 176.9 (165.3 with it), gate >= 200
+chip: cold 2560x6912 (4423680 B x 23 launches = 97.0 MiB per list): 30.30 us per launch -> 146.0 GB/s = 0.535 of 273 spec, 0.615 of 237.2 practical; minus the launch floor 26.78 us -> 165.2 GB/s (0.696 of 237.2)
+FAIL: cold GB/s minus the launch floor at 2560x6912: 165.2 (146.0 with it), gate >= 180
+gpu_tern_test: 68 checks, 4 failed: FAIL
diff --git a/evidence/encoder-fix-sweep-20261018T1512Z/summary.txt b/evidence/encoder-fix-sweep-20261018T1512Z/summary.txt
new file mode 100644
index 000000000 ..610751e1e
--- /dev/null
+++ b/evidence/encoder-fix-sweep-20261018T1512Z/summary.txt
@@ -0,0 +1,19 @@
+rc=0 gpu_decode_attn_test 1s :: gpu_decode_attn_test: 29 checks, 0 failed: PASS
+rc=0 gpu_prefill_attn_test 13s :: gpu_prefill_attn_test: 164 checks, 0 failed: PASS
+rc=0 gpu_decode_attn256_test 1s :: gpu_decode_attn256_test: 30 checks, 0 failed: PASS
+rc=0 gpu_attention_test 0s :: PASS: 219 checks, 0 failed
+rc=0 gpu_elementwise_test 1s :: PASS: 35 checks, 0 failed
+rc=0 gpu_tcgemm_test 4s :: GPU_TCGEMM: PASS
+rc=0 gpu_gdn_test 2s :: gpu_gdn_test: 54 checks, 0 failed: PASS
+rc=0 gpu_router_test 1s :: gpu_router_test: 17 checks, 0 failed: PASS
+rc=0 gpu_moe_window_test 7s :: PASS: 143 checks, 0 failed
+rc=0 gpu_cmdlist_test 3s :: chip: 31 checks, 0 failed: PASS
+rc=0 gpu_bf16_gemv_test 1s :: gpu_bf16_gemv_test: 12 checks, 0 failed: PASS
+rc=0 gpu_pfgemm_test 7s :: GPU_PFGEMM: PASS
+rc=0 gpu_fp8gemm_test 1s :: gpu_fp8gemm_test: 36 checks, 0 failed: PASS
+rc=1 gpu_tern_test 4s :: gpu_tern_test: 68 checks, 4 failed: FAIL
+rc=0 gpu_reconv_test 5s :: PASS: 235 checks, 0 failed
+rc=0 gpu_decode_graph_test 1s :: chip: 13 checks, 0 failed: PASS
+rc=0 gpu_qgemm_test 10s :: GPU_QGEMM: PASS
+rc=0 gpu_fp8_api_test 4s :: gpu_fp8_api_test: 30 checks, 0 failed: PASS
+rc=0 gpu_matmul_api_test 14s :: PASS: 97 checks, 0 failed
diff --git a/evidence/pattn256-chip-20261018T1331Z/NOTE.md b/evidence/pattn256-chip-20261018T1331Z/NOTE.md
new file mode 100644
index 000000000 ..6a504f634
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/NOTE.md
@@ -0,0 +1,15 @@
+# RED receipt (unfixed encoder), kept on purpose
+
+This run is the chip FAIL of the prefill attention (omega-mv#545) on the code before the encoder fix:
+`omega_blackwell_codegen.c` wrote a fixed word 3 for IADD3 (`0x010fca00`: stall 5, wait on scoreboard 4) and dropped
+the emitter's control word. At attend IR index 55 the emitter scheduled a wait on the Q loads' scoreboards (0x3);
+the chip got a wait on scoreboard 4, the MOVs at 88/89 zeroed the loads' address registers R22:R23 while loads were
+still queued, and the attend faulted (Xid 13, Graphics SM Warp Exception: Invalid Address Space) once a second wave
+of CTAs ran behind the first wave's stores (grid > 48 CTAs).
+
+INVALID lines in this run: every "mutant ... caught" and every "process latched" result after the first marker
+timeout. The process was latched by the first fault, so those checks never ran a kernel.
+
+Investigation: ~/workspace/investigations/2026-10-18-pattn256-hang (run10..run21). The proof run (run21): same
+binary, only the 7 IADD3 words rewritten to the emitter's control word: 5/5 at 104 tokens, 2/2 at 2048 tokens,
+1/1 at 2048 tokens from 6144; the unchanged binary in the same batch FAILED.
diff --git a/evidence/pattn256-chip-20261018T1331Z/SHA256SUMS b/evidence/pattn256-chip-20261018T1331Z/SHA256SUMS
new file mode 100644
index 000000000 ..7a98f77ce
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/SHA256SUMS
@@ -0,0 +1,10 @@
+f1a1eaac62c7fc2dd911024811a10e0e462d3c8cd64437074343d69e5c425b48 receipt-baseline-decode.json
+e077d5ba72db8ecd859156777016d9b103b7edecb34adc84015f2559bfdea11f receipt-main.json
+e938ca88a7bd5a32a2184753dbef10e9c934fbf947f9a562672b5343ec2567ba receipt-maxpos131072.json
+855df92583f5f8a21f40d0d9130c23aff7cde471e9b793edbf3f693105b31a20 baseline-decode.log
+f2d60ab2d4854a6f37d5cf7cae6a0a1b6f08df6c23a1d55384b258a6aa458898 build.log
+a5d483bc7b65f792c9b42eb1cdddb61cadd5611c25544a1487f59c5077c8488d host-only.log
+e90e2caa584daecc3bec2d86f67382679bf724c504197a4fa06bab7d5d5ddd25 main.log
+5fcf24e63bb95983cda0669f9bc25670cea9f1c6b1d3d4d13a1d6724c1c39cf8 maxpos131072.log
+e55662a240488b1f0c363df06bbe332b574d242362dced99ba233ad74ec6e504 sim.log
+a2ed727ed05c6e3fae8b05b1d2b2e3bb152964c4e26973cef8f341827745a182 device.txt
diff --git a/evidence/pattn256-chip-20261018T1331Z/baseline-decode.log b/evidence/pattn256-chip-20261018T1331Z/baseline-decode.log
new file mode 100644
index 000000000 ..68511ac27
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/baseline-decode.log
@@ -0,0 +1,9 @@
+cache alloc (1 layer, 32768 positions, 128 MiB): rc=OK 250.5 ms ()
+chip context 301 sharp q rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=2x4 per_split=256 depth=4 kv_bytes=1232896 fill=0.1ms chip_med=119.9us (10.3 GB/s) call_med=122.4us reps=5
+chip context 301 sharp q mutant 1: caught (rc=OK bad=4815 worst=17.399)
+chip context 301 sharp q mutant 2: caught (rc=OK bad=5666 worst=40.991)
+chip context 301 sharp q mutant 3: caught (rc=OK bad=899 worst=3.363)
+chip context 301 sharp q mutant 4: caught (rc=OK bad=2752 worst=30.582)
+chip context 301 sharp q mutant 5: caught (rc=OK bad=2937 worst=78.730)
+gpu_decode_attn256_test: 9 checks, 0 failed: PASS
+baseline exit 0 (recorded)
diff --git a/evidence/pattn256-chip-20261018T1331Z/build.log b/evidence/pattn256-chip-20261018T1331Z/build.log
new file mode 100644
index 000000000 ..4b5069afa
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/build.log
@@ -0,0 +1 @@
+make: 'build/gpu_decode_attn256_test' is up to date.
diff --git a/evidence/pattn256-chip-20261018T1331Z/device.txt b/evidence/pattn256-chip-20261018T1331Z/device.txt
new file mode 100644
index 000000000 ..f5e3f93e0
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/device.txt
@@ -0,0 +1,6 @@
+start 2026-10-18T13:31:33Z omega=ba1bf0d2ca6c3e13d762674492b54e2ad63fc62b branch=feat/pattn256 dirty=1 physics=/home/drakestapleton/workspace/physics-own30b-k physics_commit=6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf physics_lock=6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf
+Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux
+NVIDIA GB10, 580.173.02
+ total used free shared buff/cache available
+Mem: 121 95 14 0 16 25
+end 2026-10-18T13:33:50Z
diff --git a/evidence/pattn256-chip-20261018T1331Z/host-only.log b/evidence/pattn256-chip-20261018T1331Z/host-only.log
new file mode 100644
index 000000000 ..3a6212b09
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/host-only.log
@@ -0,0 +1,3 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+gpu_prefill_attn256_test: 18 checks, 0 failed: PASS
diff --git a/evidence/pattn256-chip-20261018T1331Z/main.log b/evidence/pattn256-chip-20261018T1331Z/main.log
new file mode 100644
index 000000000 ..259756951
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/main.log
@@ -0,0 +1,27 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+-- chip 1 tokens from 0 (max_pos 256)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 1.070 ms (prep 0.245, attend 0.106)
+ parity: 0 bad, worst ratio 0.000 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0)
+ twin: 1 decode calls 0.6 ms; rows k 0 v 0 words differ
+-- chip 37 tokens from 0 (max_pos 256)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 1.851 ms (prep 0.320, attend 0.104)
+ parity: 0 bad, worst ratio 0.245 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0)
+ twin: 37 decode calls 4.3 ms; rows k 0 v 0 words differ
+-- chip 19 tokens from 100 (max_pos 512)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 0.658 ms (prep 0.328, attend 0.105)
+ parity: 0 bad, worst ratio 0.088 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0)
+ twin: 19 decode calls 2.3 ms; rows k 0 v 0 words differ
+-- chip 141 tokens from 37 (max_pos 512)
+FAIL: prefill 37+141: CHIP_FAIL marker wait timed out (latched)
+chip prep mutant 1: caught (rc CHIP_FAIL, 0 bad, worst 0.0, rows ok)
+chip prep mutant 3: caught (rc CHIP_FAIL, 0 bad, worst 0.0, rows ok)
+chip attend mutant 1: caught (rc CHIP_FAIL, 0 bad, worst 0.0, rows ok)
+chip attend mutant 2: caught (rc CHIP_FAIL, 0 bad, worst 0.0, rows ok)
+-- chip 2048 tokens from 0 (max_pos 4096)
+FAIL: cache with history: CHIP_FAIL process latched
+-- chip 2048 tokens from 6144 (max_pos 8192)
+FAIL: cache with history: CHIP_FAIL process latched
+-- chip 2048 tokens from 30720 (max_pos 32768)
+FAIL: cache with history: CHIP_FAIL process latched
+gpu_prefill_attn256_test: 57 checks, 4 failed: FAIL
diff --git a/evidence/pattn256-chip-20261018T1331Z/maxpos131072.log b/evidence/pattn256-chip-20261018T1331Z/maxpos131072.log
new file mode 100644
index 000000000 ..2af6871d5
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/maxpos131072.log
@@ -0,0 +1,12 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+-- chip 2048 tokens from 0 (max_pos 4096)
+FAIL: prefill 0+2048: CHIP_FAIL marker wait timed out (latched)
+-- chip 2048 tokens from 6144 (max_pos 8192)
+FAIL: cache with history: CHIP_FAIL process latched
+-- chip 2048 tokens from 30720 (max_pos 32768)
+FAIL: cache with history: CHIP_FAIL process latched
+-- chip 2048 tokens from 129024 (max_pos 131072)
+FAIL: cache with history: CHIP_FAIL process latched
+gpu_prefill_attn256_test: 23 checks, 4 failed: FAIL
+max-pos 131072 exit 1 (informational)
diff --git a/evidence/pattn256-chip-20261018T1331Z/receipt-baseline-decode.json b/evidence/pattn256-chip-20261018T1331Z/receipt-baseline-decode.json
new file mode 100644
index 000000000 ..f4ef73d0e
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/receipt-baseline-decode.json
@@ -0,0 +1 @@
+{"receipt":"OMEGA_GPU_DECODE_ATTN256_V1","reps":5,"evict":1,"max_pos":32768,"rotary_dim":64,"points":[{"name":"context 301 sharp q","pos":300,"rc":"OK","bad":0,"worst_of_tol":0.000,"rows":"ok (0 one-ulp k flips)","second_call_identical":1,"grid_x":2,"grid_y":4,"per_split":256,"depth":4,"kv_bytes":1232896 ,"fill_ms":0.1,"chip_median_ns":119889,"gb_per_s":10.3,"call_median_ns":122449,"reps":5},{"name":"context 301 sharp q mutant 1","caught":1,"rc":"OK","bad":4815,"worst_of_tol":17.399},{"name":"context 301 sharp q mutant 2","caught":1,"rc":"OK","bad":5666,"worst_of_tol":40.991},{"name":"context 301 sharp q mutant 3","caught":1,"rc":"OK","bad":899,"worst_of_tol":3.363},{"name":"context 301 sharp q mutant 4","caught":1,"rc":"OK","bad":2752,"worst_of_tol":30.582},{"name":"context 301 sharp q mutant 5","caught":1,"rc":"OK","bad":2937,"worst_of_tol":78.730}],"checks":9,"failed":0,"device_opens":1,"verdict":"OMEGA_GPU_DECODE_ATTN256_PASS"}
diff --git a/evidence/pattn256-chip-20261018T1331Z/receipt-main.json b/evidence/pattn256-chip-20261018T1331Z/receipt-main.json
new file mode 100644
index 000000000 ..eb1b2373e
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/receipt-main.json
@@ -0,0 +1,3 @@
+{"test": "gpu_prefill_attn256", "rotary_dim": 64, "points": [
+
+], "checks": 57, "failed": 4}
diff --git a/evidence/pattn256-chip-20261018T1331Z/receipt-maxpos131072.json b/evidence/pattn256-chip-20261018T1331Z/receipt-maxpos131072.json
new file mode 100644
index 000000000 ..54ea050d0
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/receipt-maxpos131072.json
@@ -0,0 +1,3 @@
+{"test": "gpu_prefill_attn256", "rotary_dim": 64, "points": [
+
+], "checks": 23, "failed": 4}
diff --git a/evidence/pattn256-chip-20261018T1331Z/sim.log b/evidence/pattn256-chip-20261018T1331Z/sim.log
new file mode 100644
index 000000000 ..47887a8b6
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1331Z/sim.log
@@ -0,0 +1,15 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+sim one token at position 0 ok bad=0 worst=0.000 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.1 s)
+sim 8 tokens from 0 (one CTA) ok bad=0 worst=0.286 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.1 s)
+sim 37 tokens from 0 (odd m, partial CTA) ok bad=0 worst=0.254 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.9 s)
+sim 19 tokens from 37 (odd start) ok bad=0 worst=0.136 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.8 s)
+sim 19 tokens from 100, sharp q (x4) ok bad=0 worst=0.088 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.9 s)
+sim 40 tokens from 250 (crosses 256) ok bad=0 worst=0.059 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (3.6 s)
+sim 24 tokens from 0, full rope (rotary 256) ok bad=0 worst=0.292 rows vs decode twin: 0 differ; vs reference: ok (1 one-ulp k flips, worst token 1) (0.4 s)
+sim prep mutant 1 at 24 tokens from 40: caught (bad=3122843 worst=31.641 rows vs decode twin: 96 differ; vs reference: token 0 k[0] slot 0 chip bf9f ref 3f5c)
+sim prep mutant 3 at 24 tokens from 40: caught (bad=3135017 worst=95.649 rows vs decode twin: 192 differ; vs reference: token 0 v[0][0] chip 0000 ref 3f41)
+sim attend mutant 1 at 24 tokens from 40: caught (bad=114761 worst=76.729 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0))
+sim attend mutant 2 at 24 tokens from 40: caught (bad=110456 worst=374.128 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0))
+sim: 53330976 warp issues in total
+gpu_prefill_attn256_test: 29 checks, 0 failed: PASS
diff --git a/evidence/pattn256-chip-20261018T1512Z/NOTE.md b/evidence/pattn256-chip-20261018T1512Z/NOTE.md
new file mode 100644
index 000000000 ..7fd8d06ae
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/NOTE.md
@@ -0,0 +1,11 @@
+# First chip run with the encoder fix (omega-mv#545)
+
+Attention parity passed at every point (worst 0.007 of the tolerance); no fault at any size up to 129024+2048.
+The 2 FAILs are the row check's ruler, not the kernel: one K value per run (30720+2048 token 961: chip 36f0 ref 36f3;
+129024+2048 token 871: chip b637 ref b63a) is a value of ~1e-5 left by the rotation's cancellation, 3 bf16 ulps from
+the double oracle; the chip rows are bit-equal to the decode program's rows at the same points (twin: 0 words differ).
+The check was widened to "1 ulp, or within 8 f32 roundings of the row's largest |k|" (tests/gpu_prefill_attn256_test.c
+rows_ok); the rerun is evidence/pattn256-chip-20261018T1517Z.
+The sweep beside it (evidence/encoder-fix-sweep-20261018T1512Z): 18/19 families PASS on the chip; gpu_tern_test FAILs only its
+4 GB/s speed gates, and the unfixed encoder fails the same 4 gates in an A/B on the same load (new 119.3/116.7,
+old 112.3/112.6 GB/s at 3840x2560), so the gates measured host load, not the fix.
diff --git a/evidence/pattn256-chip-20261018T1512Z/SHA256SUMS b/evidence/pattn256-chip-20261018T1512Z/SHA256SUMS
new file mode 100644
index 000000000 ..278429382
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/SHA256SUMS
@@ -0,0 +1,11 @@
+d057000d5fcd5ad26750fe58cb04637e22b46f390efaf17dfa67a7385f3305d0 receipt-baseline-decode.json
+eb3f592e95d3e7858cbaef51341e2d0ddbb14f2c38090d837c732925d3696e9b receipt-main.json
+92350d12c6845f381c13ee12325ab79aec7b96872a66cbca27a3d6191f42e609 receipt-maxpos131072.json
+deced11da5f9acfaafb4685031ef8e5e8804c08907d4703a0d471a1e13c77f18 baseline-decode.log
+43ebe5e7cea68cf72e00ad276c225cdac698926ee2f1528bc8374e1ebb9104e3 build.log
+37a6d523d0f3cdcf6e9d12e39895bbc8daff6e6a276144a0d16f55d68905e32c encode-control.log
+a5d483bc7b65f792c9b42eb1cdddb61cadd5611c25544a1487f59c5077c8488d host-only.log
+76feba85dc092001bc54550451a8f0881b2db9fe9e4326577a91b80020fbb103 main.log
+91a0c4808221abb688975b8e2ed9d9bc16ecd2bbfae0d8043d6ed4652a188771 maxpos131072.log
+8ee020046a8d7c9828c051c1d7bb57b027d4a0b06a4936c28b2d86aba5b71552 sim.log
+7b507a6bde9d1d1c1b8dbfa200a5adda797beda5b0f9b59cdcd0091d55e58cf2 device.txt
diff --git a/evidence/pattn256-chip-20261018T1512Z/baseline-decode.log b/evidence/pattn256-chip-20261018T1512Z/baseline-decode.log
new file mode 100644
index 000000000 ..d0601cd5a
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/baseline-decode.log
@@ -0,0 +1,9 @@
+cache alloc (1 layer, 32768 positions, 128 MiB): rc=OK 167.4 ms ()
+chip context 301 sharp q rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=2x4 per_split=256 depth=4 kv_bytes=1232896 fill=0.1ms chip_med=123.6us (10.0 GB/s) call_med=126.6us reps=5
+chip context 301 sharp q mutant 1: caught (rc=OK bad=4815 worst=17.399)
+chip context 301 sharp q mutant 2: caught (rc=OK bad=5666 worst=40.991)
+chip context 301 sharp q mutant 3: caught (rc=OK bad=899 worst=3.363)
+chip context 301 sharp q mutant 4: caught (rc=OK bad=2752 worst=30.582)
+chip context 301 sharp q mutant 5: caught (rc=OK bad=2937 worst=78.730)
+gpu_decode_attn256_test: 9 checks, 0 failed: PASS
+baseline exit 0 (recorded)
diff --git a/evidence/pattn256-chip-20261018T1512Z/build.log b/evidence/pattn256-chip-20261018T1512Z/build.log
new file mode 100644
index 000000000 ..043d51cd3
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/build.log
@@ -0,0 +1,2 @@
+make: 'build/gpu_decode_attn256_test' is up to date.
+make: 'build/bw_encode_control_test' is up to date.
diff --git a/evidence/pattn256-chip-20261018T1512Z/device.txt b/evidence/pattn256-chip-20261018T1512Z/device.txt
new file mode 100644
index 000000000 ..857c170bc
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/device.txt
@@ -0,0 +1,6 @@
+start 2026-10-18T15:12:19Z omega=ba1bf0d2ca6c3e13d762674492b54e2ad63fc62b branch=feat/pattn256 dirty=9 physics=/home/drakestapleton/workspace/physics-own30b-k physics_commit=6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf physics_lock=6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf
+Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux
+NVIDIA GB10, 580.173.02
+ total used free shared buff/cache available
+Mem: 121 97 14 0 15 24
+end 2026-10-18T15:13:03Z
diff --git a/evidence/pattn256-chip-20261018T1512Z/encode-control.log b/evidence/pattn256-chip-20261018T1512Z/encode-control.log
new file mode 100644
index 000000000 ..b9e018794
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/encode-control.log
@@ -0,0 +1 @@
+bw_encode_control_test: 480 encodings checked, 0 opcodes refused (no operands), 0 dropped the control word: PASS
diff --git a/evidence/pattn256-chip-20261018T1512Z/host-only.log b/evidence/pattn256-chip-20261018T1512Z/host-only.log
new file mode 100644
index 000000000 ..3a6212b09
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/host-only.log
@@ -0,0 +1,3 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+gpu_prefill_attn256_test: 18 checks, 0 failed: PASS
diff --git a/evidence/pattn256-chip-20261018T1512Z/main.log b/evidence/pattn256-chip-20261018T1512Z/main.log
new file mode 100644
index 000000000 ..5def3d23d
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/main.log
@@ -0,0 +1,39 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+-- chip 1 tokens from 0 (max_pos 256)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 1.094 ms (prep 0.126, attend 0.106)
+ parity: 0 bad, worst ratio 0.000 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0)
+ twin: 1 decode calls 0.7 ms; rows k 0 v 0 words differ
+-- chip 37 tokens from 0 (max_pos 256)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 1.839 ms (prep 0.116, attend 0.105)
+ parity: 0 bad, worst ratio 0.245 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0)
+ twin: 37 decode calls 7.1 ms; rows k 0 v 0 words differ
+-- chip 19 tokens from 100 (max_pos 512)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 0.444 ms (prep 0.113, attend 0.106)
+ parity: 0 bad, worst ratio 0.088 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0)
+ twin: 19 decode calls 3.0 ms; rows k 0 v 0 words differ
+-- chip 141 tokens from 37 (max_pos 512)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 3.421 ms (prep 0.213, attend 0.306)
+ parity: 0 bad, worst ratio 0.133 of the tolerance (0.1 s reference); rows: ok (1 one-ulp k flips, worst token 1)
+ twin: 141 decode calls 29.1 ms; rows k 0 v 0 words differ
+chip prep mutant 1: caught (rc OK, 123588 bad, worst 41.4, rows differ)
+chip prep mutant 3: caught (rc OK, 135824 bad, worst 87.2, rows differ)
+chip attend mutant 1: caught (rc OK, 114019 bad, worst 79.5, rows ok)
+chip attend mutant 2: caught (rc OK, 110706 bad, worst 416.0, rows ok)
+-- chip 2048 tokens from 0 (max_pos 4096)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 51.924 ms (prep 2.138, attend 10.125)
+ parity: 0 bad, worst ratio 0.175 of the tolerance (0.1 s reference); rows: ok (23 one-ulp k flips, worst token 1)
+ twin: 2048 decode calls 521.0 ms; rows k 0 v 0 words differ
+ timing (median of 9): prep 2.136 ms, attend 10.195 ms, call 27.930 ms -> 166079 tokens/s; attend 5.06 TFLOPS useful, 106.1 GB/s K/V streamed
+-- chip 2048 tokens from 6144 (max_pos 8192)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 68.458 ms (prep 2.128, attend 39.808)
+ parity: 0 bad, worst ratio 0.012 of the tolerance (0.4 s reference); rows: ok (24 one-ulp k flips, worst token 1)
+ twin: 2048 decode calls 1553.5 ms; rows k 0 v 0 words differ
+ timing (median of 9): prep 2.385 ms, attend 40.928 ms, call 59.669 ms -> 47283 tokens/s; attend 8.82 TFLOPS useful, 183.8 GB/s K/V streamed
+-- chip 2048 tokens from 30720 (max_pos 32768)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 188.749 ms (prep 2.141, attend 159.442)
+FAIL: 30720+2048: appended rows vs reference: token 961 k[3] slot 150 chip 36f0 ref 36f3
+ parity: 0 bad, worst ratio 0.007 of the tolerance (2.0 s reference); rows: FAIL
+ twin: 2048 decode calls 4677.8 ms; rows k 0 v 0 words differ
+ timing (median of 9): prep 2.045 ms, attend 149.678 ms, call 166.864 ms -> 13498 tokens/s; attend 10.67 TFLOPS useful, 222.4 GB/s K/V streamed
+gpu_prefill_attn256_test: 93 checks, 1 failed: FAIL
diff --git a/evidence/pattn256-chip-20261018T1512Z/maxpos131072.log b/evidence/pattn256-chip-20261018T1512Z/maxpos131072.log
new file mode 100644
index 000000000 ..5998e9b2e
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/maxpos131072.log
@@ -0,0 +1,22 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+-- chip 2048 tokens from 0 (max_pos 4096)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 48.745 ms (prep 2.061, attend 9.926)
+ parity: 0 bad, worst ratio 0.175 of the tolerance (0.1 s reference); rows: ok (23 one-ulp k flips, worst token 1)
+ timing (median of 5): prep 1.940 ms, attend 10.063 ms, call 23.550 ms -> 170621 tokens/s; attend 5.12 TFLOPS useful, 107.5 GB/s K/V streamed
+-- chip 2048 tokens from 6144 (max_pos 8192)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 60.095 ms (prep 1.949, attend 38.439)
+ parity: 0 bad, worst ratio 0.012 of the tolerance (0.4 s reference); rows: ok (24 one-ulp k flips, worst token 1)
+ timing (median of 5): prep 1.892 ms, attend 38.195 ms, call 52.593 ms -> 51089 tokens/s; attend 9.45 TFLOPS useful, 197.0 GB/s K/V streamed
+-- chip 2048 tokens from 30720 (max_pos 32768)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 178.046 ms (prep 1.977, attend 151.579)
+FAIL: 30720+2048: appended rows vs reference: token 961 k[3] slot 150 chip 36f0 ref 36f3
+ parity: 0 bad, worst ratio 0.007 of the tolerance (1.9 s reference); rows: FAIL
+ timing (median of 5): prep 1.965 ms, attend 147.270 ms, call 164.559 ms -> 13723 tokens/s; attend 10.85 TFLOPS useful, 226.1 GB/s K/V streamed
+-- chip 2048 tokens from 129024 (max_pos 131072)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 619.667 ms (prep 1.940, attend 596.310)
+FAIL: 129024+2048: appended rows vs reference: token 871 k[1] slot 141 chip b637 ref b63a
+ parity: 0 bad, worst ratio 0.003 of the tolerance (7.9 s reference); rows: FAIL
+ timing (median of 5): prep 1.939 ms, attend 604.868 ms, call 618.090 ms -> 3375 tokens/s; attend 10.82 TFLOPS useful, 225.5 GB/s K/V streamed
+gpu_prefill_attn256_test: 50 checks, 2 failed: FAIL
+max-pos 131072 exit 1 (informational)
diff --git a/evidence/pattn256-chip-20261018T1512Z/receipt-baseline-decode.json b/evidence/pattn256-chip-20261018T1512Z/receipt-baseline-decode.json
new file mode 100644
index 000000000 ..995baff41
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/receipt-baseline-decode.json
@@ -0,0 +1 @@
+{"receipt":"OMEGA_GPU_DECODE_ATTN256_V1","reps":5,"evict":1,"max_pos":32768,"rotary_dim":64,"points":[{"name":"context 301 sharp q","pos":300,"rc":"OK","bad":0,"worst_of_tol":0.000,"rows":"ok (0 one-ulp k flips)","second_call_identical":1,"grid_x":2,"grid_y":4,"per_split":256,"depth":4,"kv_bytes":1232896 ,"fill_ms":0.1,"chip_median_ns":123553,"gb_per_s":10.0,"call_median_ns":126577,"reps":5},{"name":"context 301 sharp q mutant 1","caught":1,"rc":"OK","bad":4815,"worst_of_tol":17.399},{"name":"context 301 sharp q mutant 2","caught":1,"rc":"OK","bad":5666,"worst_of_tol":40.991},{"name":"context 301 sharp q mutant 3","caught":1,"rc":"OK","bad":899,"worst_of_tol":3.363},{"name":"context 301 sharp q mutant 4","caught":1,"rc":"OK","bad":2752,"worst_of_tol":30.582},{"name":"context 301 sharp q mutant 5","caught":1,"rc":"OK","bad":2937,"worst_of_tol":78.730}],"checks":9,"failed":0,"device_opens":1,"verdict":"OMEGA_GPU_DECODE_ATTN256_PASS"}
diff --git a/evidence/pattn256-chip-20261018T1512Z/receipt-main.json b/evidence/pattn256-chip-20261018T1512Z/receipt-main.json
new file mode 100644
index 000000000 ..33de0bc54
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/receipt-main.json
@@ -0,0 +1,5 @@
+{"test": "gpu_prefill_attn256", "rotary_dim": 64, "points": [
+ {"pos0": 0, "m": 2048, "max_pos": 4096, "reps": 9, "prep_ns": 2136151 , "attend_ns": 10195331 , "call_ns": 27930384 , "attend_useful_flops": 51564773376 , "attend_kv_bytes": 1082130432 , "parity_bad": 0, "parity_worst_ratio": 0.1755},
+ {"pos0": 6144, "m": 2048, "max_pos": 8192, "reps": 9, "prep_ns": 2385352 , "attend_ns": 40927933 , "call_ns": 59669117 , "attend_useful_flops": 360802418688 , "attend_kv_bytes": 7524581376 , "parity_bad": 0, "parity_worst_ratio": 0.0122},
+ {"pos0": 30720, "m": 2048, "max_pos": 32768, "reps": 9, "prep_ns": 2045063 , "attend_ns": 149677884 , "call_ns": 166863578 , "attend_useful_flops": 1597752999936 , "attend_kv_bytes": 33294385152 , "parity_bad": 0, "parity_worst_ratio": 0.0073}
+], "checks": 93, "failed": 1}
diff --git a/evidence/pattn256-chip-20261018T1512Z/receipt-maxpos131072.json b/evidence/pattn256-chip-20261018T1512Z/receipt-maxpos131072.json
new file mode 100644
index 000000000 ..b90b77207
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/receipt-maxpos131072.json
@@ -0,0 +1,6 @@
+{"test": "gpu_prefill_attn256", "rotary_dim": 64, "points": [
+ {"pos0": 0, "m": 2048, "max_pos": 4096, "reps": 5, "prep_ns": 1939863 , "attend_ns": 10063363 , "call_ns": 23550179 , "attend_useful_flops": 51564773376 , "attend_kv_bytes": 1082130432 , "parity_bad": 0, "parity_worst_ratio": 0.1755},
+ {"pos0": 6144, "m": 2048, "max_pos": 8192, "reps": 5, "prep_ns": 1892311 , "attend_ns": 38194726 , "call_ns": 52593017 , "attend_useful_flops": 360802418688 , "attend_kv_bytes": 7524581376 , "parity_bad": 0, "parity_worst_ratio": 0.0122},
+ {"pos0": 30720, "m": 2048, "max_pos": 32768, "reps": 5, "prep_ns": 1965095 , "attend_ns": 147270442 , "call_ns": 164558871 , "attend_useful_flops": 1597752999936 , "attend_kv_bytes": 33294385152 , "parity_bad": 0, "parity_worst_ratio": 0.0073},
+ {"pos0": 129024, "m": 2048, "max_pos": 131072, "reps": 5, "prep_ns": 1939015 , "attend_ns": 604868259 , "call_ns": 618089715 , "attend_useful_flops": 6545555324928 , "attend_kv_bytes": 136373600256 , "parity_bad": 0, "parity_worst_ratio": 0.0026}
+], "checks": 50, "failed": 2}
diff --git a/evidence/pattn256-chip-20261018T1512Z/sim.log b/evidence/pattn256-chip-20261018T1512Z/sim.log
new file mode 100644
index 000000000 ..1be405995
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1512Z/sim.log
@@ -0,0 +1,15 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+sim one token at position 0 ok bad=0 worst=0.000 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.1 s)
+sim 8 tokens from 0 (one CTA) ok bad=0 worst=0.286 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.1 s)
+sim 37 tokens from 0 (odd m, partial CTA) ok bad=0 worst=0.254 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.9 s)
+sim 19 tokens from 37 (odd start) ok bad=0 worst=0.136 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.8 s)
+sim 19 tokens from 100, sharp q (x4) ok bad=0 worst=0.088 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (0.9 s)
+sim 40 tokens from 250 (crosses 256) ok bad=0 worst=0.059 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0) (3.7 s)
+sim 24 tokens from 0, full rope (rotary 256) ok bad=0 worst=0.292 rows vs decode twin: 0 differ; vs reference: ok (1 one-ulp k flips, worst token 1) (0.4 s)
+sim prep mutant 1 at 24 tokens from 40: caught (bad=3122843 worst=31.641 rows vs decode twin: 96 differ; vs reference: token 0 k[0] slot 0 chip bf9f ref 3f5c)
+sim prep mutant 3 at 24 tokens from 40: caught (bad=3135017 worst=95.649 rows vs decode twin: 192 differ; vs reference: token 0 v[0][0] chip 0000 ref 3f41)
+sim attend mutant 1 at 24 tokens from 40: caught (bad=114761 worst=76.729 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0))
+sim attend mutant 2 at 24 tokens from 40: caught (bad=110456 worst=374.128 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0))
+sim: 53330976 warp issues in total
+gpu_prefill_attn256_test: 29 checks, 0 failed: PASS
diff --git a/evidence/pattn256-chip-20261018T1517Z/SHA256SUMS b/evidence/pattn256-chip-20261018T1517Z/SHA256SUMS
new file mode 100644
index 000000000 ..e7dd976da
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/SHA256SUMS
@@ -0,0 +1,11 @@
+470f04aef3b80dcad458d6657570b2e8056f69141719492f8a3bd2a0a34bf42e receipt-baseline-decode.json
+c696910c3fb9a709384cd7ef6d1b4cc3fed5ec3f3a9af92684739313770c1304 receipt-main.json
+9cce95799dc20c4dfef40f9b999a92f37642d06033c2070181646b26753d69e8 receipt-maxpos131072.json
+de798e2d39bb56a88ea6bcfdb0a245166282eb9f510b10ba031b0c4bef5b7575 baseline-decode.log
+43ebe5e7cea68cf72e00ad276c225cdac698926ee2f1528bc8374e1ebb9104e3 build.log
+37a6d523d0f3cdcf6e9d12e39895bbc8daff6e6a276144a0d16f55d68905e32c encode-control.log
+a5d483bc7b65f792c9b42eb1cdddb61cadd5611c25544a1487f59c5077c8488d host-only.log
+928e2226088a9dc7b235189efd978a8b077de7964886346097998926a37d63c3 main.log
+b55c4feb9e81e5b3e7204e5de046a7d63c98e2b872caae83b2ac49e9338e6c83 maxpos131072.log
+22b17478c26c5540cec774f258890640a3151da51541e197087c2b679d50218b sim.log
+1958ac465d49d0ba92c9005e368c34134bbd30eeb555faf4ac5416a9e9d59f49 device.txt
diff --git a/evidence/pattn256-chip-20261018T1517Z/baseline-decode.log b/evidence/pattn256-chip-20261018T1517Z/baseline-decode.log
new file mode 100644
index 000000000 ..de2a816b0
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/baseline-decode.log
@@ -0,0 +1,9 @@
+cache alloc (1 layer, 32768 positions, 128 MiB): rc=OK 164.4 ms ()
+chip context 301 sharp q rc=OK bad=0 worst=0.000 rows=ok (0 one-ulp k flips) grid=2x4 per_split=256 depth=4 kv_bytes=1232896 fill=0.1ms chip_med=119.4us (10.3 GB/s) call_med=122.5us reps=5
+chip context 301 sharp q mutant 1: caught (rc=OK bad=4815 worst=17.399)
+chip context 301 sharp q mutant 2: caught (rc=OK bad=5666 worst=40.991)
+chip context 301 sharp q mutant 3: caught (rc=OK bad=899 worst=3.363)
+chip context 301 sharp q mutant 4: caught (rc=OK bad=2752 worst=30.582)
+chip context 301 sharp q mutant 5: caught (rc=OK bad=2937 worst=78.730)
+gpu_decode_attn256_test: 9 checks, 0 failed: PASS
+baseline exit 0 (recorded)
diff --git a/evidence/pattn256-chip-20261018T1517Z/build.log b/evidence/pattn256-chip-20261018T1517Z/build.log
new file mode 100644
index 000000000 ..043d51cd3
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/build.log
@@ -0,0 +1,2 @@
+make: 'build/gpu_decode_attn256_test' is up to date.
+make: 'build/bw_encode_control_test' is up to date.
diff --git a/evidence/pattn256-chip-20261018T1517Z/device.txt b/evidence/pattn256-chip-20261018T1517Z/device.txt
new file mode 100644
index 000000000 ..01c7e5e43
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/device.txt
@@ -0,0 +1,6 @@
+start 2026-10-18T15:17:36Z omega=ba1bf0d2ca6c3e13d762674492b54e2ad63fc62b branch=feat/pattn256 dirty=11 physics=/home/drakestapleton/workspace/physics-own30b-k physics_commit=6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf physics_lock=6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf
+Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux
+NVIDIA GB10, 580.173.02
+ total used free shared buff/cache available
+Mem: 121 97 16 0 13 24
+end 2026-10-18T15:18:18Z
diff --git a/evidence/pattn256-chip-20261018T1517Z/encode-control.log b/evidence/pattn256-chip-20261018T1517Z/encode-control.log
new file mode 100644
index 000000000 ..b9e018794
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/encode-control.log
@@ -0,0 +1 @@
+bw_encode_control_test: 480 encodings checked, 0 opcodes refused (no operands), 0 dropped the control word: PASS
diff --git a/evidence/pattn256-chip-20261018T1517Z/host-only.log b/evidence/pattn256-chip-20261018T1517Z/host-only.log
new file mode 100644
index 000000000 ..3a6212b09
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/host-only.log
@@ -0,0 +1,3 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+gpu_prefill_attn256_test: 18 checks, 0 failed: PASS
diff --git a/evidence/pattn256-chip-20261018T1517Z/main.log b/evidence/pattn256-chip-20261018T1517Z/main.log
new file mode 100644
index 000000000 ..54507da74
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/main.log
@@ -0,0 +1,38 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+-- chip 1 tokens from 0 (max_pos 256)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 0.794 ms (prep 0.217, attend 0.103)
+ parity: 0 bad, worst ratio 0.000 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 1 decode calls 0.3 ms; rows k 0 v 0 words differ
+-- chip 37 tokens from 0 (max_pos 256)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 1.052 ms (prep 0.106, attend 0.103)
+ parity: 0 bad, worst ratio 0.245 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 37 decode calls 3.9 ms; rows k 0 v 0 words differ
+-- chip 19 tokens from 100 (max_pos 512)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 0.373 ms (prep 0.107, attend 0.103)
+ parity: 0 bad, worst ratio 0.088 of the tolerance (0.0 s reference); rows: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 19 decode calls 2.1 ms; rows k 0 v 0 words differ
+-- chip 141 tokens from 37 (max_pos 512)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 3.069 ms (prep 0.211, attend 0.305)
+ parity: 0 bad, worst ratio 0.133 of the tolerance (0.1 s reference); rows: ok (1 one-ulp k flips, worst token 1; 0 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 141 decode calls 14.9 ms; rows k 0 v 0 words differ
+chip prep mutant 1: caught (rc OK, 123588 bad, worst 41.4, rows differ)
+chip prep mutant 3: caught (rc OK, 135824 bad, worst 87.2, rows differ)
+chip attend mutant 1: caught (rc OK, 114019 bad, worst 79.5, rows ok)
+chip attend mutant 2: caught (rc OK, 110706 bad, worst 416.0, rows ok)
+-- chip 2048 tokens from 0 (max_pos 4096)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 45.129 ms (prep 1.950, attend 9.834)
+ parity: 0 bad, worst ratio 0.175 of the tolerance (0.1 s reference); rows: ok (23 one-ulp k flips, worst token 1; 0 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 2048 decode calls 406.2 ms; rows k 0 v 0 words differ
+ timing (median of 9): prep 1.852 ms, attend 9.957 ms, call 23.692 ms -> 173423 tokens/s; attend 5.18 TFLOPS useful, 108.7 GB/s K/V streamed
+-- chip 2048 tokens from 6144 (max_pos 8192)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 61.243 ms (prep 2.351, attend 37.264)
+ parity: 0 bad, worst ratio 0.012 of the tolerance (0.4 s reference); rows: ok (24 one-ulp k flips, worst token 1; 0 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 2048 decode calls 1048.5 ms; rows k 0 v 0 words differ
+ timing (median of 9): prep 1.865 ms, attend 38.751 ms, call 55.149 ms -> 50425 tokens/s; attend 9.31 TFLOPS useful, 194.2 GB/s K/V streamed
+-- chip 2048 tokens from 30720 (max_pos 32768)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 169.583 ms (prep 1.949, attend 147.153)
+ parity: 0 bad, worst ratio 0.007 of the tolerance (1.9 s reference); rows: ok (26 one-ulp k flips, worst token 1; 1 small-value k gaps within 8 f32 roundings of the row max)
+ twin: 2048 decode calls 3775.6 ms; rows k 0 v 0 words differ
+ timing (median of 9): prep 1.863 ms, attend 148.461 ms, call 165.340 ms -> 13624 tokens/s; attend 10.76 TFLOPS useful, 224.3 GB/s K/V streamed
+gpu_prefill_attn256_test: 93 checks, 0 failed: PASS
diff --git a/evidence/pattn256-chip-20261018T1517Z/maxpos131072.log b/evidence/pattn256-chip-20261018T1517Z/maxpos131072.log
new file mode 100644
index 000000000 ..e208f45b0
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/maxpos131072.log
@@ -0,0 +1,20 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+-- chip 2048 tokens from 0 (max_pos 4096)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 45.111 ms (prep 2.056, attend 9.853)
+ parity: 0 bad, worst ratio 0.175 of the tolerance (0.1 s reference); rows: ok (23 one-ulp k flips, worst token 1; 0 small-value k gaps within 8 f32 roundings of the row max)
+ timing (median of 5): prep 1.942 ms, attend 9.989 ms, call 23.975 ms -> 171647 tokens/s; attend 5.16 TFLOPS useful, 108.3 GB/s K/V streamed
+-- chip 2048 tokens from 6144 (max_pos 8192)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 61.761 ms (prep 2.048, attend 37.723)
+ parity: 0 bad, worst ratio 0.012 of the tolerance (0.4 s reference); rows: ok (24 one-ulp k flips, worst token 1; 0 small-value k gaps within 8 f32 roundings of the row max)
+ timing (median of 5): prep 1.937 ms, attend 38.490 ms, call 51.604 ms -> 50660 tokens/s; attend 9.37 TFLOPS useful, 195.5 GB/s K/V streamed
+-- chip 2048 tokens from 30720 (max_pos 32768)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 169.652 ms (prep 1.948, attend 148.011)
+ parity: 0 bad, worst ratio 0.007 of the tolerance (1.9 s reference); rows: ok (26 one-ulp k flips, worst token 1; 1 small-value k gaps within 8 f32 roundings of the row max)
+ timing (median of 5): prep 1.968 ms, attend 150.497 ms, call 167.199 ms -> 13433 tokens/s; attend 10.62 TFLOPS useful, 221.2 GB/s K/V streamed
+-- chip 2048 tokens from 129024 (max_pos 131072)
+ prep 330 insns 64 regs, attend 632 insns 172 regs; first call 621.475 ms (prep 1.950, attend 599.316)
+ parity: 0 bad, worst ratio 0.003 of the tolerance (7.8 s reference); rows: ok (28 one-ulp k flips, worst token 1; 2 small-value k gaps within 8 f32 roundings of the row max)
+ timing (median of 5): prep 1.959 ms, attend 591.290 ms, call 606.531 ms -> 3452 tokens/s; attend 11.07 TFLOPS useful, 230.6 GB/s K/V streamed
+gpu_prefill_attn256_test: 50 checks, 0 failed: PASS
+max-pos 131072 exit 0 (informational)
diff --git a/evidence/pattn256-chip-20261018T1517Z/receipt-baseline-decode.json b/evidence/pattn256-chip-20261018T1517Z/receipt-baseline-decode.json
new file mode 100644
index 000000000 ..bd063b01f
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/receipt-baseline-decode.json
@@ -0,0 +1 @@
+{"receipt":"OMEGA_GPU_DECODE_ATTN256_V1","reps":5,"evict":1,"max_pos":32768,"rotary_dim":64,"points":[{"name":"context 301 sharp q","pos":300,"rc":"OK","bad":0,"worst_of_tol":0.000,"rows":"ok (0 one-ulp k flips)","second_call_identical":1,"grid_x":2,"grid_y":4,"per_split":256,"depth":4,"kv_bytes":1232896 ,"fill_ms":0.1,"chip_median_ns":119441,"gb_per_s":10.3,"call_median_ns":122481,"reps":5},{"name":"context 301 sharp q mutant 1","caught":1,"rc":"OK","bad":4815,"worst_of_tol":17.399},{"name":"context 301 sharp q mutant 2","caught":1,"rc":"OK","bad":5666,"worst_of_tol":40.991},{"name":"context 301 sharp q mutant 3","caught":1,"rc":"OK","bad":899,"worst_of_tol":3.363},{"name":"context 301 sharp q mutant 4","caught":1,"rc":"OK","bad":2752,"worst_of_tol":30.582},{"name":"context 301 sharp q mutant 5","caught":1,"rc":"OK","bad":2937,"worst_of_tol":78.730}],"checks":9,"failed":0,"device_opens":1,"verdict":"OMEGA_GPU_DECODE_ATTN256_PASS"}
diff --git a/evidence/pattn256-chip-20261018T1517Z/receipt-main.json b/evidence/pattn256-chip-20261018T1517Z/receipt-main.json
new file mode 100644
index 000000000 ..625a81212
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/receipt-main.json
@@ -0,0 +1,5 @@
+{"test": "gpu_prefill_attn256", "rotary_dim": 64, "points": [
+ {"pos0": 0, "m": 2048, "max_pos": 4096, "reps": 9, "prep_ns": 1852009 , "attend_ns": 9957251 , "call_ns": 23691832 , "attend_useful_flops": 51564773376 , "attend_kv_bytes": 1082130432 , "parity_bad": 0, "parity_worst_ratio": 0.1755},
+ {"pos0": 6144, "m": 2048, "max_pos": 8192, "reps": 9, "prep_ns": 1864521 , "attend_ns": 38750500 , "call_ns": 55148759 , "attend_useful_flops": 360802418688 , "attend_kv_bytes": 7524581376 , "parity_bad": 0, "parity_worst_ratio": 0.0122},
+ {"pos0": 30720, "m": 2048, "max_pos": 32768, "reps": 9, "prep_ns": 1862633 , "attend_ns": 148460851 , "call_ns": 165340153 , "attend_useful_flops": 1597752999936 , "attend_kv_bytes": 33294385152 , "parity_bad": 0, "parity_worst_ratio": 0.0073}
+], "checks": 93, "failed": 0}
diff --git a/evidence/pattn256-chip-20261018T1517Z/receipt-maxpos131072.json b/evidence/pattn256-chip-20261018T1517Z/receipt-maxpos131072.json
new file mode 100644
index 000000000 ..fdaafaeb0
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/receipt-maxpos131072.json
@@ -0,0 +1,6 @@
+{"test": "gpu_prefill_attn256", "rotary_dim": 64, "points": [
+ {"pos0": 0, "m": 2048, "max_pos": 4096, "reps": 5, "prep_ns": 1942474 , "attend_ns": 9989011 , "call_ns": 23974698 , "attend_useful_flops": 51564773376 , "attend_kv_bytes": 1082130432 , "parity_bad": 0, "parity_worst_ratio": 0.1755},
+ {"pos0": 6144, "m": 2048, "max_pos": 8192, "reps": 5, "prep_ns": 1937178 , "attend_ns": 38489524 , "call_ns": 51604343 , "attend_useful_flops": 360802418688 , "attend_kv_bytes": 7524581376 , "parity_bad": 0, "parity_worst_ratio": 0.0122},
+ {"pos0": 30720, "m": 2048, "max_pos": 32768, "reps": 5, "prep_ns": 1968362 , "attend_ns": 150496801 , "call_ns": 167198679 , "attend_useful_flops": 1597752999936 , "attend_kv_bytes": 33294385152 , "parity_bad": 0, "parity_worst_ratio": 0.0073},
+ {"pos0": 129024, "m": 2048, "max_pos": 131072, "reps": 5, "prep_ns": 1959146 , "attend_ns": 591289547 , "call_ns": 606530682 , "attend_useful_flops": 6545555324928 , "attend_kv_bytes": 136373600256 , "parity_bad": 0, "parity_worst_ratio": 0.0026}
+], "checks": 50, "failed": 0}
diff --git a/evidence/pattn256-chip-20261018T1517Z/sim.log b/evidence/pattn256-chip-20261018T1517Z/sim.log
new file mode 100644
index 000000000 ..92287e499
--- /dev/null
+++ b/evidence/pattn256-chip-20261018T1517Z/sim.log
@@ -0,0 +1,15 @@
+attend: 632 instructions, 172 registers (declared 176, 256 threads -> 45056 of 65536), 12 placeholders
+prep: 330 instructions, 64 registers
+sim one token at position 0 ok bad=0 worst=0.000 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max) (0.0 s)
+sim 8 tokens from 0 (one CTA) ok bad=0 worst=0.286 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max) (0.1 s)
+sim 37 tokens from 0 (odd m, partial CTA) ok bad=0 worst=0.254 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max) (0.9 s)
+sim 19 tokens from 37 (odd start) ok bad=0 worst=0.136 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max) (0.8 s)
+sim 19 tokens from 100, sharp q (x4) ok bad=0 worst=0.088 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max) (0.9 s)
+sim 40 tokens from 250 (crosses 256) ok bad=0 worst=0.059 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max) (3.7 s)
+sim 24 tokens from 0, full rope (rotary 256) ok bad=0 worst=0.292 rows vs decode twin: 0 differ; vs reference: ok (1 one-ulp k flips, worst token 1; 0 small-value k gaps within 8 f32 roundings of the row max) (0.4 s)
+sim prep mutant 1 at 24 tokens from 40: caught (bad=3122843 worst=31.641 rows vs decode twin: 96 differ; vs reference: token 0 k[0] slot 0 chip bf9f ref 3f5c (row max 2.02))
+sim prep mutant 3 at 24 tokens from 40: caught (bad=3135017 worst=95.649 rows vs decode twin: 192 differ; vs reference: token 0 v[0][0] chip 0000 ref 3f41)
+sim attend mutant 1 at 24 tokens from 40: caught (bad=114761 worst=76.729 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max))
+sim attend mutant 2 at 24 tokens from 40: caught (bad=110456 worst=374.128 rows vs decode twin: 0 differ; vs reference: ok (0 one-ulp k flips, worst token 0; 0 small-value k gaps within 8 f32 roundings of the row max))
+sim: 53330976 warp issues in total
+gpu_prefill_attn256_test: 29 checks, 0 failed: PASS
diff --git a/src/.crumb b/src/.crumb
index 529800d7a ..6b955897f 100644
--- a/src/.crumb
+++ b/src/.crumb
@@ -182,14 +182,14 @@
}
],
"children_root": "sha256:15012a017b26a269feb256b64875ece2912f5f82c57804baafa3777c4fcb80b9 ",
- "compiled_at": "2026-10-18T13:06:21Z",
+ "compiled_at": "2026-10-18T15:21:47Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:088de32c7f661acdf7e4c352240dd318dc4d01f510983bc90971ac39e23ca9be ",
+ "digest": "sha256:fbe222132e0f413ae3f4230a7b3389a2c0fcca3a56fe1371eac7406658b21843 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 545,
- "generated_at_commit": "c3ab69f66d6b2a2bce7efe425d80b1306e1140ed ",
- "source_tree": "sha256:b127e0811056ec10f143d76bc46da50d1c6938195e66a34ba717ec7233294f82 "
+ "files": 549,
+ "generated_at_commit": "acdeff745c292cebb3b22cc7ae298409a0b7ee64 ",
+ "source_tree": "sha256:daf12136780bc80d1f4b7a6ee4050a3e32324c1af51d0fd3801ec848dad4eab4 "
},
"owner_lane": "",
"provenance": {
diff --git a/src/omega_blackwell_codegen.c b/src/omega_blackwell_codegen.c
index fdf1d4be0 ..eef76090f 100644
--- a/src/omega_blackwell_codegen.c
+++ b/src/omega_blackwell_codegen.c
@@ -141,10 +141,11 @@ int omega_bw_regalloc_solve(BlackwellIRProgram *prog) {
/*
* Bounded deterministic linear-scan register allocator.
* Computes genuine live intervals across virtual registers and assigns
- * available physical GPRs (R2..R127) and UGPRs (UR4..UR31).
+ * available physical GPRs (R2..R127, or up to the program's opt-in gpr_limit) and UGPRs (UR4..UR31).
* Enforces even-alignment and dual-register reservation for 64-bit pairs.
*/
- bool gpr_busy[BW_PHYS_GPR_MAX];
+ const int gpr_lim = ra->gpr_limit ? (int)ra->gpr_limit : BW_PHYS_GPR_MAX;
+ bool gpr_busy[BW_PHYS_GPR_HW_LIMIT];
memset(gpr_busy, 0, sizeof(gpr_busy));
int max_phys_used = BW_PHYS_GPR_START;
@@ -178,9 +179,9 @@ int omega_bw_regalloc_solve(BlackwellIRProgram *prog) {
for (int p = 0; p < ra->num_vregs; p++) {
if (ra->intervals[p].active && ra->intervals[p].last_use < iv->first_def) {
int freed = ra->intervals[p].phys_reg;
- if (freed >= 0 && freed < BW_PHYS_GPR_MAX) {
+ if (freed >= 0 && freed < gpr_lim) {
uint32_t bsize = ra->intervals[p].bundle_size ? ra->intervals[p].bundle_size : (ra->intervals[p].is_pair ? 2 : (ra->intervals[p].is_quad ? 4 : 1));
- for (uint32_t k = 0; k < bsize && (freed + (int)k) < BW_PHYS_GPR_MAX; k++) {
+ for (uint32_t k = 0; k < bsize && (freed + (int)k) < gpr_lim; k++) {
gpr_busy[freed + k] = false;
}
}
@@ -194,7 +195,7 @@ int omega_bw_regalloc_solve(BlackwellIRProgram *prog) {
if (bsize == 4) {
/* 128-bit quad requires 4-alignment and 4 contiguous free registers */
int start = (BW_PHYS_GPR_START + 3) & ~3;
- for (int p = start; p <= BW_PHYS_GPR_MAX - 4; p += 4) {
+ for (int p = start; p <= gpr_lim - 4; p += 4) {
if (!gpr_busy[p] && !gpr_busy[p + 1] && !gpr_busy[p + 2] && !gpr_busy[p + 3]) {
assigned = p;
for (int k = 0; k < 4; k++) gpr_busy[p + k] = true;
@@ -204,7 +205,7 @@ int omega_bw_regalloc_solve(BlackwellIRProgram *prog) {
} else if (bsize == 2) {
/* 64-bit pair requires even alignment and contiguous free registers */
int start = (BW_PHYS_GPR_START + 1) & ~1;
- for (int p = start; p <= BW_PHYS_GPR_MAX - 2; p += 2) {
+ for (int p = start; p <= gpr_lim - 2; p += 2) {
if (!gpr_busy[p] && !gpr_busy[p + 1]) {
assigned = p;
gpr_busy[p] = true;
@@ -213,7 +214,7 @@ int omega_bw_regalloc_solve(BlackwellIRProgram *prog) {
}
}
} else {
- for (int p = BW_PHYS_GPR_START; p < BW_PHYS_GPR_MAX; p++) {
+ for (int p = BW_PHYS_GPR_START; p < gpr_lim; p++) {
if (!gpr_busy[p]) {
assigned = p;
gpr_busy[p] = true;
@@ -371,12 +372,12 @@ static int encode_single_insn(const BlackwellIRInsn *insn, const OmegaRegAlloc *
w[0] = 0x7c0c | ((uint32_t)(dst & 0xff) << 16) | ((uint32_t)(src1 & 0xff) << 24);
w[1] = (uint32_t)(ureg & 0xff);
w[2] = 0x0bf06070;
- w[3] = 0x002fda00;
+ w[3] = insn->control ? insn->control : 0x002fda00;
} else {
w[0] = 0x780c | ((uint32_t)(dst & 0xff) << 16) | ((uint32_t)(src1 & 0xff) << 24);
w[1] = insn->imm;
w[2] = 0x03f06270;
- w[3] = 0x001fda00;
+ w[3] = insn->control ? insn->control : 0x001fda00;
}
break;
@@ -414,7 +415,7 @@ static int encode_single_insn(const BlackwellIRInsn *insn, const OmegaRegAlloc *
w[0] = 0x7210 | ((uint32_t)(dst & 0xff) << 16) | ((uint32_t)(src1 & 0xff) << 24);
w[1] = (uint32_t)(src2 & 0xff);
w[2] = 0x07ffe0ff;
- w[3] = 0x010fca00;
+ w[3] = insn->control ? insn->control : 0x010fca00; /* omega-mv#545: the emitter's waits, not a fixed SB4 wait */
break;
case BW_IR_HMMA_F16:
@@ -677,7 +678,7 @@ static int encode_single_insn(const BlackwellIRInsn *insn, const OmegaRegAlloc *
w[0] = insn->predicate_p0 ? 0x0000094d : 0x0000794d;
w[1] = 0x00000000;
w[2] = 0x03800000;
- w[3] = 0x000fea00;
+ w[3] = insn->control ? insn->control : 0x000fea00;
break;
case BW_IR_BRA: {
@@ -2545,3 +2546,9 @@ int omega_blackwell_test_codegen_variation(void) {
/* Declared registers: peak + 2 rounded up to 8 (see omega_blackwell_codegen.h for the chip evidence). */
uint32_t omega_bw_gpr_declared(uint32_t peak) { return ((peak + 2u + 7u) / 8u) * 8u; }
int omega_bw_gpr_declared_ok(uint32_t declared, uint32_t peak) { return declared % 8u == 0u && declared >= peak + 2u; }
+
+int omega_bw_ir_set_gpr_limit(BlackwellIRProgram *prog, uint32_t limit) {
+ if (!prog || limit <= BW_PHYS_GPR_MAX || limit > BW_PHYS_GPR_HW_LIMIT) return -1;
+ prog->regalloc.gpr_limit = limit;
+ return 0;
+}
diff --git a/src/omega_blackwell_codegen.h b/src/omega_blackwell_codegen.h
index c59d19938 ..df73aff5e 100644
--- a/src/omega_blackwell_codegen.h
+++ b/src/omega_blackwell_codegen.h
@@ -10,7 +10,11 @@
#define BW_MAX_VREGS 256
#define BW_MAX_UVREGS 32
#define BW_PHYS_GPR_START 2 /* Reserve R0, R1 */
-#define BW_PHYS_GPR_MAX 128
+#define BW_PHYS_GPR_MAX 128 /* default allocation limit (R2..R127); a program may opt into more (omega_bw_ir_set_gpr_limit) */
+/* Highest limit a program may ask for: the chip allows 255 registers per thread and 64K per block (CUDA Programming
+ * Guide, Compute Capabilities appendix: "per thread is 255"); a peak of 246 declares 248 (peak + 2 rounded up to 8).
+ * The launcher must keep threads * declared <= 65536 (omega#545). */
+#define BW_PHYS_GPR_HW_LIMIT 246
#define BW_PHYS_UGPR_START 4 /* Reserve UR0-UR3 */
#define BW_PHYS_UGPR_MAX 32
@@ -163,6 +167,7 @@ typedef struct {
int uvreg_to_phys[BW_MAX_UVREGS];
uint32_t peak_gpr_usage;
uint32_t peak_ugpr_usage;
+ uint32_t gpr_limit; /* 0: BW_PHYS_GPR_MAX; else the exclusive physical limit, <= BW_PHYS_GPR_HW_LIMIT */
} OmegaRegAlloc;
/* IR Program */
@@ -195,6 +200,9 @@ int omega_bw_ir_alloc_uvreg64(BlackwellIRProgram *prog);
/* Solves bounded deterministic live-interval register allocation */
int omega_bw_regalloc_solve(BlackwellIRProgram *prog);
+/* Opt this program into physical registers up to limit - 1 (BW_PHYS_GPR_MAX < limit <= BW_PHYS_GPR_HW_LIMIT); call after
+ * omega_bw_ir_init. Every other program keeps the default, so its allocation is unchanged. 0 ok, -1 out of range. */
+int omega_bw_ir_set_gpr_limit(BlackwellIRProgram *prog, uint32_t limit);
/* Encodes scheduled IR program into 128-bit sm_121 machine code */
int omega_bw_encode_program(const BlackwellIRProgram *prog, uint8_t *code_buf, size_t max_len, size_t *out_len);
diff --git a/src/omega_blackwell_codegen_attn256.c b/src/omega_blackwell_codegen_attn256.c
index 4ba877bf9 ..9d27ff4fc 100644
--- a/src/omega_blackwell_codegen_attn256.c
+++ b/src/omega_blackwell_codegen_attn256.c
@@ -166,7 +166,7 @@ static void rms_scale(Em *e, int qa, int qb, int sq, int ts, int rs, int addr, i
}
int omega_blackwell_codegen_decode_attn256_prog(const OmegaDecodeAttn256Spec *spec, BlackwellIRProgram *prog) {
- if (!spec || !prog || spec->depth < 1 || spec->depth > OMEGA_DATTN256_MAX_DEPTH || spec->mutant < 0 || spec->mutant > 5) return -1;
+ if (!spec || !prog || spec->depth < 1 || spec->depth > OMEGA_DATTN256_MAX_DEPTH || spec->mutant < 0 || spec->mutant > 5 || spec->prep > 1) return -1;
omega_bw_ir_init(prog);
Em em; memset(&em, 0, sizeof em); em.p = prog; Em *e = &em;
const uint32_t D = spec->depth;
@@ -185,6 +185,10 @@ int omega_blackwell_codegen_decode_attn256_prog(const OmegaDecodeAttn256Spec *sp
ldc32(e, kvs, OMEGA_DATTN256_ARG_KV_STRIDE); ldc32(e, eps, OMEGA_DATTN256_ARG_EPS);
ldc32(e, qks, OMEGA_DATTN256_ARG_QK_SCALE);
s2r(e, tid, BW_SR_TID_X); s2r(e, cx, BW_SR_CTAID_X); s2r(e, cy, BW_SR_CTAID_Y);
+ if (spec->prep) { /* prefill prep (#545): CTA cx = token cx at position pos0 + cx, its qkv row */
+ iadd(e, pos, pos, cx);
+ { int rowoff = V(e); if (e->err) return -1; imadi(e, R(rowoff), R(cx), OMEGA_DATTN256_QKV_WORDS * 4u, NOREG); imadw(e, pqkv, rowoff, 1u, pqkv); }
+ }
movi(e, one, 1); movrz(e, R(zero)); movi(e, c7fff, 0x7fffu); movi(e, c16, 16);
shr(e, warp, tid, 5);
andi(e, R(lane), R(tid), 31u);
@@ -262,6 +266,26 @@ int omega_blackwell_codegen_decode_attn256_prog(const OmegaDecodeAttn256Spec *sp
for (unsigned i = 0; i < 4; i++) { fmul(e, S(qa, i), S(qa, i), R(qksw)); fmul(e, S(qb, i), S(qb, i), R(qksw)); }
bar_sync(e); /* every partner read done before q' overwrites the staging */
sts8(e, a0, one, t1, qa, qb); /* warps 6, 7 write scratch inside s[][] */
+ if (spec->prep) {
+ /* q' as bf16 in the attend kernel's A-fragment layout (omega_blackwell_codegen_pattn256.h, OMEGA_PATTN256_QF_*):
+ * word i of lane L (dims 8L+2i, +1) goes to ((((cx>>1)*4 + cy)*6 + warp)*16 + (L>>1))*64 + i*16 + ((L&1)*2 + (cx&1))*4.
+ * Warps 6, 7 (k, v) skip it. */
+ int qw = V128(e), pqf = V64(e), qa64 = V64(e), h0q = V(e), h1q = V(e), tbq = V(e); if (e->err) return -1;
+ isetp_ge_u32(e, f, one);
+ int bq = bra_if_p0_fwd(e);
+ for (unsigned w = 0; w < 4; w++) {
+ int src = w < 2 ? qa : qb; unsigned s0 = (2 * w) % 4;
+ bf16_of(e, h0q, S(src, s0), c7fff, tbq); bf16_of(e, h1q, S(src, s0 + 1), c7fff, tbq); imadi(e, S(qw, w), R(h1q), 65536u, h0q);
+ }
+ ldc64(e, pqf, OMEGA_DATTN256_ARG_OUT);
+ shr(e, t1, cx, 1); imadi(e, R(t1), R(t1), 4u, cy); imadi(e, R(t1), R(t1), 6u, warp);
+ shr(e, t2, lane, 1); imadi(e, R(t1), R(t1), 16u, t2); imadi(e, R(t1), R(t1), 64u, NOREG);
+ andi(e, R(t2), R(lane), 1u); imadi(e, R(t2), R(t2), 2u, NOREG);
+ { int cb = V(e); if (e->err) return -1; andi(e, R(cb), R(cx), 1u); iadd(e, t2, t2, cb); }
+ imadi(e, R(t1), R(t2), 4u, t1);
+ for (unsigned w = 0; w < 4; w++) { imadi(e, R(t2), R(one), 16u * w, t1); imadw(e, qa64, t2, 1u, pqf); stg(e, BW_IR_STG_E, qa64, S(qw, w), udesc); }
+ patch_bra(e, bq, here(e));
+ }
/* ---- the new token's K (warp 6: the rotated k) and V (warp 7: the raw v), bf16 into the cache by the CTA that owns `pos` ---- */
if (MUT != 3) {
@@ -269,7 +293,8 @@ int omega_blackwell_codegen_decode_attn256_prog(const OmegaDecodeAttn256Spec *sp
/* key = (splits - 1 - cx) + 1 - f: zero only for warps 6, 7 of the last split */
imadi(e, R(t2), R(cx), 0xffffffffu, splitsm1);
imadi(e, R(t2), R(one), 1u, t2);
- imadi(e, R(key), R(f), 0xffffffffu, t2);
+ if (spec->prep) imadi(e, R(key), R(f), 0xffffffffu, one); /* prep: every CTA owns its token: key = 1 - f */
+ else imadi(e, R(key), R(f), 0xffffffffu, t2);
isetp_ge_u32(e, key, one);
int b1 = bra_if_p0_fwd(e);
/* cache row address of position pos for this lane: 8 bf16 = 16 bytes per lane; K plane, V plane for warp 7 */
@@ -291,6 +316,11 @@ int omega_blackwell_codegen_decode_attn256_prog(const OmegaDecodeAttn256Spec *sp
patch_bra(e, b1, here(e));
}
membar(e);
+ if (spec->prep) { /* prep ends here: the K/V rows and q' are written */
+ tail(e);
+ if (e->err) return -1;
+ return omega_bw_regalloc_solve(prog);
+ }
bar_sync(e);
/* ---- running state ---- */
diff --git a/src/omega_blackwell_codegen_attn256.h b/src/omega_blackwell_codegen_attn256.h
index 110ef815c ..74988b7a5 100644
--- a/src/omega_blackwell_codegen_attn256.h
+++ b/src/omega_blackwell_codegen_attn256.h
@@ -93,6 +93,11 @@ typedef struct {
int mutant; /* TEST ONLY. 0 none; 1 no RoPE on q and k; 2 V read one position late; 3 the new K/V are not
* written to the cache; 4 the cross-split combine ignores the max (differs only when splits > 1);
* 5 the odd warps' dim half is dropped from the partial (dims 128..255 wrong). */
+ uint32_t prep; /* 1: the prefill prep launch (omega-mv#545): grid (m, 4), CTA (cx, cy) runs this kernel's prologue for
+ * token cx at position ARG_POS + cx (qkv row cx, 32768 bytes per row), writes k_new / v_new into the
+ * cache rows as the decode step does (same instruction sequence, so the same bits), writes q' as bf16
+ * to ARG_OUT in the attend kernel's A-fragment layout (OMEGA_PATTN256_QF_*), and exits. Mutants 1
+ * and 3 apply; ARG_PART, ARG_CNT, ARG_PER_SPLIT, ARG_SPLITS and ARG_OUT_SCALE are not read. */
} OmegaDecodeAttn256Spec;
/* Builds the IR program (register-allocated) into *prog. 0 ok, -1 refused (depth 0 or > 4, mutant outside 0..5,
diff --git a/src/omega_blackwell_codegen_pattn256.c b/src/omega_blackwell_codegen_pattn256.c
new file mode 100644
index 000000000 ..27af1ac10
--- /dev/null
+++ b/src/omega_blackwell_codegen_pattn256.c
@@ -0,0 +1,386 @@
+/*
+ * omega_blackwell_codegen_pattn256.c: causal prefill attention for Qwen3.8-27B on tensor cores, the attend launch
+ * (see the header). The emitter helpers are those of omega_blackwell_codegen_pattn.c, copied unchanged (control words,
+ * the read barrier on every load, held scoreboards 3/4 for prefetch loads, loop live ranges, HMMA spacing: >= 4
+ * independent HMMAs at stall 8 between dependent ones, stall 15 + NOP 14 before a non-HMMA reader of an HMMA result).
+ */
+#include "omega_blackwell_codegen_pattn256.h"
+#include "omega_blackwell_codegen_tc.h"
+#include <string.h>
+
+#define CW(stall, wbar, rbar, wait) \
+ (((uint32_t)(stall) << 9) | ((uint32_t)(wbar) << 14) | ((uint32_t)(rbar) << 17) | ((uint32_t)(wait) << 20))
+#define CW_YIELD 0x2000u
+#define SB_NONE 7u
+#define SB_GPR 0u
+#define SB_RD 1u
+#define SB_UGPR 2u
+#define NOREG (-1)
+#define MAX_LOOPS 4
+
+enum { K_FIXED, K_PRED, K_VAR, K_VAR_MORE, K_UVAR, K_STORE, K_SYNC, K_EXIT, K_BRA, K_BSSY, K_BSYNC };
+
+typedef struct {
+ BlackwellIRProgram *p;
+ uint32_t pending, held;
+ int err;
+ int open_start[MAX_LOOPS];
+ int depth;
+ uint32_t placeholders;
+} Em;
+
+static void emit(Em *e, BlackwellIRInsn in, int kind) {
+ uint32_t wait = e->pending;
+ switch (kind) {
+ case K_FIXED: in.control = CW(6, SB_NONE, SB_NONE, wait); e->pending = 0; break;
+ case K_PRED: in.control = CW(14, SB_NONE, SB_NONE, wait); e->pending = 0; break;
+ case K_VAR: in.control = CW(4, SB_GPR, SB_RD, wait) | CW_YIELD; e->pending = (1u << SB_GPR) | (1u << SB_RD); break;
+ case K_VAR_MORE: in.control = CW(4, SB_GPR, SB_RD, (e->pending & (1u << SB_RD))) | CW_YIELD; e->pending |= (1u << SB_GPR) | (1u << SB_RD); break;
+ case K_UVAR: in.control = CW(4, SB_UGPR, SB_NONE, wait) | CW_YIELD; e->pending = 1u << SB_UGPR; break;
+ case K_STORE: in.control = CW(4, SB_NONE, SB_RD, wait) | CW_YIELD; e->pending = 1u << SB_RD; break;
+ case K_SYNC: in.control = CW(6, SB_NONE, SB_NONE, wait); e->pending = 0; break;
+ case K_EXIT: in.control = CW(5, SB_NONE, SB_NONE, wait); e->pending = in.predicate_p0 ? wait : 0; break;
+ case K_BRA: in.control = CW(5, SB_NONE, SB_NONE, wait); e->pending = in.predicate_p0 ? wait : 0; break;
+ case K_BSSY: in.control = CW(1, SB_NONE, SB_NONE, wait) | CW_YIELD; e->pending = 0; break;
+ case K_BSYNC: in.control = CW(5, SB_NONE, SB_NONE, wait) | CW_YIELD; e->pending = 0; break;
+ default: e->err = -1; return;
+ }
+ if (omega_bw_ir_append(e->p, &in) < 0) e->err = -1;
+}
+
+static BlackwellIRInsn I0(BlackwellIROpcode op) {
+ BlackwellIRInsn i; memset(&i, 0, sizeof i);
+ i.op = op; i.dst_vreg = NOREG; i.src1_vreg = NOREG; i.src2_vreg = NOREG; i.src3_vreg = NOREG; i.ureg = NOREG;
+ return i;
+}
+static int V(Em *e) { int v = omega_bw_ir_alloc_vreg(e->p); if (v < 0) e->err = -1; return v; }
+static int V64(Em *e) { int v = omega_bw_ir_alloc_vreg64(e->p); if (v < 0) e->err = -1; return v; }
+static int V128(Em *e) { int v = omega_bw_ir_alloc_vreg128(e->p); if (v < 0) e->err = -1; return v; }
+static int UV64(Em *e) { int v = omega_bw_ir_alloc_uvreg64(e->p); if (v < 0) e->err = -1; return v; }
+static int here(const Em *e) { return (int)e->p->count; }
+
+typedef struct { int v; unsigned s; } Op;
+static Op R(int v) { Op o = { v, 0 }; return o; }
+static Op S(int v, unsigned s) { Op o = { v, s }; return o; }
+
+static void ldcu64(Em *e, int ud, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDCU64); i.dst_vreg = ud; i.imm = off; i.is_uniform = true; emit(e, i, K_UVAR); }
+static void ldc64(Em *e, int d, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDC64); i.dst_vreg = d; i.imm = off; emit(e, i, K_VAR); }
+static void ldc32(Em *e, int d, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDC); i.dst_vreg = d; i.imm = off; emit(e, i, K_VAR); }
+static void s2r(Em *e, int d, uint32_t sr) { BlackwellIRInsn i = I0(BW_IR_S2R); i.dst_vreg = d; i.imm = sr; emit(e, i, K_VAR); }
+static void movi(Em *e, Op d, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_MOV_IMM); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; i.imm = imm; emit(e, i, K_FIXED); }
+static void movrz(Em *e, Op d) { BlackwellIRInsn i = I0(BW_IR_MOV_RZ); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; emit(e, i, K_FIXED); }
+/* d = a * imm + c */
+static void imadi(Em *e, Op d, Op a, uint32_t imm, int c) { BlackwellIRInsn i = I0(BW_IR_IMAD); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; i.src1_vreg = a.v; i.src1_subreg = (uint8_t)a.s; i.imm = imm; i.src3_vreg = c; emit(e, i, K_FIXED); }
+/* d = a * b + c (registers) */
+static void imadr(Em *e, int d, int a, int b, int c) { BlackwellIRInsn i = I0(BW_IR_IMAD); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; i.src3_vreg = c; emit(e, i, K_FIXED); }
+/* d64 = a * imm + c64 */
+static void imadw(Em *e, int d64, int a, uint32_t imm, int c64) { BlackwellIRInsn i = I0(BW_IR_IMAD_WIDE); i.dst_vreg = d64; i.src1_vreg = a; i.imm = imm; i.src3_vreg = c64; emit(e, i, K_FIXED); }
+static void mov(Em *e, Op d, Op a) { imadi(e, d, a, 1u, NOREG); }
+static void shrs(Em *e, int d, Op a, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_SHF_R); i.dst_vreg = d; i.src1_vreg = a.v; i.src1_subreg = (uint8_t)a.s; i.imm = imm; emit(e, i, K_FIXED); }
+static void shr(Em *e, int d, int a, uint32_t imm) { shrs(e, d, R(a), imm); }
+static void andi(Em *e, Op d, Op a, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_LOP3_AND); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; i.src1_vreg = a.v; i.src1_subreg = (uint8_t)a.s; i.imm = imm; emit(e, i, K_FIXED); }
+static void fop(Em *e, BlackwellIROpcode op, Op d, Op a, Op b, Op c) {
+ BlackwellIRInsn i = I0(op); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; i.src1_vreg = a.v; i.src1_subreg = (uint8_t)a.s;
+ i.src2_vreg = b.v; i.src2_subreg = (uint8_t)b.s; i.src3_vreg = c.v; i.src3_subreg = (uint8_t)c.s; emit(e, i, K_FIXED);
+}
+static void iadd(Em *e, int d, int a, int b) { fop(e, BW_IR_IADD3, R(d), R(a), R(b), R(NOREG)); }
+static void fadd(Em *e, Op d, Op a, Op b) { fop(e, BW_IR_FADD, d, a, b, R(NOREG)); }
+static void fsub(Em *e, Op d, Op a, Op b) { fop(e, BW_IR_FSUB, d, a, b, R(NOREG)); }
+static void fmul(Em *e, Op d, Op a, Op b) { fop(e, BW_IR_FMUL, d, a, b, R(NOREG)); }
+static void fmaxx(Em *e, Op d, Op a, Op b) { fop(e, BW_IR_FMNMX_MAX, d, a, b, R(NOREG)); }
+static void mufu(Em *e, BlackwellIROpcode op, Op d, Op a, int first) { BlackwellIRInsn i = I0(op); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; i.src1_vreg = a.v; i.src1_subreg = (uint8_t)a.s; emit(e, i, first ? K_VAR : K_VAR_MORE); }
+static void ldg_wide(Em *e, BlackwellIROpcode op, int d, int addr64, uint32_t imm, int udesc, int first) {
+ BlackwellIRInsn i = I0(op); i.dst_vreg = d; i.src1_vreg = addr64; i.imm = imm; i.ureg = udesc; emit(e, i, first ? K_VAR : K_VAR_MORE);
+}
+static void stg(Em *e, int addr64, uint32_t imm, Op val, int udesc) { BlackwellIRInsn i = I0(BW_IR_STG_E); i.src1_vreg = addr64; i.imm = imm; i.src2_vreg = val.v; i.src2_subreg = (uint8_t)val.s; i.ureg = udesc; emit(e, i, K_STORE); }
+static void lds128(Em *e, int d128, int addr, uint32_t imm, int first) { BlackwellIRInsn i = I0(BW_IR_LDS128); i.dst_vreg = d128; i.src1_vreg = addr; i.imm = imm; emit(e, i, first ? K_VAR : K_VAR_MORE); }
+static void sts32(Em *e, int addr, Op val) { BlackwellIRInsn i = I0(BW_IR_STS32); i.src1_vreg = addr; i.src2_vreg = val.v; i.src2_subreg = (uint8_t)val.s; emit(e, i, K_STORE); }
+static void bar_sync(Em *e) { emit(e, I0(BW_IR_BAR_SYNC), K_SYNC); }
+static void shfl_down(Em *e, int d, int a, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_SHFL_DOWN); i.dst_vreg = d; i.src1_vreg = a; i.imm = off; emit(e, i, K_VAR); }
+/* SHFL.BFLY placeholder (omega_blackwell_codegen_tc.h), patched after encoding */
+static void shfl_bfly(Em *e, int d, int a, uint32_t lanes) { shfl_down(e, d, a, OMEGA_TC_MARK_BFLY | (lanes & 31u)); e->placeholders++; }
+/* F2FP.BF16.F32.PACK_AB placeholder: d = bf16_rn(hi) << 16 | bf16_rn(lo) */
+static void f2fp(Em *e, Op d, Op hi, Op lo) {
+ BlackwellIRInsn i = I0(BW_IR_FMNMX_MAX); i.dst_vreg = d.v; i.dst_subreg = (uint8_t)d.s; i.src1_vreg = hi.v; i.src1_subreg = (uint8_t)hi.s;
+ i.src2_vreg = lo.v; i.src2_subreg = (uint8_t)lo.s; i.imm = OMEGA_TC_MARK_F2FP; emit(e, i, K_FIXED); e->placeholders++;
+}
+static void isetp_ge_u32(Em *e, int a, int b) { BlackwellIRInsn i = I0(BW_IR_ISETP_GE_U32); i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_PRED); }
+static void bra_if_p0(Em *e, int target) { BlackwellIRInsn i = I0(BW_IR_BRA); i.predicate_p0 = true; i.imm = (uint32_t)(target - here(e)); emit(e, i, K_BRA); }
+static int bra_if_p0_fwd(Em *e) { int at = here(e); BlackwellIRInsn i = I0(BW_IR_BRA); i.predicate_p0 = true; i.imm = 1; emit(e, i, K_BRA); return at; }
+static void patch_bra(Em *e, int at, int target) { if (!e->err) e->p->insns[at].imm = (uint32_t)(target - at); }
+static int bssy_fwd(Em *e) { int at = here(e); BlackwellIRInsn i = I0(BW_IR_BSSY); i.bar_reg = 0; i.imm = 2; emit(e, i, K_BSSY); return at; }
+static void bsync(Em *e) { BlackwellIRInsn i = I0(BW_IR_BSYNC); i.bar_reg = 0; emit(e, i, K_BSYNC); }
+static void tail(Em *e) {
+ emit(e, I0(BW_IR_EXIT), K_EXIT);
+ BlackwellIRInsn self = I0(BW_IR_BRA);
+ self.control = 0x000fc000u;
+ if (omega_bw_ir_append(e->p, &self) < 0) e->err = -1;
+}
+static void loop_begin(Em *e) { if (e->depth >= MAX_LOOPS) { e->err = -1; return; } e->open_start[e->depth++] = here(e); }
+static void loop_end(Em *e) {
+ if (e->depth <= 0) { e->err = -1; return; }
+ int start = e->open_start[--e->depth], end = here(e) - 1;
+ OmegaRegAlloc *ra = &e->p->regalloc;
+ for (int v = 0; v < ra->num_vregs; v++) {
+ OmegaLiveInterval *iv = &ra->intervals[v];
+ if (iv->first_def >= 0 && iv->first_def < start && iv->last_use >= start && iv->last_use < end) iv->last_use = end;
+ }
+}
+typedef struct { int bssy, bra; } Region;
+static Region region_skip_if_p0(Em *e) { Region r; r.bssy = bssy_fwd(e); r.bra = bra_if_p0_fwd(e); return r; }
+static void region_end(Em *e, Region r) { int at = here(e); bsync(e); patch_bra(e, r.bra, at); patch_bra(e, r.bssy, at + 1); }
+
+/* HMMA.16816.F32.BF16 d = a * b + c; b is the register pair at b + bsub (0 or 2); c NOREG = RZ */
+static void hmma(Em *e, int d, int a, int b, unsigned bsub, int c, uint32_t stall) {
+ BlackwellIRInsn i = I0(BW_IR_HMMA_BF16); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; i.src2_subreg = (uint8_t)bsub; i.src3_vreg = c;
+ i.control = CW(stall, SB_NONE, SB_NONE, e->pending); e->pending = 0;
+ if (omega_bw_ir_append(e->p, &i) < 0) e->err = -1;
+}
+static void nop(Em *e, uint32_t stall) {
+ BlackwellIRInsn i = I0(BW_IR_NOP); i.control = CW(stall, SB_NONE, SB_NONE, e->pending); e->pending = 0;
+ if (omega_bw_ir_append(e->p, &i) < 0) e->err = -1;
+}
+/* a prefetch LDS.128: scoreboard sb (3 or 4) is held, not waited for, until consume() */
+static void lds_pf(Em *e, int d, int addr, uint32_t imm, unsigned sb) {
+ BlackwellIRInsn in = I0(BW_IR_LDS128); in.dst_vreg = d; in.src1_vreg = addr; in.imm = imm;
+ in.control = CW(4, sb, SB_RD, (e->pending & (1u << SB_RD))) | CW_YIELD;
+ e->pending |= 1u << SB_RD; e->held |= 1u << sb;
+ if (omega_bw_ir_append(e->p, &in) < 0) e->err = -1;
+}
+static void consume(Em *e, unsigned sb) { e->pending |= e->held & (1u << sb); e->held &= ~(1u << sb); }
+
+
+/* shared memory map */
+#define SM_K 0u /* K block, [s 16][lane 32][16 B]: lane (g, t) holds b0, b1 of key g and of key 8 + g */
+#define SM_V 8192u /* V block, [np 16][lane 32][16 B]: b0, b1 of dim tiles 2np and 2np + 1 */
+static const uint32_t NEG_BIG = 0xF149F2CAu; /* -1e30f */
+
+int omega_pattn256_spec_ok(const OmegaPrefillAttn256Spec *s) { return s && s->mutant >= 0 && s->mutant <= 2; }
+
+int omega_blackwell_codegen_prefill_attn256_prog(const OmegaPrefillAttn256Spec *spec, BlackwellIRProgram *prog) {
+ if (!omega_pattn256_spec_ok(spec) || !prog) return -1;
+ omega_bw_ir_init(prog);
+ if (omega_bw_ir_set_gpr_limit(prog, BW_PHYS_GPR_HW_LIMIT) != 0) return -1;
+ Em em; memset(&em, 0, sizeof em); em.p = prog; Em *e = &em;
+ const int MUT = spec->mutant;
+
+ /* ---- arguments and identities ---- */
+ int udesc = UV64(e);
+ int pqf = V64(e), pkc = V64(e), pvc = V64(e);
+ int pos0 = V(e), mc = V(e), kvs = V(e);
+ int tid = V(e), cx = V(e), cy = V(e), warp = V(e), lane = V(e), one = V(e), zero = V(e);
+ int cyk = V(e), nk = V(e), t1 = V(e), t2 = V(e), cxw = V(e), cnt = V(e);
+ if (e->err) return -1;
+ ldcu64(e, udesc, 0x358);
+ ldc64(e, pqf, OMEGA_PATTN256_ARG_QF); ldc64(e, pkc, OMEGA_PATTN256_ARG_KC); ldc64(e, pvc, OMEGA_PATTN256_ARG_VC);
+ ldc32(e, pos0, OMEGA_PATTN256_ARG_POS0); ldc32(e, mc, OMEGA_PATTN256_ARG_MC); ldc32(e, kvs, OMEGA_PATTN256_ARG_KV_STRIDE);
+ s2r(e, tid, BW_SR_TID_X); s2r(e, cx, BW_SR_CTAID_X); s2r(e, cy, BW_SR_CTAID_Y);
+ movi(e, R(one), 1); movrz(e, R(zero));
+ shr(e, warp, tid, 5);
+ andi(e, R(lane), R(tid), 31u);
+ imadr(e, cyk, cy, kvs, NOREG); /* byte offset of this KV head's plane */
+ imadi(e, R(cxw), R(cx), OMEGA_PATTN256_TOKENS, NOREG); /* first chunk token of the CTA */
+ /* nk = min(cxw + 8, mc) = hi + over * (mc - hi), over = 1 when hi > mc */
+ imadi(e, R(t2), R(one), OMEGA_PATTN256_TOKENS, cxw); /* hi */
+ imadi(e, R(t1), R(t2), 0xffffffffu, mc); /* mc - hi */
+ { int ov = V(e); if (e->err) return -1;
+ shr(e, ov, t1, 31); imadr(e, nk, ov, t1, t2); }
+
+ /* ---- Q: the tile's 16 A fragments straight from QF (16 LDG.128 from one address) ---- */
+ int q[16];
+ for (unsigned s = 0; s < 16; s++) q[s] = V128(e);
+ int tokA = V(e), dqa = V(e);
+ if (e->err) return -1;
+ {
+ int g = V(e), hg = V(e), tp = V(e), tpm = V(e), c5 = V(e), ad64 = V64(e); if (e->err) return -1;
+ shr(e, g, lane, 2);
+ movi(e, R(c5), 5u);
+ imadi(e, R(t1), R(g), 0xffffffffu, c5); /* 5 - g */
+ shr(e, t2, t1, 31); /* 1 when g > 5 */
+ imadr(e, hg, t2, t1, g); /* min(g, 5) */
+ shr(e, t1, warp, 1);
+ imadi(e, R(tokA), R(t1), 2u, cxw); /* the tile's first chunk token */
+ shr(e, tp, tokA, 1);
+ /* token pair clamped to the last written one: tpm = (mc - 1) >> 1; tp = min(tp, tpm) */
+ imadi(e, R(tpm), R(one), 0xffffffffu, mc); shr(e, tpm, tpm, 1);
+ imadi(e, R(t1), R(tp), 0xffffffffu, tpm); /* tpm - tp */
+ shr(e, t2, t1, 31); imadr(e, tp, t2, t1, tp);
+ imadi(e, R(t1), R(tp), 4u, cy); imadi(e, R(t1), R(t1), 6u, hg); imadi(e, R(t1), R(t1), 1024u, NOREG);
+ andi(e, R(t2), R(lane), 3u); imadi(e, R(t1), R(t2), 16u, t1);
+ imadw(e, ad64, t1, 1u, pqf);
+ for (unsigned s = 0; s < 16; s++) ldg_wide(e, BW_IR_LDG_E_128, q[s], ad64, s * 64u, udesc, s == 0);
+ iadd(e, dqa, pos0, tokA); /* row-A position - kb (kb = 0) */
+ }
+
+ /* ---- main loop state ---- */
+ int o[16], sc[4], kf[2], pp, vf[4];
+ for (unsigned i = 0; i < 16; i++) o[i] = V128(e);
+ int mA = V(e), mB = V(e), lA = V(e), lB = V(e), gK = V64(e), gV = V64(e), sKb = V(e), sVb = V(e);
+ int lane16 = V(e), vfb = V(e), negc = V(e);
+ if (e->err) return -1;
+ {
+ int ka = V(e), c = V(e), tq = V(e); if (e->err) return -1;
+ /* blocks: kend = pos0 + nk - 1; nblk = kend / 16 + 1 */
+ iadd(e, t1, pos0, nk); imadi(e, R(t1), R(one), 0xffffffffu, t1); shr(e, t1, t1, 4); imadi(e, R(cnt), R(one), 1u, t1);
+ shr(e, ka, tid, 5); andi(e, R(c), R(tid), 31u);
+ /* staging pointers: K units (key ka + 8i, chunk c), V unit (keys 2ka, 2ka + 1, chunk c) */
+ imadi(e, R(t1), R(c), 16u, NOREG);
+ imadw(e, gK, cyk, 1u, pkc); imadw(e, gK, ka, 512u, gK); imadw(e, gK, t1, 1u, gK);
+ imadw(e, gV, cyk, 1u, pvc); imadw(e, gV, ka, 1024u, gV); imadw(e, gV, t1, 1u, gV);
+ /* sKb = (c>>1)*512 + ka*64 + (c&1)*4 (+ t'*16 for word t', + i*8 for key ka + 8i) */
+ shr(e, t1, c, 1); imadi(e, R(sKb), R(t1), 512u, NOREG);
+ imadi(e, R(sKb), R(ka), 64u, sKb);
+ andi(e, R(t2), R(c), 1u); imadi(e, R(sKb), R(t2), 4u, sKb);
+ /* sVb = SM_V + (c>>1)*512 + (ka&3)*16 + ((c&1)*2 + (ka>>2))*4 (+ j*64 for dim 8c + j) */
+ shr(e, t1, c, 1); imadi(e, R(sVb), R(t1), 512u, NOREG);
+ andi(e, R(t1), R(ka), 3u); imadi(e, R(sVb), R(t1), 16u, sVb);
+ shr(e, tq, ka, 2); imadi(e, R(t1), R(t2), 2u, tq); imadi(e, R(sVb), R(t1), 4u, sVb);
+ imadi(e, R(sVb), R(one), SM_V, sVb);
+ imadi(e, R(lane16), R(lane), 16u, NOREG);
+ andi(e, R(t1), R(warp), 1u); imadi(e, R(vfb), R(t1), 4096u, lane16); imadi(e, R(vfb), R(one), SM_V, vfb);
+ }
+ for (unsigned i = 0; i < 16; i++) for (unsigned k = 0; k < 4; k++) movrz(e, S(o[i], k));
+ movi(e, R(negc), NEG_BIG); mov(e, R(mA), R(negc)); mov(e, R(mB), R(negc)); movrz(e, R(lA)); movrz(e, R(lB));
+
+ int kq4[2], va4 = V128(e), vb4 = V128(e);
+ for (unsigned i = 0; i < 2; i++) kq4[i] = V128(e);
+ int ev = V(e), od = V(e), sa = V(e), mxA = V(e), mxB = V(e), alA = V(e), alB = V(e), sh = V(e);
+ for (unsigned j = 0; j < 4; j++) sc[j] = V128(e);
+ kf[0] = V128(e); kf[1] = V128(e); pp = V128(e);
+ for (unsigned i = 0; i < 4; i++) vf[i] = V128(e);
+ if (e->err) return -1;
+
+ const int L_m = here(e);
+ loop_begin(e);
+ bar_sync(e); /* every warp is done with the previous block */
+ /* ---- stage the block ---- */
+ ldg_wide(e, BW_IR_LDG_E_128, kq4[0], gK, 0, udesc, 1);
+ ldg_wide(e, BW_IR_LDG_E_128, kq4[1], gK, 8u * 512u, udesc, 0);
+ ldg_wide(e, BW_IR_LDG_E_128, va4, gV, 0, udesc, 0);
+ ldg_wide(e, BW_IR_LDG_E_128, vb4, gV, 512u, udesc, 0);
+ for (unsigned i = 0; i < 2; i++) for (unsigned k = 0; k < 4; k++) { imadi(e, R(sa), R(one), i * 8u + 16u * k, sKb); sts32(e, sa, S(kq4[i], k)); }
+ for (unsigned k = 0; k < 4; k++) {
+ andi(e, R(t1), S(va4, k), 0xffffu); imadi(e, R(ev), S(vb4, k), 65536u, t1);
+ shrs(e, t1, S(va4, k), 16); andi(e, R(t2), S(vb4, k), 0xffff0000u); iadd(e, od, t1, t2);
+ imadi(e, R(sa), R(one), (2u * k) * 64u, sVb); sts32(e, sa, R(ev));
+ imadi(e, R(sa), R(one), (2u * k + 1u) * 64u, sVb); sts32(e, sa, R(od));
+ }
+ bar_sync(e);
+
+ /* ---- S = Q K^T: 16 k-steps x 2 key tiles, even / odd k-steps into separate accumulators, K fragments
+ * double-buffered on scoreboards 3/4 ---- */
+ lds_pf(e, kf[0], lane16, SM_K, 3);
+ consume(e, 3);
+ for (unsigned s = 0; s < 16; s++) {
+ const unsigned cur = s & 1u, nx = cur ^ 1u, sbn = 3u + nx, a = (s & 1u) * 2u;
+ if (s < 15) lds_pf(e, kf[nx], lane16, SM_K + (s + 1u) * 512u, sbn);
+ hmma(e, sc[a], q[s], kf[cur], 0, s >= 2 ? sc[a] : NOREG, 8);
+ hmma(e, sc[a + 1], q[s], kf[cur], 2, s >= 2 ? sc[a + 1] : NOREG, 8);
+ if (s < 15) consume(e, sbn);
+ }
+ nop(e, 15); nop(e, 14);
+ for (unsigned k = 0; k < 4; k++) { fadd(e, S(sc[0], k), S(sc[0], k), S(sc[2], k)); fadd(e, S(sc[1], k), S(sc[1], k), S(sc[3], k)); }
+
+ /* ---- causal mask: key kb + 8j + 2t + (k&1) > row position (row A for k < 2, A + 1 for k >= 2) ---- */
+ if (MUT != 1) {
+ imadi(e, R(t1), R(one), 0xfffffff1u, dqa); shr(e, t1, t1, 31); /* 1 when kb + 15 > row-A position */
+ isetp_ge_u32(e, zero, t1);
+ const int b = bra_if_p0_fwd(e);
+ int dql = V(e); if (e->err) return -1;
+ shr(e, t2, lane16, 3); andi(e, R(t2), R(t2), 6u); imadi(e, R(dql), R(t2), 0xffffffffu, dqa); /* dqa - 2t */
+ for (unsigned j = 0; j < 2; j++) for (unsigned k = 0; k < 4; k++) {
+ int32_t cst = (k >= 2 ? 1 : 0) - 8 * (int32_t)j - (int32_t)(k & 1u);
+ imadi(e, R(t1), R(one), (uint32_t)cst, dql); shr(e, t1, t1, 31); imadi(e, R(t1), R(t1), NEG_BIG, NOREG);
+ fadd(e, S(sc[j], k), S(sc[j], k), R(t1));
+ }
+ patch_bra(e, b, here(e));
+ }
+
+ /* ---- online softmax (log2 units) ---- */
+ fmaxx(e, R(mxA), S(sc[0], 0), S(sc[0], 1)); fmaxx(e, R(mxB), S(sc[0], 2), S(sc[0], 3));
+ fmaxx(e, R(mxA), R(mxA), S(sc[1], 0)); fmaxx(e, R(mxA), R(mxA), S(sc[1], 1));
+ fmaxx(e, R(mxB), R(mxB), S(sc[1], 2)); fmaxx(e, R(mxB), R(mxB), S(sc[1], 3));
+ shfl_bfly(e, sh, mxA, 1); fmaxx(e, R(mxA), R(mxA), R(sh)); shfl_bfly(e, sh, mxA, 2); fmaxx(e, R(mxA), R(mxA), R(sh));
+ shfl_bfly(e, sh, mxB, 1); fmaxx(e, R(mxB), R(mxB), R(sh)); shfl_bfly(e, sh, mxB, 2); fmaxx(e, R(mxB), R(mxB), R(sh));
+ fmaxx(e, R(mxA), R(mxA), R(mA)); fmaxx(e, R(mxB), R(mxB), R(mB));
+ fsub(e, R(alA), R(mA), R(mxA)); fsub(e, R(alB), R(mB), R(mxB));
+ mov(e, R(mA), R(mxA)); mov(e, R(mB), R(mxB));
+ for (unsigned j = 0; j < 2; j++) for (unsigned k = 0; k < 4; k++) fsub(e, S(sc[j], k), S(sc[j], k), R(k < 2 ? mA : mB));
+ mufu(e, BW_IR_MUFU_EX2, R(alA), R(alA), 1); mufu(e, BW_IR_MUFU_EX2, R(alB), R(alB), 0);
+ for (unsigned j = 0; j < 2; j++) for (unsigned k = 0; k < 4; k++) mufu(e, BW_IR_MUFU_EX2, S(sc[j], k), S(sc[j], k), 0);
+ fmul(e, R(lA), R(lA), R(alA)); fmul(e, R(lB), R(lB), R(alB));
+ for (unsigned j = 0; j < 2; j++) for (unsigned k = 0; k < 4; k++) fadd(e, R(k < 2 ? lA : lB), R(k < 2 ? lA : lB), S(sc[j], k));
+ if (MUT != 2) for (unsigned i = 0; i < 16; i++) for (unsigned k = 0; k < 4; k++) fmul(e, S(o[i], k), S(o[i], k), R(k < 2 ? alA : alB));
+ f2fp(e, S(pp, 0), S(sc[0], 1), S(sc[0], 0)); f2fp(e, S(pp, 1), S(sc[0], 3), S(sc[0], 2));
+ f2fp(e, S(pp, 2), S(sc[1], 1), S(sc[1], 0)); f2fp(e, S(pp, 3), S(sc[1], 3), S(sc[1], 2));
+
+ /* ---- O += P V: one k-step (16 keys) x 16 dim tiles of this warp's 128 dims, in two rounds of 4 fragments ---- */
+ for (unsigned r = 0; r < 2; r++) {
+ for (unsigned np = 0; np < 4; np++) lds128(e, vf[np], vfb, (r * 4u + np) * 512u, np == 0);
+ for (unsigned np = 0; np < 4; np++) {
+ const unsigned n = 2u * (4u * r + np);
+ hmma(e, o[n], pp, vf[np], 0, o[n], 8); hmma(e, o[n + 1], pp, vf[np], 2, o[n + 1], 8);
+ }
+ }
+ imadw(e, gK, one, 16u * 512u, gK); imadw(e, gV, one, 16u * 512u, gV);
+ imadi(e, R(dqa), R(one), 0xfffffff0u, dqa);
+ imadi(e, R(cnt), R(one), 0xffffffffu, cnt);
+ isetp_ge_u32(e, cnt, one);
+ bra_if_p0(e, L_m);
+ loop_end(e);
+
+ /* ---- epilogue: rows g < 6 (a lane-divergent region), tokens < mc (warp-uniform) ---- */
+ nop(e, 15); nop(e, 14);
+ {
+ int pout = V64(e), osc = V(e), po = V64(e), g = V(e), tq = V(e), etid = V(e), ecx = V(e), ecy = V(e), emc = V(e), ewarp = V(e), elane = V(e), etok = V(e), c6 = V(e);
+ if (e->err) return -1;
+ ldc64(e, pout, OMEGA_PATTN256_ARG_OUT); ldc32(e, osc, OMEGA_PATTN256_ARG_OUT_SCALE); ldc32(e, emc, OMEGA_PATTN256_ARG_MC);
+ s2r(e, etid, BW_SR_TID_X); s2r(e, ecx, BW_SR_CTAID_X); s2r(e, ecy, BW_SR_CTAID_Y);
+ shr(e, ewarp, etid, 5); andi(e, R(elane), R(etid), 31u);
+ shr(e, t1, ewarp, 1); imadi(e, R(t1), R(t1), 2u, NOREG); imadi(e, R(etok), R(ecx), OMEGA_PATTN256_TOKENS, t1);
+ shfl_bfly(e, sh, lA, 1); fadd(e, R(lA), R(lA), R(sh)); shfl_bfly(e, sh, lA, 2); fadd(e, R(lA), R(lA), R(sh));
+ shfl_bfly(e, sh, lB, 1); fadd(e, R(lB), R(lB), R(sh)); shfl_bfly(e, sh, lB, 2); fadd(e, R(lB), R(lB), R(sh));
+ mufu(e, BW_IR_MUFU_RCP, R(lA), R(lA), 1); mufu(e, BW_IR_MUFU_RCP, R(lB), R(lB), 0);
+ fmul(e, R(lA), R(lA), R(osc)); fmul(e, R(lB), R(lB), R(osc));
+ for (unsigned i = 0; i < 16; i++) for (unsigned k = 0; k < 4; k++) fmul(e, S(o[i], k), S(o[i], k), R(k < 2 ? lA : lB));
+ /* out + ((etok*24 + cy*6 + g)*256 + (warp&1)*128 + 2t)*4 */
+ shr(e, g, elane, 2); andi(e, R(tq), R(elane), 3u);
+ imadi(e, R(t1), R(etok), 24u, NOREG); imadi(e, R(t1), R(ecy), 6u, t1); iadd(e, t1, t1, g); imadi(e, R(t1), R(t1), 1024u, NOREG);
+ andi(e, R(t2), R(ewarp), 1u); imadi(e, R(t1), R(t2), 512u, t1); imadi(e, R(t1), R(tq), 8u, t1);
+ imadw(e, po, t1, 1u, pout);
+ movi(e, R(c6), 6u);
+ isetp_ge_u32(e, g, c6);
+ Region rg = region_skip_if_p0(e);
+ for (unsigned row = 0; row < 2; row++) {
+ imadi(e, R(t1), R(one), row, etok);
+ isetp_ge_u32(e, t1, emc);
+ const int b = bra_if_p0_fwd(e);
+ for (unsigned i = 0; i < 16; i++) {
+ const uint32_t off = row * OMEGA_PATTN256_OUT_WORDS * 4u + i * 32u;
+ stg(e, po, off, S(o[i], 2 * row), udesc); stg(e, po, off + 4u, S(o[i], 2 * row + 1), udesc);
+ }
+ patch_bra(e, b, here(e));
+ }
+ region_end(e, rg);
+ }
+ tail(e);
+ if (e->err) return -1;
+ if (omega_bw_regalloc_solve(prog) != 0) return -1;
+ return 0;
+}
+
+int omega_prefill_attn256_prog_stats(const OmegaPrefillAttn256Spec *spec, uint32_t *insns, uint32_t *gprs, uint32_t *placeholders) {
+ static BlackwellIRProgram p;
+ if (omega_blackwell_codegen_prefill_attn256_prog(spec, &p) != 0) return -1;
+ if (insns) *insns = (uint32_t)p.count;
+ if (gprs) *gprs = p.regalloc.peak_gpr_usage;
+ if (placeholders) {
+ uint32_t n = 0;
+ for (size_t i = 0; i < p.count; i++) {
+ const BlackwellIRInsn *in = &p.insns[i];
+ if ((in->op == BW_IR_SHFL_DOWN && (in->imm & OMEGA_TC_MARK_BFLY)) || (in->op == BW_IR_FMNMX_MAX && in->imm == OMEGA_TC_MARK_F2FP)) n++;
+ }
+ *placeholders = n;
+ }
+ return 0;
+}
diff --git a/src/omega_blackwell_codegen_pattn256.h b/src/omega_blackwell_codegen_pattn256.h
new file mode 100644
index 000000000 ..82e2a6e81
--- /dev/null
+++ b/src/omega_blackwell_codegen_pattn256.h
@@ -0,0 +1,69 @@
+#ifndef OMEGA_BLACKWELL_CODEGEN_PATTN256_H
+#define OMEGA_BLACKWELL_CODEGEN_PATTN256_H
+/*
+ * omega_blackwell_codegen_pattn256: causal prefill attention for Qwen3.8-27B on tensor cores (omega-mv#545,
+ * 2026-10-18): head_dim 256, 24 query heads over 4 KV heads (6 per KV head), the decode attention's cache
+ * (omega_gpu_decode_attn256_api.h). A derivative of omega_blackwell_codegen_pattn.h (the 30B's head_dim 128 kernel,
+ * untouched). Two launches per call (omega_gpu_prefill_attn256_api.h):
+ *
+ * prep the decode kernel's prologue in prep mode (OmegaDecodeAttn256Spec.prep): per token, q' = RoPE(RMSNorm(q)
+ * * q_norm) * qk_scale as bf16 into the QF buffer below, and k_new / v_new into the cache rows with the
+ * decode step's own instruction sequence (so the rows a prompt leaves are the rows m decode steps leave).
+ * attend this kernel: grid (ceil(m / 8), 4), 8 warps. CTA (cx, cy) serves KV head cy and the chunk tokens
+ * cx*8 .. cx*8+7. Row tile = 16 rows: row g (0..7) = token 2*tile, head cy*6 + min(g, 5); row g + 8 = the
+ * next token, same head (rows 6, 7 repeat head 5 and are never stored: a quarter of the tensor-core work of
+ * this first cut is spent on them). Warp w: tile w >> 1, output dims 128*(w & 1) .. +127. Both warps of a
+ * tile compute its scores (16 k-steps; Q's 16 A fragments = 64 registers, loaded once).
+ * Main loop over key blocks of 16 (kb = 0, 16, .. <= kend = pos0 + nk - 1, nk = min(cx*8 + 8, m)): stage
+ * K (fragment-major, B of S = Q K^T) and V (transposed pairs, B of O = P V) of the block in shared memory
+ * (8 KiB each), S = Q K^T (HMMA.16816.F32.BF16, four accumulators), causal mask (key > row position:
+ * s += -1e30, skipped when the whole block is at or below the tile's first token), online softmax in log2
+ * units (EX2), O rescaled by alpha = EX2(m_old - m_new), P packed to bf16 (F2FP), O += P V.
+ * Epilogue: l summed over the quad, out = O * RCP(l) * out_scale for rows g < 6 and tokens < m.
+ *
+ * Keys past kend in the last block are read from the cache (rows the prompt has not reached) and masked; the cache
+ * is zero at allocation and only ever holds finite K/V rows, so 0 * row stays 0 in P V.
+ * Registers: the program opts into BW_PHYS_GPR_HW_LIMIT (omega_bw_ir_set_gpr_limit); 256 threads x the declared
+ * count must stay <= 65536 (the launcher checks). Shared memory: 16 KiB, the QMD cap.
+ * The host simulator (tests/bw_warp_sim_pa.h) runs both launches; a simulator pass is never a chip result.
+ */
+#include "omega_blackwell_codegen.h"
+#include <stdint.h>
+
+#define OMEGA_PATTN256_WARPS 8u
+#define OMEGA_PATTN256_THREADS 256u
+#define OMEGA_PATTN256_TOKENS 8u /* tokens per CTA */
+#define OMEGA_PATTN256_KEYS 16u /* keys per main-loop block */
+#define OMEGA_PATTN256_SHARED_BYTES 16384u /* K block 8 KiB + V block 8 KiB (the QMD cap) */
+#define OMEGA_PATTN256_OUT_WORDS 6144u /* f32 per token row of the output (24 heads x 256) */
+
+/* QF: q' bf16 in A-fragment order. For token pair tp = tok >> 1, KV head c, head g of the group (0..5), k-step s
+ * (dims 16s .. 16s+15) and quad lane t (0..3), 16 bytes at QF_OFF(tp, c, g, s, t) hold the four A registers
+ * {a0, a1, a2, a3} = {(tok 2tp, dims 16s+2t, +1), (tok 2tp+1, same), (tok 2tp, dims 16s+8+2t, +1), (tok 2tp+1, same)},
+ * each register = bf16 of the lower dim in the low half. */
+#define OMEGA_PATTN256_QF_PAIR_BYTES 24576u /* one token pair, all 4 KV heads */
+#define OMEGA_PATTN256_QF_OFF(tp, c, g, s, t) \
+ ((((((uint64_t)(tp) * 4u + (c)) * 6u + (g)) * 16u + (s)) * 4u + (t)) * 16u)
+
+/* constant bank 0 at 0x380 */
+#define OMEGA_PATTN256_ARG_QF 0x380u /* bf16 QF, ceil(m / 2) token pairs */
+#define OMEGA_PATTN256_ARG_KC 0x388u /* bf16 K plane base of the layer [kv_head][max_pos][256] */
+#define OMEGA_PATTN256_ARG_VC 0x390u /* bf16 V plane base */
+#define OMEGA_PATTN256_ARG_OUT 0x398u /* f32 [m][6144] (token-major, head h at h * 256, model dim order) */
+#define OMEGA_PATTN256_ARG_POS0 0x3a0u /* u32 position of chunk token 0 */
+#define OMEGA_PATTN256_ARG_MC 0x3a4u /* u32 tokens, >= 1 */
+#define OMEGA_PATTN256_ARG_KV_STRIDE 0x3a8u /* u32 bytes per KV head plane (max_pos * 512) */
+#define OMEGA_PATTN256_ARG_OUT_SCALE 0x3acu /* f32 */
+#define OMEGA_PATTN256_ARGS_WORDS 12u
+
+typedef struct {
+ int mutant; /* TEST ONLY. 0 none; 1 no causal mask; 2 O is never rescaled by alpha. Each must be caught. */
+} OmegaPrefillAttn256Spec;
+
+int omega_pattn256_spec_ok(const OmegaPrefillAttn256Spec *spec);
+/* Builds the register-allocated IR program. 0 ok, -1 refused or over BW_MAX_IR_INSNS / BW_MAX_VREGS / the registers. */
+int omega_blackwell_codegen_prefill_attn256_prog(const OmegaPrefillAttn256Spec *spec, BlackwellIRProgram *prog);
+/* Instruction, peak-register and placeholder counts (host, no device). */
+int omega_prefill_attn256_prog_stats(const OmegaPrefillAttn256Spec *spec, uint32_t *insns, uint32_t *gprs, uint32_t *placeholders);
+
+#endif
diff --git a/src/omega_gpu_prefill_attn256_api.c b/src/omega_gpu_prefill_attn256_api.c
new file mode 100644
index 000000000 ..b7ab6aa89
--- /dev/null
+++ b/src/omega_gpu_prefill_attn256_api.c
@@ -0,0 +1,233 @@
+/*
+ * omega_gpu_prefill_attn256_api.c: the two launches of the head_dim 256 prefill attention (omega-mv#545; see the
+ * header). The prep kernel is the decode kernel's own program in prep mode (omega_blackwell_codegen_attn256.h), the
+ * attend kernel is omega_blackwell_codegen_pattn256.h; it uses the SHFL.BFLY / F2FP placeholders of
+ * omega_blackwell_codegen_tc.h, so its code is patched after encoding and the patch count must equal the program's
+ * placeholder count. Session use mirrors omega_gpu_prefill_attn_api.c.
+ */
+#include "omega_gpu_prefill_attn256_api.h"
+#include "omega_blackwell_codegen_tc.h"
+#include "omega_gpu_session.h"
+#include "omega_gpu_cmdlist.h"
+#include <string.h>
+
+#define MARKER_TIMEOUT_MS 60000ull
+#define POISON_F32 (-999.0f)
+#define QKVW OMEGA_DATTN256_QKV_WORDS
+#define OUTW OMEGA_PATTN256_OUT_WORDS
+enum { KK_PREP, KK_ATTEND, KK_N };
+
+typedef struct {
+ bool valid;
+ union { OmegaDecodeAttn256Spec prep; OmegaPrefillAttn256Spec att; } spec;
+ OmegaBlackwellKernel kernel;
+ OmegaGpuMem code;
+ uint32_t insns;
+} Slot;
+
+static struct {
+ bool hooked;
+ Slot slot[KK_N];
+ int prep_mut, att_mut;
+ OmegaGpuMem qf; uint32_t qf_rows; bool have_qf; /* q' scratch for qf_rows tokens */
+ OmegaGpuMem qkv, out; uint32_t buf_rows; bool have_bufs; /* host-entry staging */
+} g;
+
+static void bufs_forget(void) { g.have_qf = false; g.qf_rows = 0; g.have_bufs = false; g.buf_rows = 0; }
+static void on_session_close(void) { memset(g.slot, 0, sizeof g.slot); bufs_forget(); }
+static OmegaGpuSession *dev_open_locked(void) {
+ if (!g.hooked) { (void)omega_gpu_session_on_close(on_session_close); g.hooked = true; }
+ return omega_gpu_session_open();
+}
+static void slots_clear_locked(void) {
+ for (unsigned k = 0; k < KK_N; k++) { if (g.slot[k].valid) omega_gpu_session_free(&g.slot[k].code); memset(&g.slot[k], 0, sizeof g.slot[k]); }
+}
+void omega_gpu_prefill_attn256_test_set_mutant(int prep_mutant, int attend_mutant) {
+ omega_gpu_session_lock(); g.prep_mut = prep_mutant; g.att_mut = attend_mutant; slots_clear_locked(); omega_gpu_session_unlock();
+}
+void omega_gpu_prefill_attn256_release(void) {
+ omega_gpu_session_lock();
+ if (g.have_qf) omega_gpu_session_free(&g.qf);
+ if (g.have_bufs) { omega_gpu_session_free(&g.qkv); omega_gpu_session_free(&g.out); }
+ bufs_forget();
+ omega_gpu_session_unlock();
+}
+
+static void spec_of(unsigned kind, Slot *tmp) {
+ memset(tmp, 0, sizeof *tmp);
+ if (kind == KK_PREP) { tmp->spec.prep.depth = OMEGA_GPU_DATTN256_DEPTH; tmp->spec.prep.mutant = g.prep_mut; tmp->spec.prep.prep = 1; }
+ else tmp->spec.att.mutant = g.att_mut;
+}
+static int prog_of(unsigned kind, const Slot *tmp, BlackwellIRProgram *prog) {
+ return kind == KK_PREP ? omega_blackwell_codegen_decode_attn256_prog(&tmp->spec.prep, prog)
+ : omega_blackwell_codegen_prefill_attn256_prog(&tmp->spec.att, prog);
+}
+static uint32_t placeholders_of(const BlackwellIRProgram *prog) {
+ uint32_t n = 0;
+ for (size_t i = 0; i < prog->count; i++) {
+ const BlackwellIRInsn *in = &prog->insns[i];
+ if ((in->op == BW_IR_SHFL_DOWN && (in->imm & OMEGA_TC_MARK_BFLY)) || (in->op == BW_IR_FMNMX_MAX && in->imm == OMEGA_TC_MARK_F2FP)) n++;
+ }
+ return n;
+}
+
+size_t omega_gpu_prefill_attn256_encode(unsigned kind, uint8_t *code, size_t cap, uint32_t *gprs, int *patched) {
+ if (kind >= KK_N) return 0;
+ Slot tmp; spec_of(kind, &tmp);
+ BlackwellIRProgram *prog = omega_gpu_host_calloc(1, sizeof *prog);
+ if (!prog) return 0;
+ size_t need = 0;
+ if (prog_of(kind, &tmp, prog) == 0) need = omega_bw_program_code_bytes(prog);
+ OmegaBlackwellKernel k;
+ if (need == 0 || need > cap || omega_blackwell_kernel_encode_into(prog, code, cap, &k) != 0) { omega_gpu_host_free(prog); return 0; }
+ int np = omega_tc_patch_code(prog, code, need);
+ if (gprs) *gprs = k.gpr_count;
+ if (patched) *patched = np;
+ const int ok = np >= 0 && (uint32_t)np == placeholders_of(prog);
+ omega_gpu_host_free(prog);
+ return ok ? need : 0;
+}
+
+/* rec: a record call is running (lock held): a miss is refused instead of compiled */
+static int kernel_for(unsigned kind, int rec, Slot **out, bool *hit) {
+ Slot tmp; spec_of(kind, &tmp);
+ Slot *s = &g.slot[kind];
+ if (s->valid && memcmp(&s->spec, &tmp.spec, sizeof tmp.spec) == 0) { *out = s; *hit = true; return OMEGA_GPU_DATTN_OK; }
+ if (rec) { omega_gpu_session_set_error("prefill attn256 record: kernel cache miss (warm up before recording)"); return OMEGA_GPU_DATTN_TOO_LARGE; }
+ if (s->valid) omega_gpu_session_free(&s->code);
+ memset(s, 0, sizeof *s);
+ BlackwellIRProgram *prog = omega_gpu_host_calloc(1, sizeof *prog);
+ if (!prog) { omega_gpu_session_set_error("prefill attn256 codegen: host memory"); return OMEGA_GPU_DATTN_CODEGEN_FAIL; }
+ int cg = prog_of(kind, &tmp, prog);
+ size_t need = cg == 0 ? omega_bw_program_code_bytes(prog) : 0;
+ if (cg != 0 || need == 0) { omega_gpu_host_free(prog); omega_gpu_session_set_error("prefill attn256 codegen refused the spec"); return OMEGA_GPU_DATTN_CODEGEN_FAIL; }
+ /* both launches run 256 threads per CTA: the declared registers must fit the 64K register file (CUDA Programming
+ * Guide, Compute Capabilities: "maximum number of 32-bit registers per thread block is 64K") */
+ if ((uint64_t)OMEGA_PATTN256_THREADS * omega_bw_gpr_declared(prog->regalloc.peak_gpr_usage) > 65536u) { omega_gpu_host_free(prog); omega_gpu_session_set_error("prefill attn256: register file"); return OMEGA_GPU_DATTN_TOO_LARGE; }
+ const uint32_t expect = placeholders_of(prog), insns = (uint32_t)prog->count;
+ OmegaGpuMem code;
+ if (omega_gpu_session_alloc_code(need, &code) != 0) { omega_gpu_host_free(prog); return OMEGA_GPU_DATTN_CHIP_FAIL; }
+ OmegaBlackwellKernel kernel;
+ cg = omega_blackwell_kernel_encode_into(prog, code.cpu, need, &kernel);
+ int np = cg == 0 ? omega_tc_patch_code(prog, code.cpu, need) : -1;
+ omega_gpu_host_free(prog);
+ if (cg != 0 || !kernel.code || kernel.code_size != need) { omega_gpu_session_free(&code); omega_gpu_session_set_error("prefill attn256 encode"); return OMEGA_GPU_DATTN_CODEGEN_FAIL; }
+ if (np < 0 || (uint32_t)np != expect) { omega_gpu_session_free(&code); omega_gpu_session_set_error("prefill attn256: placeholder patch count mismatch"); return OMEGA_GPU_DATTN_CODEGEN_FAIL; }
+ if (omega_gpu_session_sync_to_gpu(&code) != 0) { omega_gpu_session_free(&code); return OMEGA_GPU_DATTN_CHIP_FAIL; }
+ memset(s, 0, sizeof *s);
+ s->valid = true; s->spec = tmp.spec; s->kernel = kernel; s->code = code; s->insns = insns;
+ *out = s; *hit = false;
+ return OMEGA_GPU_DATTN_OK;
+}
+
+static size_t qf_bytes(uint32_t rows) { return (size_t)((rows + 1u) / 2u) * OMEGA_PATTN256_QF_PAIR_BYTES; }
+static int qf_locked(uint32_t rows) {
+ if (g.have_qf && g.qf_rows >= rows) return 0;
+ if (g.have_qf) { omega_gpu_session_free(&g.qf); g.have_qf = false; g.qf_rows = 0; }
+ if (omega_gpu_session_alloc(qf_bytes(rows), &g.qf) != 0) return -1;
+ g.have_qf = true; g.qf_rows = rows;
+ return 0;
+}
+int omega_gpu_prefill_attn256_reserve(uint32_t max_m) {
+ if (max_m == 0 || max_m > OMEGA_GPU_PATTN256_MAX_M) return OMEGA_GPU_DATTN_BAD_ARGS;
+ omega_gpu_session_lock();
+ int rc = dev_open_locked() && qf_locked(max_m) == 0 ? OMEGA_GPU_DATTN_OK : OMEGA_GPU_DATTN_CHIP_FAIL;
+ omega_gpu_session_unlock();
+ return rc;
+}
+static int bufs_locked(uint32_t rows) {
+ if (g.have_bufs && g.buf_rows >= rows) return 0;
+ if (g.have_bufs) { omega_gpu_session_free(&g.qkv); omega_gpu_session_free(&g.out); g.have_bufs = false; g.buf_rows = 0; }
+ if (omega_gpu_session_alloc((size_t)rows * QKVW * 4u, &g.qkv) != 0) return -1;
+ if (omega_gpu_session_alloc((size_t)rows * OUTW * 4u, &g.out) != 0) { omega_gpu_session_free(&g.qkv); return -1; }
+ g.have_bufs = true; g.buf_rows = rows;
+ return 0;
+}
+
+/* host != 0: qkv / out are host arrays staged through the module buffers (poison-checked); else qkv_va / out_va are
+ * device buffers. rec non-NULL: record path (lock held, nothing allocated, compiled or submitted). */
+static int core(OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0, uint32_t m, const float *qkv, float *out,
+ uint64_t qkv_va, uint64_t out_va, float eps, float out_scale, OmegaGpuPrefillAttn256Info *info, OmegaGpuCmdList *rec) {
+ uint64_t t0 = omega_gpu_session_now_ns();
+ if (info) memset(info, 0, sizeof *info);
+ const int host = qkv != NULL;
+ OmegaGpuDecodeAttn256CacheView v;
+ if (!c || m == 0 || m > OMEGA_GPU_PATTN256_MAX_M || omega_gpu_decode_attn256_cache_view(c, layer, &v) != OMEGA_GPU_DATTN_OK ||
+ pos0 > v.max_pos || m > v.max_pos - pos0 || (host ? !out : (!qkv_va || !out_va || (qkv_va & 15u) || (out_va & 15u)))) return OMEGA_GPU_DATTN_BAD_ARGS;
+ if (!rec) omega_gpu_session_lock();
+#define UNLOCK() do { if (!rec) omega_gpu_session_unlock(); } while (0)
+ if (!dev_open_locked()) { UNLOCK(); return OMEGA_GPU_DATTN_CHIP_FAIL; }
+ Slot *ks[KK_N] = { NULL, NULL }; bool hit[KK_N] = { false, false };
+ int rc = OMEGA_GPU_DATTN_OK;
+ for (unsigned k = 0; k < KK_N && rc == OMEGA_GPU_DATTN_OK; k++) rc = kernel_for(k, rec != NULL, &ks[k], &hit[k]);
+ if (rc != OMEGA_GPU_DATTN_OK) { UNLOCK(); return rc; }
+ if (rec) { if (!g.have_qf || g.qf_rows < m) { omega_gpu_session_set_error("prefill attn256 record: q' scratch not reserved for m tokens"); return OMEGA_GPU_DATTN_TOO_LARGE; } }
+ else if (qf_locked(m) != 0) { UNLOCK(); return OMEGA_GPU_DATTN_CHIP_FAIL; }
+ if (host) {
+ if (bufs_locked(m) != 0) { UNLOCK(); return OMEGA_GPU_DATTN_CHIP_FAIL; }
+ memcpy(g.qkv.cpu, qkv, (size_t)m * QKVW * 4u);
+ float *od = g.out.cpu;
+ for (size_t i = 0; i < (size_t)m * OUTW; i++) od[i] = POISON_F32;
+ if (omega_gpu_session_sync_to_gpu(&g.qkv) != 0 || omega_gpu_session_sync_to_gpu(&g.out) != 0) rc = OMEGA_GPU_DATTN_CHIP_FAIL;
+ qkv_va = g.qkv.va; out_va = g.out.va;
+ }
+ const uint32_t kvs = v.max_pos * OMEGA_DATTN256_ROW_BYTES, gx_att = (m + OMEGA_PATTN256_TOKENS - 1u) / OMEGA_PATTN256_TOKENS;
+ float fe = eps, f1 = 1.0f, fo = out_scale, fq = (float)(0.0625 * 1.4426950408889634 ); /* log2(e) / sqrt(256) */
+ uint32_t ue, u1, uo, uq; memcpy(&ue, &fe, 4); memcpy(&u1, &f1, 4); memcpy(&uo, &fo, 4); memcpy(&uq, &fq, 4);
+ uint32_t ap[OMEGA_DATTN256_ARGS_WORDS], aa[OMEGA_PATTN256_ARGS_WORDS];
+#define A64(a, i, x) do { (a)[i] = (uint32_t)(x); (a)[(i) + 1] = (uint32_t)((uint64_t)(x) >> 32); } while (0)
+ A64(ap, 0, qkv_va); A64(ap, 2, v.k_va); A64(ap, 4, v.v_va); A64(ap, 6, v.rope_va); A64(ap, 8, v.q_norm_va); A64(ap, 10, v.k_norm_va);
+ A64(ap, 12, g.qf.va); A64(ap, 14, v.part_va); A64(ap, 16, v.cnt_va);
+ ap[18] = pos0; ap[19] = OMEGA_DATTN256_CHUNK; ap[20] = 1u; ap[21] = kvs; ap[22] = ue; ap[23] = u1; ap[24] = uq;
+ A64(aa, 0, g.qf.va); A64(aa, 2, v.k_va); A64(aa, 4, v.v_va); A64(aa, 6, out_va);
+ aa[8] = pos0; aa[9] = m; aa[10] = kvs; aa[11] = uo;
+#undef A64
+ OmegaGpuLaunch L[KK_N] = {
+ { .code_va = ks[KK_PREP]->code.va, .gpr_count = omega_bw_gpr_declared(ks[KK_PREP]->kernel.gpr_count),
+ .threads_x = OMEGA_PATTN256_THREADS, .threads_y = 1, .grid_x = m, .grid_y = OMEGA_DATTN256_KV_HEADS,
+ .num_elements = (size_t)m * QKVW, .args = ap, .n_args = OMEGA_DATTN256_ARGS_WORDS, .timeout_ms = MARKER_TIMEOUT_MS,
+ .shared_bytes = OMEGA_DATTN256_SHARED_BYTES },
+ { .code_va = ks[KK_ATTEND]->code.va, .gpr_count = omega_bw_gpr_declared(ks[KK_ATTEND]->kernel.gpr_count),
+ .threads_x = OMEGA_PATTN256_THREADS, .threads_y = 1, .grid_x = gx_att, .grid_y = OMEGA_DATTN256_KV_HEADS,
+ .num_elements = (size_t)m * OUTW, .args = aa, .n_args = OMEGA_PATTN256_ARGS_WORDS, .timeout_ms = MARKER_TIMEOUT_MS,
+ .shared_bytes = OMEGA_PATTN256_SHARED_BYTES },
+ };
+ if (info) {
+ info->layer = layer; info->pos0 = pos0; info->m = m; info->grid_x[0] = m; info->grid_x[1] = gx_att;
+ for (unsigned k = 0; k < KK_N; k++) { info->insns[k] = ks[k]->insns; info->gprs[k] = ks[k]->kernel.gpr_count; info->kernel_cache_hits += hit[k]; }
+ }
+ for (unsigned k = 0; k < KK_N && rc == OMEGA_GPU_DATTN_OK; k++) {
+ if (!omega_bw_gpr_declared_ok(L[k].gpr_count, ks[k]->kernel.gpr_count)) { omega_gpu_session_set_error("declared registers below peak + 2: refusing to launch"); rc = OMEGA_GPU_DATTN_CHIP_FAIL; }
+ else if (rec) { if (omega_gpu_cmdlist_add(rec, &L[k]) < 0) rc = OMEGA_GPU_DATTN_CHIP_FAIL; }
+ else if (omega_gpu_session_launch(&L[k], info ? &info->elapsed_ns[k] : NULL, NULL) != 0) rc = OMEGA_GPU_DATTN_CHIP_FAIL;
+ }
+ if (rc == OMEGA_GPU_DATTN_OK && host) {
+ if (omega_gpu_session_sync_to_cpu(&g.out) != 0) rc = OMEGA_GPU_DATTN_CHIP_FAIL;
+ else {
+ const float *od = g.out.cpu;
+ size_t unchanged = 0;
+ for (size_t i = 0; i < (size_t)m * OUTW; i++) if (od[i] == POISON_F32) unchanged++;
+ if (unchanged) { omega_gpu_session_set_error("prefill attn256: output poison survived"); rc = OMEGA_GPU_DATTN_CHIP_FAIL; }
+ else memcpy(out, od, (size_t)m * OUTW * 4u);
+ }
+ }
+ UNLOCK();
+#undef UNLOCK
+ if (info) info->call_ns = omega_gpu_session_now_ns() - t0;
+ return rc;
+}
+
+int omega_gpu_prefill_attn256(OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0, uint32_t m,
+ const float *qkv, float eps, float out_scale, float *out, OmegaGpuPrefillAttn256Info *info) {
+ if (!qkv) return OMEGA_GPU_DATTN_BAD_ARGS;
+ return core(c, layer, pos0, m, qkv, out, 0, 0, eps, out_scale, info, NULL);
+}
+int omega_gpu_prefill_attn256_dev(OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0, uint32_t m,
+ uint64_t qkv_va, float eps, float out_scale, uint64_t out_va, OmegaGpuPrefillAttn256Info *info) {
+ return core(c, layer, pos0, m, NULL, NULL, qkv_va, out_va, eps, out_scale, info, NULL);
+}
+int omega_gpu_prefill_attn256_record(OmegaGpuCmdList *cl, OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0,
+ uint32_t m, uint64_t qkv_va, float eps, float out_scale, uint64_t out_va) {
+ if (!cl) return OMEGA_GPU_DATTN_BAD_ARGS;
+ return core(c, layer, pos0, m, NULL, NULL, qkv_va, out_va, eps, out_scale, NULL, cl);
+}
diff --git a/src/omega_gpu_prefill_attn256_api.h b/src/omega_gpu_prefill_attn256_api.h
new file mode 100644
index 000000000 ..0683ea30b
--- /dev/null
+++ b/src/omega_gpu_prefill_attn256_api.h
@@ -0,0 +1,59 @@
+#ifndef OMEGA_GPU_PREFILL_ATTN256_API_H
+#define OMEGA_GPU_PREFILL_ATTN256_API_H
+/*
+ * omega_gpu_prefill_attn256_api: causal prefill attention for Qwen3.8-27B (omega-mv#545, 2026-10-18), on the decode
+ * attention's cache (omega_gpu_decode_attn256_api.h); the kernels are described in omega_blackwell_codegen_pattn256.h.
+ *
+ * int omega_gpu_prefill_attn256(c, layer, pos0, m, qkv, eps, out_scale, out, info)
+ * qkv: host f32 [m][8192], one row per token in the decode call's layout (q 24 x 256 permuted, k 4 x 256 permuted,
+ * v 4 x 256; the gate is not part of it), tokens at positions pos0 .. pos0+m-1 (positions 0 .. pos0-1 of `layer`
+ * already in the cache). Appends K and V for those positions with the decode step's instruction sequence (the
+ * rows equal m decode steps' rows on the same chip) and writes out: host f32 [m][6144] (token-major, head h at
+ * h * 256, model dim order) multiplied by out_scale. pos0 + m <= max_pos, 1 <= m <= OMEGA_GPU_PATTN256_MAX_M.
+ * Two launches: prep (grid m x 4), attend (grid ceil(m / 8) x 4). Returns OMEGA_GPU_DATTN_OK or an
+ * OMEGA_GPU_DATTN_* code; the text is in omega_gpu_decode_attn_last_error().
+ * int omega_gpu_prefill_attn256_dev(c, layer, pos0, m, qkv_va, eps, out_scale, out_va, info)
+ * The same with device buffers (qkv_va: f32 [m][8192], out_va: f32 [m][6144], 16-byte aligned GPU VAs in the
+ * session); no host copies and no poison check (the caller's download path is the check).
+ * int omega_gpu_prefill_attn256_record(cl, c, layer, pos0, m, qkv_va, eps, out_scale, out_va)
+ * Record path (omega_gpu_cmdlist.h): both launches appended to cl. The caller holds omega_gpu_session_lock(), has
+ * reserved the q' scratch for m tokens (omega_gpu_prefill_attn256_reserve) and warmed both kernels with one
+ * non-record call (a kernel cache miss is refused, never compiled while recording).
+ * int omega_gpu_prefill_attn256_reserve(max_m): allocates the q' scratch for max_m tokens now (ceil(max_m / 2) x
+ * 24576 bytes); calls beyond it grow it (host and dev paths) or are refused (record path: TOO_LARGE).
+ * void omega_gpu_prefill_attn256_release(void): frees the module's buffers (also released when the session closes).
+ *
+ * Every buffer is GPU-uncached host-visible session memory (nvos.h:1117 rule), launched through
+ * omega_gpu_session_launch.
+ */
+#include "omega_gpu_decode_attn256_api.h"
+#include "omega_blackwell_codegen_pattn256.h"
+#include <stdint.h>
+
+#define OMEGA_GPU_PATTN256_MAX_M 32768u
+
+typedef struct {
+ uint32_t layer, pos0, m;
+ uint32_t grid_x[2]; /* prep, attend */
+ uint32_t insns[2], gprs[2]; /* allocator peak registers */
+ uint64_t elapsed_ns[2]; /* marker-to-marker chip time of each launch (host and dev paths) */
+ uint64_t call_ns;
+ uint32_t kernel_cache_hits; /* 0..2 */
+} OmegaGpuPrefillAttn256Info;
+
+int omega_gpu_prefill_attn256(OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0, uint32_t m,
+ const float *qkv, float eps, float out_scale, float *out, OmegaGpuPrefillAttn256Info *info);
+int omega_gpu_prefill_attn256_dev(OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0, uint32_t m,
+ uint64_t qkv_va, float eps, float out_scale, uint64_t out_va, OmegaGpuPrefillAttn256Info *info);
+struct OmegaGpuCmdList;
+int omega_gpu_prefill_attn256_record(struct OmegaGpuCmdList *cl, OmegaGpuDecodeAttn256Cache *c, uint32_t layer, uint32_t pos0,
+ uint32_t m, uint64_t qkv_va, float eps, float out_scale, uint64_t out_va);
+int omega_gpu_prefill_attn256_reserve(uint32_t max_m);
+void omega_gpu_prefill_attn256_release(void);
+
+/* ---- tests ---- */
+void omega_gpu_prefill_attn256_test_set_mutant(int prep_mutant, int attend_mutant); /* OmegaDecodeAttn256Spec / OmegaPrefillAttn256Spec .mutant */
+/* host: build + encode + patch a kernel (0 prep, 1 attend) into code (cap bytes); returns the code size or 0 */
+size_t omega_gpu_prefill_attn256_encode(unsigned kind, uint8_t *code, size_t cap, uint32_t *gprs, int *patched);
+
+#endif
diff --git a/tests/.crumb b/tests/.crumb
index 6b98163fd ..4f3a08ca5 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -296,14 +296,14 @@
}
],
"children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8 ",
- "compiled_at": "2026-10-18T13:06:21Z",
+ "compiled_at": "2026-10-18T15:21:47Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:6947682ecc9b0f6e6704ae8d7ba4121075d6b219d6317b17acf7fe7b412f3892 ",
+ "digest": "sha256:ef8690a977452cb604669c5e0f11a801b873f033c617e8530fa90b4a0074c111 ",
"evidence_files": 16,
"evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a ",
- "files": 1272,
- "generated_at_commit": "c3ab69f66d6b2a2bce7efe425d80b1306e1140ed ",
- "source_tree": "sha256:f47111f6aad8c35e914abd28def6546c2c6ce9fe525c55538cd1b2d1f37f5670 "
+ "files": 1274,
+ "generated_at_commit": "acdeff745c292cebb3b22cc7ae298409a0b7ee64 ",
+ "source_tree": "sha256:d713e4bedd04a8ecafe0343b1e3c372f480dc0f07b8a6efe63b17c6fadda6ea9 "
},
"owner_lane": "",
"provenance": {
diff --git a/tests/bw_encode_control_test.c b/tests/bw_encode_control_test.c
new file mode 100644
index 000000000 ..46a67b11d
--- /dev/null
+++ b/tests/bw_encode_control_test.c
@@ -0,0 +1,50 @@
+/*
+ * bw_encode_control_test: every opcode the encoder accepts must carry the control word the emitter scheduled
+ * (BlackwellIRInsn.control: stall, yield, write / read scoreboards, wait mask) into the instruction's top word
+ * (omega-mv#545, 2026-10-18). The encoder's golden-word checks compare words 0..2 only, so an opcode that wrote a
+ * fixed word 3 kept its own wait mask and dropped the emitter's: IADD3 always waited on scoreboard 4 instead of the
+ * Q loads' scoreboards, the next MOVs overwrote the loads' address registers while loads were still queued, and the
+ * prefill attention faulted (Xid 13, Invalid Address Space) on the chip.
+ *
+ * Host only, no device. Exit 0 when every accepted opcode honours the control word.
+ */
+#include "omega_blackwell_codegen.h"
+#include <stdio.h>
+#include <string.h>
+
+#define CTL_FIELD 0x03fffe00u /* stall 9..12, yield 13, wbar 14..16, rbar 17..19, wait 20..25 */
+
+static const uint32_t sentinels[] = {
+ (3u << 9) | (5u << 14) | (4u << 17) | (0x2au << 20), /* stall 3, wbar 5, rbar 4, wait 0x2a */
+ (12u << 9) | 0x2000u | (2u << 14) | (7u << 17) | (0x15u << 20), /* stall 12, yield, wbar 2, rbar none, wait 0x15 */
+};
+
+int main(void) {
+ int checked = 0, refused = 0, bad = 0;
+ for (int op = 0; op <= (int)BW_IR_MUFU_LG2; op++) {
+ for (int form = 0; form < 4; form++) {
+ const int pred = form & 1, uni = form >> 1;
+ int accepted_any = 0;
+ for (unsigned s = 0; s < sizeof sentinels / sizeof sentinels[0]; s++) {
+ BlackwellIRInsn in;
+ memset(&in, 0, sizeof in);
+ in.op = (BlackwellIROpcode)op;
+ in.dst_vreg = 4; in.src1_vreg = 6; in.src2_vreg = 8; in.src3_vreg = 10; in.ureg = 4;
+ in.imm = 2; in.predicate_p0 = pred != 0; in.is_uniform = uni != 0;
+ in.control = sentinels[s];
+ uint32_t w[4] = { 0, 0, 0, 0 };
+ if (omega_blackwell_encode_one(&in, w) != 0) continue;
+ accepted_any = 1;
+ checked++;
+ if ((w[3] & CTL_FIELD) != (sentinels[s] & CTL_FIELD)) {
+ bad++;
+ printf("FAIL: op %d%s%s: control 0x%08x encoded as 0x%08x\n", op, pred ? " (@P0)" : "", uni ? " (uniform)" : "", sentinels[s], w[3]);
+ }
+ }
+ if (!accepted_any && form == 0) refused++;
+ }
+ }
+ printf("bw_encode_control_test: %d encodings checked, %d opcodes refused (no operands), %d dropped the control word: %s\n",
+ checked, refused, bad, bad ? "FAIL" : "PASS");
+ return bad ? 1 : 0;
+}
diff --git a/tests/bw_warp_sim_pa.h b/tests/bw_warp_sim_pa.h
index 7657df020 ..a2eaf262d 100644
--- a/tests/bw_warp_sim_pa.h
+++ b/tests/bw_warp_sim_pa.h
@@ -98,6 +98,8 @@ typedef struct {
uint32_t smem_bytes;
WsRange ranges[WS_MAX_RANGES]; int nranges; /* when > 0, every global access must fall in one */
int order; /* 0 = lowest pc first, 1 = highest pc first */
+ uint32_t reg_poison; /* 0: registers start at zero; else every lane register starts as a hash of this seed, the CTA and the
+ * register (the chip gives a CTA whatever the previous CTA on the SM left behind) */
int trace; /* print every issue of warp 0 of CTA (0,0) */
/* results */
int err; int err_pc; char msg[200];
@@ -344,6 +346,9 @@ static int ws_run(WsSim *s, uint32_t grid_x, uint32_t grid_y) {
uint32_t nw = s->threads / WS_WARP;
for (uint32_t cy = 0; cy < grid_y && !s->err; cy++) for (uint32_t cx = 0; cx < grid_x && !s->err; cx++) {
memset(warps, 0, sizeof(WsWarp) * nw);
+ if (s->reg_poison) for (uint32_t w = 0; w < nw; w++) for (int L = 0; L < WS_WARP; L++) for (int r = 0; r < 256; r++) {
+ uint32_t h = s->reg_poison ^ (cx * 0x9e3779b9u) ^ (cy * 0x85ebca6bu) ^ ((w * 32u + (uint32_t)L) * 0xc2b2ae35u) ^ ((uint32_t)r * 0x27d4eb2fu);
+ h ^= h >> 15; h *= 0x2c1b3c6du; h ^= h >> 12; warps[w].lane[L].r[r] = h; if (r == 0) warps[w].lane[L].p0 = (uint8_t)((s->reg_poison >> 31) | (h & 1u)); }
if (s->smem && s->smem_bytes) for (uint32_t i = 0; i + 4 <= s->smem_bytes; i += 4) { uint32_t poison = 0xfeedfaceu; memcpy(s->smem + i, &poison, 4); }
for (uint32_t w = 0; w < nw; w++) { warps[w].nfrag = 1; warps[w].frag[0].pc = 0; warps[w].frag[0].mask = 0xffffffffu; warps[w].frag[0].parked = 0; }
int trace = s->trace && cx == 0 && cy == 0;
diff --git a/tests/gpu_attention_test.c b/tests/gpu_attention_test.c
index 45790315a ..ca1468168 100644
--- a/tests/gpu_attention_test.c
+++ b/tests/gpu_attention_test.c
@@ -1109,15 +1109,17 @@ static void hd128_checks(void) {
/* head_dim 64 byte-identity pin and head_dim 128 codegen facts (CPU only, no device, no simulator).
* The digests are SHA-256 of the encoded kernel bytes as emitted by the batched-load program of 2026-10-12
- * (speed/attention-batched-loads; before it, main c0369e6 was pinned at 160 instructions); any change to the head_dim 64 program changes a digest and fails here. */
+ * (speed/attention-batched-loads; before it, main c0369e6 was pinned at 160 instructions), re-pinned 2026-10-18 for the encoder
+ * control-word fix (omega-mv#545: 8 IADD3 and 1 EXIT word 3 per kernel carry the scheduled waits; reverting only those
+ * words reproduces the previous digests); any change to the head_dim 64 program changes a digest and fails here. */
typedef struct { bool f32; uint32_t log2bs, log2gqa; size_t insns; const char *sha256; } Pin;
static const Pin k_pins64[] = {
- { false, 4, 3, 216, "44d27fae78ea21ee77fd7a0ebd2ebfcac52e9e45a81de84b035868092e13e424 " },
- { false, 4, 2, 216, "3bc79d4a54fd0d82024b376dfdb718e8326431917251f13f5c44be6ba8eb6f0c " },
- { false, 4, 0, 216, "83eca9872e32c17321d2f8ec6a6ec92638ed72b136d8958cda5cdfc451c01ef8 " },
- { true, 12, 3, 184, "b6a25d8739185bbd944bfcc1ec174abb24ce46529f06c56f8d5ac77bf6883ddd " },
- { true, 12, 2, 184, "46a2b82ebcb55237f4a7585679b42ac9558c7a434e8e80ccef6cc0bfaed8fcb9 " },
- { true, 12, 0, 184, "970db9533c836eca7c86783875a2ad898cd69bc3070cae418cc92b3ce2dbbd9c " },
+ { false, 4, 3, 216, "5e183059327a4b3f188d749f296385ec43e718bbbf98de4f2697b5b553e7ccb1 " },
+ { false, 4, 2, 216, "6656927ae80d3677c8444e5ccbb696b50850e21b3ff52bf14dd79d6f83232243 " },
+ { false, 4, 0, 216, "b3d40b99628c4bb9bdb25c503766aca5c904456e63301b5338963071ab9b28e0 " },
+ { true, 12, 3, 184, "61eab0c548f36364ee4d7547fa8f32fffcc20096182112d5fef12fe381712e31 " },
+ { true, 12, 2, 184, "0095f8fb408efad952f0cad4f0e9d6d99f950d4aa8bbd14ee71a5347297fcbc9 " },
+ { true, 12, 0, 184, "e0c44b49246198765f0eb60a6cc065d59c98f41fadc10b1d4e3fbc18587d855d " },
};
static void hex_digest(const uint8_t d[32], char out[65]) { for (int i = 0; i < 32; i++) snprintf(out + 2 * i, 3, "%02x", d[i]); }
static void hd_codegen_checks(void) {
diff --git a/tests/gpu_decode_attn256_test.c b/tests/gpu_decode_attn256_test.c
index c46162a38 ..58425703d 100644
--- a/tests/gpu_decode_attn256_test.c
+++ b/tests/gpu_decode_attn256_test.c
@@ -212,12 +212,12 @@ static void host_only(void) {
free(ref); case_free(&c); }
/* codegen budget */
for (uint32_t d = 1; d <= 4; d++) for (int m = 0; m <= 5; m++) {
- OmegaDecodeAttn256Spec s = { d, m }; uint32_t n = 0, gp = 0;
+ OmegaDecodeAttn256Spec s = { d, m, 0 }; uint32_t n = 0, gp = 0;
int rc = omega_decode_attn256_prog_stats(&s, &n, &gp);
CHECK(rc == 0 && n <= 1024 && gp <= 126, "codegen depth %u mutant %d: rc %d insns %u gprs %u", d, m, rc, n, gp);
if (rc == 0 && m == 0) printf("codegen depth %u: %u instructions, %u registers (declared %u, 256 threads -> %u of 65536)\n", d, n, gp, omega_bw_gpr_declared(gp), 256 * omega_bw_gpr_declared(gp));
}
- { OmegaDecodeAttn256Spec s = { 0, 0 }; CHECK(omega_decode_attn256_prog_stats(&s, NULL, NULL) != 0, "depth 0 refused");
+ { OmegaDecodeAttn256Spec s = { 0, 0, 0 }; CHECK(omega_decode_attn256_prog_stats(&s, NULL, NULL) != 0, "depth 0 refused");
s.depth = 5; CHECK(omega_decode_attn256_prog_stats(&s, NULL, NULL) != 0, "depth 5 refused");
s.depth = 1; s.mutant = 6; CHECK(omega_decode_attn256_prog_stats(&s, NULL, NULL) != 0, "mutant 6 refused"); }
CHECK(omega_gpu_decode_attn256_cache_alloc(0, 256, THETA, 64, NULL) == OMEGA_GPU_DATTN_BAD_ARGS, "NULL out refused");
@@ -237,7 +237,7 @@ static void host_only(void) {
static uint64_t g_sim_issues;
static int sim_point(uint32_t max_pos, uint32_t pos, uint32_t rotary, uint32_t depth, int mutant, uint32_t per_split, float qscale, uint32_t seed, char *msg, size_t n, double *worst, size_t *bad, char *rows, size_t rn) {
static BlackwellIRProgram prog;
- OmegaDecodeAttn256Spec spec = { depth, mutant };
+ OmegaDecodeAttn256Spec spec = { depth, mutant, 0 };
if (omega_blackwell_codegen_decode_attn256_prog(&spec, &prog) != 0) { snprintf(msg, n, "codegen refused"); return -1; }
Case c; case_make(&c, max_pos, pos, rotary, seed, qscale);
uint16_t *kcp = case_kc_perm(&c);
diff --git a/tests/gpu_prefill_attn256_test.c b/tests/gpu_prefill_attn256_test.c
new file mode 100644
index 000000000 ..5598e59fb
--- /dev/null
+++ b/tests/gpu_prefill_attn256_test.c
@@ -0,0 +1,591 @@
+/*
+ * gpu_prefill_attn256_test: the head_dim 256 causal prefill attention for Qwen3.8-27B (omega-mv#545,
+ * omega_gpu_prefill_attn256_api.h), on the decode attention's cache (omega_gpu_decode_attn256_api.h).
+ * --host-only codegen budgets of both kernels (instructions <= 1024, registers within the opt-in limit and the
+ * 256-thread register file, attend placeholders patched), refusals, layout constants. No device.
+ * --sim both launches through tests/bw_warp_sim_pa.h (no chip): several (pos0, m) points incl. odd starts,
+ * history, a 256 boundary and full rope; both fragment orders on the small points. Gates: appended K/V
+ * rows bit-equal to m runs of the DECODE program on a twin cache (the same simulator), outputs within
+ * the tolerance of a double reference, prep mutants 1 and 3 and attend mutants 1 and 2 caught. The q'
+ * scratch starts as NaN so a read of a slot the prep launch never wrote shows up.
+ * (default) the chip: parity against the double reference (every token up to 512 tokens, 8 sampled tokens
+ * above), rows bit-identical to m decode calls on a twin cache and the next decode step on both caches
+ * bit-identical, second call identical, out_scale 2^20 exact, device entry == host entry, mutants caught,
+ * timing medians of 2048-token chunks at contexts 2k, 8k, 32k (and 128k with --max-pos 131072); JSON
+ * receipt with --out.
+ * The reference works in the model's dim order (crates/aien-inference-abi/src/qwen38.rs `attention`): zero-centred
+ * RMSNorm x * rsqrt(mean + eps) * (1 + w), RoPE on the first rotary_dim dims with pairs (j, j + rotary_dim/2), scores
+ * q.k / sqrt(256), causal softmax. The kernel sees q, k and the norm weights permuted (omega_dattn256_perm_vec) and K rows
+ * permuted; V and the output are in model order.
+ * Tolerance: |out - ref| <= 5e-3 * max|v| * out_scale per element. The reference rounds q' * (log2(e) / 16) to bf16 as
+ * the prep kernel does (from double, the kernel from f32: rare one-ulp differences) and uses its own bf16 K/V rows; what
+ * remains is P rounded to bf16 for the tensor cores (relative 2^-9 per weight, l summed from the unrounded p:
+ * <= 2^-9 * max|v| = 0.0020) and f32 / EX2 error (~2^-22). The measured worst ratio is printed; the mutants miss by far
+ * more. Host and simulator passes are never chip results.
+ */
+#include "omega_gpu_prefill_attn256_api.h"
+#include "omega_gpu_session.h"
+#include "omega_blackwell_codegen_tc.h"
+#include "bw_warp_sim_pa.h"
+#include <inttypes.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+static int g_checks, g_failed;
+#define CHECK(cond, ...) do { g_checks++; if (!(cond)) { g_failed++; printf("FAIL: "); printf(__VA_ARGS__); printf("\n"); } } while (0)
+static uint32_t lcg(uint32_t *s) { *s = *s * 1664525u + 1013904223u; return *s; }
+static float frand(uint32_t *s, float lo, float hi) { return lo + (hi - lo) * ((float)(lcg(s) >> 8) / 16777216 .0f); }
+static double now_ms(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return t.tv_sec * 1e3 + t.tv_nsec / 1e6; }
+static int cmp_u64(const void *a, const void *b) { uint64_t x = *(const uint64_t *)a, y = *(const uint64_t *)b; return x < y ? -1 : x > y; }
+static const double THETA = 10000000 .0; /* Qwen3.8-27B rope_theta */
+static const float EPS = 1e-6f;
+#define HD 256u
+#define QH 24u
+#define KVH 4u
+#define QW OMEGA_DATTN256_QKV_WORDS /* 8192 */
+#define OW OMEGA_PATTN256_OUT_WORDS /* 6144 */
+#define QEND (QH * HD)
+#define KEND (QEND + KVH * HD)
+#define RB OMEGA_DATTN256_ROW_BYTES
+static const float QKS = (float)((1.0 / 16.0) * 1.4426950408889634 );
+#define TOL_REL 5e-3
+
+/* one layer's random state in MODEL order: m qkv rows, norm weights w (zero-centred), history rows 0..pos0-1 */
+typedef struct {
+ uint32_t max_pos, pos0, m, rotary;
+ float *qkv; /* [m][8192] */
+ float qn[HD], kn[HD];
+ uint16_t *kc, *vc; /* [4][max_pos][256] model order */
+} Case;
+static void case_make(Case *c, uint32_t max_pos, uint32_t pos0, uint32_t m, uint32_t rotary, uint32_t seed, float qscale) {
+ uint32_t s = seed;
+ c->max_pos = max_pos; c->pos0 = pos0; c->m = m; c->rotary = rotary;
+ c->qkv = malloc((size_t)m * QW * 4);
+ for (size_t t = 0; t < m; t++) for (size_t i = 0; i < QW; i++) c->qkv[t * QW + i] = frand(&s, -1.0f, 1.0f) * (i < QEND ? qscale : 1.0f);
+ for (unsigned i = 0; i < HD; i++) { c->qn[i] = frand(&s, -0.2f, 0.2f); c->kn[i] = frand(&s, -0.2f, 0.2f); }
+ size_t words = (size_t)KVH * max_pos * HD;
+ c->kc = calloc(words, 2); c->vc = calloc(words, 2);
+ for (unsigned g = 0; g < KVH; g++) for (uint32_t t = 0; t < pos0; t++) for (unsigned i = 0; i < HD; i++) {
+ size_t o = ((size_t)g * max_pos + t) * HD + i;
+ c->kc[o] = omega_dattn_bf16_rne(frand(&s, -1.0f, 1.0f)); c->vc[o] = omega_dattn_bf16_rne(frand(&s, -1.0f, 1.0f));
+ }
+}
+static void case_free(Case *c) { free(c->qkv); free(c->kc); free(c->vc); }
+/* the kernel's inputs: q and k heads permuted, v as is; norms 1 + w permuted */
+static void case_kernel_qkv(const Case *c, float *qkv_k) {
+ for (size_t t = 0; t < c->m; t++) {
+ const float *src = c->qkv + t * QW; float *dst = qkv_k + t * QW;
+ for (unsigned h = 0; h < QH + KVH; h++) omega_dattn256_perm_vec(src + h * HD, dst + h * HD, c->rotary);
+ memcpy(dst + KEND, src + KEND, (size_t)KVH * HD * 4);
+ }
+}
+static void case_kernel_norms(const Case *c, float *qn_k, float *kn_k) {
+ float t[HD];
+ for (unsigned i = 0; i < HD; i++) t[i] = 1.0f + c->qn[i];
+ omega_dattn256_perm_vec(t, qn_k, c->rotary);
+ for (unsigned i = 0; i < HD; i++) t[i] = 1.0f + c->kn[i];
+ omega_dattn256_perm_vec(t, kn_k, c->rotary);
+}
+/* K history rows permuted, V as is, into a [K plane | V plane] buffer laid out like the cache (plane bytes apart) */
+static void case_history_into(const Case *c, uint8_t *kv, size_t plane) {
+ for (unsigned g = 0; g < KVH; g++) for (uint32_t t = 0; t < c->pos0; t++) {
+ size_t o = ((size_t)g * c->max_pos + t);
+ omega_dattn256_perm_vec_bf16(c->kc + o * HD, (uint16_t *)(kv + o * RB), c->rotary);
+ memcpy(kv + plane + o * RB, c->vc + o * HD, RB);
+ }
+}
+
+/* ---- double-precision oracle (test-owned: libm) in MODEL order ---- */
+static void norm_rope(double *x, const float *w, float eps, uint32_t rotary, uint32_t pos) {
+ double ss = 0; for (unsigned i = 0; i < HD; i++) ss += x[i] * x[i];
+ double r = 1.0 / sqrt(ss / (double)HD + (double)eps);
+ for (unsigned i = 0; i < HD; i++) x[i] = x[i] * r * (1.0 + (double)w[i]);
+ const unsigned half = rotary / 2;
+ for (unsigned j = 0; j < half; j++) {
+ double inv = 1.0 / pow(THETA, (double)(2 * j) / (double)rotary), ang = (double)pos * inv, cs = cos(ang), sn = sin(ang);
+ double x1 = x[j], x2 = x[j + half];
+ x[j] = x1 * cs - x2 * sn; x[j + half] = x2 * cs + x1 * sn;
+ }
+}
+/* the reference K/V rows (model order, bf16) of every chunk token: kn/vn [m][4][256] */
+static void ref_rows(const Case *c, uint16_t *kn, uint16_t *vn) {
+ for (size_t t = 0; t < c->m; t++) for (unsigned g = 0; g < KVH; g++) {
+ const float *row = c->qkv + t * QW; double k[HD];
+ for (unsigned i = 0; i < HD; i++) k[i] = row[QEND + g * HD + i];
+ norm_rope(k, c->kn, EPS, c->rotary, c->pos0 + (uint32_t)t);
+ for (unsigned i = 0; i < HD; i++) { kn[(t * KVH + g) * HD + i] = omega_dattn_bf16_rne((float)k[i]); vn[(t * KVH + g) * HD + i] = omega_dattn_bf16_rne(row[KEND + g * HD + i]); }
+ }
+}
+/* reference output of chunk token t: out[6144] (* out_scale) */
+static void ref_token(const Case *c, const uint16_t *kn, const uint16_t *vn, size_t t, float out_scale, double *out) {
+ const uint32_t pos = c->pos0 + (uint32_t)t;
+ double *p = malloc(((size_t)pos + 1) * sizeof(double));
+ for (unsigned h = 0; h < QH; h++) {
+ const unsigned g = h / (QH / KVH);
+ double q[HD]; float qb[HD];
+ for (unsigned i = 0; i < HD; i++) q[i] = c->qkv[t * QW + h * HD + i];
+ norm_rope(q, c->qn, EPS, c->rotary, pos);
+ for (unsigned i = 0; i < HD; i++) qb[i] = omega_dattn_bf16_f32(omega_dattn_bf16_rne((float)(q[i] * (double)QKS)));
+ double mx = -1e300;
+ for (uint32_t j = 0; j <= pos; j++) {
+ const uint16_t *kr = j < c->pos0 ? c->kc + ((size_t)g * c->max_pos + j) * HD : kn + ((size_t)(j - c->pos0) * KVH + g) * HD;
+ double s = 0; for (unsigned i = 0; i < HD; i++) s += (double)qb[i] * (double)omega_dattn_bf16_f32(kr[i]);
+ p[j] = s; if (s > mx) mx = s;
+ }
+ double l = 0, o[HD]; memset(o, 0, sizeof o);
+ for (uint32_t j = 0; j <= pos; j++) {
+ const double w = exp2(p[j] - mx); l += w;
+ const uint16_t *vr = j < c->pos0 ? c->vc + ((size_t)g * c->max_pos + j) * HD : vn + ((size_t)(j - c->pos0) * KVH + g) * HD;
+ for (unsigned i = 0; i < HD; i++) o[i] += w * (double)omega_dattn_bf16_f32(vr[i]);
+ }
+ for (unsigned i = 0; i < HD; i++) out[h * HD + i] = o[i] / l * (double)out_scale;
+ }
+ free(p);
+}
+/* the tokens parity checks: all up to 512, else first 2, last 2 and 4 spread */
+static size_t parity_tokens(uint32_t m, uint32_t *tok) {
+ if (m <= 512) { for (uint32_t t = 0; t < m; t++) tok[t] = t; return m; }
+ const uint32_t pick[8] = { 0, 1, m / 5, (2 * m) / 5, (3 * m) / 5, (4 * m) / 5, m - 2, m - 1 };
+ memcpy(tok, pick, sizeof pick);
+ return 8;
+}
+static size_t parity(const Case *c, const uint16_t *kn, const uint16_t *vn, const float *out, float out_scale, double *worst) {
+ uint32_t *tok = malloc((size_t)(c->m > 8 ? c->m : 8) * 4); size_t nt = parity_tokens(c->m, tok);
+ double *ref = malloc(OW * sizeof(double)), tol = TOL_REL * out_scale + 1e-6 * out_scale; size_t bad = 0; *worst = 0;
+ for (size_t k = 0; k < nt; k++) {
+ ref_token(c, kn, vn, tok[k], out_scale, ref);
+ for (size_t i = 0; i < OW; i++) { double d = fabs((double)out[(size_t)tok[k] * OW + i] - ref[i]); if (!(d <= tol)) bad++; if (d / tol > *worst || d != d) *worst = d != d ? INFINITY : d / tol; }
+ }
+ free(ref); free(tok);
+ return bad;
+}
+/* the rows the kernel appended (K permuted, V model order; [4][256] per token at kchip/vchip + t * 1024 words) against
+ * the reference rows: v exact, k as below */
+static float bf16f(uint16_t h) { uint32_t u = (uint32_t)h << 16; float f; memcpy(&f, &u, 4); return f; }
+/* K rows: chip == ref, or one bf16 ulp apart (at most 32 per token), or, for a value left small by the rotation's
+ * cancellation (x1 cos - x2 sin), within 8 f32 roundings of the head row's largest |k| (8 * 2^-24 * rowmax): the
+ * chip rotates in f32, the oracle in double, and a 3-ulp gap at 7e-6 in a row of O(1) values is f32 rounding, not a
+ * kernel error (seen at 30720+2048 and 129024+2048 on 2026-10-18; the rows were bit-equal to the decode program's). */
+static int rows_ok(const Case *c, const uint16_t *kchip, const uint16_t *vchip, const uint16_t *kn, const uint16_t *vn, char *why, size_t n) {
+ unsigned flips = 0, worst_tok = 0, small = 0;
+ for (size_t t = 0; t < c->m; t++) {
+ unsigned tf = 0;
+ for (unsigned g = 0; g < KVH; g++) {
+ float rowmax = 0;
+ for (unsigned i = 0; i < HD; i++) { float a = fabsf(bf16f(kn[(t * KVH + g) * HD + i])); if (a > rowmax) rowmax = a; }
+ for (unsigned i = 0; i < HD; i++) {
+ size_t ci = (t * KVH + g) * HD + i, ri = (t * KVH + g) * HD + omega_dattn256_perm_slot(i, c->rotary);
+ if (vchip[ci] != vn[ci]) { snprintf(why, n, "token %zu v[%u][%u] chip %04x ref %04x", t, g, i, vchip[ci], vn[ci]); return 0; }
+ if (kchip[ci] == kn[ri]) continue;
+ int d = (int)kchip[ci] - (int)kn[ri];
+ if (d >= -1 && d <= 1) { tf++; continue; }
+ if (fabsf(bf16f(kchip[ci]) - bf16f(kn[ri])) <= 8.0f * 0x1p-24f * rowmax) { small++; continue; }
+ snprintf(why, n, "token %zu k[%u] slot %u chip %04x ref %04x (row max %.3g)", t, g, i, kchip[ci], kn[ri], (double)rowmax);
+ return 0;
+ }
+ }
+ if (tf > 32) { snprintf(why, n, "token %zu: %u one-ulp k flips", t, tf); return 0; }
+ if (tf > worst_tok) worst_tok = tf;
+ flips += tf;
+ }
+ snprintf(why, n, "ok (%u one-ulp k flips, worst token %u; %u small-value k gaps within 8 f32 roundings of the row max)", flips, worst_tok, small);
+ return 1;
+}
+/* ------------------------------------------------------------- host only */
+static void host_only(void) {
+ for (int m = 0; m <= 2; m++) {
+ OmegaPrefillAttn256Spec s = { m }; uint32_t n = 0, gp = 0, ph = 0;
+ int rc = omega_prefill_attn256_prog_stats(&s, &n, &gp, &ph);
+ const uint32_t dec = omega_bw_gpr_declared(gp);
+ CHECK(rc == 0 && n <= BW_MAX_IR_INSNS && gp <= BW_PHYS_GPR_HW_LIMIT && 256u * dec <= 65536u && ph > 0,
+ "attend codegen mutant %d: rc %d insns %u gprs %u (declared %u) placeholders %u", m, rc, n, gp, dec, ph);
+ if (rc == 0 && m == 0) printf("attend: %u instructions, %u registers (declared %u, 256 threads -> %u of 65536), %u placeholders\n", n, gp, dec, 256 * dec, ph);
+ }
+ { OmegaPrefillAttn256Spec s = { 3 }; CHECK(omega_prefill_attn256_prog_stats(&s, NULL, NULL, NULL) != 0, "attend mutant 3 refused");
+ s.mutant = -1; CHECK(omega_prefill_attn256_prog_stats(&s, NULL, NULL, NULL) != 0, "attend mutant -1 refused"); }
+ static const int pm[3] = { 0, 1, 3 };
+ for (unsigned k = 0; k < 3; k++) {
+ OmegaDecodeAttn256Spec s = { .depth = OMEGA_GPU_DATTN256_DEPTH, .mutant = pm[k], .prep = 1 }; uint32_t n = 0, gp = 0;
+ int rc = omega_decode_attn256_prog_stats(&s, &n, &gp);
+ CHECK(rc == 0 && n <= BW_MAX_IR_INSNS && gp <= BW_PHYS_GPR_MAX - 2, "prep codegen mutant %d: rc %d insns %u gprs %u", pm[k], rc, n, gp);
+ if (rc == 0 && k == 0) printf("prep: %u instructions, %u registers\n", n, gp);
+ }
+ { OmegaDecodeAttn256Spec s = { .depth = 4, .prep = 2 }; CHECK(omega_decode_attn256_prog_stats(&s, NULL, NULL) != 0, "prep 2 refused"); }
+ static uint8_t code[1 << 17];
+ for (unsigned k = 0; k < 2; k++) {
+ uint32_t gp = 0; int np = -1; size_t n = omega_gpu_prefill_attn256_encode(k, code, sizeof code, &gp, &np);
+ CHECK(n > 0 && (k == 0 ? np == 0 : np > 0), "encode %s: %zu bytes, gprs %u, %d placeholders patched", k ? "attend" : "prep", n, gp, np);
+ }
+ CHECK(omega_gpu_prefill_attn256_encode(2, code, sizeof code, NULL, NULL) == 0, "encode kind 2 refused");
+ CHECK(omega_gpu_prefill_attn256_encode(1, code, 64, NULL, NULL) == 0, "encode into a too-small buffer refused");
+ CHECK(OMEGA_PATTN256_SHARED_BYTES <= 16384u, "attend shared memory within the QMD cap");
+ CHECK(OMEGA_PATTN256_QF_OFF(1, 0, 0, 0, 0) == OMEGA_PATTN256_QF_PAIR_BYTES && OMEGA_PATTN256_QF_OFF(0, 3, 5, 15, 3) + 16u == OMEGA_PATTN256_QF_PAIR_BYTES, "QF layout: one token pair is 24576 bytes, densely packed");
+ CHECK(omega_gpu_prefill_attn256(NULL, 0, 0, 1, (const float *)code, EPS, 1.0f, (float *)code, NULL) == OMEGA_GPU_DATTN_BAD_ARGS, "NULL cache refused");
+ CHECK(omega_gpu_prefill_attn256_reserve(0) == OMEGA_GPU_DATTN_BAD_ARGS && omega_gpu_prefill_attn256_reserve(OMEGA_GPU_PATTN256_MAX_M + 1) == OMEGA_GPU_DATTN_BAD_ARGS, "reserve 0 and above MAX_M refused before any device work");
+ /* reference sanity: one token at position 0 returns its own rounded v */
+ { Case c; case_make(&c, 256, 0, 1, 64, 11, 1.0f); uint16_t kn[KVH * HD], vn[KVH * HD]; double ref[OW];
+ ref_rows(&c, kn, vn); ref_token(&c, kn, vn, 0, 1.0f, ref);
+ int good = 1; for (unsigned h = 0; h < QH; h++) for (unsigned i = 0; i < HD; i++) good &= fabs(ref[h * HD + i] - (double)omega_dattn_bf16_f32(vn[(h / 6) * HD + i])) < 1e-12;
+ CHECK(good, "reference: context 1 returns the rounded v of the head's KV group");
+ case_free(&c); }
+}
+
+/* ------------------------------------------------------------- simulator */
+static uint64_t g_sim_issues;
+static uint32_t g_poison; /* --poison SEED: registers start as junk in every simulated CTA (tests/bw_warp_sim_pa.h reg_poison) */
+typedef struct {
+ const Case *c;
+ uint8_t *kv; size_t plane;
+ float *rope, *norms, *qkv_k;
+} SimBufs;
+static void cb64(WsSim *s, unsigned off, const void *p) { uint64_t a = (uintptr_t)p; s->cbank[off / 4] = (uint32_t)a; s->cbank[off / 4 + 1] = (uint32_t)(a >> 32); }
+static void cbf(WsSim *s, unsigned off, float f) { memcpy(&s->cbank[off / 4], &f, 4); }
+/* the decode program (prep 0 or 1) at position pos (prep: tokens pos .. pos+grid_x-1, qkv rows from qkv_k) */
+static int sim_decode_launch(const BlackwellIRProgram *prog, const SimBufs *b, uint32_t pos, uint32_t grid_x, const float *qkv_k, size_t qkv_bytes,
+ void *out, size_t out_bytes, float *part, size_t part_bytes, uint32_t *cnt, uint32_t splits, int order, char *msg, size_t n) {
+ static uint8_t smem[OMEGA_DATTN256_SHARED_BYTES];
+ WsSim s; memset(&s, 0, sizeof s);
+ s.p = prog; s.threads = 256; s.order = order; s.reg_poison = g_poison; s.smem = smem; s.smem_bytes = sizeof smem;
+ cb64(&s, OMEGA_DATTN256_ARG_QKV, qkv_k); cb64(&s, OMEGA_DATTN256_ARG_KC, b->kv); cb64(&s, OMEGA_DATTN256_ARG_VC, b->kv + b->plane);
+ cb64(&s, OMEGA_DATTN256_ARG_ROPE, b->rope); cb64(&s, OMEGA_DATTN256_ARG_QN, b->norms); cb64(&s, OMEGA_DATTN256_ARG_KN, b->norms + HD);
+ cb64(&s, OMEGA_DATTN256_ARG_OUT, out); cb64(&s, OMEGA_DATTN256_ARG_PART, part); cb64(&s, OMEGA_DATTN256_ARG_CNT, cnt);
+ s.cbank[OMEGA_DATTN256_ARG_POS / 4] = pos; s.cbank[OMEGA_DATTN256_ARG_PER_SPLIT / 4] = 256; s.cbank[OMEGA_DATTN256_ARG_SPLITS / 4] = splits;
+ s.cbank[OMEGA_DATTN256_ARG_KV_STRIDE / 4] = b->c->max_pos * RB;
+ cbf(&s, OMEGA_DATTN256_ARG_EPS, EPS); cbf(&s, OMEGA_DATTN256_ARG_OUT_SCALE, 1.0f); cbf(&s, OMEGA_DATTN256_ARG_QK_SCALE, QKS);
+ s.nranges = 5;
+ s.ranges[0].lo = (uintptr_t)qkv_k; s.ranges[0].hi = (uintptr_t)qkv_k + qkv_bytes;
+ s.ranges[1].lo = (uintptr_t)b->kv; s.ranges[1].hi = (uintptr_t)b->kv + 2 * b->plane;
+ s.ranges[2].lo = (uintptr_t)b->rope; s.ranges[2].hi = (uintptr_t)b->rope + (size_t)b->c->max_pos * OMEGA_DATTN256_ROPE_ROW_BYTES;
+ s.ranges[3].lo = (uintptr_t)b->norms; s.ranges[3].hi = (uintptr_t)b->norms + 2048;
+ s.ranges[4].lo = (uintptr_t)out; s.ranges[4].hi = (uintptr_t)out + out_bytes;
+ if (part) { /* prep never touches the partials or counters: no range, so a stray access faults */
+ s.ranges[5].lo = (uintptr_t)part; s.ranges[5].hi = (uintptr_t)part + part_bytes;
+ s.ranges[6].lo = (uintptr_t)cnt; s.ranges[6].hi = (uintptr_t)cnt + 16; s.nranges = 7;
+ }
+ int err = ws_run(&s, grid_x, KVH);
+ if (err) { snprintf(msg, n, "%s launch at %u: %s (pc %d)", part ? "decode" : "prep", pos, s.msg, s.err_pc); return -1; }
+ g_sim_issues += s.warp_issues;
+ return 0;
+}
+static int sim_attend_launch(const BlackwellIRProgram *prog, const SimBufs *b, const uint8_t *qf, size_t qf_bytes, float *out, int order, char *msg, size_t n) {
+ static uint8_t smem[OMEGA_PATTN256_SHARED_BYTES];
+ const Case *c = b->c;
+ WsSim s; memset(&s, 0, sizeof s);
+ s.p = prog; s.threads = OMEGA_PATTN256_THREADS; s.order = order; s.reg_poison = g_poison; s.smem = smem; s.smem_bytes = sizeof smem;
+ cb64(&s, OMEGA_PATTN256_ARG_QF, qf); cb64(&s, OMEGA_PATTN256_ARG_KC, b->kv); cb64(&s, OMEGA_PATTN256_ARG_VC, b->kv + b->plane); cb64(&s, OMEGA_PATTN256_ARG_OUT, out);
+ s.cbank[OMEGA_PATTN256_ARG_POS0 / 4] = c->pos0; s.cbank[OMEGA_PATTN256_ARG_MC / 4] = c->m; s.cbank[OMEGA_PATTN256_ARG_KV_STRIDE / 4] = c->max_pos * RB;
+ cbf(&s, OMEGA_PATTN256_ARG_OUT_SCALE, 1.0f);
+ s.nranges = 3;
+ s.ranges[0].lo = (uintptr_t)qf; s.ranges[0].hi = (uintptr_t)qf + qf_bytes;
+ s.ranges[1].lo = (uintptr_t)b->kv; s.ranges[1].hi = (uintptr_t)b->kv + 2 * b->plane;
+ s.ranges[2].lo = (uintptr_t)out; s.ranges[2].hi = (uintptr_t)out + (size_t)c->m * OW * 4;
+ int err = ws_run(&s, (c->m + OMEGA_PATTN256_TOKENS - 1) / OMEGA_PATTN256_TOKENS, KVH);
+ if (err) { snprintf(msg, n, "attend: %s (pc %d)", s.msg, s.err_pc); return -1; }
+ g_sim_issues += s.warp_issues;
+ return 0;
+}
+static int sim_point(uint32_t max_pos, uint32_t pos0, uint32_t m, uint32_t rotary, float qscale, uint32_t seed, int orders, int prep_mut, int att_mut,
+ char *msg, size_t n, double *worst, size_t *bad) {
+ static BlackwellIRProgram pprog, aprog, dprog;
+ OmegaDecodeAttn256Spec ps = { .depth = OMEGA_GPU_DATTN256_DEPTH, .mutant = prep_mut, .prep = 1 }, ds = { .depth = OMEGA_GPU_DATTN256_DEPTH };
+ OmegaPrefillAttn256Spec as = { att_mut };
+ if (omega_blackwell_codegen_decode_attn256_prog(&ps, &pprog) != 0 || omega_blackwell_codegen_prefill_attn256_prog(&as, &aprog) != 0 ||
+ omega_blackwell_codegen_decode_attn256_prog(&ds, &dprog) != 0) { snprintf(msg, n, "codegen refused"); return -1; }
+ Case c; case_make(&c, max_pos, pos0, m, rotary, seed, qscale);
+ SimBufs b = { .c = &c };
+ b.plane = (size_t)KVH * max_pos * RB + OMEGA_DATTN256_PLANE_SLACK;
+ b.kv = aligned_alloc(16, 2 * b.plane);
+ uint8_t *twin = aligned_alloc(16, 2 * b.plane);
+ b.rope = aligned_alloc(16, (size_t)max_pos * OMEGA_DATTN256_ROPE_ROW_BYTES);
+ for (uint32_t p = 0; p < max_pos; p++) omega_dattn256_rope_row(p, THETA, rotary, b.rope + (size_t)p * 256);
+ b.norms = aligned_alloc(16, 2048); case_kernel_norms(&c, b.norms, b.norms + HD);
+ b.qkv_k = aligned_alloc(16, (size_t)m * QW * 4); case_kernel_qkv(&c, b.qkv_k);
+ const size_t qf_bytes = (size_t)((m + 1) / 2) * OMEGA_PATTN256_QF_PAIR_BYTES;
+ uint8_t *qf = aligned_alloc(16, qf_bytes);
+ float *out = aligned_alloc(16, (size_t)m * OW * 4), *copy = malloc((size_t)m * OW * 4);
+ int err = 0;
+ for (int order = 0; order < orders && !err; order++) {
+ memset(b.kv, 0, 2 * b.plane); case_history_into(&c, b.kv, b.plane);
+ memset(qf, 0xff, qf_bytes); /* NaN bf16 pairs: a slot the prep never wrote poisons its row */
+ for (size_t i = 0; i < (size_t)m * OW; i++) out[i] = -999.0f;
+ err = sim_decode_launch(&pprog, &b, pos0, m, b.qkv_k, (size_t)m * QW * 4, qf, qf_bytes, NULL, 0, NULL, 0, order, msg, n);
+ if (!err) err = sim_attend_launch(&aprog, &b, qf, qf_bytes, out, order, msg, n);
+ if (err) break;
+ size_t unwritten = 0; for (size_t i = 0; i < (size_t)m * OW; i++) if (out[i] == -999.0f) unwritten++;
+ if (unwritten) { err = -1; snprintf(msg, n, "%zu output words never written", unwritten); break; }
+ if (order == 0) memcpy(copy, out, (size_t)m * OW * 4);
+ else if (memcmp(copy, out, (size_t)m * OW * 4) != 0) { err = -1; snprintf(msg, n, "the fragment order changed the result"); }
+ }
+ if (!err) {
+ /* twin: m decode steps of the decode program from the same history */
+ memset(twin, 0, 2 * b.plane); case_history_into(&c, twin, b.plane);
+ SimBufs tb = b; tb.kv = twin;
+ float *dout = aligned_alloc(16, OW * 4);
+ const uint32_t smax = (pos0 + m + 255) / 256;
+ float *part = aligned_alloc(16, (size_t)KVH * smax * OMEGA_DATTN256_PARTIAL_WORDS * 4);
+ uint32_t *cnt = aligned_alloc(16, 16);
+ for (uint32_t t = 0; t < m && !err; t++) {
+ const uint32_t pos = pos0 + t, splits = (pos + 256) / 256;
+ memset(cnt, 0, 16);
+ err = sim_decode_launch(&dprog, &tb, pos, splits, b.qkv_k + (size_t)t * QW, QW * 4, dout, OW * 4, part, (size_t)KVH * splits * OMEGA_DATTN256_PARTIAL_WORDS * 4, cnt, splits, 0, msg, n);
+ }
+ free(dout); free(part); free(cnt);
+ size_t rowdiff = 0;
+ for (unsigned h = 0; h < 2 * KVH && !err; h++) {
+ const size_t o = (h >= KVH ? b.plane : 0) + (size_t)(h % KVH) * max_pos * RB;
+ for (uint32_t t = 0; t < pos0 + m; t++) rowdiff += memcmp(b.kv + o + (size_t)t * RB, twin + o + (size_t)t * RB, RB) != 0;
+ }
+ uint16_t *kn = malloc((size_t)m * KVH * HD * 2), *vn = malloc((size_t)m * KVH * HD * 2), *kch = malloc((size_t)m * KVH * HD * 2), *vch = malloc((size_t)m * KVH * HD * 2);
+ ref_rows(&c, kn, vn);
+ for (uint32_t t = 0; t < m; t++) for (unsigned g = 0; g < KVH; g++) {
+ const size_t o = ((size_t)g * max_pos + pos0 + t) * RB;
+ memcpy(kch + ((size_t)t * KVH + g) * HD, b.kv + o, RB); memcpy(vch + ((size_t)t * KVH + g) * HD, b.kv + b.plane + o, RB);
+ }
+ char why[160];
+ if (!err) {
+ int rok = rows_ok(&c, kch, vch, kn, vn, why, sizeof why);
+ *bad = parity(&c, kn, vn, out, 1.0f, worst);
+ if (rowdiff) *bad += 1000000 ;
+ if (!rok) *bad += 2000000 ;
+ snprintf(msg, n, "bad=%zu worst=%.3f rows vs decode twin: %zu differ; vs reference: %s", *bad, *worst, rowdiff, why);
+ }
+ free(kn); free(vn); free(kch); free(vch);
+ }
+ free(b.kv); free(twin); free(b.rope); free(b.norms); free(b.qkv_k); free(qf); free(out); free(copy); case_free(&c);
+ return err;
+}
+static void sim_battery(void) {
+ char msg[400]; double worst; size_t bad;
+ struct { uint32_t max_pos, pos0, m, rot; float qs; int orders; const char *name; } pts[] = {
+ { 256, 0, 1, 64, 1.0f, 2, "one token at position 0" },
+ { 256, 0, 8, 64, 1.0f, 2, "8 tokens from 0 (one CTA)" },
+ { 256, 0, 37, 64, 1.0f, 2, "37 tokens from 0 (odd m, partial CTA)" },
+ { 256, 37, 19, 64, 1.0f, 2, "19 tokens from 37 (odd start)" },
+ { 256, 100, 19, 64, 4.0f, 1, "19 tokens from 100, sharp q (x4)" },
+ { 512, 250, 40, 64, 1.0f, 1, "40 tokens from 250 (crosses 256)" },
+ { 256, 0, 24, 256, 1.0f, 1, "24 tokens from 0, full rope (rotary 256)" },
+ };
+ for (size_t i = 0; i < sizeof pts / sizeof pts[0]; i++) {
+ double t0 = now_ms();
+ int err = sim_point(pts[i].max_pos, pts[i].pos0, pts[i].m, pts[i].rot, pts[i].qs, 100 + (uint32_t)i, pts[i].orders, 0, 0, msg, sizeof msg, &worst, &bad);
+ CHECK(err == 0 && bad == 0, "sim %s: %s", pts[i].name, msg);
+ printf("sim %-42s %s %s (%.1f s)\n", pts[i].name, err ? "ERROR" : bad ? "MISMATCH" : "ok", msg, (now_ms() - t0) / 1e3);
+ fflush(stdout);
+ }
+ static const struct { int pm, am; } mut[] = { { 1, 0 }, { 3, 0 }, { 0, 1 }, { 0, 2 } };
+ for (size_t i = 0; i < sizeof mut / sizeof mut[0]; i++) {
+ int err = sim_point(256, 40, 24, 64, 1.0f, 200, 1, mut[i].pm, mut[i].am, msg, sizeof msg, &worst, &bad);
+ int caught = err != 0 || bad > 0;
+ CHECK(caught, "sim %s mutant %d NOT caught (%s)", mut[i].pm ? "prep" : "attend", mut[i].pm ? mut[i].pm : mut[i].am, msg);
+ printf("sim %s mutant %d at 24 tokens from 40: %s (%s)\n", mut[i].pm ? "prep" : "attend", mut[i].pm ? mut[i].pm : mut[i].am, caught ? "caught" : "MISSED", msg);
+ fflush(stdout);
+ }
+ printf("sim: %" PRIu64 " warp issues in total\n", g_sim_issues);
+}
+
+/* ------------------------------------------------------------- chip */
+static FILE *g_json;
+static int g_json_first = 1;
+static int cache_with_history(const Case *c, OmegaGpuDecodeAttn256Cache **out) {
+ int rc = omega_gpu_decode_attn256_cache_alloc(1, c->max_pos, THETA, c->rotary, out);
+ if (rc != OMEGA_GPU_DATTN_OK) return rc;
+ float qn_k[HD], kn_k[HD]; case_kernel_norms(c, qn_k, kn_k);
+ rc = omega_gpu_decode_attn256_set_norms(*out, 0, qn_k, kn_k);
+ if (rc != OMEGA_GPU_DATTN_OK || c->pos0 == 0) return rc;
+ uint16_t *kp = malloc((size_t)c->pos0 * RB);
+ for (unsigned g = 0; g < KVH && rc == OMEGA_GPU_DATTN_OK; g++) {
+ for (uint32_t t = 0; t < c->pos0; t++) omega_dattn256_perm_vec_bf16(c->kc + ((size_t)g * c->max_pos + t) * HD, kp + (size_t)t * HD, c->rotary);
+ rc = omega_gpu_decode_attn256_cache_write(*out, 0, g, 0, c->pos0, kp, c->vc + (size_t)g * c->max_pos * HD);
+ }
+ free(kp);
+ return rc;
+}
+/* the chunk's appended rows, [m][4][256] each (K permuted as stored) */
+static int read_rows(OmegaGpuDecodeAttn256Cache *cc, const Case *c, uint16_t *k, uint16_t *v) {
+ for (uint32_t t = 0; t < c->m; t++) for (unsigned g = 0; g < KVH; g++) {
+ int rc = omega_gpu_decode_attn256_cache_read(cc, 0, g, c->pos0 + t, k + ((size_t)t * KVH + g) * HD, v + ((size_t)t * KVH + g) * HD);
+ if (rc != OMEGA_GPU_DATTN_OK) return rc;
+ }
+ return OMEGA_GPU_DATTN_OK;
+}
+static uint64_t median_u64(uint64_t *v, int n) { qsort(v, (size_t)n, sizeof *v, cmp_u64); return v[n / 2]; }
+static int chip_point(uint32_t max_pos, uint32_t pos0, uint32_t m, float qscale, uint32_t seed, int twin, int reps) {
+ printf("-- chip %u tokens from %u (max_pos %u)\n", m, pos0, max_pos); fflush(stdout);
+ Case c; case_make(&c, max_pos, pos0, m, 64, seed, qscale);
+ float *qkv_k = malloc((size_t)m * QW * 4); case_kernel_qkv(&c, qkv_k);
+ float *out = malloc((size_t)m * OW * 4), *out2 = malloc((size_t)m * OW * 4);
+ const size_t rw = (size_t)m * KVH * HD;
+ uint16_t *kn = malloc(rw * 2), *vn = malloc(rw * 2), *kch = malloc(rw * 2), *vch = malloc(rw * 2), *ktw = malloc(rw * 2), *vtw = malloc(rw * 2);
+ OmegaGpuDecodeAttn256Cache *cc = NULL, *tc = NULL;
+ OmegaGpuPrefillAttn256Info info;
+ int ok = 1; char why[200]; double worst = 0; size_t bad = 0;
+ int rc = cache_with_history(&c, &cc);
+ CHECK(rc == OMEGA_GPU_DATTN_OK, "cache with history: %s %s", omega_gpu_decode_attn_rc_name(rc), rc ? omega_gpu_decode_attn_last_error() : "");
+ if (rc != OMEGA_GPU_DATTN_OK) { ok = 0; goto done; }
+ rc = omega_gpu_prefill_attn256(cc, 0, pos0, m, qkv_k, EPS, 1.0f, out, &info);
+ CHECK(rc == OMEGA_GPU_DATTN_OK, "prefill %u+%u: %s %s", pos0, m, omega_gpu_decode_attn_rc_name(rc), rc ? omega_gpu_decode_attn_last_error() : "");
+ if (rc != OMEGA_GPU_DATTN_OK) { ok = 0; goto done; }
+ printf(" prep %u insns %u regs, attend %u insns %u regs; first call %.3f ms (prep %.3f, attend %.3f)\n", info.insns[0], info.gprs[0], info.insns[1], info.gprs[1],
+ info.call_ns / 1e6, info.elapsed_ns[0] / 1e6, info.elapsed_ns[1] / 1e6);
+ ref_rows(&c, kn, vn);
+ rc = read_rows(cc, &c, kch, vch);
+ int rok = rc == OMEGA_GPU_DATTN_OK && rows_ok(&c, kch, vch, kn, vn, why, sizeof why);
+ CHECK(rok, "%u+%u: appended rows vs reference: %s", pos0, m, rc ? "read failed" : why);
+ double t0 = now_ms();
+ bad = parity(&c, kn, vn, out, 1.0f, &worst);
+ CHECK(bad == 0, "%u+%u: parity: %zu elements outside the tolerance (worst ratio %.3f)", pos0, m, bad, worst);
+ printf(" parity: %zu bad, worst ratio %.3f of the tolerance (%.1f s reference); rows: %s\n", bad, worst, (now_ms() - t0) / 1e3, rok ? why : "FAIL");
+ ok &= rok && bad == 0;
+ /* second call over the same positions: the same rows are rewritten, the same output */
+ rc = omega_gpu_prefill_attn256(cc, 0, pos0, m, qkv_k, EPS, 1.0f, out2, &info);
+ CHECK(rc == OMEGA_GPU_DATTN_OK && memcmp(out, out2, (size_t)m * OW * 4) == 0 && info.kernel_cache_hits == 2, "%u+%u: second call bit-identical with both kernels cached (rc %d hits %u)", pos0, m, rc, info.kernel_cache_hits);
+ /* out_scale 2^20: exact */
+ rc = omega_gpu_prefill_attn256(cc, 0, pos0, m, qkv_k, EPS, 1048576 .0f, out2, NULL);
+ { size_t diff = 0; for (size_t i = 0; i < (size_t)m * OW; i++) diff += out2[i] != out[i] * 1048576 .0f;
+ CHECK(rc == OMEGA_GPU_DATTN_OK && diff == 0, "%u+%u: out_scale 2^20 is exact (%zu words differ)", pos0, m, diff); }
+ /* device entry == host entry */
+ {
+ OmegaGpuMem q, o; memset(&q, 0, sizeof q); memset(&o, 0, sizeof o);
+ omega_gpu_session_lock();
+ int arc = omega_gpu_session_open() && omega_gpu_session_alloc((size_t)m * QW * 4, &q) == 0 && omega_gpu_session_alloc((size_t)m * OW * 4, &o) == 0 ? 0 : -1;
+ if (arc == 0) { memcpy(q.cpu, qkv_k, (size_t)m * QW * 4); float *od = o.cpu; for (size_t i = 0; i < (size_t)m * OW; i++) od[i] = -999.0f;
+ arc = omega_gpu_session_sync_to_gpu(&q) | omega_gpu_session_sync_to_gpu(&o); }
+ omega_gpu_session_unlock();
+ rc = arc == 0 ? omega_gpu_prefill_attn256_dev(cc, 0, pos0, m, q.va, EPS, 1.0f, o.va, NULL) : OMEGA_GPU_DATTN_CHIP_FAIL;
+ omega_gpu_session_lock();
+ int same = rc == OMEGA_GPU_DATTN_OK && omega_gpu_session_sync_to_cpu(&o) == 0 && memcmp(o.cpu, out, (size_t)m * OW * 4) == 0;
+ if (q.cpu) omega_gpu_session_free(&q);
+ if (o.cpu) omega_gpu_session_free(&o);
+ omega_gpu_session_unlock();
+ CHECK(same, "%u+%u: device entry bit-identical to the host entry (rc %s)", pos0, m, omega_gpu_decode_attn_rc_name(rc));
+ }
+ /* twin: m decode calls from the same history; rows bit-identical, then the next decode step on both caches */
+ if (twin) {
+ rc = cache_with_history(&c, &tc);
+ float *dout = malloc(OW * 4);
+ t0 = now_ms();
+ for (uint32_t t = 0; t < m && rc == OMEGA_GPU_DATTN_OK; t++) rc = omega_gpu_decode_attn256(tc, 0, pos0 + t, qkv_k + (size_t)t * QW, EPS, 1.0f, dout, NULL);
+ const double dec_ms = now_ms() - t0;
+ CHECK(rc == OMEGA_GPU_DATTN_OK, "%u+%u: twin decode loop: %s %s", pos0, m, omega_gpu_decode_attn_rc_name(rc), rc ? omega_gpu_decode_attn_last_error() : "");
+ if (rc == OMEGA_GPU_DATTN_OK) rc = read_rows(tc, &c, ktw, vtw);
+ size_t kd = 0, vd = 0;
+ for (size_t i = 0; i < rw && rc == OMEGA_GPU_DATTN_OK; i++) { kd += kch[i] != ktw[i]; vd += vch[i] != vtw[i]; }
+ CHECK(rc == OMEGA_GPU_DATTN_OK && kd == 0 && vd == 0, "%u+%u: rows bit-identical to %u decode calls (k %zu, v %zu words differ)", pos0, m, m, kd, vd);
+ printf(" twin: %u decode calls %.1f ms; rows k %zu v %zu words differ\n", m, dec_ms, kd, vd);
+ if (pos0 + m < max_pos && rc == OMEGA_GPU_DATTN_OK) {
+ float *nq = malloc(QW * 4), *o1 = malloc(OW * 4), *o2 = malloc(OW * 4); uint32_t s = seed ^ 0x5a5a5a5au;
+ for (unsigned h = 0; h < QH + KVH; h++) { float raw[HD]; for (unsigned i = 0; i < HD; i++) raw[i] = frand(&s, -1.0f, 1.0f); omega_dattn256_perm_vec(raw, nq + h * HD, 64); }
+ for (unsigned i = KEND; i < QW; i++) nq[i] = frand(&s, -1.0f, 1.0f);
+ int r1 = omega_gpu_decode_attn256(cc, 0, pos0 + m, nq, EPS, 1.0f, o1, NULL), r2 = omega_gpu_decode_attn256(tc, 0, pos0 + m, nq, EPS, 1.0f, o2, NULL);
+ CHECK(r1 == OMEGA_GPU_DATTN_OK && r2 == OMEGA_GPU_DATTN_OK && memcmp(o1, o2, OW * 4) == 0, "%u+%u: next decode step bit-identical after prefill and after the decode loop", pos0, m);
+ free(nq); free(o1); free(o2);
+ }
+ free(dout);
+ }
+ /* timing: reps calls on the same positions (rows rewritten with the same bits) */
+ if (reps > 0) {
+ uint64_t *pp = malloc((size_t)reps * 8), *aa = malloc((size_t)reps * 8), *cl = malloc((size_t)reps * 8);
+ for (int r = 0; r < reps && rc == OMEGA_GPU_DATTN_OK; r++) {
+ rc = omega_gpu_prefill_attn256(cc, 0, pos0, m, qkv_k, EPS, 1.0f, out2, &info);
+ pp[r] = info.elapsed_ns[0]; aa[r] = info.elapsed_ns[1]; cl[r] = info.call_ns;
+ }
+ CHECK(rc == OMEGA_GPU_DATTN_OK, "%u+%u: timing calls", pos0, m);
+ if (rc == OMEGA_GPU_DATTN_OK) {
+ const uint64_t mp = median_u64(pp, reps), ma = median_u64(aa, reps), mc = median_u64(cl, reps);
+ /* useful work: QK^T and PV over the causal context, 2 flops per multiply-add, 24 heads x 256 dims */
+ double flops = 0, kvb = 0;
+ for (uint32_t t = 0; t < m; t++) flops += 4.0 * (double)(pos0 + t + 1) * QH * HD;
+ for (uint32_t cx = 0; cx * OMEGA_PATTN256_TOKENS < m; cx++) {
+ uint32_t nk = (cx + 1) * OMEGA_PATTN256_TOKENS; if (nk > m) nk = m;
+ kvb += (double)KVH * (((pos0 + nk - 1) >> 4) + 1) * 16.0 * 2 * RB;
+ }
+ printf(" timing (median of %d): prep %.3f ms, attend %.3f ms, call %.3f ms -> %.0f tokens/s; attend %.2f TFLOPS useful, %.1f GB/s K/V streamed\n",
+ reps, mp / 1e6, ma / 1e6, mc / 1e6, m / ((mp + ma) / 1e9), flops / (double)ma / 1e3, kvb / (double)ma);
+ if (g_json) {
+ fprintf(g_json, "%s {\"pos0\": %u, \"m\": %u, \"max_pos\": %u, \"reps\": %d, \"prep_ns\": %" PRIu64 ", \"attend_ns\": %" PRIu64 ", \"call_ns\": %" PRIu64 ", \"attend_useful_flops\": %.0f, \"attend_kv_bytes\": %.0f, \"parity_bad\": %zu, \"parity_worst_ratio\": %.4f}",
+ g_json_first ? "" : ",\n", pos0, m, max_pos, reps, mp, ma, mc, flops, kvb, bad, worst);
+ g_json_first = 0;
+ }
+ }
+ free(pp); free(aa); free(cl);
+ }
+done:
+ if (tc) omega_gpu_decode_attn256_cache_free(tc);
+ if (cc) omega_gpu_decode_attn256_cache_free(cc);
+ free(qkv_k); free(out); free(out2); free(kn); free(vn); free(kch); free(vch); free(ktw); free(vtw); case_free(&c);
+ return ok;
+}
+static void chip_mutants(void) {
+ static const struct { int pm, am; } mut[] = { { 1, 0 }, { 3, 0 }, { 0, 1 }, { 0, 2 } };
+ for (size_t i = 0; i < sizeof mut / sizeof mut[0]; i++) {
+ omega_gpu_prefill_attn256_test_set_mutant(mut[i].pm, mut[i].am);
+ Case c; case_make(&c, 256, 40, 24, 64, 300, 1.0f);
+ float *qkv_k = malloc((size_t)c.m * QW * 4); case_kernel_qkv(&c, qkv_k);
+ float *out = malloc((size_t)c.m * OW * 4);
+ uint16_t *kn = malloc((size_t)c.m * KVH * HD * 2), *vn = malloc((size_t)c.m * KVH * HD * 2), *kch = malloc((size_t)c.m * KVH * HD * 2), *vch = malloc((size_t)c.m * KVH * HD * 2);
+ OmegaGpuDecodeAttn256Cache *cc = NULL;
+ int rc = cache_with_history(&c, &cc);
+ if (rc == OMEGA_GPU_DATTN_OK) rc = omega_gpu_prefill_attn256(cc, 0, c.pos0, c.m, qkv_k, EPS, 1.0f, out, NULL);
+ double worst = 0; size_t bad = 0; char why[200] = "";
+ int rok = 1;
+ if (rc == OMEGA_GPU_DATTN_OK) {
+ ref_rows(&c, kn, vn);
+ rok = read_rows(cc, &c, kch, vch) == OMEGA_GPU_DATTN_OK && rows_ok(&c, kch, vch, kn, vn, why, sizeof why);
+ bad = parity(&c, kn, vn, out, 1.0f, &worst);
+ }
+ const int caught = rc != OMEGA_GPU_DATTN_OK || bad > 0 || !rok;
+ CHECK(caught, "chip %s mutant %d NOT caught", mut[i].pm ? "prep" : "attend", mut[i].pm ? mut[i].pm : mut[i].am);
+ printf("chip %s mutant %d: %s (rc %s, %zu bad, worst %.1f, rows %s)\n", mut[i].pm ? "prep" : "attend", mut[i].pm ? mut[i].pm : mut[i].am, caught ? "caught" : "MISSED",
+ omega_gpu_decode_attn_rc_name(rc), bad, worst, rok ? "ok" : "differ");
+ if (cc) omega_gpu_decode_attn256_cache_free(cc);
+ free(qkv_k); free(out); free(kn); free(vn); free(kch); free(vch); case_free(&c);
+ }
+ omega_gpu_prefill_attn256_test_set_mutant(0, 0);
+}
+
+int main(int argc, char **argv) {
+ int host = 0, sim = 0, reps = 9, quick = 0, timing_only = 0; const char *json = NULL; uint32_t maxp = 32768;
+ for (int i = 1; i < argc; i++) {
+ if (!strcmp(argv[i], "--host-only")) host = 1;
+ else if (!strcmp(argv[i], "--sim")) sim = 1;
+ else if (!strcmp(argv[i], "--poison") && i + 1 < argc) g_poison = (uint32_t)strtoul(argv[++i], NULL, 0);
+ else if (!strcmp(argv[i], "--sim-point") && i + 3 < argc) { /* one simulator point: MAX_POS POS0 M */
+ uint32_t a = (uint32_t)atoi(argv[i + 1]), b = (uint32_t)atoi(argv[i + 2]), m = (uint32_t)atoi(argv[i + 3]); i += 3;
+ char msg[400]; double worst = 0; size_t bad = 0; double t0 = now_ms();
+ int err = sim_point(a, b, m, 64, 1.0f, 77, 1, 0, 0, msg, sizeof msg, &worst, &bad);
+ CHECK(err == 0 && bad == 0, "sim point %u+%u (max_pos %u): %s", b, m, a, msg);
+ printf("sim point %u tokens from %u (max_pos %u): %s %s (%.1f s)\n", m, b, a, err ? "ERROR" : bad ? "MISMATCH" : "ok", msg, (now_ms() - t0) / 1e3);
+ host = 1; }
+ else if (!strcmp(argv[i], "--quick")) quick = 1;
+ else if (!strcmp(argv[i], "--timing-only")) timing_only = 1;
+ else if (!strcmp(argv[i], "--reps") && i + 1 < argc) reps = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "--max-pos") && i + 1 < argc) maxp = (uint32_t)atoi(argv[++i]);
+ else if (!strcmp(argv[i], "--out") && i + 1 < argc) json = argv[++i];
+ else { fprintf(stderr, "usage: %s [--host-only | --sim | [--quick] [--timing-only] [--reps N] [--max-pos 32768|131072] [--out receipt.json]]\n", argv[0]); return 2; }
+ }
+ if (reps < 1) reps = 1;
+ host_only();
+ if (sim) sim_battery();
+ if (!host && !sim) {
+ if (json) { g_json = fopen(json, "w"); if (g_json) fprintf(g_json, "{\"test\": \"gpu_prefill_attn256\", \"rotary_dim\": 64, \"points\": [\n"); }
+ if (!timing_only) {
+ chip_point(256, 0, 1, 1.0f, 1, 1, 0);
+ chip_point(256, 0, 37, 1.0f, 2, 1, 0);
+ chip_point(512, 100, 19, 1.0f, 3, 1, 0);
+ chip_point(512, 37, 141, 4.0f, 4, 1, 0);
+ chip_mutants();
+ }
+ if (!quick) {
+ chip_point(4096, 0, 2048, 1.0f, 8, !timing_only, reps);
+ chip_point(8192, 6144, 2048, 1.0f, 9, !timing_only, reps);
+ chip_point(32768, 30720, 2048, 1.0f, 10, !timing_only, reps);
+ if (maxp >= 131072) chip_point(131072, 129024, 2048, 1.0f, 11, !timing_only, reps);
+ }
+ if (g_json) { fprintf(g_json, "\n], \"checks\": %d, \"failed\": %d}\n", g_checks, g_failed); fclose(g_json); }
+ }
+ printf("gpu_prefill_attn256_test: %d checks, %d failed: %s\n", g_checks, g_failed, g_failed ? "FAIL" : "PASS");
+ return g_failed ? 1 : 0;
+}
diff --git a/tools/.crumb b/tools/.crumb
index 492c12d1a ..baad8ca16 100644
--- a/tools/.crumb
+++ b/tools/.crumb
@@ -62,14 +62,14 @@
}
],
"children_root": "sha256:e1f826c2beb8604bb0dcba49575f7c6b48cf5488c40b616b212fda2ed70c62ee ",
- "compiled_at": "2026-10-18T13:06:21Z",
+ "compiled_at": "2026-10-18T15:21:47Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:db3d0e54d63e2ca868e85392d6b71a612b2a49ff95948f9e1f13b1e7072f46e8 ",
+ "digest": "sha256:e4a329c378a5873cf01d3636c85097718dcfb3e4ff4da8a1bf45801d2db96d21 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 285,
- "generated_at_commit": "c3ab69f66d6b2a2bce7efe425d80b1306e1140ed ",
- "source_tree": "sha256:a2abf5ced00b4e60ea4b863a6e99f94fd406cec098075162227613c8751769ac "
+ "files": 286,
+ "generated_at_commit": "acdeff745c292cebb3b22cc7ae298409a0b7ee64 ",
+ "source_tree": "sha256:04a1158249096adc2c94103936edd76aa5ed3c5b7d1227158f7ee1ac98144b7f "
},
"owner_lane": "",
"provenance": {
diff --git a/tools/run_gpu_prefill_attn256_chip.sh b/tools/run_gpu_prefill_attn256_chip.sh
new file mode 100755
index 000000000 ..8bfc7dde3
--- /dev/null
+++ b/tools/run_gpu_prefill_attn256_chip.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# run_gpu_prefill_attn256_chip.sh EVIDENCE_DIR [PHYSICS_DIR]
+# Qwen3.8-27B chip gate for omega_gpu_prefill_attn256_api (omega-mv#545: causal prefill attention, head_dim 256, 24 q / 4 kv
+# heads, prep launch = the decode kernel's prologue, attend launch on tensor cores).
+# Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_prefill_attn256_chip.sh EVID
+# 0. host proofs first (never hardware results): --host-only (codegen budgets, refusals, layout, reference sanity) and
+# --sim (warp-simulator parity on 7 points, rows bit-equal to the decode program, mutants)
+# and the encoder control-word check (tests/bw_encode_control_test.c: every opcode carries its scheduled waits)
+# 1. baseline: the already-proven decode attention chip test at its quick points (chip and session path work first)
+# 2. main: parity, rows bit-identical to m decode calls, next decode step identical, second call identical, out_scale,
+# device entry, mutants, timing of 2048-token chunks at contexts 2k, 8k, 32k
+# 3. informational: --timing-only --max-pos 131072 (the chunk that ends at context 128k)
+# Verdict line last: "GPU_PREFILL_ATTN256_CHIP: PASS|FAIL". Steps 0 and 2 decide; 1 and 3 are recorded.
+set -u
+EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}"
+HERE="$(cd "$(dirname "$0")/.." && pwd)"
+mkdir -p "$EVID"
+cd "$HERE" || exit 2
+{
+ echo "start $(date -u +%FT%TZ) omega=$(git rev-parse HEAD) branch=$(git rev-parse --abbrev-ref HEAD) dirty=$(git status --porcelain | wc -l) physics=$PHYS physics_commit=$(git -C "$PHYS" rev-parse HEAD) physics_lock=$(cat physics.lock 2>/dev/null | head -1)"
+ uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2
+} > "$EVID/device.txt"
+make PHYSICS_DIR="$PHYS" -j10 build/gpu_prefill_attn256_test build/gpu_decode_attn256_test build/bw_encode_control_test > "$EVID/build.log" 2>&1 || { echo "GPU_PREFILL_ATTN256_CHIP: FAIL build"; exit 1; }
+T=./build/gpu_prefill_attn256_test
+fail=0
+./build/bw_encode_control_test 2>&1 | tee "$EVID/encode-control.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
+$T --host-only 2>&1 | tee "$EVID/host-only.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
+$T --sim 2>&1 | tee "$EVID/sim.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
+./build/gpu_decode_attn256_test --reps 5 --only "context 301" --out "$EVID/receipt-baseline-decode.json" 2>&1 | tee "$EVID/baseline-decode.log"
+echo "baseline exit ${PIPESTATUS[0]} (recorded)" | tee -a "$EVID/baseline-decode.log"
+$T --reps 9 --out "$EVID/receipt-main.json" 2>&1 | tee "$EVID/main.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
+$T --reps 5 --timing-only --max-pos 131072 --out "$EVID/receipt-maxpos131072.json" 2>&1 | tee "$EVID/maxpos131072.log"; echo "max-pos 131072 exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/maxpos131072.log"
+
+echo "end $(date -u +%FT%TZ)" >> "$EVID/device.txt"
+(cd "$EVID" && sha256sum *.json *.log device.txt > SHA256SUMS)
+if [ $fail = 0 ]; then echo "GPU_PREFILL_ATTN256_CHIP: PASS"; else echo "GPU_PREFILL_ATTN256_CHIP: FAIL"; exit 1; fi