diff --git a/.crumb b/.crumb index e4da81044..1f5353046 100644 --- a/.crumb +++ b/.crumb @@ -51,8 +51,8 @@ "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "acb4b39846f70c6ed1388aed49c2be8e94bacc05c56e1ac4c5d596717882c1f3", - "last_commit": "c0369e6", + "digest": "a63059c62ce482be4d3bf91309d253dfe0cf0bc92e2e0c9848ce0a1df27de20f", + "last_commit": "d17c35f", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -64,7 +64,7 @@ }, { "digest": "f2d9839725a355ae85e54d047a70e3641d94cb6547df33eb532e16d925f544fe", - "last_commit": "e09adff", + "last_commit": "917e8b9", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, @@ -87,14 +87,14 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "b029d6586df469b9c198b733749582f7fe724c1a35b62af7583a08c1df67b392", - "last_commit": "e09adff", + "digest": "5729b9d1050029412a0e1a360ba7dc7e85eea057191ba1919a1bda6ea1a06e97", + "last_commit": "6ce003b", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "bcc2c5b959587ff0b115cd4664886cbca17cf7fc0f36a601f1b5c7edb9f05b7d", - "last_commit": "e09adff", + "digest": "8c43418cb6e8c35217c6b43b3db332d5f4b061bdf3f62c44d735d251aa5b0793", + "last_commit": "d17c35f", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -105,15 +105,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:87e095b4a1eae6ee1dd0f225c362771e49ee3ac542c4d125f0760fcdc009161b", - "compiled_at": "2026-10-07T02:55:37Z", + "children_root": "sha256:2298066853eee25e22c0d896bdfdc12c9de740cefbda6f12fc36cf3b95789ecb", + "compiled_at": "2026-10-07T03:14:57Z", "compiler": "crumb-compile/1", - "digest": "sha256:f94d30694df98504baf7ef44036d281a5243e669cef99c5b1c3112defd02283a", - "evidence_files": 4777, - "evidence_root": "sha256:9748ca0a0301a9185d1623da4f264b34dc335d265752021052702f3d2114dcfc", - "files": 6617, - "generated_at_commit": "afa40707e02617d4055ecf50a7a81515270981fc", - "source_tree": "sha256:8008be6963727913bfff283658047bbcf23b61764d983bd8f85c6c612555e53d" + "digest": "sha256:be1297cc0758e934e5dd59f01b4b50a6611531a003d7cff4f24511bbb08c7dcf", + "evidence_files": 4818, + "evidence_root": "sha256:07642731585ad396c5d9b566a4b8df7807018f494d322dffce41bd04fb51e553", + "files": 6658, + "generated_at_commit": "ee956a370b62f50a337eed4b1d360ae0170c83c0", + "source_tree": "sha256:561d455bf1f05e98bb809f15ccebbd269650eb664b9c184296996ab1a231b290" }, "owner_lane": "", "provenance": { diff --git a/Makefile b/Makefile index d9bea8ed0..6e10515b9 100644 --- a/Makefile +++ b/Makefile @@ -2285,6 +2285,7 @@ test-gpu-reconv: $(GPU_RECONV_TEST) ./$(GPU_RECONV_TEST) --host-only # FB-1 cut 5: native gqa_attention (f32 KV) and paged_attention (bf16 KV, + batch). +# head_dim 128 (CPU phase, Qwen3-4B): the same battery with --hd 128 through both host simulators; GB10 parity NOT_RUN. # test-gpu-attention runs host-only (refusals, codegen, nvdisasm listing) and then the # whole parity battery through the host IR simulator (--sim, no chip); the chip # gate is `./build/gpu_attention_test --out receipt.json` through the heavy queue @@ -2297,6 +2298,9 @@ test-gpu-attention: $(GPU_ATTN_TEST) ./$(GPU_ATTN_TEST) --host-only ./$(GPU_ATTN_TEST) --sim ./$(GPU_ATTN_TEST) --sweep --sim --out $(OUT_DIR)/gpu_attention_sweep_sim.json + ./$(GPU_ATTN_TEST) --hd 128 --host-only + ./$(GPU_ATTN_TEST) --hd 128 --sim + ./$(GPU_ATTN_TEST) --hd 128 --divergent --sim # FB-1 cut 4b: fresh-process device-open probe (flake investigation, tools/probe_gpu_open.sh) $(OUT_DIR)/gpu_session_probe: tests/gpu_session_probe.c src/omega_gpu_session.h $(OUT_DIR)/libomega_gpu.a diff --git a/docs/.crumb b/docs/.crumb index 8849404bb..d331ffc88 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -81,8 +81,8 @@ "purpose": "Directory docs/estimation. Purpose not yet described by a human." }, { - "digest": "ed0c4e7b8e7ba3b7ef4acee3c7d7d4d0c013529d514626339899d3862df052ea", - "last_commit": "b56e89b", + "digest": "62e8f966aa687b76e46f67dc0878da9b451dde8845c8300831621f02134fc8a9", + "last_commit": "d17c35f", "name": "numeric", "purpose": "Directory docs/numeric. Purpose not yet described by a human." }, @@ -117,15 +117,15 @@ "purpose": "Directory docs/turing. Purpose not yet described by a human." } ], - "children_root": "sha256:ce53c9c7f75a7d122d6a926bb304b2df1bd0730693b54887b842ad3559bafe83", - "compiled_at": "2026-10-06T18:55:17Z", + "children_root": "sha256:40c824a4491f49c13ae7637f996adfe2f76fe34fe9f8bcda9b6b5a3b2c87b343", + "compiled_at": "2026-10-07T03:13:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:acb4b39846f70c6ed1388aed49c2be8e94bacc05c56e1ac4c5d596717882c1f3", + "digest": "sha256:a63059c62ce482be4d3bf91309d253dfe0cf0bc92e2e0c9848ce0a1df27de20f", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", "files": 114, - "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", - "source_tree": "sha256:c764d5e8d30422555a58660b8a2876f48beabdb795bd7ff261ca635127e98e0b" + "generated_at_commit": "1c5339d25afc3e0a70e0aee20a3f41c486b37644", + "source_tree": "sha256:7c4e57b89d5a6118d92e2846692e786194d92b565e53b42097da27ed132457f2" }, "owner_lane": "", "provenance": { diff --git a/docs/numeric/.crumb b/docs/numeric/.crumb index d73d20fce..57a77754a 100644 --- a/docs/numeric/.crumb +++ b/docs/numeric/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-05T03:24:21Z", + "compiled_at": "2026-10-07T03:13:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:ed0c4e7b8e7ba3b7ef4acee3c7d7d4d0c013529d514626339899d3862df052ea", + "digest": "sha256:62e8f966aa687b76e46f67dc0878da9b451dde8845c8300831621f02134fc8a9", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 10, - "generated_at_commit": "b544d81db1f8d576685a8de19add13c7c59b052a", - "source_tree": "sha256:1585c3906422d4a1d6481b39728d70d350aa3a0cf121e058fb71fcf70f054026" + "generated_at_commit": "1c5339d25afc3e0a70e0aee20a3f41c486b37644", + "source_tree": "sha256:97fb0b5bcceb056f11aaee9608269be485c87de1557c700a84417d274097d6f1" }, "owner_lane": "", "provenance": { diff --git a/docs/numeric/FB1_CUT5_ATTENTION.md b/docs/numeric/FB1_CUT5_ATTENTION.md index 72786f45d..14636ee64 100644 --- a/docs/numeric/FB1_CUT5_ATTENTION.md +++ b/docs/numeric/FB1_CUT5_ATTENTION.md @@ -136,8 +136,8 @@ of that CTA instruction by instruction. ## Limits of this cut -- head_dim 64 only (TinyLlama, Llama-3.2-1B). Larger heads need a bigger shared-memory - declaration in the QMD (word 36) and a second thread-per-token tiling. +- head_dim 64 (TinyLlama, Llama-3.2-1B) on chip; head_dim 128 (Qwen3-4B) is host-simulator only, see + the head_dim 128 section below. Other head dims are refused (TOO_LARGE). - Staging copy of q, the referenced KV blocks (once per physical block per launch, OM-2) and the tables per call. No resident KV: the pool lives in an anonymous CPU mmap whose "device address" is the CPU virtual address, not a GPU VA this channel can address, and @@ -149,3 +149,63 @@ of that CTA instruction by instruction. - UNVERIFIED on chip until the gate run: forward predicated `@P0 BRA`, bf16 K loads as 32-bit pairs (the 16-bit widening itself is cut 4's), one launcher opening the device while another API in the same process holds it. + +## head_dim 128 (2026-10-07, CPU phase: GB10 parity NOT_RUN) + +Qwen3-4B: 32 query heads, 8 KV heads (GQA 4:1), head_dim 128. head_dim is now a kernel +parameter (`KSpec.hd`, 64 or 128) instead of a constant; the head_dim 64 program is the same +bytes as before (see Evidence). Status: host battery, host IR simulator and host warp +simulator PASS at head_dim 128; nothing has run on the chip. + +### Where 64 was assumed (omega main c0369e6, before this change) and what changed + +| Assumption | File:line (c0369e6) | head_dim 128 | +|---|---|---| +| `HD = 64`, threads per CTA = head_dim | `omega_gpu_attention_api.h:76`, `.c:215`, `.c:612` (launch `threads_x`), `.c:627` | `threads_x = KSpec.hd`; QMD CTA width 128 | +| head_dim refused unless 64 | `.c:663`, header comments `.h:43`, `.h:70` | 64 and 128 accepted, anything else TOO_LARGE | +| shared layout 4 x 256 B: q 0, s/p 256, token offsets 512, warp partials 768 | `.c:216-219`, `.c:240-242`, `.c:286` | 4 x 512 B: 0, 512, 1024, 1536 (`4hd`, `8hd`, `12hd`) | +| QMD shared size 1024 (default) | `omega_blackwell_qmd.c:117` (`shared_bytes == 0` gives 8 x 128 B), session launch `omega_gpu_session.c:167` | launcher passes `shared_bytes = 16 * hd`: 1024 (same QMD word as before) or 2048 | +| 2 warps: partials read at 768 and 896 (`c768`, `c896`) | `.c:241-242`, `.c:381`, `.c:401` | 4 warps: partials of warps 2 and 3 at +256 and +384, two extra LDS and two extra FMNMX / FADD per reduction (emitted only for hd 128) | +| chunk = 64 tokens: `base += 64`, phase B loop bound 64 (`c64`) | `.c:241`, `.c:423`, `.c:428` | `c64` holds `hd` (chunk size) | +| dim-pair inner loop bound 32 (`c32`) | `.c:241`, `.c:361` | `c32` holds `hd / 2` | +| q / out row stride `HD * 4` | `.c:253`, `.c:261`, `.c:688`, `.c:705`, `.c:730` | `head_dim` argument | +| score scale log2(e) / sqrt(64) | `.c:658`, `.c:705`, `.c:814` | `score_scale(head_dim)` | +| paged layout must have head stride `HD * 2` | `.c:726` | `head_dim * 2` | +| kernel cache key lacks head_dim | `.c:528` | key includes `hd` | +| per-thread / warp simulators: 64 threads, 1024 B shared | `tests/gpu_attention_test.c:535-536`, `:792` | sized from `--hd`; shared bound is the QMD declaration (16 * hd) | +| Not 64-dependent, unchanged | 32-lane SHFL tree (`.c:376-378`), 16 argument words, `MAX_CTAS 64`, `MAX_Q_HEADS 64`, GPR budget 64 | Qwen3-4B 32 heads: 2 sequences per launch | + +### Limits for one head_dim 128 CTA (GB10, SM 12.1) + +| Resource | Need | Limit | Source | +|---|---|---|---| +| Shared memory per block | 2048 B | SM 12.x SMEM capacity 0 to 100 KB per SM; 49152 B per block is shown for a CC 10.0 example | CUDA Programming Guide, Compute Capabilities appendix (Context7 `/websites/nvidia_cuda_cuda-programming-guide`): "Compute Capability 12.x has 128 KB of Unified Data Cache and SMEM capacities from 0 KB up to 100 KB"; "sharedMemPerBlock (49152 bytes)" (printed for CC 10.0; the 12.x per-block row was not returned: DOCS SILENT on the exact 12.1 per-block figure) | +| Registers per block | 128 threads x 64 GPR = 8192 | 64K 32-bit registers per block, 255 per thread | same appendix: "The maximum number of 32-bit registers per thread block is 64K, and per thread is 255" | +| Threads per block | 128 | DOCS SILENT (the retrieved snippets give 2048 threads per SM, not the per-block cap) | 64 threads already run on the chip (receipt FB1-CUT5-cd80bf4); QMD field is 16 bits wide (`clcec0qmd.h:248`, `NVCEC0_QMDV05_00_CTA_THREAD_DIMENSION0 MW(1103:1088)`) | +| QMD shared field | 2048 B = 16 units of 128 B | field is 11 bits, `NVCEC0_QMDV05_00_SHARED_MEMORY_SIZE_SHIFTED7 MW(1162:1152)` (`clcec0qmd.h:254`); MIN/MAX/TARGET SM_CONFIG fields (`:255-257`) keep the value omega already sends (word 36) | the header gives field widths only: DOCS SILENT on what SM_CONFIG code 9 allows; UNKNOWN until the chip run (`OMEGA_BW_QMD_MAX_SHARED_BYTES` 16384 is omega's own bound) | +| BAR.SYNC with 128 threads | one barrier, all CTA threads | QMD declares 1 barrier (`omega_blackwell_qmd.c:112`) | INFERRED: since Volta the barrier counts arriving threads (see `tests/bw_warp_sim.h` header); not chip-verified for sm_121 | + +### Evidence (CPU only, 2026-10-07, omega main c0369e6 + this change) + +- head_dim 64 byte identity: the SHA-256 of the encoded kernel (and instruction count) for six + shapes (bf16 and f32 KV, log2 gqa 3, 2 and 0) was recorded from a build of c0369e6 and is + pinned in `tests/gpu_attention_test.c` (`k_pins64`); `--host-only` checks all six. Pin + negative control: a flipped digest bit must not match. +- head_dim 128 encodes: 168 instructions (160 at head_dim 64), 48 GPRs (46), decodes with + nvdisasm SM121 with no undecodable instruction and the expected instruction set. +- `./build/gpu_attention_test --hd 128 --sim` runs the whole battery (f32 contiguous and paged + bf16 and batched, Qwen3-4B 32q/8kv and 32q/4kv, contexts 1 to 2048 with 127/128/129 around a + chunk, large scores, MHA, shared-prefix dedupe, every mutant) through the per-thread + simulator against the f64 oracle at the same tolerance as head_dim 64; `--hd 128 --divergent + --sim` runs it through the warp simulator (BSSY/BSYNC regions, both fragment orders). +- New head_dim 128 checks (`hd128_checks`): uniform scores (sum over four warp partials) and a + dominant token above the f32 exponent range in each of the four warps and in later partial + chunks (max over four warp partials). Mutation test (not committed): removing the two extra + FMNMX fails the dominant-token check (1024 wrong outputs); removing the two extra FADD + fails the uniform and the random-data cases. +- Shared-memory negative control: the simulators run the head_dim 128 kernel under a 1024 byte + declaration and must stop (error 3, "shared access past the declared size"). + +### GB10 parity plan (later, coordinated window; NOT_RUN) + +See the pull request body for the commands, shapes, tolerance and hold estimate. diff --git a/evidence/FB1-CUT5-HD128-5a9f759/NOTES.md b/evidence/FB1-CUT5-HD128-5a9f759/NOTES.md new file mode 100644 index 000000000..76a053837 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/NOTES.md @@ -0,0 +1,12 @@ +# omega#323 GB10 window, 2026-10-07 (hold d6d82f-attn, 02:17:34Z to 02:27:46Z, exit 1) + +Code under test: omega 5a9f759 (draft PR #323), physics at physics.lock. Nothing patched or rerun after the run. + +- hd64 regression (tools/run_gpu_attention_chip.sh): rc 0. run.log PASS 122/0, sweep PASS 73/0, timing PASS 2/0 (hd64-regression/). +- hd128 (`./build/gpu_attention_test --hd 128 --out receipt-hd128.json`): rc 1, "FAIL: 126 checks, 71 failed" (run-hd128.log). + - ctx1 PASS (worst_scaled_err 0), ctx17 PASS (0.00198 of the allowed 1.0) on the first two launches. + - ctx256 (first multi-chunk context): the launch never completed; the host waited the full 600000 ms and returned CHIP_FAIL (call_ns 600000552302). The session then latched (by design) so every later case was refused: ctx2048 .. ctx1000 and all later cases are NOT a chip result, they are the latch. Only ctx1 and ctx17 are valid hd128 chip observations. + - The hd128_checks results at the end also ran after the latch: not valid chip results. +- Observed on the chip: a 128-thread CTA with 64 GPR and 2048 B declared shared memory launched and completed correctly for contexts 1 and 17 (single, partial chunk). Whether 2048 B shared memory, four warps in BAR.SYNC, or the second-chunk loop is the cause of the ctx256 stall is UNKNOWN (ctx127/128 never ran validly). +- DOCS SILENT items remain: exact 12.1 per-block shared limit, per-block thread cap, SM_CONFIG code 9 meaning. +- Disclosure from the coordinator: session 711736 ran CPU-only load 02:11:23Z to 02:17:41Z (no GPU use). The hold began 02:17:34Z, 7 s before it stopped; timing figures from the first seconds (build step) are possibly CPU-contended. Parity results are not affected. diff --git a/evidence/FB1-CUT5-HD128-5a9f759/end.txt b/evidence/FB1-CUT5-HD128-5a9f759/end.txt new file mode 100644 index 000000000..0a575ab5d --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/end.txt @@ -0,0 +1 @@ +2026-10-07T02:27:46Z diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression.log b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression.log new file mode 100644 index 000000000..2159467d0 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression.log @@ -0,0 +1,4 @@ +PASS: 122 checks, 0 failed +PASS: 73 checks, 0 failed +PASS: 2 checks, 0 failed +FB1-CUT5 chip gate rc=0 (sweep rc=0 timing rc=0) receipt=/home/drakestapleton/workspace/hive/WATTN/receipts/FB1-CUT5-5a9f759/receipt.json sweep=/home/drakestapleton/workspace/hive/WATTN/receipts/FB1-CUT5-5a9f759/sweep.json diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/SHA256SUMS b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/SHA256SUMS new file mode 100644 index 000000000..64b176d22 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/SHA256SUMS @@ -0,0 +1,12 @@ +0f9c7cccbfaab7f11a76c834f06a34156f949fb3cb932d9747196f085d68ab10 build.log +a424168552b33c21653a463dc7cf1b3422b66d4f86af1d7cd8d4232c957c8d38 device.txt +4f83db25193278a4eab50202656a69aa151ac416f6cd3c047063f256d34f0611 gpu_attention_test.c +51aaaa6f47fb8e6b5bcf5dae2cb8b5efc74776ec2d185ed71d0dc2f3dbc5b0ae omega_gpu_attention_api.c +470d114d0488d74d8f149b8bdcd1568b33f4676db17001a77f19e44bef754cb1 omega_gpu_attention_api.h +0c0b1bfb4b1cedbbf760bd8dbdbe682640e022c49176be7fb0a22909a4995ccc receipt.json +de821a83d7999fcaa5111e43015f42dc273f38066b6992e485b00f1599c0f439 run.log +3464d701aa858434f17f0e5f8c138b9d1525fef993e1c3899694145443e13916 sim.log +2b89e63de4fad2f73d04f06e60983808a92700438670d28a28abe20797fa9fa7 sweep.json +525252ca9cc4a471c4beee870fffc89093e4c7036cd1049345c97d33b9b19ba6 sweep.log +7cc0c857b479629140c04ac2e8c94cf54ed03f1bd0074f09d92613840035843e timing.json +fe3a2a5961880d2a8fab03958bcbaefa00fb30a28bef554d7783b271938dfed6 timing.log diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/build.log b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/build.log new file mode 100644 index 000000000..033297390 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/build.log @@ -0,0 +1,2 @@ +ar rcs build/libomega_gpu.a build/sha256.o build/omega_canonical.o build/omega_validate.o build/omega_core.o build/omega_codec.o build/aarch64_encoder.o build/aarch64_decoder.o build/omega_realize.o build/omega_exec.o build/omega_self_host.o build/omega_verify.o build/omega_program.o build/omega_synthesis.o build/omega_library.o build/omega_discovery.o build/omega_machine.o build/omega_realize_synth.o build/omega_matvec.o build/omega_accelerator.o build/omega_accelerator_world.o build/omega_vector.o build/omega_blackwell_encoder.o build/omega_blackwell_qmd.o build/omega_blackwell_realize.o build/omega_blackwell_submit.o build/omega_blackwell_engine.o build/omega_gpu_engine.o build/omega_blackwell_matmul.o build/omega_blackwell_codegen.o build/omega_gpu_session.o build/omega_gpu_matmul_api.o build/omega_gpu_elementwise_api.o build/omega_gpu_attention_api.o build/omega_gpu_wait.o build/omega_evidence.o build/m16_native.o build/nvrm.o build/omega_program_ir.o build/omega_vc_bridge.o build/omega_resolve.o build/omega_receipt.o build/omega_blake3.o build/omega_vcstore.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I../physics/m16 -I../physics/nvrm -I../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -ffp-contract=off -Itests -o build/gpu_attention_test tests/gpu_attention_test.c build/libomega_gpu.a -lpthread -lm diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/device.txt b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/device.txt new file mode 100644 index 000000000..221c22967 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/device.txt @@ -0,0 +1,5 @@ +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 +omega 5a9f759ebf133f2e295e3c98e294d0f251ab9687 (0 uncommitted paths) +physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +2026-10-07T02:17:35Z diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/receipt.json b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/receipt.json new file mode 100644 index 000000000..8e2bb354c --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/receipt.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_V1","tolerances":{"rel":2e-4,"abs":2e-5,"large_scores_rel":1e-3,"large_scores_abs":1e-4},"cases":[{"case":"gqa_f32_tinyllama_32q4kv_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":315953,"call_ns":133995773,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2048,"kv_bytes_naive":2048,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00189431,"pass":true,"chip_elapsed_ns":103329,"call_ns":223057,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":34816,"kv_bytes_naive":34816,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00189409,"pass":true,"chip_elapsed_ns":206801,"call_ns":360482,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0028582,"pass":true,"chip_elapsed_ns":1278631,"call_ns":1843003,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"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)"},{"case":"gqa_f32_tinyllama_32q4kv_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00174821,"pass":true,"chip_elapsed_ns":205441,"call_ns":288193,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":133120,"kv_bytes_naive":133120,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00197914,"pass":true,"chip_elapsed_ns":103201,"call_ns":107649,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00177573,"pass":true,"chip_elapsed_ns":102881,"call_ns":107329,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":264192,"kv_bytes_naive":264192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00259576,"pass":true,"chip_elapsed_ns":191681,"call_ns":199201,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":614400,"kv_bytes_naive":614400,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00247545,"pass":true,"chip_elapsed_ns":816293,"call_ns":845957,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2048000,"kv_bytes_naive":2048000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":103552,"call_ns":196081,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096,"kv_bytes_naive":4096,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00174276,"pass":true,"chip_elapsed_ns":102785,"call_ns":105457,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":69632,"kv_bytes_naive":69632,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_llama32_1b_32q8kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00161378,"pass":true,"chip_elapsed_ns":292066,"call_ns":382562,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0029454,"pass":true,"chip_elapsed_ns":1327688,"call_ns":2414350,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"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)"},{"case":"gqa_f32_llama32_1b_32q8kv_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0014332,"pass":true,"chip_elapsed_ns":308114,"call_ns":479363,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":266240,"kv_bytes_naive":266240,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00186415,"pass":true,"chip_elapsed_ns":103488,"call_ns":111441,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00185519,"pass":true,"chip_elapsed_ns":103201,"call_ns":111297,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":528384,"kv_bytes_naive":528384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00162705,"pass":true,"chip_elapsed_ns":308465,"call_ns":331874,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1228800,"kv_bytes_naive":1228800,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00330327,"pass":true,"chip_elapsed_ns":815653,"call_ns":925765,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096000,"kv_bytes_naive":4096000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_large_scores_32q4kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.105395,"pass":true,"chip_elapsed_ns":206769,"call_ns":359298,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"NO_MAX:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_mha_16q16kv_ctx300","n":1024,"rc":"OK","violations":0,"worst_scaled_err":0.00197746,"pass":true,"chip_elapsed_ns":411379,"call_ns":632708,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2457600,"kv_bytes_naive":2457600,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":3,"mutants_caught":3,"mutant_note":"Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":104401,"call_ns":190145,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":16384,"kv_bytes_naive":16384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.002096,"pass":true,"chip_elapsed_ns":103248,"call_ns":180321,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00199949,"pass":true,"chip_elapsed_ns":408211,"call_ns":512051,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00336531,"pass":true,"chip_elapsed_ns":1211191,"call_ns":1269544,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00182741,"pass":true,"chip_elapsed_ns":205937,"call_ns":297330,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":81920,"kv_bytes_naive":81920,"kv_blocks_unique":5,"kv_blocks_logical":5,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00191997,"pass":true,"chip_elapsed_ns":102833,"call_ns":106257,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":131072,"kv_bytes_naive":131072,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00192425,"pass":true,"chip_elapsed_ns":103153,"call_ns":106849,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":147456,"kv_bytes_naive":147456,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00243899,"pass":true,"chip_elapsed_ns":305905,"call_ns":311618,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":311296,"kv_bytes_naive":311296,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00547531,"pass":true,"chip_elapsed_ns":509043,"call_ns":512963,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":163840,"kv_bytes_naive":1032192,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":104176,"call_ns":196241,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00223287,"pass":true,"chip_elapsed_ns":103409,"call_ns":180609,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00167964,"pass":true,"chip_elapsed_ns":412738,"call_ns":509603,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00358689,"pass":true,"chip_elapsed_ns":1228999,"call_ns":1352871,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00228809,"pass":true,"chip_elapsed_ns":307858,"call_ns":425923,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":163840,"kv_bytes_naive":163840,"kv_blocks_unique":5,"kv_blocks_logical":5,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00160376,"pass":true,"chip_elapsed_ns":205553,"call_ns":210897,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00173996,"pass":true,"chip_elapsed_ns":205313,"call_ns":210689,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":294912,"kv_bytes_naive":294912,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00303696,"pass":true,"chip_elapsed_ns":463731,"call_ns":473939,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":622592,"kv_bytes_naive":622592,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00420311,"pass":true,"chip_elapsed_ns":472451,"call_ns":479235,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":327680,"kv_bytes_naive":2064384,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_batch_3seq_32q8kv_ctx40_0_100","n":6144,"rc":"OK","violations":0,"worst_scaled_err":0.00181424,"pass":true,"chip_elapsed_ns":310786,"call_ns":563124,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":229376,"kv_bytes_naive":229376,"kv_blocks_unique":7,"kv_blocks_logical":7,"mutants_run":4,"mutants_caught":4,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_shared_prefix_4seq_8q2kv_10pre","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00188498,"pass":true,"chip_elapsed_ns":307122,"call_ns":413843,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":155648,"kv_bytes_naive":401408,"kv_blocks_unique":19,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2046)"},{"case":"paged_bf16_shared_prefix_4seq_32q8kv_10pre","n":8192,"rc":"OK","violations":0,"worst_scaled_err":0.0024233,"pass":true,"chip_elapsed_ns":514131,"call_ns":655076,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":950272,"kv_bytes_naive":1605632,"kv_blocks_unique":29,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181)"}],"mutant_count":6,"mutants":{"NO_MAX":{"run":1,"caught":1},"KV_HEAD":{"run":11,"caught":11},"SLOT":{"run":9,"caught":9},"NO_RESCALE":{"run":4,"caught":4},"Q_ROW":{"run":6,"caught":6},"OUT_ROW":{"run":6,"caught":6}},"device_opens":1,"checks":122,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_PASS"} diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/run.log b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/run.log new file mode 100644 index 000000000..7dcd38e44 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/run.log @@ -0,0 +1,49 @@ +PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=315953 call_ns=133995773 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=103329 call_ns=223057 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=206801 call_ns=360482 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=1278631 call_ns=1843003 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=205441 call_ns=288193 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=103201 call_ns=107649 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=102881 call_ns=107329 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=191681 call_ns=199201 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=816293 call_ns=845957 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=103552 call_ns=196081 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=102785 call_ns=105457 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=292066 call_ns=382562 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=1327688 call_ns=2414350 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=308114 call_ns=479363 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=103488 call_ns=111441 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=103201 call_ns=111297 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=308465 call_ns=331874 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=815653 call_ns=925765 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.105395 chip_ns=206769 call_ns=359298 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.00197746 chip_ns=411379 call_ns=632708 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=104401 call_ns=190145 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.002096 chip_ns=103248 call_ns=180321 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00199949 chip_ns=408211 call_ns=512051 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.00336531 chip_ns=1211191 call_ns=1269544 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00182741 chip_ns=205937 call_ns=297330 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.00191997 chip_ns=102833 call_ns=106257 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.00192425 chip_ns=103153 call_ns=106849 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.00243899 chip_ns=305905 call_ns=311618 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.00547531 chip_ns=509043 call_ns=512963 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=104176 call_ns=196241 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.00223287 chip_ns=103409 call_ns=180609 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00167964 chip_ns=412738 call_ns=509603 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.00358689 chip_ns=1228999 call_ns=1352871 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=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00228809 chip_ns=307858 call_ns=425923 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.00160376 chip_ns=205553 call_ns=210897 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.00173996 chip_ns=205313 call_ns=210689 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.00303696 chip_ns=463731 call_ns=473939 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.00420311 chip_ns=472451 call_ns=479235 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00181424 chip_ns=310786 call_ns=563124 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=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00188498 chip_ns=307122 call_ns=413843 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.0024233 chip_ns=514131 call_ns=655076 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=1 +PASS: 122 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sim.log b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sim.log new file mode 100644 index 000000000..84bf76600 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sim.log @@ -0,0 +1,49 @@ +PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=7024200 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.00189313 chip_ns=0 call_ns=9378214 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.00183169 chip_ns=0 call_ns=42007312 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.00274869 chip_ns=0 call_ns=240298701 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.00145684 chip_ns=0 call_ns=10782189 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.00206007 chip_ns=0 call_ns=15291831 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.00165735 chip_ns=0 call_ns=18196152 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.00201893 chip_ns=0 call_ns=36272783 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.00297055 chip_ns=0 call_ns=118249507 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=0 call_ns=3278579 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.00187227 chip_ns=0 call_ns=4416954 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.00201723 chip_ns=0 call_ns=30248381 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=0 call_ns=241921638 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.00195964 chip_ns=0 call_ns=10861438 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.00170583 chip_ns=0 call_ns=15430696 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.0017034 chip_ns=0 call_ns=18324073 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.00187268 chip_ns=0 call_ns=36577953 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.00303901 chip_ns=0 call_ns=119313129 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.105626 chip_ns=0 call_ns=30250492 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.00197746 chip_ns=0 call_ns=18207080 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=3202690 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.0020981 chip_ns=0 call_ns=4457402 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00182155 chip_ns=0 call_ns=31124946 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.00365795 chip_ns=0 call_ns=246728001 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00173051 chip_ns=0 call_ns=10895598 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.00189837 chip_ns=0 call_ns=15731146 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.00172729 chip_ns=0 call_ns=18529610 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.00210268 chip_ns=0 call_ns=37278629 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.00547531 chip_ns=0 call_ns=121445478 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=0 call_ns=3215458 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.00215313 chip_ns=0 call_ns=4445610 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.0021938 chip_ns=0 call_ns=31160547 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.00358689 chip_ns=0 call_ns=247223685 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=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00163443 chip_ns=0 call_ns=10904094 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.00186221 chip_ns=0 call_ns=15724618 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.00163299 chip_ns=0 call_ns=18569882 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.00264235 chip_ns=0 call_ns=37301861 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.00399855 chip_ns=0 call_ns=121603047 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00179162 chip_ns=0 call_ns=14515746 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=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00208743 chip_ns=0 call_ns=24292523 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.0024233 chip_ns=0 call_ns=97322796 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=0 +PASS: 122 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sweep.json b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sweep.json new file mode 100644 index 000000000..f6c086e23 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sweep.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_SWEEP_V1","path":"paged_bf16","head_dim":64,"block_size":16,"timed_calls":20,"host_simulator":false,"tolerances":{"rel":2e-4,"abs":2e-5},"hardware_counters":"unavailable (SM occupancy, bandwidth utilisation, cache hit rates are not observable through this path)","points":[{"q_heads":1,"kv_heads":1,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":64,"out_width":64,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00162825,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":1,"threads_per_cta":64,"call_ms_median":0.1034,"call_ms_p90":0.1044,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1030,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":256,"tab_bytes":68,"out_bytes":256,"kv_source":"staged"},{"q_heads":1,"kv_heads":1,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":64,"out_width":64,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00286577,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":1,"threads_per_cta":64,"call_ms_median":0.4082,"call_ms_p90":0.4090,"kernel_ms_median":0.4066,"kernel_ms_p90":0.4075,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":256,"tab_bytes":516,"out_bytes":256,"kv_source":"staged"},{"q_heads":2,"kv_heads":1,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00274735,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.1034,"call_ms_p90":0.1036,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1028,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":512,"tab_bytes":68,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":1,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00293219,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.4082,"call_ms_p90":0.4088,"kernel_ms_median":0.4067,"kernel_ms_p90":0.4072,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":512,"tab_bytes":516,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":2,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00285429,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.1034,"call_ms_p90":0.1038,"kernel_ms_median":0.1026,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":512,"tab_bytes":68,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":2,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00344759,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.4089,"call_ms_p90":0.4094,"kernel_ms_median":0.4066,"kernel_ms_p90":0.4069,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":512,"tab_bytes":516,"out_bytes":512,"kv_source":"staged"},{"q_heads":4,"kv_heads":1,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00195521,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1035,"call_ms_p90":0.1036,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1028,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":1,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00455218,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4081,"call_ms_p90":0.4085,"kernel_ms_median":0.4066,"kernel_ms_p90":0.4069,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":2,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00195668,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1035,"call_ms_p90":0.1038,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1028,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":2,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00429287,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4089,"call_ms_p90":0.4095,"kernel_ms_median":0.4066,"kernel_ms_p90":0.4071,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":4,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00208557,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1038,"call_ms_p90":0.1040,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1028,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":4,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00447204,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4103,"call_ms_p90":0.4113,"kernel_ms_median":0.4065,"kernel_ms_p90":0.4069,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":8,"kv_heads":1,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00244755,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1035,"call_ms_p90":0.1041,"kernel_ms_median":0.1025,"kernel_ms_p90":0.1027,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":1,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00561397,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4084,"call_ms_p90":0.4092,"kernel_ms_median":0.4066,"kernel_ms_p90":0.4074,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":2,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00277137,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1038,"call_ms_p90":0.1040,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":2,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00478059,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4088,"call_ms_p90":0.4094,"kernel_ms_median":0.4063,"kernel_ms_p90":0.4068,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":4,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00220051,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1040,"call_ms_p90":0.1047,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":4,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0051977,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4110,"call_ms_p90":0.4871,"kernel_ms_median":0.4068,"kernel_ms_p90":0.4829,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":8,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00240979,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1045,"call_ms_p90":0.1046,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":8,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00466806,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4140,"call_ms_p90":0.4154,"kernel_ms_median":0.4068,"kernel_ms_p90":0.4078,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":16,"kv_heads":1,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00249826,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1040,"call_ms_p90":0.1042,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1028,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":1,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00536905,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4088,"call_ms_p90":0.5098,"kernel_ms_median":0.4066,"kernel_ms_p90":0.5077,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":2,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00239844,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1042,"call_ms_p90":0.1044,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":2,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00570392,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4097,"call_ms_p90":0.4105,"kernel_ms_median":0.4068,"kernel_ms_p90":0.4074,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":4,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00278498,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1044,"call_ms_p90":0.1045,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":4,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00518169,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4109,"call_ms_p90":0.4120,"kernel_ms_median":0.4063,"kernel_ms_p90":0.4074,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":8,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00262688,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1046,"call_ms_p90":0.1049,"kernel_ms_median":0.1026,"kernel_ms_p90":0.1027,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":8,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0059316,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4155,"call_ms_p90":0.4162,"kernel_ms_median":0.4068,"kernel_ms_p90":0.4072,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":16,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00239914,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1059,"call_ms_p90":0.1063,"kernel_ms_median":0.1029,"kernel_ms_p90":0.1030,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":16,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00553838,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4247,"call_ms_p90":0.4264,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4097,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":24,"kv_heads":1,"gqa_ratio":24,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":1,"gqa_ratio":24,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":2,"gqa_ratio":12,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":2,"gqa_ratio":12,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":3,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00306755,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1049,"call_ms_p90":0.1050,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1030,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":36864,"kv_bytes_naive":196608,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":3,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00539717,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.5934,"call_ms_p90":0.6136,"kernel_ms_median":0.5894,"kernel_ms_p90":0.6096,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":233472,"kv_bytes_naive":1572864,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":4,"gqa_ratio":6,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":4,"gqa_ratio":6,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":6,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00326846,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1052,"call_ms_p90":0.1055,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":73728,"kv_bytes_naive":393216,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":6,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00527248,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.5940,"call_ms_p90":0.6168,"kernel_ms_median":0.5870,"kernel_ms_p90":0.6098,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":466944,"kv_bytes_naive":3145728,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":8,"gqa_ratio":3,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":8,"gqa_ratio":3,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":12,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00338069,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1057,"call_ms_p90":0.1062,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":147456,"kv_bytes_naive":786432,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":12,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00538782,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6254,"call_ms_p90":0.6767,"kernel_ms_median":0.6111,"kernel_ms_p90":0.6621,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":933888,"kv_bytes_naive":6291456,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":24,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00259323,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1073,"call_ms_p90":0.1083,"kernel_ms_median":0.1029,"kernel_ms_p90":0.1039,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":294912,"kv_bytes_naive":1572864,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":24,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00737519,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.5373,"call_ms_p90":0.5392,"kernel_ms_median":0.5087,"kernel_ms_p90":0.5098,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1867776,"kv_bytes_naive":12582912,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":32,"kv_heads":1,"gqa_ratio":32,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00241453,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1048,"call_ms_p90":0.1052,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1030,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":1,"gqa_ratio":32,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00525453,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4095,"call_ms_p90":0.4099,"kernel_ms_median":0.4065,"kernel_ms_p90":0.4069,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":2,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0031327,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1052,"call_ms_p90":0.1053,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":2,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00648224,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4114,"call_ms_p90":0.4123,"kernel_ms_median":0.4077,"kernel_ms_p90":0.4084,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":4,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00316999,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1054,"call_ms_p90":0.1056,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":4,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00599161,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4133,"call_ms_p90":0.4139,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4085,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":8,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00278167,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1056,"call_ms_p90":0.1061,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1031,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":8,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.005897,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4184,"call_ms_p90":0.4190,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4089,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":16,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00268895,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1067,"call_ms_p90":0.1072,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":16,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00571167,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4287,"call_ms_p90":0.4304,"kernel_ms_median":0.4089,"kernel_ms_p90":0.4097,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":32,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00256581,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1090,"call_ms_p90":0.1096,"kernel_ms_median":0.1029,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":393216,"kv_bytes_naive":2097152,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":32,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00647965,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4511,"call_ms_p90":0.4554,"kernel_ms_median":0.4087,"kernel_ms_p90":0.4094,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":2490368,"kv_bytes_naive":16777216,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":64,"kv_heads":1,"gqa_ratio":64,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00332208,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1066,"call_ms_p90":0.1074,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":1,"gqa_ratio":64,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00559141,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.4112,"call_ms_p90":0.4732,"kernel_ms_median":0.4068,"kernel_ms_p90":0.4687,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":2,"gqa_ratio":32,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00286709,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1065,"call_ms_p90":0.1069,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1031,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":2,"gqa_ratio":32,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00639622,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0234,"call_ms_p90":1.1095,"kernel_ms_median":1.0182,"kernel_ms_p90":1.1043,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":4,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00399345,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1072,"call_ms_p90":0.1076,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":4,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00618912,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0244,"call_ms_p90":1.0253,"kernel_ms_median":1.0175,"kernel_ms_p90":1.0185,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":8,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0028507,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1075,"call_ms_p90":0.1078,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":8,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00529008,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0293,"call_ms_p90":1.0308,"kernel_ms_median":1.0180,"kernel_ms_p90":1.0195,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":16,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00272721,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1084,"call_ms_p90":0.1087,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":16,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00565958,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0394,"call_ms_p90":1.0414,"kernel_ms_median":1.0179,"kernel_ms_p90":1.0190,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":32,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00282842,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1108,"call_ms_p90":0.1117,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1040,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":393216,"kv_bytes_naive":2097152,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":32,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00670759,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0640,"call_ms_p90":1.0685,"kernel_ms_median":1.0181,"kernel_ms_p90":1.0191,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":2490368,"kv_bytes_naive":16777216,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":64,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00284045,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1169,"call_ms_p90":0.1178,"kernel_ms_median":0.1036,"kernel_ms_p90":0.1044,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":786432,"kv_bytes_naive":4194304,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":64,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00870193,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0979,"call_ms_p90":1.1970,"kernel_ms_median":0.9966,"kernel_ms_p90":1.0866,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":4980736,"kv_bytes_naive":33554432,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"}],"points_total":72,"points_supported":64,"points_unsupported":8,"device_opens":1,"checks":73,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_SWEEP_PASS"} diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sweep.log b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sweep.log new file mode 100644 index 000000000..1b95bfec3 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/sweep.log @@ -0,0 +1,74 @@ +PASS sweep 1q/ 1kv ratio 1 ctx 256: launches=1 ctas=1 call_ms med=0.103 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=256 tab=68 out=256 worst=0.00162825 +PASS sweep 1q/ 1kv ratio 1 ctx 2048: launches=1 ctas=1 call_ms med=0.408 p90=0.409 kernel_ms med=0.407 p90=0.407 kv_staged=77824 (naive 524288) blocks=19/128 q=256 tab=516 out=256 worst=0.00286577 +PASS sweep 2q/ 1kv ratio 2 ctx 256: launches=1 ctas=2 call_ms med=0.103 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=512 tab=68 out=512 worst=0.00274735 +PASS sweep 2q/ 1kv ratio 2 ctx 2048: launches=1 ctas=2 call_ms med=0.408 p90=0.409 kernel_ms med=0.407 p90=0.407 kv_staged=77824 (naive 524288) blocks=19/128 q=512 tab=516 out=512 worst=0.00293219 +PASS sweep 2q/ 2kv ratio 1 ctx 256: launches=1 ctas=2 call_ms med=0.103 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=512 tab=68 out=512 worst=0.00285429 +PASS sweep 2q/ 2kv ratio 1 ctx 2048: launches=1 ctas=2 call_ms med=0.409 p90=0.409 kernel_ms med=0.407 p90=0.407 kv_staged=155648 (naive 1048576) blocks=19/128 q=512 tab=516 out=512 worst=0.00344759 +PASS sweep 4q/ 1kv ratio 4 ctx 256: launches=1 ctas=4 call_ms med=0.103 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00195521 +PASS sweep 4q/ 1kv ratio 4 ctx 2048: launches=1 ctas=4 call_ms med=0.408 p90=0.408 kernel_ms med=0.407 p90=0.407 kv_staged=77824 (naive 524288) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00455218 +PASS sweep 4q/ 2kv ratio 2 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00195668 +PASS sweep 4q/ 2kv ratio 2 ctx 2048: launches=1 ctas=4 call_ms med=0.409 p90=0.410 kernel_ms med=0.407 p90=0.407 kv_staged=155648 (naive 1048576) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00429287 +PASS sweep 4q/ 4kv ratio 1 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00208557 +PASS sweep 4q/ 4kv ratio 1 ctx 2048: launches=1 ctas=4 call_ms med=0.410 p90=0.411 kernel_ms med=0.407 p90=0.407 kv_staged=311296 (naive 2097152) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00447204 +PASS sweep 8q/ 1kv ratio 8 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00244755 +PASS sweep 8q/ 1kv ratio 8 ctx 2048: launches=1 ctas=8 call_ms med=0.408 p90=0.409 kernel_ms med=0.407 p90=0.407 kv_staged=77824 (naive 524288) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00561397 +PASS sweep 8q/ 2kv ratio 4 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00277137 +PASS sweep 8q/ 2kv ratio 4 ctx 2048: launches=1 ctas=8 call_ms med=0.409 p90=0.409 kernel_ms med=0.406 p90=0.407 kv_staged=155648 (naive 1048576) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00478059 +PASS sweep 8q/ 4kv ratio 2 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00220051 +PASS sweep 8q/ 4kv ratio 2 ctx 2048: launches=1 ctas=8 call_ms med=0.411 p90=0.487 kernel_ms med=0.407 p90=0.483 kv_staged=311296 (naive 2097152) blocks=19/128 q=2048 tab=516 out=2048 worst=0.0051977 +PASS sweep 8q/ 8kv ratio 1 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00240979 +PASS sweep 8q/ 8kv ratio 1 ctx 2048: launches=1 ctas=8 call_ms med=0.414 p90=0.415 kernel_ms med=0.407 p90=0.408 kv_staged=622592 (naive 4194304) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00466806 +PASS sweep 16q/ 1kv ratio 16 ctx 256: launches=1 ctas=16 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00249826 +PASS sweep 16q/ 1kv ratio 16 ctx 2048: launches=1 ctas=16 call_ms med=0.409 p90=0.510 kernel_ms med=0.407 p90=0.508 kv_staged=77824 (naive 524288) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00536905 +PASS sweep 16q/ 2kv ratio 8 ctx 256: launches=1 ctas=16 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00239844 +PASS sweep 16q/ 2kv ratio 8 ctx 2048: launches=1 ctas=16 call_ms med=0.410 p90=0.411 kernel_ms med=0.407 p90=0.407 kv_staged=155648 (naive 1048576) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00570392 +PASS sweep 16q/ 4kv ratio 4 ctx 256: launches=1 ctas=16 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00278498 +PASS sweep 16q/ 4kv ratio 4 ctx 2048: launches=1 ctas=16 call_ms med=0.411 p90=0.412 kernel_ms med=0.406 p90=0.407 kv_staged=311296 (naive 2097152) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00518169 +PASS sweep 16q/ 8kv ratio 2 ctx 256: launches=1 ctas=16 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00262688 +PASS sweep 16q/ 8kv ratio 2 ctx 2048: launches=1 ctas=16 call_ms med=0.416 p90=0.416 kernel_ms med=0.407 p90=0.407 kv_staged=622592 (naive 4194304) blocks=19/128 q=4096 tab=516 out=4096 worst=0.0059316 +PASS sweep 16q/16kv ratio 1 ctx 256: launches=1 ctas=16 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=196608 (naive 1048576) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00239914 +PASS sweep 16q/16kv ratio 1 ctx 2048: launches=1 ctas=16 call_ms med=0.425 p90=0.426 kernel_ms med=0.408 p90=0.410 kv_staged=1245184 (naive 8388608) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00553838 +PASS sweep 24q/ 1kv ratio 24 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 1kv ratio 24 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 2kv ratio 12 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 2kv ratio 12 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 3kv ratio 8 ctx 256: launches=1 ctas=24 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=36864 (naive 196608) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00306755 +PASS sweep 24q/ 3kv ratio 8 ctx 2048: launches=1 ctas=24 call_ms med=0.593 p90=0.614 kernel_ms med=0.589 p90=0.610 kv_staged=233472 (naive 1572864) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00539717 +PASS sweep 24q/ 4kv ratio 6 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 4kv ratio 6 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 6kv ratio 4 ctx 256: launches=1 ctas=24 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=73728 (naive 393216) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00326846 +PASS sweep 24q/ 6kv ratio 4 ctx 2048: launches=1 ctas=24 call_ms med=0.594 p90=0.617 kernel_ms med=0.587 p90=0.610 kv_staged=466944 (naive 3145728) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00527248 +PASS sweep 24q/ 8kv ratio 3 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 8kv ratio 3 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/12kv ratio 2 ctx 256: launches=1 ctas=24 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=147456 (naive 786432) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00338069 +PASS sweep 24q/12kv ratio 2 ctx 2048: launches=1 ctas=24 call_ms med=0.625 p90=0.677 kernel_ms med=0.611 p90=0.662 kv_staged=933888 (naive 6291456) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00538782 +PASS sweep 24q/24kv ratio 1 ctx 256: launches=1 ctas=24 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.104 kv_staged=294912 (naive 1572864) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00259323 +PASS sweep 24q/24kv ratio 1 ctx 2048: launches=1 ctas=24 call_ms med=0.537 p90=0.539 kernel_ms med=0.509 p90=0.510 kv_staged=1867776 (naive 12582912) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00737519 +PASS sweep 32q/ 1kv ratio 32 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00241453 +PASS sweep 32q/ 1kv ratio 32 ctx 2048: launches=1 ctas=32 call_ms med=0.410 p90=0.410 kernel_ms med=0.407 p90=0.407 kv_staged=77824 (naive 524288) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00525453 +PASS sweep 32q/ 2kv ratio 16 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=8192 tab=68 out=8192 worst=0.0031327 +PASS sweep 32q/ 2kv ratio 16 ctx 2048: launches=1 ctas=32 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.408 kv_staged=155648 (naive 1048576) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00648224 +PASS sweep 32q/ 4kv ratio 8 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00316999 +PASS sweep 32q/ 4kv ratio 8 ctx 2048: launches=1 ctas=32 call_ms med=0.413 p90=0.414 kernel_ms med=0.408 p90=0.408 kv_staged=311296 (naive 2097152) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00599161 +PASS sweep 32q/ 8kv ratio 4 ctx 256: launches=1 ctas=32 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00278167 +PASS sweep 32q/ 8kv ratio 4 ctx 2048: launches=1 ctas=32 call_ms med=0.418 p90=0.419 kernel_ms med=0.408 p90=0.409 kv_staged=622592 (naive 4194304) blocks=19/128 q=8192 tab=516 out=8192 worst=0.005897 +PASS sweep 32q/16kv ratio 2 ctx 256: launches=1 ctas=32 call_ms med=0.107 p90=0.107 kernel_ms med=0.103 p90=0.103 kv_staged=196608 (naive 1048576) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00268895 +PASS sweep 32q/16kv ratio 2 ctx 2048: launches=1 ctas=32 call_ms med=0.429 p90=0.430 kernel_ms med=0.409 p90=0.410 kv_staged=1245184 (naive 8388608) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00571167 +PASS sweep 32q/32kv ratio 1 ctx 256: launches=1 ctas=32 call_ms med=0.109 p90=0.110 kernel_ms med=0.103 p90=0.103 kv_staged=393216 (naive 2097152) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00256581 +PASS sweep 32q/32kv ratio 1 ctx 2048: launches=1 ctas=32 call_ms med=0.451 p90=0.455 kernel_ms med=0.409 p90=0.409 kv_staged=2490368 (naive 16777216) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00647965 +PASS sweep 64q/ 1kv ratio 64 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.107 kernel_ms med=0.103 p90=0.104 kv_staged=12288 (naive 65536) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00332208 +PASS sweep 64q/ 1kv ratio 64 ctx 2048: launches=1 ctas=64 call_ms med=0.411 p90=0.473 kernel_ms med=0.407 p90=0.469 kv_staged=77824 (naive 524288) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00559141 +PASS sweep 64q/ 2kv ratio 32 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.107 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00286709 +PASS sweep 64q/ 2kv ratio 32 ctx 2048: launches=1 ctas=64 call_ms med=1.023 p90=1.110 kernel_ms med=1.018 p90=1.104 kv_staged=155648 (naive 1048576) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00639622 +PASS sweep 64q/ 4kv ratio 16 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.104 kv_staged=49152 (naive 262144) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00399345 +PASS sweep 64q/ 4kv ratio 16 ctx 2048: launches=1 ctas=64 call_ms med=1.024 p90=1.025 kernel_ms med=1.018 p90=1.018 kv_staged=311296 (naive 2097152) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00618912 +PASS sweep 64q/ 8kv ratio 8 ctx 256: launches=1 ctas=64 call_ms med=0.108 p90=0.108 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=16384 tab=68 out=16384 worst=0.0028507 +PASS sweep 64q/ 8kv ratio 8 ctx 2048: launches=1 ctas=64 call_ms med=1.029 p90=1.031 kernel_ms med=1.018 p90=1.019 kv_staged=622592 (naive 4194304) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00529008 +PASS sweep 64q/16kv ratio 4 ctx 256: launches=1 ctas=64 call_ms med=0.108 p90=0.109 kernel_ms med=0.103 p90=0.103 kv_staged=196608 (naive 1048576) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00272721 +PASS sweep 64q/16kv ratio 4 ctx 2048: launches=1 ctas=64 call_ms med=1.039 p90=1.041 kernel_ms med=1.018 p90=1.019 kv_staged=1245184 (naive 8388608) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00565958 +PASS sweep 64q/32kv ratio 2 ctx 256: launches=1 ctas=64 call_ms med=0.111 p90=0.112 kernel_ms med=0.103 p90=0.104 kv_staged=393216 (naive 2097152) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00282842 +PASS sweep 64q/32kv ratio 2 ctx 2048: launches=1 ctas=64 call_ms med=1.064 p90=1.069 kernel_ms med=1.018 p90=1.019 kv_staged=2490368 (naive 16777216) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00670759 +PASS sweep 64q/64kv ratio 1 ctx 256: launches=1 ctas=64 call_ms med=0.117 p90=0.118 kernel_ms med=0.104 p90=0.104 kv_staged=786432 (naive 4194304) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00284045 +PASS sweep 64q/64kv ratio 1 ctx 2048: launches=1 ctas=64 call_ms med=1.098 p90=1.197 kernel_ms med=0.997 p90=1.087 kv_staged=4980736 (naive 33554432) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00870193 +sweep: 72 points (64 supported, 8 unsupported by the kernel envelope), device_opens=1 +PASS: 73 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/timing.json b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/timing.json new file mode 100644 index 000000000..31fb120bd --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/timing.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_TIMING_V1","gate_median_ms":3.0,"calls":100,"cases":[{"case":"gqa_f32_tinyllama_32q4kv_ctx2048","first_call_ms":134.621,"ok_calls":100,"violations":0,"worst_scaled_err":0.00323017,"median_ms":1.2092,"p90_ms":1.3206,"min_ms":1.1488,"max_ms":1.7140,"chip_us_mean":1171.1,"device_opens":1,"pass":true}],"checks":2,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_TIMING_PASS"} diff --git a/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/timing.log b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/timing.log new file mode 100644 index 000000000..eb7cd4c45 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/hd64-regression/timing.log @@ -0,0 +1,2 @@ +PASS timing gqa_f32_tinyllama_32q4kv_ctx2048 first_call_ms=134.621 ok_calls=100/100 violations=0 worst_scaled_err=0.00323017 median_ms=1.209 p90_ms=1.321 min_ms=1.149 max_ms=1.714 chip_us_mean=1171.1 device_opens=1 +PASS: 2 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-5a9f759/receipt-hd128.json b/evidence/FB1-CUT5-HD128-5a9f759/receipt-hd128.json new file mode 100644 index 000000000..ddc3ae0fc --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/receipt-hd128.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_V1","tolerances":{"rel":2e-4,"abs":2e-5,"large_scores_rel":1e-3,"large_scores_abs":1e-4},"cases":[{"case":"gqa_f32_qwen3_4b_32q8kv_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":215826,"call_ns":135100772,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8192,"kv_bytes_naive":8192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00198312,"pass":true,"chip_elapsed_ns":104481,"call_ns":245761,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":139264,"kv_bytes_naive":139264,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx256","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":2.7208e+42,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx2048","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":3.21028e+42,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=CHIP_FAIL,bad=4095) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4095) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4095) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4095)"},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx127","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx128","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx129","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx300","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx1000","n":4096,"rc":"CHIP_FAIL","violations":4091,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx1","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx17","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4095)"},{"case":"gqa_f32_gqa8_32q4kv_ctx256","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx2048","n":4096,"rc":"CHIP_FAIL","violations":4093,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=CHIP_FAIL,bad=4093) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4093) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4093) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4093)"},{"case":"gqa_f32_gqa8_32q4kv_ctx127","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx128","n":4096,"rc":"CHIP_FAIL","violations":4093,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx129","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx300","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx1000","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_large_scores_32q4kv_ctx256","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":1,"mutants_caught":1,"mutant_note":"NO_MAX:CAUGHT(rc=CHIP_FAIL,bad=4096)"},{"case":"gqa_f32_mha_16q16kv_ctx300","n":2048,"rc":"CHIP_FAIL","violations":2048,"worst_scaled_err":3.02771e+42,"pass":false,"chip_elapsed_ns":0,"call_ns":600000552302,"chip_calls":0,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":3,"mutants_caught":3,"mutant_note":"Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=2048) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=2048) KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=2048)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx1","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx17","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4096)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx256","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048","n":4096,"rc":"CHIP_FAIL","violations":4087,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4087) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4087) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4087) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4087) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4087)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx127","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx128","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx129","n":4096,"rc":"CHIP_FAIL","violations":4093,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx300","n":4096,"rc":"CHIP_FAIL","violations":4091,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000","n":4096,"rc":"CHIP_FAIL","violations":4093,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx1","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx17","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4096)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx256","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx2048","n":4096,"rc":"CHIP_FAIL","violations":4091,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4091) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4091) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4091) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4091) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4091)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx127","n":4096,"rc":"CHIP_FAIL","violations":4095,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx128","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx129","n":4096,"rc":"CHIP_FAIL","violations":4091,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx300","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx1000","n":4096,"rc":"CHIP_FAIL","violations":4096,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_batch_3seq_32q8kv_ctx40_0_100","n":12288,"rc":"CHIP_FAIL","violations":12288,"worst_scaled_err":50291.8,"pass":false,"chip_elapsed_ns":1026,"call_ns":281474386328240,"chip_calls":4267627848,"unwritten_words":65535,"kv_bytes_staged":280147804740424,"kv_bytes_naive":281474386328368,"kv_blocks_unique":65226,"kv_blocks_logical":4267682060,"mutants_run":4,"mutants_caught":4,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=12288) SLOT:CAUGHT(rc=CHIP_FAIL,bad=12288) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=12288) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=12288)"},{"case":"paged_bf16_shared_prefix_4seq_8q2kv_10pre","n":4096,"rc":"CHIP_FAIL","violations":4094,"worst_scaled_err":inf,"pass":false,"chip_elapsed_ns":100,"call_ns":600000552302,"chip_calls":40,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4094) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4094)"},{"case":"paged_bf16_shared_prefix_4seq_32q8kv_10pre","n":16384,"rc":"CHIP_FAIL","violations":16383,"worst_scaled_err":49709.1,"pass":false,"chip_elapsed_ns":100,"call_ns":600000552302,"chip_calls":40,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=16383) SLOT:CAUGHT(rc=CHIP_FAIL,bad=16383)"}],"mutant_count":6,"mutants":{"NO_MAX":{"run":1,"caught":1},"KV_HEAD":{"run":11,"caught":11},"SLOT":{"run":9,"caught":9},"NO_RESCALE":{"run":4,"caught":4},"Q_ROW":{"run":6,"caught":6},"OUT_ROW":{"run":6,"caught":6}},"device_opens":1,"checks":122,"failed":69,"verdict":"OMEGA_GPU_ATTENTION_FAIL"} diff --git a/evidence/FB1-CUT5-HD128-5a9f759/run-hd128.log b/evidence/FB1-CUT5-HD128-5a9f759/run-hd128.log new file mode 100644 index 000000000..0fcbdfe37 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/run-hd128.log @@ -0,0 +1,127 @@ +PASS gqa_f32_qwen3_4b_32q8kv_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=215826 call_ns=135100772 calls=1 unwritten=0 kv_staged=8192/8192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00198312 chip_ns=104481 call_ns=245761 calls=1 unwritten=0 kv_staged=139264/139264 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx256 rc=CHIP_FAIL violations=4096 worst=2.7208e+42 +FAIL gqa_f32_qwen3_4b_32q8kv_ctx256 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=2.7208e+42 chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx2048 repeat run (cache hit) is bit-identical +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx2048 rc=CHIP_FAIL violations=4095 worst=3.21028e+42 +FAIL gqa_f32_qwen3_4b_32q8kv_ctx2048 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=3.21028e+42 chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=CHIP_FAIL,bad=4095) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4095) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4095) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4095) +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx127 rc=CHIP_FAIL violations=4094 worst=inf +FAIL gqa_f32_qwen3_4b_32q8kv_ctx127 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx128 rc=CHIP_FAIL violations=4094 worst=inf +FAIL gqa_f32_qwen3_4b_32q8kv_ctx128 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx129 rc=CHIP_FAIL violations=4096 worst=inf +FAIL gqa_f32_qwen3_4b_32q8kv_ctx129 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx300 rc=CHIP_FAIL violations=4094 worst=inf +FAIL gqa_f32_qwen3_4b_32q8kv_ctx300 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_qwen3_4b_32q8kv_ctx1000 rc=CHIP_FAIL violations=4091 worst=inf +FAIL gqa_f32_qwen3_4b_32q8kv_ctx1000 n=4096 rc=CHIP_FAIL violations=4091 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx1 rc=CHIP_FAIL violations=4096 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx1 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx17 rc=CHIP_FAIL violations=4095 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx17 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4095) +FAIL: gqa_f32_gqa8_32q4kv_ctx256 rc=CHIP_FAIL violations=4095 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx256 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx2048 repeat run (cache hit) is bit-identical +FAIL: gqa_f32_gqa8_32q4kv_ctx2048 rc=CHIP_FAIL violations=4093 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx2048 n=4096 rc=CHIP_FAIL violations=4093 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=CHIP_FAIL,bad=4093) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4093) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4093) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4093) +FAIL: gqa_f32_gqa8_32q4kv_ctx127 rc=CHIP_FAIL violations=4095 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx127 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx128 rc=CHIP_FAIL violations=4093 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx128 n=4096 rc=CHIP_FAIL violations=4093 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx129 rc=CHIP_FAIL violations=4094 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx129 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx300 rc=CHIP_FAIL violations=4094 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx300 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_gqa8_32q4kv_ctx1000 rc=CHIP_FAIL violations=4094 worst=inf +FAIL gqa_f32_gqa8_32q4kv_ctx1000 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +FAIL: gqa_f32_large_scores_32q4kv_ctx256 rc=CHIP_FAIL violations=4096 worst=inf +FAIL gqa_f32_large_scores_32q4kv_ctx256 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 1/1 NO_MAX:CAUGHT(rc=CHIP_FAIL,bad=4096) +FAIL: mha: Q_ROW and OUT_ROW outputs are distinct wrong answers (0 of 2048 differ) +FAIL: gqa_f32_mha_16q16kv_ctx300 rc=CHIP_FAIL violations=2048 worst=3.02771e+42 +FAIL gqa_f32_mha_16q16kv_ctx300 n=2048 rc=CHIP_FAIL violations=2048 worst_scaled_err=3.02771e+42 chip_ns=0 call_ns=600000552302 calls=0 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=2048) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=2048) KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=2048) +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx1 rc=CHIP_FAIL violations=4096 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx1 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 1/1 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096) +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx17 rc=CHIP_FAIL violations=4096 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx17 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 2/2 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4096) +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx256 rc=CHIP_FAIL violations=4095 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx256 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048 rc=CHIP_FAIL violations=4087 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048 n=4096 rc=CHIP_FAIL violations=4087 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 5/5 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4087) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4087) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4087) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4087) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4087) +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx127 rc=CHIP_FAIL violations=4095 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx127 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx128 rc=CHIP_FAIL violations=4095 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx128 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx129 rc=CHIP_FAIL violations=4093 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx129 n=4096 rc=CHIP_FAIL violations=4093 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx300 rc=CHIP_FAIL violations=4091 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx300 n=4096 rc=CHIP_FAIL violations=4091 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000 rc=CHIP_FAIL violations=4093 worst=inf +FAIL paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000 n=4096 rc=CHIP_FAIL violations=4093 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx1 rc=CHIP_FAIL violations=4096 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx1 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 1/1 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096) +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx17 rc=CHIP_FAIL violations=4096 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx17 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 2/2 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4096) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4096) +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx256 rc=CHIP_FAIL violations=4094 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx256 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx2048 rc=CHIP_FAIL violations=4091 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx2048 n=4096 rc=CHIP_FAIL violations=4091 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 5/5 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4091) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4091) NO_RESCALE:CAUGHT(rc=CHIP_FAIL,bad=4091) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=4091) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=4091) +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx127 rc=CHIP_FAIL violations=4095 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx127 n=4096 rc=CHIP_FAIL violations=4095 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx128 rc=CHIP_FAIL violations=4094 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx128 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx129 rc=CHIP_FAIL violations=4091 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx129 n=4096 rc=CHIP_FAIL violations=4091 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx300 rc=CHIP_FAIL violations=4094 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx300 n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: paged_bf16_gqa8_32q4kv_bs16_ctx1000 rc=CHIP_FAIL violations=4096 worst=inf +FAIL paged_bf16_gqa8_32q4kv_bs16_ctx1000 n=4096 rc=CHIP_FAIL violations=4096 worst_scaled_err=inf chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 0/0 +FAIL: batch: the empty sequence is all zeros +FAIL: paged_bf16_batch_3seq_32q8kv_ctx40_0_100: sequence 0 alone (single entry point, 3 blocks, ctx 40) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_batch_3seq_32q8kv_ctx40_0_100: sequence 1 alone (single entry point, 1 blocks, ctx 0) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_batch_3seq_32q8kv_ctx40_0_100: sequence 2 alone (single entry point, 4 blocks, ctx 100) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_batch_3seq_32q8kv_ctx40_0_100: repeated batch call is a cache hit, bit-identical, same staging counters (rc=CHIP_FAIL hit=128 staged 35434760061254/280147804740424) +FAIL: batch: 7 distinct blocks staged once each (65226/4267682060, 280147804740424 bytes) +FAIL: paged_bf16_batch_3seq_32q8kv_ctx40_0_100 rc=CHIP_FAIL violations=12288 worst=50291.8 +FAIL paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=12288 rc=CHIP_FAIL violations=12288 worst_scaled_err=50291.8 chip_ns=1026 call_ns=281474386328240 calls=4267627848 unwritten=65535 kv_staged=280147804740424/281474386328368 blocks=65226/4267682060 | mutants 4/4 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=12288) SLOT:CAUGHT(rc=CHIP_FAIL,bad=12288) Q_ROW:CAUGHT(rc=CHIP_FAIL,bad=12288) OUT_ROW:CAUGHT(rc=CHIP_FAIL,bad=12288) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: 1 logical references, 1 unique staged (expected 49/19) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: staged 2097152 < naive 2097152 bytes (saved 0) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre legacy staging: parity (rc=CHIP_FAIL bad=4096) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre negative control: duplicated prefix staging is flagged (legacy staged 280147804740424 == naive 281474386328368, dedupe 2097152) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: dedupe and legacy staging are bit-identical +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: sequence 0 alone (single entry point, 11 blocks, ctx 165) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: sequence 1 alone (single entry point, 12 blocks, ctx 180) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: sequence 2 alone (single entry point, 13 blocks, ctx 193) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: sequence 3 alone (single entry point, 13 blocks, ctx 207) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre: repeated batch call is a cache hit, bit-identical, same staging counters (rc=CHIP_FAIL hit=128 staged 35434760061254/2097152) +FAIL: paged_bf16_shared_prefix_4seq_8q2kv_10pre rc=CHIP_FAIL violations=4094 worst=inf +FAIL paged_bf16_shared_prefix_4seq_8q2kv_10pre n=4096 rc=CHIP_FAIL violations=4094 worst_scaled_err=inf chip_ns=100 call_ns=600000552302 calls=40 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 2/2 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=4094) SLOT:CAUGHT(rc=CHIP_FAIL,bad=4094) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: 1 logical references, 1 unique staged (expected 49/29) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: staged 2097152 < naive 2097152 bytes (saved 0) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: q/out/table traffic accounted (q=16384 out=16384 tab=8) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre legacy staging: parity (rc=CHIP_FAIL bad=16382) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre negative control: duplicated prefix staging is flagged (legacy staged 280147804740424 == naive 281474386328368, dedupe 2097152) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: dedupe and legacy staging are bit-identical +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: sequence 0 alone (single entry point, 11 blocks, ctx 165) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: sequence 1 alone (single entry point, 12 blocks, ctx 180) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: sequence 2 alone (single entry point, 13 blocks, ctx 193) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: sequence 3 alone (single entry point, 13 blocks, ctx 207) is bit-identical to its batched row (rc=CHIP_FAIL) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre: repeated batch call is a cache hit, bit-identical, same staging counters (rc=CHIP_FAIL hit=128 staged 35434760061254/2097152) +FAIL: paged_bf16_shared_prefix_4seq_32q8kv_10pre rc=CHIP_FAIL violations=16383 worst=49709.1 +FAIL paged_bf16_shared_prefix_4seq_32q8kv_10pre n=16384 rc=CHIP_FAIL violations=16383 worst_scaled_err=49709.1 chip_ns=100 call_ns=600000552302 calls=40 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 2/2 KV_HEAD:CAUGHT(rc=CHIP_FAIL,bad=16383) SLOT:CAUGHT(rc=CHIP_FAIL,bad=16383) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=1 +FAIL: hd128 uniform scores: mean of V over 300 tokens (rc CHIP_FAIL, 1024 bad, worst 3.14169e+42, 0 threads) + hd128 dominant token 5 (warp 0 of chunk 0): rc CHIP_FAIL, 1024 bad, worst 4.21267e+41 + hd128 dominant token 40 (warp 1 of chunk 0): rc CHIP_FAIL, 1024 bad, worst 1.16258e+42 + hd128 dominant token 70 (warp 2 of chunk 0): rc CHIP_FAIL, 1024 bad, worst 8.29127e+41 + hd128 dominant token 100 (warp 3 of chunk 0): rc CHIP_FAIL, 1024 bad, worst 1.29469e+42 + hd128 dominant token 127 (warp 3 of chunk 0): rc CHIP_FAIL, 1024 bad, worst 4.7454e+41 + hd128 dominant token 131 (warp 0 of chunk 1): rc CHIP_FAIL, 1024 bad, worst 1.2533e+42 + hd128 dominant token 299 (warp 1 of chunk 2): rc CHIP_FAIL, 1024 bad, worst 7.97848e+41 +FAIL: hd128 dominant token in every warp and chunk: exact max/sum over four warp partials (worst bad 1024) +FAIL: 126 checks, 71 failed diff --git a/evidence/FB1-CUT5-HD128-5a9f759/start.txt b/evidence/FB1-CUT5-HD128-5a9f759/start.txt new file mode 100644 index 000000000..48df48edf --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/start.txt @@ -0,0 +1 @@ +2026-10-07T02:17:34Z diff --git a/evidence/FB1-CUT5-HD128-5a9f759/status.txt b/evidence/FB1-CUT5-HD128-5a9f759/status.txt new file mode 100644 index 000000000..64542c8f7 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-5a9f759/status.txt @@ -0,0 +1,2 @@ +hd64 rc=0 +hd128 rc=1 diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/SHA256SUMS b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/SHA256SUMS new file mode 100644 index 000000000..3a9851d47 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/SHA256SUMS @@ -0,0 +1,12 @@ +7377faa169d26cfe93b79c1024d97473deac677a68395ca8f51dfdbe2c27caaa build.log +531f8e1a0e28de36ece4b2d45bfb0186682e46ab865dd90d0c9449260e15cd2b device.txt +4f83db25193278a4eab50202656a69aa151ac416f6cd3c047063f256d34f0611 gpu_attention_test.c +adb89be06da592d860aaab5a31fc2c7aed478fde9535c23eb3a0604b3b844c06 omega_gpu_attention_api.c +470d114d0488d74d8f149b8bdcd1568b33f4676db17001a77f19e44bef754cb1 omega_gpu_attention_api.h +260359db1c3d0c5e257b747f426468fcff898966a830e464f04bc662aceef156 receipt.json +894c962ad34958b3cb3edbe82bdfbd2fd8be00f332eb48a7b933d6de874e3b3b run.log +3094ef8189a833f18c0c1a24fe3a224df7758fa6ed89261f3baff416f37d49ce sim.log +6b87b77e3d8532d0af9ff8c670b533a14b6d42771bec6c68566fafca79c89ceb sweep.json +c2764d16a56ae8892421bf27839e3a5e4c23da2b618d607248e45178dd37ac5f sweep.log +b92a19cf40acf471555c3914b990f1b633e49714e0d1d910eecacfebfb41ca20 timing.json +14c2fbeee7f3eeaf3ea230b1115f50164c29c154b6c647e618ec9d1913d80700 timing.log diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/build.log b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/build.log new file mode 100644 index 000000000..67d1efeaf --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/build.log @@ -0,0 +1,8 @@ +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_accelerator_world.c -o build/omega_accelerator_world.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_submit.c -o build/omega_blackwell_submit.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_gpu_session.c -o build/omega_gpu_session.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_gpu_matmul_api.c -o build/omega_gpu_matmul_api.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_gpu_elementwise_api.c -o build/omega_gpu_elementwise_api.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_gpu_attention_api.c -o build/omega_gpu_attention_api.o +ar rcs build/libomega_gpu.a build/sha256.o build/omega_canonical.o build/omega_validate.o build/omega_core.o build/omega_codec.o build/aarch64_encoder.o build/aarch64_decoder.o build/omega_realize.o build/omega_exec.o build/omega_self_host.o build/omega_verify.o build/omega_program.o build/omega_synthesis.o build/omega_library.o build/omega_discovery.o build/omega_machine.o build/omega_realize_synth.o build/omega_matvec.o build/omega_accelerator.o build/omega_accelerator_world.o build/omega_vector.o build/omega_blackwell_encoder.o build/omega_blackwell_qmd.o build/omega_blackwell_realize.o build/omega_blackwell_submit.o build/omega_blackwell_engine.o build/omega_gpu_engine.o build/omega_blackwell_matmul.o build/omega_blackwell_codegen.o build/omega_gpu_session.o build/omega_gpu_matmul_api.o build/omega_gpu_elementwise_api.o build/omega_gpu_attention_api.o build/omega_gpu_wait.o build/omega_evidence.o build/m16_native.o build/nvrm.o build/omega_program_ir.o build/omega_vc_bridge.o build/omega_resolve.o build/omega_receipt.o build/omega_blake3.o build/omega_vcstore.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/m16 -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/nvrm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I/home/drakestapleton/workspace/hive/WATTN/omega/../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -ffp-contract=off -Itests -o build/gpu_attention_test tests/gpu_attention_test.c build/libomega_gpu.a -lpthread -lm diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/device.txt b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/device.txt new file mode 100644 index 000000000..77e1224b6 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/device.txt @@ -0,0 +1,5 @@ +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 +omega 7dd92dc3f9db1a21aeedc7f38b629e5ce4358d4e (0 uncommitted paths) +physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +2026-10-07T03:14:27Z diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/gpu_attention_test.c b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/gpu_attention_test.c new file mode 100644 index 000000000..80ff4b01f --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/gpu_attention_test.c @@ -0,0 +1,972 @@ +/* gpu_attention_test: FB-1 cut 5 gate for omega_gpu_attention_api. + * + * ./gpu_attention_test --host-only refusals, codegen (both kernel families and every + * mutant), register budget, nvdisasm listing check + * ./gpu_attention_test --timing [--out r.json] cut 4b gate: 1 query x 32 heads x 2048 ctx, 100 calls + * through the persistent session, median under 3 ms + * ./gpu_attention_test --sweep [--out s.json] head-scaling sweep: paged bf16 at head_dim 64 over q heads + * 1..64 x every kv-head divisor x ctx 256/2048, parity + timings + * (receipt OMEGA_GPU_ATTENTION_SWEEP_V1; --sim marks host timings) + * ./gpu_attention_test --out receipt.json chip gate: every shape against the host oracle, the + * mutants (deliberately wrong kernels, all of + * 1 .. OMEGA_GPU_ATTN_MUTANT_COUNT-1) which the same + * check must catch, a negative control, timings + * + * Oracles re-state aien-sovereign-core crates/aien-inference-abi/src/backend.rs (main 8b5caed) in C: + * ReferenceCpuBackend::gqa_attention (f64 scores, max, exp, sum, 1/max(sum,1e-12), f64 weighted sum), + * TensorBackend::paged_attention (f64 online softmax token by token over the paged bf16 pool, tokens + * past the block table dropped, zeros for empty context) and paged_attention_batch (ctx <= 0 -> 0, + * table rows past the array -> empty, negative entries removed). Compiled with -ffp-contract=off. + * + * Tolerance (why): the chip accumulates the 64-term dot products, the per-chunk sums and the + * rescaled running sums in f32 (worst case about n * 2^-24 relative over n = 2048 terms, 1.2e-4), + * uses MUFU.EX2 (PTX ex2.approx: 2^-22.5 relative) for every weight and for the 32 chunk rescale + * factors, and MUFU.RCP for the final normalisation. Every output is a convex combination of V + * values of unit scale, so |error| <= 2e-4 * |want| + 2e-5 covers these with margin; the mutants + * move results by 1e-2 or more (wrong head, wrong token) or produce NaN (overflow without the max). + * The large-score case (scores up to ~300) carries the f32 rounding of the score itself into the + * exponent (3e-5 absolute per score), so it uses 1e-3 relative + 1e-4 absolute. + */ +#include "omega_gpu_attention_api.h" +#include "omega_gpu_session.h" +#include "omega_blackwell_codegen.h" +#include "bw_warp_sim.h" /* omega #308: SIMT warp simulator for --divergent */ +#include +#include +#include +#include +#include +#include +#include + +static int g_checks, g_failed; +static int g_sim_mode; /* --sim: the host simulator never opens the device */ +static int g_divergent; /* --divergent (omega #308 R2): the j >= ctx branch inside a BSSY/BSYNC region */ +static uint32_t g_hd = 64; /* --hd 128: the whole battery at head_dim 128 (Qwen3-4B shapes); both simulators size the CTA from it */ +#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 uint16_t f2bf(float f) { uint32_t u; memcpy(&u, &f, 4); uint32_t r = ((u >> 16) & 1u) + 0x7fffu; return (uint16_t)((u + r) >> 16); } +static float bf2f(uint16_t b) { uint32_t u = (uint32_t)b << 16; float f; memcpy(&f, &u, 4); return f; } + +/* ----------------------------------------------------------------- oracles */ +static void oracle_gqa(const float *q, const float *kc, const float *vc, size_t seq_len, size_t nqh, size_t nkv, size_t hd, float *out) { + if (seq_len == 0) { memset(out, 0, nqh * hd * 4); return; } + size_t ratio = nqh / nkv; double inv_sqrt_d = 1.0 / sqrt((double)hd); + double *scores = malloc(seq_len * sizeof *scores); + for (size_t h = 0; h < nqh; h++) { + size_t kvh = h / ratio; const float *qh = q + h * hd; + for (size_t t = 0; t < seq_len; t++) { + const float *kt = kc + (t * nkv + kvh) * hd; double dot = 0.0; + for (size_t d = 0; d < hd; d++) dot += (double)qh[d] * (double)kt[d]; + scores[t] = dot * inv_sqrt_d; + } + double mx = -INFINITY; for (size_t t = 0; t < seq_len; t++) if (scores[t] > mx) mx = scores[t]; + double sum = 0.0; for (size_t t = 0; t < seq_len; t++) { scores[t] = exp(scores[t] - mx); sum += scores[t]; } + double inv = 1.0 / (sum > 1e-12 ? sum : 1e-12); + for (size_t t = 0; t < seq_len; t++) scores[t] *= inv; + for (size_t d = 0; d < hd; d++) { + double s = 0.0; + for (size_t t = 0; t < seq_len; t++) s += scores[t] * (double)vc[(t * nkv + kvh) * hd + d]; + out[h * hd + d] = (float)s; + } + } + free(scores); +} +/* bf16 pool in the canonical layout; the oracle's read_kv_head: element_offset(block, layer, is_value, token) + kv_head*head_dim*2 */ +static const uint16_t *kv_head(const uint8_t *pool, const OmegaGpuKvLayout *ly, size_t blk, size_t layer, int is_v, size_t tok, size_t kvh, size_t hd) { + size_t off = blk * ly->block_stride_bytes + layer * ly->layer_stride_bytes + (is_v ? ly->kv_plane_stride_bytes : 0) + tok * ly->token_stride_bytes + kvh * hd * 2; + return (const uint16_t *)(pool + off); +} +static void oracle_paged(const float *q, const uint8_t *pool, const OmegaGpuKvLayout *ly, const uint32_t *ids, size_t nids, size_t ctx, size_t layer, + size_t nqh, size_t nkv, size_t hd, float *out) { + if (ctx == 0 || nids == 0) { memset(out, 0, nqh * hd * 4); return; } + size_t ratio = nqh / nkv; double inv_sqrt_d = 1.0 / sqrt((double)hd); size_t bs = ly->block_size; + double *acc = malloc(hd * sizeof *acc); + for (size_t h = 0; h < nqh; h++) { + size_t kvh = h / ratio; const float *qh = q + h * hd; + double m = -INFINITY, l = 0.0; for (size_t d = 0; d < hd; d++) acc[d] = 0.0; + for (size_t t = 0; t < ctx; t++) { + size_t bi = t / bs; if (bi >= nids) break; + const uint16_t *kh = kv_head(pool, ly, ids[bi], layer, 0, t % bs, kvh, hd); + const uint16_t *vh = kv_head(pool, ly, ids[bi], layer, 1, t % bs, kvh, hd); + double dot = 0.0; for (size_t d = 0; d < hd; d++) dot += (double)qh[d] * (double)bf2f(kh[d]); + double score = dot * inv_sqrt_d, mn = m > score ? m : score, alpha = exp(m - mn), beta = exp(score - mn); + l = l * alpha + beta; + for (size_t d = 0; d < hd; d++) acc[d] = acc[d] * alpha + beta * (double)bf2f(vh[d]); + m = mn; + } + double inv = l > 0.0 ? 1.0 / l : 0.0; + for (size_t d = 0; d < hd; d++) out[h * hd + d] = (float)(acc[d] * inv); + } + free(acc); +} +static void oracle_batch(const float *q, const uint8_t *pool, const OmegaGpuKvLayout *ly, const int32_t *tables, const int32_t *ctxs, size_t maxb, size_t nseq, + size_t layer, size_t nqh, size_t nkv, size_t hd, float *out) { + size_t stride = nqh * hd; + uint32_t *ids = malloc((maxb ? maxb : 1) * sizeof *ids); + for (size_t s = 0; s < nseq; s++) { + size_t ctx = ctxs[s] > 0 ? (size_t)ctxs[s] : 0, n = 0; + size_t total = nseq * maxb; /* the table array length as the trait sees it */ + if ((s + 1) * maxb <= total) for (size_t b = 0; b < maxb; b++) if (tables[s * maxb + b] >= 0) ids[n++] = (uint32_t)tables[s * maxb + b]; + oracle_paged(q + s * stride, pool, ly, ids, n, ctx, layer, nqh, nkv, hd, out + s * stride); + } + free(ids); +} + +static size_t compare(const float *got, const float *want, size_t n, double rel, double abs_tol, double *worst) { + size_t bad = 0; *worst = 0.0; + for (size_t i = 0; i < n; i++) { + double d = fabs((double)got[i] - (double)want[i]); + double lim = rel * fabs((double)want[i]) + abs_tol; + double scaled = lim > 0 ? d / lim : (d > 0 ? INFINITY : 0.0); + if (scaled > *worst) *worst = scaled; + if (!(d <= lim)) bad++; /* NaN counts as bad */ + } + return bad; +} + +/* ------------------------------------------------------------- host only */ +static int nvdisasm_check(bool f32, const char *name, const char *const *must, int n_must) { + const char *nv = "/usr/local/cuda/bin/nvdisasm"; + if (access(nv, X_OK) != 0) { printf("nvdisasm: not present, listing check skipped for %s\n", name); return 0; } + OmegaBlackwellKernel k; memset(&k, 0, sizeof k); + if (omega_gpu_attention_codegen_hd(f32, f32 ? 12 : 4, 3, g_hd, &k) != OMEGA_GPU_ATTN_OK) return -1; + char bin[64], lst[64], cmd[256]; + snprintf(bin, sizeof bin, "/tmp/omega_attn_%s_%d.bin", name, (int)getpid()); + snprintf(lst, sizeof lst, "/tmp/omega_attn_%s_%d.sass", name, (int)getpid()); + FILE *f = fopen(bin, "wb"); if (!f) { free(k.code); return -1; } + fwrite(k.code, 1, k.code_size, f); fclose(f); + snprintf(cmd, sizeof cmd, "%s -b SM121 %s > %s 2>&1", nv, bin, lst); + int rc = system(cmd); + free(k.code); + FILE *l = fopen(lst, "r"); if (!l) return -1; + char line[512]; int seen[16] = {0}; int bad = 0, insns = 0; + while (fgets(line, sizeof line, l)) { + if (!strstr(line, "/*0")) continue; + insns++; + if (strstr(line, "?") || strstr(line, "error")) bad++; + for (int i = 0; i < n_must; i++) if (strstr(line, must[i])) seen[i] = 1; + } + fclose(l); + int miss = 0; + for (int i = 0; i < n_must; i++) if (!seen[i]) { printf(" %s: nvdisasm listing lacks %s\n", name, must[i]); miss++; } + printf("nvdisasm %s: rc=%d insns=%d undecodable=%d missing=%d (%s)\n", name, rc, insns, bad, miss, lst); + unlink(bin); + return (rc == 0 && bad == 0 && miss == 0) ? 0 : -1; +} + +static OmegaGpuKvLayout layout_for(uint32_t num_blocks, uint32_t bs, uint32_t layers, uint32_t nkv, uint32_t hd) { + OmegaGpuKvLayout ly; + ly.head_stride_bytes = (uint64_t)hd * 2; ly.token_stride_bytes = ly.head_stride_bytes * nkv; + ly.kv_plane_stride_bytes = ly.token_stride_bytes * bs; ly.layer_stride_bytes = 2 * ly.kv_plane_stride_bytes; + ly.block_stride_bytes = ly.layer_stride_bytes * layers; ly.pool_bytes = ly.block_stride_bytes * num_blocks; + ly.num_blocks = num_blocks; ly.num_layers = layers; ly.block_size = bs; + return ly; +} + +static void host_only(void) { + float q[64 * 64], kv[64 * 64], out[64 * 64]; memset(q, 0, sizeof q); memset(kv, 0, sizeof kv); + CHECK(omega_gpu_gqa_attention_f32(NULL, kv, kv, 1, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "NULL q refused"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 4, 96, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "head_dim 96 refused (TOO_LARGE)"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 4, 256, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "head_dim 256 refused (TOO_LARGE)"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 6, 2, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "gqa ratio 3 refused"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 5, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "32 q heads / 5 kv heads refused"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, OMEGA_GPU_ATTN_MAX_GQA_CTX + 1, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "context past the envelope refused"); + for (int i = 0; i < 64; i++) out[i] = 1.0f; + OmegaGpuAttnInfo info; + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 0, 1, 1, 64, out, &info) == OMEGA_GPU_ATTN_OK && out[0] == 0.0f && out[63] == 0.0f && info.chip_calls == 0, "seq_len 0 writes zeros without a launch"); + OmegaGpuKvLayout ly = layout_for(8, 16, 2, 4, 64); + uint8_t *pool = calloc(ly.pool_bytes, 1); + uint32_t ids[2] = { 1, 9 }; + CHECK(omega_gpu_paged_attention_bf16(q, pool, &ly, ids, 2, 20, 0, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "block id past the pool refused"); + CHECK(omega_gpu_paged_attention_bf16(q, pool, &ly, ids, 1, 20, 2, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "layer past the pool refused"); + OmegaGpuKvLayout bad = ly; bad.block_size = 12; + CHECK(omega_gpu_paged_attention_bf16(q, pool, &bad, ids, 1, 10, 0, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "block size 12 (not a power of two) refused"); + bad = ly; bad.head_stride_bytes = 256; + CHECK(omega_gpu_paged_attention_bf16(q, pool, &bad, ids, 1, 10, 0, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "layout whose head stride is not head_dim*2 refused"); + free(pool); + CHECK(strcmp(omega_gpu_attention_rc_name(OMEGA_GPU_ATTN_UNWRITTEN), "UNWRITTEN") == 0, "rc name"); + + /* with --divergent the listing must also show the region ops (last two entries) */ + static const char *const must_bf16[] = { "MUFU.EX2", "MUFU.RCP", "FMNMX", "BAR.SYNC", "SHFL.DOWN", "@P0 BRA", "@!P0 BRA", "LDG.E.U16", "LDG.E ", "LDS R", "STS [R", "STG.E", "LOP3.LUT", "SHF.R.U32.HI", "BSSY", "BSYNC" }; + static const char *const must_f32[] = { "MUFU.EX2", "MUFU.RCP", "FMNMX", "BAR.SYNC", "SHFL.DOWN", "@P0 BRA", "@!P0 BRA", "LDG.E ", "LDS R", "STS [R", "STG.E", "BSSY", "BSYNC" }; + for (int f32 = 0; f32 < 2; f32++) { + const char *name = f32 ? "gqa_f32" : "paged_bf16"; + OmegaBlackwellKernel k; memset(&k, 0, sizeof k); + int rc = omega_gpu_attention_codegen_hd(f32 != 0, f32 ? 12 : 4, 3, g_hd, &k); + CHECK(rc == OMEGA_GPU_ATTN_OK && k.code_size > 0 && k.gpr_count <= 64, "%s kernel generated (rc %s, %zu insns, %u gprs)", name, omega_gpu_attention_rc_name(rc), k.insn_count, k.gpr_count); + printf("codegen %s: %zu insns, %u gprs, %u ugprs\n", name, k.insn_count, k.gpr_count, k.uniform_gpr_count); + /* every mutant (1 .. COUNT-1) is a distinct kernel: different from the baseline and from + * every other mutant, named, and inside the register budget */ + uint8_t digests[OMEGA_GPU_ATTN_MUTANT_COUNT][32]; memcpy(digests[0], k.code_digest, 32); + free(k.code); + for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) { + omega_gpu_attention_test_set_mutant((OmegaGpuAttnMutant)m); + memset(&k, 0, sizeof k); + int mrc = omega_gpu_attention_codegen_hd(f32 != 0, f32 ? 12 : 4, 3, g_hd, &k); + CHECK(mrc == OMEGA_GPU_ATTN_OK && k.gpr_count <= 64, "%s mutant %s generated (rc %s, %u gprs)", name, omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), omega_gpu_attention_rc_name(mrc), k.gpr_count); + CHECK(strcmp(omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), "?") != 0, "mutant %d has a name", m); + memcpy(digests[m], k.code_digest, 32); + free(k.code); + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_NONE); + for (int o = 0; o < m; o++) + CHECK(memcmp(digests[o], digests[m], 32) != 0, "%s mutant %s kernel differs from %s", name, omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)o)); + } + CHECK(strcmp(omega_gpu_attention_mutant_name(OMEGA_GPU_ATTN_MUTANT_COUNT), "?") == 0, "COUNT has no name"); + /* a different shape key is a different kernel */ + memset(&k, 0, sizeof k); + CHECK(omega_gpu_attention_codegen_hd(f32 != 0, f32 ? 12 : 4, 2, g_hd, &k) == OMEGA_GPU_ATTN_OK && memcmp(digests[0], k.code_digest, 32) != 0, "%s log2gqa 2 kernel differs from log2gqa 3", name); + free(k.code); + CHECK(nvdisasm_check(f32 != 0, name, f32 ? must_f32 : must_bf16, (f32 ? 11 : 14) + (g_divergent ? 2 : 0)) == 0, "%s nvdisasm listing decodes and shows the expected instructions", name); + } +} + +/* ------------------------------------------------------------- chip gate */ +typedef struct { const char *name; size_t n; int rc; size_t bad; double worst; int pass; uint64_t chip_ns, call_ns; uint32_t calls, unwritten; + int mutants_run, mutants_caught; char mutant_note[400]; + uint64_t kv_staged, kv_naive; uint32_t blk_logical, blk_unique; } Case; +static void case_info(Case *c, const OmegaGpuAttnInfo *i) { + c->chip_ns = i->elapsed_ns; c->call_ns = i->call_ns; c->calls = i->chip_calls; c->unwritten = i->unwritten_words; + c->kv_staged = i->kv_bytes_staged; c->kv_naive = i->kv_bytes_naive; c->blk_logical = i->kv_blocks_logical; c->blk_unique = i->kv_blocks_unique; +} +static Case g_cases[32]; static int g_ncases; +static int g_mutant_caught[OMEGA_GPU_ATTN_MUTANT_COUNT], g_mutant_run[OMEGA_GPU_ATTN_MUTANT_COUNT]; + +static void record(Case c, FILE *out) { + g_cases[g_ncases++] = c; + CHECK(c.pass, "%s rc=%s violations=%zu worst=%g", c.name, omega_gpu_attention_rc_name(c.rc), c.bad, c.worst); + CHECK(c.mutants_caught == c.mutants_run, "%s mutants caught %d of %d (%s)", c.name, c.mutants_caught, c.mutants_run, c.mutant_note); + printf("%s %s n=%zu rc=%s violations=%zu worst_scaled_err=%g chip_ns=%" PRIu64 " call_ns=%" PRIu64 " calls=%u unwritten=%u kv_staged=%" PRIu64 "/%" PRIu64 " blocks=%u/%u | mutants %d/%d %s\n", + c.pass && c.mutants_caught == c.mutants_run ? "PASS" : "FAIL", c.name, c.n, omega_gpu_attention_rc_name(c.rc), c.bad, c.worst, c.chip_ns, c.call_ns, c.calls, c.unwritten, + c.kv_staged, c.kv_naive, c.blk_unique, c.blk_logical, c.mutants_caught, c.mutants_run, c.mutant_note); + if (out) fprintf(out, "%s{\"case\":\"%s\",\"n\":%zu,\"rc\":\"%s\",\"violations\":%zu,\"worst_scaled_err\":%g,\"pass\":%s,\"chip_elapsed_ns\":%" PRIu64 ",\"call_ns\":%" PRIu64 ",\"chip_calls\":%u,\"unwritten_words\":%u," + "\"kv_bytes_staged\":%" PRIu64 ",\"kv_bytes_naive\":%" PRIu64 ",\"kv_blocks_unique\":%u,\"kv_blocks_logical\":%u,\"mutants_run\":%d,\"mutants_caught\":%d,\"mutant_note\":\"%s\"}", + g_ncases > 1 ? "," : "", c.name, c.n, omega_gpu_attention_rc_name(c.rc), c.bad, c.worst, c.pass ? "true" : "false", c.chip_ns, c.call_ns, c.calls, c.unwritten, + c.kv_staged, c.kv_naive, c.blk_unique, c.blk_logical, c.mutants_run, c.mutants_caught, c.mutant_note); +} + +static const char *mutant_name(int m) { return omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m); } + +/* Runs the mutants listed in `ms` (terminated by 0) through `run` and counts the catches. */ +typedef int (*RunFn)(void *ctx, float *got, OmegaGpuAttnInfo *info); +static void run_mutants(Case *c, const int *ms, RunFn run, void *ctx, float *got, const float *want, size_t n, double rel, double abs_tol) { + size_t pos = strlen(c->mutant_note); /* appends: a case may call this more than once */ + for (int i = 0; ms[i]; i++) { + OmegaGpuAttnInfo info; double w; + omega_gpu_attention_test_set_mutant((OmegaGpuAttnMutant)ms[i]); + int rc = run(ctx, got, &info); + size_t bad = compare(got, want, n, rel, abs_tol, &w); + int caught = rc != OMEGA_GPU_ATTN_OK || bad > 0; + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_NONE); + c->mutants_run++; c->mutants_caught += caught; g_mutant_run[ms[i]]++; g_mutant_caught[ms[i]] += caught; + pos += (size_t)snprintf(c->mutant_note + pos, sizeof c->mutant_note - pos, "%s%s:%s(rc=%s,bad=%zu)", pos ? " " : "", mutant_name(ms[i]), caught ? "CAUGHT" : "MISSED", omega_gpu_attention_rc_name(rc), bad); + if (pos >= sizeof c->mutant_note) break; + } +} + +typedef struct { const float *q, *kc, *vc; uint32_t seq, nqh, nkv; } GqaCtx; +static int run_gqa(void *p, float *got, OmegaGpuAttnInfo *info) { GqaCtx *c = p; return omega_gpu_gqa_attention_f32(c->q, c->kc, c->vc, c->seq, c->nqh, c->nkv, g_hd, got, info); } +typedef struct { const float *q; const uint8_t *pool; const OmegaGpuKvLayout *ly; const uint32_t *ids; uint32_t nids, ctx, layer, nqh, nkv; } PagedCtx; +static int run_paged(void *p, float *got, OmegaGpuAttnInfo *info) { PagedCtx *c = p; return omega_gpu_paged_attention_bf16(c->q, c->pool, c->ly, c->ids, c->nids, c->ctx, c->layer, c->nqh, c->nkv, g_hd, got, info); } +typedef struct { const float *q; const uint8_t *pool; const OmegaGpuKvLayout *ly; const int32_t *tables, *ctxs; uint32_t maxb, nseq, layer, nqh, nkv; } BatchCtx; +static int run_batch(void *p, float *got, OmegaGpuAttnInfo *info) { BatchCtx *c = p; return omega_gpu_paged_attention_batch_bf16(c->q, c->pool, c->ly, c->tables, c->ctxs, c->maxb, c->nseq, c->layer, c->nqh, c->nkv, g_hd, got, info); } +/* single vs batched parity and repeat (L6-KV, CAND-0 coverage): each sequence of a batch, run + * alone through the single-sequence entry point with the batch's own rules applied by hand + * (negative table entries removed, ctx <= 0 -> 0), must equal its row of the batched output bit + * for bit (same kernel, same per-CTA inputs; the batch only shares staging). Then the batch is + * called again with the same inputs: kernel cache hit, bit-identical output, identical staging + * counters. `got` must hold the batched output of `bc`. */ +static void batch_single_repeat_checks(const char *name, const BatchCtx *bc, const float *got, const Case *c) { + size_t row = (size_t)bc->nqh * g_hd, n = (size_t)bc->nseq * row; + float *one = malloc(row * 4), *again = malloc(n * 4); + uint32_t *ids = malloc((bc->maxb ? bc->maxb : 1) * 4); + for (uint32_t s = 0; s < bc->nseq; s++) { + uint32_t nb = 0; + for (uint32_t b = 0; b < bc->maxb; b++) { int32_t v = bc->tables[(size_t)s * bc->maxb + b]; if (v >= 0) ids[nb++] = (uint32_t)v; } + uint32_t ctx = bc->ctxs[s] > 0 ? (uint32_t)bc->ctxs[s] : 0; + for (size_t i = 0; i < row; i++) one[i] = -7.0f; /* poison: an unwritten row cannot match */ + OmegaGpuAttnInfo si; + int src = omega_gpu_paged_attention_bf16(bc->q + (size_t)s * row, bc->pool, bc->ly, ids, nb, ctx, bc->layer, bc->nqh, bc->nkv, g_hd, one, &si); + CHECK(src == OMEGA_GPU_ATTN_OK && memcmp(one, got + (size_t)s * row, row * 4) == 0, + "%s: sequence %u alone (single entry point, %u blocks, ctx %u) is bit-identical to its batched row (rc=%s)", name, s, nb, ctx, omega_gpu_attention_rc_name(src)); + } + OmegaGpuAttnInfo ri; + int rrc = omega_gpu_paged_attention_batch_bf16(bc->q, bc->pool, bc->ly, bc->tables, bc->ctxs, bc->maxb, bc->nseq, bc->layer, bc->nqh, bc->nkv, g_hd, again, &ri); + CHECK(rrc == OMEGA_GPU_ATTN_OK && ri.kernel_cache_hit && memcmp(again, got, n * 4) == 0 && ri.kv_bytes_staged == c->kv_staged && ri.kv_bytes_naive == c->kv_naive + && ri.kv_blocks_unique == c->blk_unique && ri.kv_blocks_logical == c->blk_logical, + "%s: repeated batch call is a cache hit, bit-identical, same staging counters (rc=%s hit=%d staged %" PRIu64 "/%" PRIu64 ")", + name, omega_gpu_attention_rc_name(rrc), (int)ri.kernel_cache_hit, ri.kv_bytes_staged, c->kv_staged); + free(one); free(again); free(ids); +} + + +static int chip(const char *out_path) { + FILE *out = out_path ? fopen(out_path, "w") : NULL; + if (out_path && !out) { printf("cannot open %s\n", out_path); return 2; } + if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_V1\",\"tolerances\":{\"rel\":2e-4,\"abs\":2e-5,\"large_scores_rel\":1e-3,\"large_scores_abs\":1e-4},\"cases\":["); + uint32_t seed = 0xfb1c0005u; + const uint32_t hd = g_hd; + typedef struct { uint32_t nqh, nkv; const char *model; } Shape; + const Shape shapes64[2] = { { 32, 4, "tinyllama" }, { 32, 8, "llama32_1b" } }; + /* head_dim 128: Qwen3-4B (32 q heads, 8 kv heads, GQA 4:1) and a ratio-8 shape */ + const Shape shapes128[2] = { { 32, 8, "qwen3_4b" }, { 32, 4, "gqa8" } }; + const Shape *shapes = hd == 128 ? shapes128 : shapes64; + /* 65, 129, 300 and 1000 end in a partial 64-token chunk after whole ones: the case that + * caught the diverged-warp shuffle on the chip (2026-10-04); 1, 17, 128, 256, 2048 did not. */ + /* head_dim 128 chunks are 128 tokens: 127, 128, 129 straddle a chunk, 300 and 1000 end in a partial one */ + const uint32_t ctxs64[9] = { 1, 17, 256, 2048, 65, 128, 129, 300, 1000 }, ctxs128[9] = { 1, 17, 256, 2048, 127, 128, 129, 300, 1000 }; + const uint32_t *ctxs = hd == 128 ? ctxs128 : ctxs64; + const int no_mutants[1] = { 0 }; + + /* 1. contiguous f32 KV (gqa_attention) */ + for (int sh = 0; sh < 2; sh++) for (int ci = 0; ci < 9; ci++) { + uint32_t nqh = shapes[sh].nqh, nkv = shapes[sh].nkv, seq = ctxs[ci]; + size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4), *again = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + char name[96]; snprintf(name, sizeof name, "gqa_f32_%s_%uq%ukv_ctx%u", shapes[sh].model, nqh, nkv, seq); + Case c = { .name = strdup(name), .n = n }; + OmegaGpuAttnInfo info; + GqaCtx gc = { q, kc, vc, seq, nqh, nkv }; + c.rc = run_gqa(&gc, got, &info); + c.bad = compare(got, want, n, 2e-4, 2e-5, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + if (ci == 3) { + OmegaGpuAttnInfo i2; int rc2 = run_gqa(&gc, again, &i2); + CHECK(rc2 == OMEGA_GPU_ATTN_OK && i2.kernel_cache_hit && memcmp(got, again, n * 4) == 0, "%s repeat run (cache hit) is bit-identical", name); + /* negative control: the comparison must reject a wrong expectation (kv heads swapped) */ + float *wrong = malloc(n * 4); double w2; + for (uint32_t h = 0; h < nqh; h++) memcpy(wrong + (size_t)h * hd, want + (size_t)((h + nqh / nkv) % nqh) * hd, hd * 4); + size_t neg = compare(got, wrong, n, 2e-4, 2e-5, &w2); + CHECK(neg > n / 2, "%s negative control: wrong expectation flagged (%zu of %zu)", name, neg, n); + free(wrong); + static const int ms[5] = { OMEGA_GPU_ATTN_MUTANT_SLOT, OMEGA_GPU_ATTN_MUTANT_NO_RESCALE, OMEGA_GPU_ATTN_MUTANT_Q_ROW, OMEGA_GPU_ATTN_MUTANT_OUT_ROW, 0 }; + run_mutants(&c, ms, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + } else if (ci == 1 && sh == 1) { + static const int ms[2] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, 0 }; + run_mutants(&c, ms, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + } else run_mutants(&c, no_mutants, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + record(c, out); free(q); free(kc); free(vc); free(got); free(want); free(again); + } + /* 2. large scores (q scaled by 200): the softmax without the running max overflows */ + { + uint32_t nqh = 32, nkv = 4, seq = 256; size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -200.0f, 200.0f); /* scores ~ +-200 natural: EX2 without the max subtraction overflows f32 (2^128) */ + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + Case c = { .name = "gqa_f32_large_scores_32q4kv_ctx256", .n = n }; + OmegaGpuAttnInfo info; GqaCtx gc = { q, kc, vc, seq, nqh, nkv }; + c.rc = run_gqa(&gc, got, &info); + c.bad = compare(got, want, n, 1e-3, 1e-4, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + static const int ms[2] = { OMEGA_GPU_ATTN_MUTANT_NO_MAX, 0 }; + run_mutants(&c, ms, run_gqa, &gc, got, want, n, 1e-3, 1e-4); + record(c, out); free(q); free(kc); free(vc); free(got); free(want); + } + /* 2b. MHA (16q/16kv, ratio 1, ctx 300 = 4 full chunks + a partial one): the head-wiring + * mutants Q_ROW and OUT_ROW are observably different here (Q_ROW keeps kv head h, OUT_ROW + * lands on kv head h^1), unlike GQA where both swap the same pair of outputs. */ + { + uint32_t nqh = 16, nkv = 16, seq = 300; size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4), *got_q = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + Case c = { .name = "gqa_f32_mha_16q16kv_ctx300", .n = n }; + OmegaGpuAttnInfo info; GqaCtx gc = { q, kc, vc, seq, nqh, nkv }; + c.rc = run_gqa(&gc, got, &info); + c.bad = compare(got, want, n, 2e-4, 2e-5, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + static const int ms_q[2] = { OMEGA_GPU_ATTN_MUTANT_Q_ROW, 0 }; + static const int ms_o[3] = { OMEGA_GPU_ATTN_MUTANT_OUT_ROW, OMEGA_GPU_ATTN_MUTANT_KV_HEAD, 0 }; + run_mutants(&c, ms_q, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + memcpy(got_q, got, n * 4); /* Q_ROW output */ + run_mutants(&c, ms_o, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + /* `got` now holds the KV_HEAD output; rerun OUT_ROW alone to compare it with Q_ROW */ + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_OUT_ROW); + OmegaGpuAttnInfo i3; int rc3 = run_gqa(&gc, got, &i3); + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_NONE); + double wq; size_t differ = compare(got, got_q, n, 2e-4, 2e-5, &wq); + CHECK(rc3 == OMEGA_GPU_ATTN_OK && differ > n / 2, "mha: Q_ROW and OUT_ROW outputs are distinct wrong answers (%zu of %zu differ)", differ, n); + record(c, out); free(q); free(kc); free(vc); free(got); free(want); free(got_q); + } + /* 3. paged bf16 KV, block size 16, 2 layers (layer 1 under test), scattered block ids */ + for (int sh = 0; sh < 2; sh++) for (int ci = 0; ci < 9; ci++) { + uint32_t nqh = shapes[sh].nqh, nkv = shapes[sh].nkv, ctx = ctxs[ci], bs = 16, layers = 2, layer = 1; + uint32_t nblk = (ctx + bs - 1) / bs, pool_blocks = nblk + 7; + OmegaGpuKvLayout ly = layout_for(pool_blocks, bs, layers, nkv, hd); + uint8_t *pool = malloc(ly.pool_bytes); uint16_t *pw = (uint16_t *)pool; + for (size_t i = 0; i < ly.pool_bytes / 2; i++) pw[i] = f2bf(frand(&seed, -1.0f, 1.0f)); + uint32_t *ids = malloc(nblk * 4); /* a scattered permutation of the pool blocks */ + for (uint32_t b = 0; b < nblk; b++) ids[b] = (b * 7 + 3) % pool_blocks; + size_t n = (size_t)nqh * hd; + float *q = malloc(n * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + oracle_paged(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, want); + char name[96]; snprintf(name, sizeof name, "paged_bf16_%s_%uq%ukv_bs%u_ctx%u", shapes[sh].model, nqh, nkv, bs, ctx); + Case c = { .name = strdup(name), .n = n }; + OmegaGpuAttnInfo info; PagedCtx pc = { q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv }; + c.rc = run_paged(&pc, got, &info); + c.bad = compare(got, want, n, 2e-4, 2e-5, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + if (ci == 3) { + /* NO_MAX cannot overflow on unit-scale scores (softmax is shift invariant); it is caught by the large-score gqa case */ + static const int ms3[6] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, OMEGA_GPU_ATTN_MUTANT_NO_RESCALE, OMEGA_GPU_ATTN_MUTANT_Q_ROW, OMEGA_GPU_ATTN_MUTANT_OUT_ROW, 0 }; + run_mutants(&c, ms3, run_paged, &pc, got, want, n, 2e-4, 2e-5); + } else if (ci == 1) { + static const int ms[3] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, 0 }; + run_mutants(&c, ms, run_paged, &pc, got, want, n, 2e-4, 2e-5); + } else if (ci == 0) { + /* one token: its softmax weight is 1 whatever K says, so a K-only slot shift is invisible; KV_HEAD still shows */ + static const int ms[2] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, 0 }; + run_mutants(&c, ms, run_paged, &pc, got, want, n, 2e-4, 2e-5); + } else run_mutants(&c, no_mutants, run_paged, &pc, got, want, n, 2e-4, 2e-5); + record(c, out); free(pool); free(ids); free(q); free(got); free(want); + } + /* 4. batch: three sequences (short, empty, truncated by its table), a negative table entry, table rows of 16 */ + { + uint32_t nqh = 32, nkv = 8, bs = 16, layers = 3, layer = 2, maxb = 16, nseq = 3, pool_blocks = 40; + OmegaGpuKvLayout ly = layout_for(pool_blocks, bs, layers, nkv, hd); + uint8_t *pool = malloc(ly.pool_bytes); uint16_t *pw = (uint16_t *)pool; + for (size_t i = 0; i < ly.pool_bytes / 2; i++) pw[i] = f2bf(frand(&seed, -1.0f, 1.0f)); + int32_t *tables = malloc((size_t)nseq * maxb * 4); + for (size_t i = 0; i < (size_t)nseq * maxb; i++) tables[i] = -1; + /* seq 0: ctx 40 over blocks 5, 17 (-1 in the middle closes up), 29 */ + tables[0] = 5; tables[1] = -1; tables[2] = 17; tables[3] = 29; + /* seq 1: ctx 0 with a table */ + tables[maxb + 0] = 1; + /* seq 2: ctx 100 but only 4 blocks (64 tokens used) */ + tables[2 * maxb + 0] = 30; tables[2 * maxb + 1] = 2; tables[2 * maxb + 2] = 33; tables[2 * maxb + 3] = 11; + int32_t ctxs2[3] = { 40, 0, 100 }; + size_t n = (size_t)nseq * nqh * hd; + float *q = malloc(n * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + oracle_batch(q, pool, &ly, tables, ctxs2, maxb, nseq, layer, nqh, nkv, hd, want); + Case c = { .name = "paged_bf16_batch_3seq_32q8kv_ctx40_0_100", .n = n }; + OmegaGpuAttnInfo info; BatchCtx bc = { q, pool, &ly, tables, ctxs2, maxb, nseq, layer, nqh, nkv }; + c.rc = run_batch(&bc, got, &info); + c.bad = compare(got, want, n, 2e-4, 2e-5, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + int zeros = 1; for (size_t i = 0; i < (size_t)nqh * hd; i++) if (got[(size_t)nqh * hd + i] != 0.0f) zeros = 0; + CHECK(zeros, "batch: the empty sequence is all zeros"); + batch_single_repeat_checks(c.name, &bc, got, &c); + static const int ms[5] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, OMEGA_GPU_ATTN_MUTANT_Q_ROW, OMEGA_GPU_ATTN_MUTANT_OUT_ROW, 0 }; + run_mutants(&c, ms, run_batch, &bc, got, want, n, 2e-4, 2e-5); + /* all 7 referenced blocks are distinct here, so dedupe stages exactly the naive figure */ + CHECK(c.blk_logical == 7 && c.blk_unique == 7 && c.kv_staged == c.kv_naive && c.kv_staged == 7ull * ly.layer_stride_bytes, "batch: 7 distinct blocks staged once each (%u/%u, %" PRIu64 " bytes)", c.blk_unique, c.blk_logical, c.kv_staged); + record(c, out); free(pool); free(tables); free(q); free(got); free(want); + } + /* 5. branch-heavy batch (attention hardening cut): four sequences share the same 10 physical + * prefix blocks (160 tokens, scattered ids) and own private tails of 1..3 blocks ending in a + * partial 64-token chunk. The shared prefix must be staged once per launch, keyed by the + * physical block id. Two head shapes: 8q/2kv puts all four sequences in one launch + * (unique = 10 + 9 tails), 32q/8kv splits them two per launch (unique = 2*10 + 9). + * Negative control: the legacy per-sequence staging (test hook) copies the prefix four + * times and the byte-reduction check must flag it. */ + for (int sh = 0; sh < 2; sh++) { + uint32_t nqh = sh ? 32 : 8, nkv = sh ? 8 : 2, bs = 16, layers = 2, layer = 1, nseq = 4, prefix_blocks = 10, pool_blocks = 64; + uint32_t expect_unique = sh ? 2 * prefix_blocks + 9 : prefix_blocks + 9; + uint32_t maxb = prefix_blocks + 3; + OmegaGpuKvLayout ly = layout_for(pool_blocks, bs, layers, nkv, hd); + uint8_t *pool = malloc(ly.pool_bytes); uint16_t *pw = (uint16_t *)pool; + for (size_t i = 0; i < ly.pool_bytes / 2; i++) pw[i] = f2bf(frand(&seed, -1.0f, 1.0f)); + int32_t *tables = malloc((size_t)nseq * maxb * 4); + for (size_t i = 0; i < (size_t)nseq * maxb; i++) tables[i] = -1; + const uint32_t tails[4] = { 1, 2, 3, 3 }; /* private blocks per sequence: 9 in all */ + const int32_t ctxs5[4] = { 165, 180, 193, 207 }; /* 160 + 5, 20, 33, 47: every last chunk partial */ + for (uint32_t s = 0; s < nseq; s++) { + for (uint32_t b = 0; b < prefix_blocks; b++) tables[s * maxb + b] = (int32_t)((b * 5 + 7) % pool_blocks); /* same scattered physical prefix */ + for (uint32_t b = 0; b < tails[s]; b++) tables[s * maxb + prefix_blocks + b] = (int32_t)(50 + s * 3 + b); /* private, distinct */ + } + size_t n = (size_t)nseq * nqh * hd; + float *q = malloc(n * 4), *got = malloc(n * 4), *want = malloc(n * 4), *legacy = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + oracle_batch(q, pool, &ly, tables, ctxs5, maxb, nseq, layer, nqh, nkv, hd, want); + char name[96]; snprintf(name, sizeof name, "paged_bf16_shared_prefix_4seq_%uq%ukv_10pre", nqh, nkv); + Case c = { .name = strdup(name), .n = n }; + OmegaGpuAttnInfo info; BatchCtx bc = { q, pool, &ly, tables, ctxs5, maxb, nseq, layer, nqh, nkv }; + c.rc = run_batch(&bc, got, &info); + c.bad = compare(got, want, n, 2e-4, 2e-5, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + uint32_t logical = 4 * prefix_blocks + 9; + CHECK(c.blk_logical == logical && c.blk_unique == expect_unique, "%s: %u logical references, %u unique staged (expected %u/%u)", name, c.blk_logical, c.blk_unique, logical, expect_unique); + CHECK(c.kv_naive == (uint64_t)logical * ly.layer_stride_bytes && c.kv_staged == (uint64_t)expect_unique * ly.layer_stride_bytes && c.kv_staged < c.kv_naive, + "%s: staged %" PRIu64 " < naive %" PRIu64 " bytes (saved %" PRIu64 ")", name, c.kv_staged, c.kv_naive, c.kv_naive - c.kv_staged); + CHECK(info.kv_source == OMEGA_GPU_ATTN_KV_STAGED && info.q_bytes == n * 4 && info.out_bytes == n * 4 && info.tab_bytes > 0, "%s: q/out/table traffic accounted (q=%" PRIu64 " out=%" PRIu64 " tab=%" PRIu64 ")", name, info.q_bytes, info.out_bytes, info.tab_bytes); + /* negative control: legacy per-sequence staging duplicates the shared prefix; same answer, more bytes */ + omega_gpu_attention_test_set_dedupe(false); + OmegaGpuAttnInfo li; int lrc = run_batch(&bc, legacy, &li); + omega_gpu_attention_test_set_dedupe(true); + double lw; size_t lbad = compare(legacy, want, n, 2e-4, 2e-5, &lw); + CHECK(lrc == OMEGA_GPU_ATTN_OK && lbad == 0, "%s legacy staging: parity (rc=%s bad=%zu)", name, omega_gpu_attention_rc_name(lrc), lbad); + CHECK(li.kv_blocks_unique == logical && li.kv_bytes_staged == li.kv_bytes_naive && li.kv_bytes_staged > c.kv_staged, + "%s negative control: duplicated prefix staging is flagged (legacy staged %" PRIu64 " == naive %" PRIu64 ", dedupe %" PRIu64 ")", name, li.kv_bytes_staged, li.kv_bytes_naive, c.kv_staged); + CHECK(memcmp(got, legacy, n * 4) == 0, "%s: dedupe and legacy staging are bit-identical", name); + batch_single_repeat_checks(name, &bc, got, &c); + static const int ms5[3] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, 0 }; + run_mutants(&c, ms5, run_batch, &bc, got, want, n, 2e-4, 2e-5); + record(c, out); free(pool); free(tables); free(q); free(got); free(want); free(legacy); + } + /* every mutant the API knows (1 .. COUNT-1) ran at least once and was caught every time; + * a mutant added to the enum without a battery entry fails here */ + for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) { + CHECK(g_mutant_run[m] > 0 && g_mutant_caught[m] == g_mutant_run[m], "mutant %s caught %d of %d runs", mutant_name(m), g_mutant_caught[m], g_mutant_run[m]); + printf("mutant %s: caught %d of %d\n", mutant_name(m), g_mutant_caught[m], g_mutant_run[m]); + } + CHECK(omega_gpu_session_open_count() == (g_sim_mode ? 0u : 1u), "device opened %s for the battery (opens=%u)", g_sim_mode ? "never (simulator)" : "once", omega_gpu_session_open_count()); + printf("device_opens=%u\n", omega_gpu_session_open_count()); + if (out) { + fprintf(out, "],\"mutant_count\":%d,\"mutants\":{", OMEGA_GPU_ATTN_MUTANT_COUNT - 1); + for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) fprintf(out, "%s\"%s\":{\"run\":%d,\"caught\":%d}", m > 1 ? "," : "", mutant_name(m), g_mutant_run[m], g_mutant_caught[m]); + fprintf(out, "},\"device_opens\":%u,\"checks\":%d,\"failed\":%d,\"verdict\":\"%s\"}\n", omega_gpu_session_open_count(), g_checks, g_failed, g_failed == 0 ? "OMEGA_GPU_ATTENTION_PASS" : "OMEGA_GPU_ATTENTION_FAIL"); + fclose(out); + } + return 0; +} + +/* ------------------------------------------------------------ host simulator + * Executes the allocated IR program (physical registers, so the register allocator's + * loop handling is under test too) for every CTA of a launch: 64 threads, 1 KB shared, + * host pointers as addresses, SHFL and BAR as lockstep points (all threads of the CTA + * must sit at the same instruction). EX2 and RCP are exact here; the chip's are approximate. */ +/* path: hash of every branch decision so far. The IR has no reconvergence instruction + * (no BSSY/BSYNC/WARPSYNC), so once a warp splits it may stay split on the chip, and a + * SHFL reading an inactive lane is undefined (CUDA guide, warp shuffle functions). Every + * SHFL therefore requires one path across the warp, or the simulator stops with error 7. */ +typedef struct { uint32_t r[256]; int pc; int p0; int done; uint64_t path; } SimThr; +static uint32_t sim_cbank[256]; +static uint8_t sim_shared[4096]; +#define SIM_TMAX 128 +#define SIM_T ((int)g_hd) /* threads per CTA = head_dim */ +static uint32_t g_smem_cap; /* negative control: pretend the QMD declared this many bytes (0 = the real 16 * head_dim) */ +#define SIM_SMEM (g_smem_cap ? g_smem_cap : 16u * g_hd) /* the shared memory the QMD declares for this kernel (launcher: shared_bytes = 16 * head_dim) */ +static int g_sim_err; +static int g_trace, g_trace_launch; static uint32_t g_trace_cx; +static uint32_t rd(const SimThr *t, int v, const BlackwellIRProgram *p) { if (v < 0) return 0; int ph = p->regalloc.vreg_to_phys[v]; return ph < 0 ? 0 : t->r[ph & 0xff]; } +static uint64_t rd64(const SimThr *t, int v, const BlackwellIRProgram *p) { if (v < 0) return 0; int ph = p->regalloc.vreg_to_phys[v] & 0xff; return (uint64_t)t->r[ph] | ((uint64_t)t->r[ph + 1] << 32); } +static void wr(SimThr *t, int v, uint32_t x, const BlackwellIRProgram *p) { if (v < 0) return; int ph = p->regalloc.vreg_to_phys[v]; if (ph >= 0) t->r[ph & 0xff] = x; } +static void wr64(SimThr *t, int v, uint64_t x, const BlackwellIRProgram *p) { if (v < 0) return; int ph = p->regalloc.vreg_to_phys[v] & 0xff; t->r[ph] = (uint32_t)x; t->r[ph + 1] = (uint32_t)(x >> 32); } +static float u2f(uint32_t u) { float f; memcpy(&f, &u, 4); return f; } +static uint32_t f2u_(float f) { uint32_t u; memcpy(&u, &f, 4); return u; } +/* run one thread until it reaches a SHFL or BAR (not executed) or EXIT; returns 1 if parked at a sync op */ +static int sim_step(SimThr *t, const BlackwellIRProgram *p, uint32_t tid, uint32_t cx, uint32_t cy) { + for (int guard = 0; guard < 50000000; guard++) { + if (t->done) return 0; + if (t->pc < 0 || (size_t)t->pc >= p->count) { g_sim_err = 1; t->done = 1; return 0; } + const BlackwellIRInsn *in = &p->insns[t->pc]; + uint32_t a = rd(t, in->src1_vreg, p), b = rd(t, in->src2_vreg, p), c = rd(t, in->src3_vreg, p); + switch (in->op) { + case BW_IR_SHFL_DOWN: case BW_IR_BAR_SYNC: return 1; + case BW_IR_EXIT: if (!in->predicate_p0 || t->p0) { t->done = 1; return 0; } break; + case BW_IR_BRA: { + int take = !in->predicate_p0 || (in->predicate_not ? !t->p0 : t->p0); + t->path = t->path * 1000003u + (((uint64_t)t->pc << 1) | (uint64_t)take); + if (take) { if ((int32_t)in->imm == 0) { g_sim_err = 2; t->done = 1; return 0; } t->pc += (int32_t)in->imm; continue; } + break; } + case BW_IR_MOV_IMM: wr(t, in->dst_vreg, in->imm, p); break; + case BW_IR_MOV_RZ: wr(t, in->dst_vreg, 0, p); break; + case BW_IR_S2R: wr(t, in->dst_vreg, in->imm == BW_SR_TID_X ? tid : in->imm == BW_SR_CTAID_X ? cx : in->imm == BW_SR_CTAID_Y ? cy : 0, p); break; + case BW_IR_LDC: wr(t, in->dst_vreg, sim_cbank[in->imm / 4], p); break; + case BW_IR_LDC64: wr64(t, in->dst_vreg, (uint64_t)sim_cbank[in->imm / 4] | ((uint64_t)sim_cbank[in->imm / 4 + 1] << 32), p); break; + case BW_IR_LDCU64: break; /* memory descriptor: not modelled */ + case BW_IR_IMAD: wr(t, in->dst_vreg, in->src2_vreg >= 0 ? a * b + c : a * in->imm + c, p); break; + case BW_IR_IMAD_WIDE: wr64(t, in->dst_vreg, (uint64_t)a * in->imm + rd64(t, in->src3_vreg, p), p); break; + case BW_IR_IADD3: wr(t, in->dst_vreg, a + b, p); break; + case BW_IR_SHF_R: wr(t, in->dst_vreg, a >> (in->imm & 31), p); break; + case BW_IR_LOP3_AND: wr(t, in->dst_vreg, a & in->imm, p); break; + case BW_IR_LOP3_XOR: wr(t, in->dst_vreg, a ^ b, p); break; + case BW_IR_ISETP_GE_U32: t->p0 = a >= b; break; + case BW_IR_LDG_E: { uint32_t x; memcpy(&x, (const void *)(uintptr_t)rd64(t, in->src1_vreg, p), 4); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_LDG_E_U16: { uint16_t x; memcpy(&x, (const void *)(uintptr_t)rd64(t, in->src1_vreg, p), 2); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_STG_E: memcpy((void *)(uintptr_t)rd64(t, in->src1_vreg, p), &b, 4); break; + case BW_IR_LDS32: { uint32_t x; if (a + 4 > SIM_SMEM) { g_sim_err = 3; t->done = 1; return 0; } memcpy(&x, sim_shared + a, 4); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_STS32: if (a + 4 > SIM_SMEM) { g_sim_err = 3; t->done = 1; return 0; } memcpy(sim_shared + a, &b, 4); break; + case BW_IR_FADD: wr(t, in->dst_vreg, f2u_(u2f(a) + u2f(b)), p); break; + case BW_IR_FSUB: wr(t, in->dst_vreg, f2u_(u2f(a) - u2f(b)), p); break; + case BW_IR_FMUL: wr(t, in->dst_vreg, f2u_(u2f(a) * u2f(b)), p); break; + case BW_IR_FFMA: wr(t, in->dst_vreg, f2u_(fmaf(u2f(a), u2f(b), u2f(c))), p); break; + case BW_IR_FMNMX_MAX: wr(t, in->dst_vreg, f2u_(fmaxf(u2f(a), u2f(b))), p); break; + case BW_IR_MUFU_EX2: wr(t, in->dst_vreg, f2u_(exp2f(u2f(a))), p); break; + case BW_IR_MUFU_RCP: wr(t, in->dst_vreg, f2u_(1.0f / u2f(a)), p); break; + default: g_sim_err = 100 + (int)in->op; t->done = 1; return 0; + } + if (g_trace && tid == 0 && cx == g_trace_cx && cy == 0 && g_trace_launch == 1) { uint32_t dv = rd(t, in->dst_vreg, p); printf("T pc=%d op=%d dst=v%d(r%d)=%08x f=%g p0=%d a=%08x b=%08x c=%08x\n", t->pc, (int)in->op, in->dst_vreg, in->dst_vreg >= 0 ? p->regalloc.vreg_to_phys[in->dst_vreg] : -1, dv, u2f(dv), t->p0, a, b, c); } + t->pc++; + } + g_sim_err = 4; t->done = 1; return 0; +} +static int sim_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info) { + const BlackwellIRProgram *p = progv; + memset(sim_cbank, 0, sizeof sim_cbank); + uint64_t qa = (uintptr_t)L->q, pa = (uintptr_t)L->pool, oa = (uintptr_t)L->out, ta = (uintptr_t)L->tab; + sim_cbank[0x380 / 4] = (uint32_t)qa; sim_cbank[0x380 / 4 + 1] = (uint32_t)(qa >> 32); + sim_cbank[0x388 / 4] = (uint32_t)pa; sim_cbank[0x388 / 4 + 1] = (uint32_t)(pa >> 32); + sim_cbank[0x390 / 4] = (uint32_t)oa; sim_cbank[0x390 / 4 + 1] = (uint32_t)(oa >> 32); + sim_cbank[0x398 / 4] = (uint32_t)ta; sim_cbank[0x398 / 4 + 1] = (uint32_t)(ta >> 32); + memcpy(&sim_cbank[0x3a0 / 4], L->params, sizeof L->params); + uint32_t *outw = L->out; for (size_t i = 0; i < L->out_bytes / 4; i++) outw[i] = 0xffbadbadu; + g_sim_err = 0; + static SimThr th[SIM_TMAX]; + g_trace_launch++; if (getenv("ATTN_SIM_TRACE")) { g_trace = 1; g_trace_cx = (uint32_t)atoi(getenv("ATTN_SIM_TRACE")); } + for (uint32_t cy = 0; cy < L->grid_y && !g_sim_err; cy++) for (uint32_t cx = 0; cx < L->grid_x && !g_sim_err; cx++) { + memset(th, 0, sizeof th); memset(sim_shared, 0, sizeof sim_shared); + for (;;) { + int parked = 0, alive = 0; + for (int i = 0; i < SIM_T; i++) { if (th[i].done) continue; alive++; parked += sim_step(&th[i], p, (uint32_t)i, cx, cy); } + if (g_sim_err) break; + if (alive == 0) break; + if (parked == 0) continue; /* every live thread exited this round */ + if (parked != alive) { g_sim_err = 5; break; } /* a thread exited while others wait at a barrier */ + int pc = -1; + for (int i = 0; i < SIM_T; i++) if (!th[i].done) { if (pc < 0) pc = th[i].pc; else if (th[i].pc != pc) g_sim_err = 6; } + if (g_sim_err) break; + const BlackwellIRInsn *in = &p->insns[pc]; + if (in->op == BW_IR_SHFL_DOWN) { + for (int i = 0; i < SIM_T; i++) if (!th[i].done && !th[i & ~31].done && th[i].path != th[i & ~31].path) g_sim_err = 7; + if (g_sim_err) break; + uint32_t src[SIM_TMAX]; + for (int i = 0; i < SIM_T; i++) src[i] = rd(&th[i], in->src1_vreg, p); + for (int i = 0; i < SIM_T; i++) { int lane = i & 31, from = lane + (int)(in->imm & 31); wr(&th[i], in->dst_vreg, from < 32 ? src[(i & ~31) + from] : src[i], p); } + } + for (int i = 0; i < SIM_T; i++) th[i].pc++; + } + } + uint32_t unwritten = 0; for (size_t i = 0; i < L->out_bytes / 4; i++) if (outw[i] == 0xffbadbadu) unwritten++; + if (info) { info->chip_calls++; info->unwritten_words += unwritten; info->ctas_last_launch = L->grid_x * L->grid_y; info->threads_per_cta = SIM_T; } + if (g_sim_err) { printf("simulator error %d\n", g_sim_err); return OMEGA_GPU_ATTN_CHIP_FAIL; } + return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; +} + + +/* ---------------------------------------------------- timing (cut 4b) */ +/* One query step of TinyLlama attention at context 2048 (32 q heads, 4 kv heads, + * f32 KV) 100 times through the persistent session, every call checked against the + * oracle; gate: median wall time per call under 3 ms, one device open per process. */ +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_d(const void *a, const void *b) { double x = *(const double *)a, y = *(const double *)b; return x < y ? -1 : x > y; } +static int timing(const char *out_path) { + FILE *out = out_path ? fopen(out_path, "w") : NULL; + if (out_path && !out) { printf("cannot open %s\n", out_path); return 2; } + enum { N = 100 }; + const uint32_t hd = 64, nqh = 32, nkv = 4, seq = 2048; + const char *name = "gqa_f32_tinyllama_32q4kv_ctx2048"; + if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_TIMING_V1\",\"gate_median_ms\":3.0,\"calls\":%d,\"cases\":[", N); + uint32_t seed = 0xfb1c004bu; + size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + double samples[N]; int ok_calls = 0; size_t bad_total = 0; double worst = 0; uint64_t chip_sum = 0; int rc_last = 0; + OmegaGpuAttnInfo info; + /* warm-up: the first call opens the device and generates the kernel (not timed) */ + int rc0 = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + double first_ms = info.call_ns / 1e6; + CHECK(rc0 == OMEGA_GPU_ATTN_OK, "%s first call rc=%s err=\"%s\"", name, omega_gpu_attention_rc_name(rc0), omega_gpu_attention_last_error()); + for (int i = 0; i < N; i++) { + double t0 = now_ms(); + int rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + samples[i] = now_ms() - t0; + double w; size_t bad = compare(got, want, n, 2e-4, 2e-5, &w); + if (w > worst) worst = w; + bad_total += bad; chip_sum += info.elapsed_ns; rc_last = rc; + if (rc == OMEGA_GPU_ATTN_OK && bad == 0) ok_calls++; + } + qsort(samples, N, sizeof samples[0], cmp_d); + double median = samples[N / 2], p90 = samples[N * 9 / 10], mn = samples[0], mx = samples[N - 1]; + uint32_t opens = omega_gpu_session_open_count(); + int pass = ok_calls == N && bad_total == 0 && median < 3.0 && opens == 1; + CHECK(pass, "timing %s ok_calls=%d/%d violations=%zu median_ms=%.3f opens=%u last_rc=%s err=\"%s\"", name, ok_calls, N, bad_total, median, opens, omega_gpu_attention_rc_name(rc_last), omega_gpu_attention_last_error()); + printf("%s timing %s first_call_ms=%.3f ok_calls=%d/%d violations=%zu worst_scaled_err=%g median_ms=%.3f p90_ms=%.3f min_ms=%.3f max_ms=%.3f chip_us_mean=%.1f device_opens=%u\n", + pass ? "PASS" : "FAIL", name, first_ms, ok_calls, N, bad_total, worst, median, p90, mn, mx, chip_sum / 1e3 / N, opens); + if (out) fprintf(out, "{\"case\":\"%s\",\"first_call_ms\":%.3f,\"ok_calls\":%d,\"violations\":%zu,\"worst_scaled_err\":%g,\"median_ms\":%.4f,\"p90_ms\":%.4f,\"min_ms\":%.4f,\"max_ms\":%.4f,\"chip_us_mean\":%.1f,\"device_opens\":%u,\"pass\":%s}", + name, first_ms, ok_calls, bad_total, worst, median, p90, mn, mx, chip_sum / 1e3 / N, opens, pass ? "true" : "false"); + free(q); free(kc); free(vc); free(got); free(want); + if (out) { fprintf(out, "],\"checks\":%d,\"failed\":%d,\"verdict\":\"%s\"}\n", g_checks, g_failed, g_failed == 0 ? "OMEGA_GPU_ATTENTION_TIMING_PASS" : "OMEGA_GPU_ATTENTION_TIMING_FAIL"); fclose(out); } + return 0; +} + +/* ------------------------------------------------ head-scaling sweep (attention hardening cut) + * `--sweep [--out sweep.json]`: the production paged bf16 path at head_dim 64 over query-head + * counts 1, 2, 4, 8, 16, 24, 32, 64 and every divisor as the kv-head count, at context 256 + * (latency) and 2048 (bandwidth), block size 16, scattered block ids. Points whose GQA ratio + * is not a power of two are mathematically legal (the generic contract allows them) but + * outside the current kernel envelope (codegen selects the kv head with a shift): they are + * called anyway, must be refused with BAD_ARGS, and are recorded as + * "unsupported_by_kernel_envelope" (no chip time). Every supported point is checked against + * the host oracle on its first call, then warmed and timed over N calls (median / p90 of the + * whole call and of the chip kernel time). Gates: parity, no unwritten word, one device open, + * every call OK; the timings are evidence, not a threshold. Only quantities the stack measures + * are recorded; SM occupancy, bandwidth utilisation and cache hit rates are not observable + * through this path and are reported as unavailable. Under --sim the timings are host-simulator + * timings and the receipt says so. */ +static int sweep(const char *out_path) { + FILE *out = out_path ? fopen(out_path, "w") : NULL; + if (out_path && !out) { printf("cannot open %s\n", out_path); return 2; } + const int N = g_sim_mode ? 1 : 20; + const uint32_t hd = 64, bs = 16, layers = 1, layer = 0; + static const uint32_t qheads[8] = { 1, 2, 4, 8, 16, 24, 32, 64 }; + static const uint32_t ctxs[2] = { 256, 2048 }; + uint32_t seed = 0xfb1c05eeu; + if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_SWEEP_V1\",\"path\":\"paged_bf16\",\"head_dim\":%u,\"block_size\":%u,\"timed_calls\":%d,\"host_simulator\":%s," + "\"tolerances\":{\"rel\":2e-4,\"abs\":2e-5},\"hardware_counters\":\"unavailable (SM occupancy, bandwidth utilisation, cache hit rates are not observable through this path)\",\"points\":[", + hd, bs, N, g_sim_mode ? "true" : "false"); + int npoints = 0, supported = 0, unsupported = 0; + double *samples = malloc((size_t)N * sizeof *samples), *ksamples = malloc((size_t)N * sizeof *ksamples); + for (int qi = 0; qi < 8; qi++) for (uint32_t nkv = 1; nkv <= qheads[qi]; nkv++) { + uint32_t nqh = qheads[qi]; + if (nqh % nkv) continue; + uint32_t ratio = nqh / nkv; int pow2 = (ratio & (ratio - 1)) == 0; + for (int ci = 0; ci < 2; ci++) { + uint32_t ctx = ctxs[ci], nblk = (ctx + bs - 1) / bs, pool_blocks = nblk + 5; + OmegaGpuKvLayout ly = layout_for(pool_blocks, bs, layers, nkv, hd); + uint8_t *pool = malloc(ly.pool_bytes); uint16_t *pw = (uint16_t *)pool; + for (size_t i = 0; i < ly.pool_bytes / 2; i++) pw[i] = f2bf(frand(&seed, -1.0f, 1.0f)); + uint32_t *ids = malloc(nblk * 4); + for (uint32_t b = 0; b < nblk; b++) ids[b] = (b * 7 + 3) % pool_blocks; + size_t n = (size_t)nqh * hd; + float *q = malloc(n * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + OmegaGpuAttnInfo info; memset(&info, 0, sizeof info); + int rc = omega_gpu_paged_attention_bf16(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, got, &info); + const char *klass; int pass; size_t bad = 0; double worst = 0; int ok_calls = 0; uint32_t unwritten = 0, cache_hits = 0; double med = 0, p90 = 0, kmed = 0, kp90 = 0; + if (!pow2) { + klass = "unsupported_by_kernel_envelope"; + pass = rc == OMEGA_GPU_ATTN_BAD_ARGS; unsupported++; + CHECK(pass, "sweep %uq/%ukv ctx %u: ratio %u (not a power of two) refused with BAD_ARGS (got %s)", nqh, nkv, ctx, ratio, omega_gpu_attention_rc_name(rc)); + } else { + klass = "supported"; supported++; + oracle_paged(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, want); + bad = compare(got, want, n, 2e-4, 2e-5, &worst); + unwritten = info.unwritten_words; + uint64_t kv_staged = info.kv_bytes_staged, kv_naive = info.kv_bytes_naive, qb = info.q_bytes, tb = info.tab_bytes, ob = info.out_bytes; + uint32_t launches = info.chip_calls, ctas = info.ctas_last_launch, blk_l = info.kv_blocks_logical, blk_u = info.kv_blocks_unique, kv_src = info.kv_source; + for (int i = 0; i < N; i++) { + OmegaGpuAttnInfo ti; + int trc = omega_gpu_paged_attention_bf16(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, got, &ti); + samples[i] = ti.call_ns / 1e6; ksamples[i] = ti.elapsed_ns / 1e6; + double w; size_t b2 = compare(got, want, n, 2e-4, 2e-5, &w); + if (w > worst) worst = w; + bad += b2; unwritten += ti.unwritten_words; cache_hits += ti.kernel_cache_hit; + if (trc == OMEGA_GPU_ATTN_OK && b2 == 0) ok_calls++; + } + qsort(samples, (size_t)N, sizeof samples[0], cmp_d); qsort(ksamples, (size_t)N, sizeof ksamples[0], cmp_d); + med = samples[N / 2]; p90 = samples[N * 9 / 10]; kmed = ksamples[N / 2]; kp90 = ksamples[N * 9 / 10]; + pass = rc == OMEGA_GPU_ATTN_OK && bad == 0 && ok_calls == N && unwritten == 0 && cache_hits == (uint32_t)N; + CHECK(pass, "sweep %uq/%ukv ctx %u: rc=%s violations=%zu ok_calls=%d/%d unwritten=%u cache_hits=%u", nqh, nkv, ctx, omega_gpu_attention_rc_name(rc), bad, ok_calls, N, unwritten, cache_hits); + printf("%s sweep %2uq/%2ukv ratio %2u ctx %4u: launches=%u ctas=%u call_ms med=%.3f p90=%.3f kernel_ms med=%.3f p90=%.3f kv_staged=%" PRIu64 " (naive %" PRIu64 ") blocks=%u/%u q=%" PRIu64 " tab=%" PRIu64 " out=%" PRIu64 " worst=%g\n", + pass ? "PASS" : "FAIL", nqh, nkv, ratio, ctx, launches, ctas, med, p90, kmed, kp90, kv_staged, kv_naive, blk_u, blk_l, qb, tb, ob, worst); + if (out) fprintf(out, "%s{\"q_heads\":%u,\"kv_heads\":%u,\"gqa_ratio\":%u,\"head_dim\":%u,\"context\":%u,\"q_width\":%zu,\"out_width\":%zu,\"class\":\"%s\",\"rc\":\"%s\",\"pass\":%s," + "\"violations\":%zu,\"worst_scaled_err\":%g,\"unwritten_words\":%u,\"launches_per_call\":%u,\"ctas_last_launch\":%u,\"threads_per_cta\":%u," + "\"call_ms_median\":%.4f,\"call_ms_p90\":%.4f,\"kernel_ms_median\":%.4f,\"kernel_ms_p90\":%.4f,\"kernel_cache_hits\":%u,\"first_call_cache_hit\":%s," + "\"kv_bytes_staged\":%" PRIu64 ",\"kv_bytes_naive\":%" PRIu64 ",\"kv_blocks_logical\":%u,\"kv_blocks_unique\":%u,\"q_bytes\":%" PRIu64 ",\"tab_bytes\":%" PRIu64 ",\"out_bytes\":%" PRIu64 ",\"kv_source\":\"%s\"}", + npoints ? "," : "", nqh, nkv, ratio, hd, ctx, n, n, klass, omega_gpu_attention_rc_name(rc), pass ? "true" : "false", bad, worst, unwritten, launches, ctas, info.threads_per_cta, + med, p90, kmed, kp90, cache_hits, info.kernel_cache_hit ? "true" : "false", kv_staged, kv_naive, blk_l, blk_u, qb, tb, ob, kv_src == OMEGA_GPU_ATTN_KV_STAGED ? "staged" : "resident"); + npoints++; + } + if (!pow2) { + printf("%s sweep %2uq/%2ukv ratio %2u ctx %4u: %s (rc=%s)\n", pass ? "PASS" : "FAIL", nqh, nkv, ratio, ctx, klass, omega_gpu_attention_rc_name(rc)); + if (out) fprintf(out, "%s{\"q_heads\":%u,\"kv_heads\":%u,\"gqa_ratio\":%u,\"head_dim\":%u,\"context\":%u,\"q_width\":%zu,\"out_width\":%zu,\"class\":\"%s\",\"rc\":\"%s\",\"pass\":%s}", + npoints ? "," : "", nqh, nkv, ratio, hd, ctx, n, n, klass, omega_gpu_attention_rc_name(rc), pass ? "true" : "false"); + npoints++; + } + free(pool); free(ids); free(q); free(got); free(want); + } + } + free(samples); free(ksamples); + uint32_t opens = omega_gpu_session_open_count(); + CHECK(opens == (g_sim_mode ? 0u : 1u), "sweep: device opened %s (opens=%u)", g_sim_mode ? "never (simulator)" : "once", opens); + printf("sweep: %d points (%d supported, %d unsupported by the kernel envelope), device_opens=%u\n", npoints, supported, unsupported, opens); + if (out) { fprintf(out, "],\"points_total\":%d,\"points_supported\":%d,\"points_unsupported\":%d,\"device_opens\":%u,\"checks\":%d,\"failed\":%d,\"verdict\":\"%s\"}\n", npoints, supported, unsupported, opens, g_checks, g_failed, g_failed == 0 ? "OMEGA_GPU_ATTENTION_SWEEP_PASS" : "OMEGA_GPU_ATTENTION_SWEEP_FAIL"); fclose(out); } + return 0; +} + +/* ------------------------------------------------------------ warp simulator (omega #308) + * The per-thread simulator above has no model of a warp (its SHFL rule is "one path across the + * warp or error 7"). With --divergent the kernel carries a real lane-dependent branch inside a + * BSSY/BSYNC region, and every launch runs through tests/bw_warp_sim.h instead: 32-lane + * fragments, barrier registers, SHFL/BAR participation. Each launch runs in both fragment + * orders and the two outputs must be bit-identical. */ +static uint64_t g_ws_issues, g_ws_launches; +static int ws_attn_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info) { + const BlackwellIRProgram *p = progv; + uint32_t *outw = L->out; size_t nw = L->out_bytes / 4; + uint32_t *copy = malloc(L->out_bytes); + int err = 0; char msg[240] = ""; + for (int order = 0; order < 2 && !err && copy; order++) { + WsSim s; memset(&s, 0, sizeof s); + s.p = p; s.threads = SIM_T; s.smem = sim_shared; s.smem_bytes = SIM_SMEM; s.order = order; + uint64_t qa = (uintptr_t)L->q, pa = (uintptr_t)L->pool, oa = (uintptr_t)L->out, ta = (uintptr_t)L->tab; + s.cbank[0x380 / 4] = (uint32_t)qa; s.cbank[0x380 / 4 + 1] = (uint32_t)(qa >> 32); + s.cbank[0x388 / 4] = (uint32_t)pa; s.cbank[0x388 / 4 + 1] = (uint32_t)(pa >> 32); + s.cbank[0x390 / 4] = (uint32_t)oa; s.cbank[0x390 / 4 + 1] = (uint32_t)(oa >> 32); + s.cbank[0x398 / 4] = (uint32_t)ta; s.cbank[0x398 / 4 + 1] = (uint32_t)(ta >> 32); + memcpy(&s.cbank[0x3a0 / 4], L->params, sizeof L->params); + for (size_t i = 0; i < nw; i++) outw[i] = 0xffbadbadu; + err = ws_run(&s, L->grid_x, L->grid_y); + if (err) { snprintf(msg, sizeof msg, "order %d: %s", order, s.msg); break; } + g_ws_issues += s.warp_issues; + if (order == 0) memcpy(copy, outw, L->out_bytes); + else if (memcmp(copy, outw, L->out_bytes) != 0) { err = -1; snprintf(msg, sizeof msg, "the fragment order changed the result"); } + } + free(copy); + g_ws_launches++; + uint32_t unwritten = 0; for (size_t i = 0; i < nw; i++) if (outw[i] == 0xffbadbadu) unwritten++; + if (info) { info->chip_calls++; info->unwritten_words += unwritten; info->ctas_last_launch = L->grid_x * L->grid_y; info->threads_per_cta = SIM_T; } + if (err) { printf("warp simulator error: %s\n", msg); return OMEGA_GPU_ATTN_CHIP_FAIL; } + return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; +} +/* Negative control for --divergent --sim: mode 2 builds the same kernel with the BSYNC dropped; + * the warp simulator must reject it (the whole point of the simulator: the old one could not). */ +static void divergent_negative_control(void) { + enum { SEQ = 65, NQH = 8, NKV = 2 }; + const uint32_t HD = g_hd; + float *q = malloc(NQH * HD * 4), *kv = malloc((size_t)SEQ * NKV * HD * 4), *out = malloc(NQH * HD * 4); + uint32_t seed = 0x308u; + for (uint32_t i = 0; i < NQH * HD; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < (size_t)SEQ * NKV * HD; i++) kv[i] = frand(&seed, -1.0f, 1.0f); + omega_gpu_attention_test_set_divergent(2); + int rc = omega_gpu_gqa_attention_f32(q, kv, kv, SEQ, NQH, NKV, HD, out, NULL); + omega_gpu_attention_test_set_divergent(1); + CHECK(rc == OMEGA_GPU_ATTN_CHIP_FAIL, "divergent mode 2 (BSYNC dropped) rejected by the warp simulator (rc %s)", omega_gpu_attention_rc_name(rc)); + int rc1 = omega_gpu_gqa_attention_f32(q, kv, kv, SEQ, NQH, NKV, HD, out, NULL); + CHECK(rc1 == OMEGA_GPU_ATTN_OK, "divergent mode 1 (regioned branch) runs clean on the same input (rc %s)", omega_gpu_attention_rc_name(rc1)); + free(q); free(kv); free(out); +} + +/* ------------------------------------------------------------ head_dim 128 (CPU phase) + * Checks that need the public API only, so the same code runs on the host simulators now and on + * the chip in the coordinated window. Run with --hd 128 (--sim for the host simulators). + * They target what head_dim 128 changed: four warps per CTA, so the chunk max and the chunk sum + * each combine FOUR warp partials (lane 0 of warps 0..3), and 128-token chunks. + * (a) uniform scores (K = 0): every weight is 1, the output is the mean of V over the context; + * a sum that drops the partial of warp 2 or 3 gives about twice the mean; + * (b) one dominant token with a score above the f32 exponent range (EX2 overflows without the + * right running max): the token sits in each of the four warps of chunk 0 and in the later, + * partial chunks; a max that ignores warp 2 or 3 overflows to inf / NaN. + * Negative controls: the comparison rejects the answer of a different token, and a shared-memory + * declaration of 1024 bytes (the head_dim 64 size) is refused by the simulators. */ +static void hd128_checks(void) { + const uint32_t hd = 128, nqh = 8, nkv = 2, seq = 300; + uint32_t seed = 0x128u; + size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = 1.0f; + for (size_t i = 0; i < nkvs; i++) vc[i] = frand(&seed, -1.0f, 1.0f); + OmegaGpuAttnInfo info; + /* (a) uniform */ + memset(kc, 0, nkvs * 4); + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + int rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + double w; size_t bad = compare(got, want, n, 2e-4, 2e-5, &w); + CHECK(rc == OMEGA_GPU_ATTN_OK && bad == 0 && info.threads_per_cta == 128, "hd128 uniform scores: mean of V over 300 tokens (rc %s, %zu bad, worst %g, %u threads)", omega_gpu_attention_rc_name(rc), bad, w, info.threads_per_cta); + float *half = malloc(n * 4); for (size_t i = 0; i < n; i++) half[i] = want[i] * 0.5f; + size_t neg = compare(got, half, n, 2e-4, 2e-5, &w); + CHECK(neg > n / 2, "hd128 uniform negative control: a result with the sum of two warps dropped (half the mean) is flagged (%zu of %zu)", neg, n); + free(half); + /* (b) one dominant token */ + static const uint32_t pos[] = { 5, 40, 70, 100, 127, 128 + 3, 256 + 43 }; + int all_ok = 1; size_t worst_bad = 0; + for (size_t pi = 0; pi < sizeof pos / sizeof pos[0]; pi++) { + memset(kc, 0, nkvs * 4); + for (uint32_t kvh = 0; kvh < nkv; kvh++) for (uint32_t d = 0; d < hd; d++) kc[((size_t)pos[pi] * nkv + kvh) * hd + d] = 12.0f; /* dot 1536, scaled by log2e / sqrt(128): about 2^196 */ + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + bad = compare(got, want, n, 2e-4, 2e-5, &w); + if (rc != OMEGA_GPU_ATTN_OK || bad) { all_ok = 0; if (bad > worst_bad) worst_bad = bad; } + printf(" hd128 dominant token %u (warp %u of chunk %u): rc %s, %zu bad, worst %g\n", pos[pi], (pos[pi] % 128) / 32, pos[pi] / 128, omega_gpu_attention_rc_name(rc), bad, w); + if (pi == 0) { + /* negative control: the answer of token 6 instead of token 5 must be flagged */ + float *other = malloc(n * 4); + for (uint32_t h = 0; h < nqh; h++) for (uint32_t d = 0; d < hd; d++) other[h * hd + d] = vc[((size_t)6 * nkv + h / (nqh / nkv)) * hd + d]; + size_t negb = compare(got, other, n, 2e-4, 2e-5, &w); + CHECK(negb > n / 2, "hd128 dominant-token negative control: the neighbouring token's V is flagged (%zu of %zu)", negb, n); + free(other); + } + } + CHECK(all_ok, "hd128 dominant token in every warp and chunk: exact max/sum over four warp partials (worst bad %zu)", worst_bad); + /* a kernel that needs 2048 bytes of shared memory must not run in a 1024-byte declaration (simulators only: they bound shared accesses) */ + if (g_sim_mode) { + g_smem_cap = 1024; + rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, NULL); + g_smem_cap = 0; + CHECK(rc == OMEGA_GPU_ATTN_CHIP_FAIL, "hd128 kernel refused under a 1024-byte shared-memory declaration (rc %s)", omega_gpu_attention_rc_name(rc)); + rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, NULL); + CHECK(rc == OMEGA_GPU_ATTN_OK, "hd128 kernel runs under the 2048-byte declaration (rc %s)", omega_gpu_attention_rc_name(rc)); + } + free(q); free(kc); free(vc); free(got); free(want); +} + +/* 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 origin/main c0369e6 (before head_dim + * 128 existed); 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, 160, "6e2b1ea2ca58327391287177e606a5317422e06301e5a8c75d2ce45eed20ff2b" }, + { false, 4, 2, 160, "230443d951335a363614bac31c5ce6be9f42ab6192e450851c7238efcc383868" }, + { false, 4, 0, 160, "a0629e402901f5ae4ee07f893f032793774c444f0646db8f40f0d8f943bf4c97" }, + { true, 12, 3, 160, "c3dc2fbbdfafc9ad0aee4213590bc75b21f122ade285d0f9ce3cbf9a76a23a30" }, + { true, 12, 2, 160, "90fb6c755be466a9b37fd3b817a6ae43016e15b0c35c45bb37da40aa73ca5ba4" }, + { true, 12, 0, 160, "a5443e2b274b2b9c620f54f9aa05aefef9e05956450144e0e31046d32a5b62a9" }, +}; +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) { + char hex[65]; + for (size_t i = 0; i < sizeof k_pins64 / sizeof k_pins64[0]; i++) { + const Pin *p = &k_pins64[i]; + OmegaBlackwellKernel k; memset(&k, 0, sizeof k); + int rc = omega_gpu_attention_codegen_hd(p->f32, p->log2bs, p->log2gqa, 64, &k); + hex_digest(k.code_digest, hex); + CHECK(rc == OMEGA_GPU_ATTN_OK && k.insn_count == p->insns && strcmp(hex, p->sha256) == 0, "hd64 %s log2bs %u log2gqa %u: encoded kernel is byte-identical to main c0369e6 (%zu insns, sha256 %.12s)", p->f32 ? "f32 " : "bf16", p->log2bs, p->log2gqa, k.insn_count, hex); + free(k.code); + /* the 4-argument entry point is the same kernel */ + OmegaBlackwellKernel k4; memset(&k4, 0, sizeof k4); + CHECK(omega_gpu_attention_codegen(p->f32, p->log2bs, p->log2gqa, &k4) == OMEGA_GPU_ATTN_OK && memcmp(k4.code_digest, k.code_digest, 32) == 0, "hd64 4-argument codegen entry is the same kernel"); + free(k4.code); + /* head_dim 128: encodes, inside the register budget, a different (longer) program */ + OmegaBlackwellKernel k2; memset(&k2, 0, sizeof k2); + int rc2 = omega_gpu_attention_codegen_hd(p->f32, p->log2bs, p->log2gqa, 128, &k2); + CHECK(rc2 == OMEGA_GPU_ATTN_OK && k2.code_size > 0 && k2.gpr_count <= 64 && k2.insn_count > p->insns && memcmp(k2.code_digest, k.code_digest, 32) != 0, + "hd128 %s log2bs %u log2gqa %u: kernel encodes (%zu insns vs %zu, %u gprs)", p->f32 ? "f32 " : "bf16", p->log2bs, p->log2gqa, k2.insn_count, p->insns, k2.gpr_count); + free(k2.code); + } + OmegaBlackwellKernel kx; memset(&kx, 0, sizeof kx); + CHECK(omega_gpu_attention_codegen_hd(false, 4, 3, 96, &kx) == OMEGA_GPU_ATTN_TOO_LARGE, "codegen refuses head_dim 96"); + CHECK(omega_gpu_attention_codegen_hd(false, 4, 3, 256, &kx) == OMEGA_GPU_ATTN_TOO_LARGE, "codegen refuses head_dim 256"); + /* negative control for the pin itself: a one-bit change to a pinned digest must not match */ + OmegaBlackwellKernel kn; memset(&kn, 0, sizeof kn); + (void)omega_gpu_attention_codegen_hd(k_pins64[0].f32, k_pins64[0].log2bs, k_pins64[0].log2gqa, 64, &kn); + kn.code_digest[0] ^= 1u; hex_digest(kn.code_digest, hex); + CHECK(strcmp(hex, k_pins64[0].sha256) != 0, "pin negative control: a flipped digest bit does not match the pin"); + free(kn.code); +} + + +int main(int argc, char **argv) { + const char *out_path = NULL; int host = 0, sim = 0, timing_mode = 0, sweep_mode = 0; + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--host-only") == 0) host = 1; + else if (strcmp(argv[i], "--sim") == 0) sim = 1; + else if (strcmp(argv[i], "--divergent") == 0) g_divergent = 1; + else if (strcmp(argv[i], "--timing") == 0) timing_mode = 1; + else if (strcmp(argv[i], "--sweep") == 0) sweep_mode = 1; + else if (strcmp(argv[i], "--hd") == 0 && i + 1 < argc) g_hd = (uint32_t)atoi(argv[++i]); + else if (strcmp(argv[i], "--out") == 0 && i + 1 < argc) out_path = argv[++i]; + } + if (g_hd != 64 && g_hd != 128) { printf("--hd must be 64 or 128\n"); return 2; } + if (g_hd == 128 && (timing_mode || sweep_mode)) { printf("--hd 128 supports the battery and --host-only (timing and sweep are head_dim 64 only)\n"); return 2; } + if (g_divergent) omega_gpu_attention_test_set_divergent(1); + if (sim) { g_sim_mode = 1; omega_gpu_attention_test_set_simulator(g_divergent ? ws_attn_launch : sim_launch); } + if (sim && g_divergent && !host) divergent_negative_control(); + if (host) { host_only(); hd_codegen_checks(); } + else if (timing_mode) { if (timing(out_path) != 0) return 2; } + else if (sweep_mode) { if (sweep(out_path) != 0) return 2; } + else { if (chip(out_path) != 0) return 2; if (g_hd == 128) hd128_checks(); } + printf("%s: %d checks, %d failed\n", g_failed ? "FAIL" : "PASS", g_checks, g_failed); + return g_failed ? 1 : 0; +} diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/omega_gpu_attention_api.c b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/omega_gpu_attention_api.c new file mode 100644 index 000000000..f22f3e975 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/omega_gpu_attention_api.c @@ -0,0 +1,909 @@ +/* omega_gpu_attention_api.c: FB-1 cut 5 (2026-10-04). See the header. + * + * Layout: (1) kernel codegen on the BlackwellIR with the serialising scheduler + * of cut 4 (every instruction waits on everything still pending; slow and safe), + * extended with forward branches and more loops; (2) the launcher, cloned from + * cut 4's run_abc with a fourth buffer (block tables and context lengths), 16 + * argument words, and cut 1b's shader-cache invalidate; (3) the public entry + * points, which stage the referenced KV blocks per launch and apply the oracle's + * argument rules (dropped tokens past the table, negative table entries, zero + * context) on the host. + * + * One CTA per (query head, sequence), head_dim threads (64 or 128; the text below says 64, the + * constants scale with KSpec.hd). The context is walked in chunks of head_dim tokens: + * phase A thread t owns token base+t: block lookup, K dot q (f32 FFMA), s = dot * scale + * (scale folds 1/sqrt(d) and log2 e), s and the token's byte offset go to shared; + * reduce chunk max (SHFL.DOWN tree per warp, lane partials to shared, BAR.SYNC, 2 LDS), + * m_new = max(m, chunk max), alpha = EX2(m - m_new), p = EX2(s - m_new) to shared, + * chunk sum the same way, l = l * alpha + chunk sum; + * phase B thread d owns dimension d: acc = acc * alpha + sum over the chunk of p_t * V[t][d]. + * Then out[d] = acc * RCP(l). The first chunk sees m = -inf, so alpha = EX2(-inf) = 0 and + * the initial l and acc drop out (PTX ISA ex2.approx: ex2(-Inf) = +0). + * + * Shared memory (16 * head_dim bytes; hd 64: 1024 bytes, the QMD default): [0,4hd) q, [4hd,8hd) s then p, + * [8hd,12hd) token byte offsets, [12hd,16hd) warp partials for the reductions (hd 64: 0, 256, 512, + * 768; hd 128: 0, 512, 1024, 1536; the partials of warp w are read at 12hd + 128w). + */ +#include "omega_gpu_attention_api.h" +#include "omega_blackwell_codegen.h" +#include "omega_bw_reconv.h" +#include "omega_blackwell_qmd.h" +#include "omega_blackwell_submit.h" +#include "omega_gpu_session.h" +#include "sha256.h" +#include +#include +#include +#include +#include + +/* ------------------------------------------------------------------ codegen */ + +#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 + +enum { K_FIXED, K_PRED, K_VAR, K_UVAR, K_STORE, K_SYNC, K_EXIT, K_BRA, K_BSSY, K_BSYNC }; + +#define AT_MAX_LOOPS 8 +typedef struct { + BlackwellIRProgram *p; + uint32_t pending; + int err; + int loop_start[AT_MAX_LOOPS], loop_end[AT_MAX_LOOPS]; + int n_loops, depth, stack[AT_MAX_LOOPS]; + BwRegions rg; /* structured reconvergence regions (omega #308) */ + int rg_mutant; /* test only: 1 = drop the BSYNC at join (the 2026-10-04 bug shape; host sim must catch it) */ +} 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(13, SB_NONE, SB_NONE, wait); e->pending = 0; break; + case K_VAR: in.control = CW(4, SB_GPR, SB_NONE, wait) | CW_YIELD; e->pending = 1u << SB_GPR; 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; + /* stall counts as nvcc 13.0.88 writes them for sm_121 (see src/omega_gpu_elementwise_api.c) */ + 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 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 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; } + +#define NOREG -1 +static BlackwellIRInsn I0(BlackwellIROpcode op) { + BlackwellIRInsn in; memset(&in, 0, sizeof in); + in.op = op; in.dst_vreg = NOREG; in.src1_vreg = NOREG; in.src2_vreg = NOREG; in.src3_vreg = NOREG; in.ureg = NOREG; + return in; +} +static void ldcu64(Em *e, int udst, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDCU64); i.dst_vreg = udst; i.imm = off; i.is_uniform = true; emit(e, i, K_UVAR); } +static void ldc64(Em *e, int dst64, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDC64); i.dst_vreg = dst64; i.imm = off; emit(e, i, K_VAR); } +static void ldc32(Em *e, int dst, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDC); i.dst_vreg = dst; i.imm = off; emit(e, i, K_VAR); } +static void s2r(Em *e, int dst, uint32_t sr) { BlackwellIRInsn i = I0(BW_IR_S2R); i.dst_vreg = dst; i.imm = sr; emit(e, i, K_VAR); } +static void movi(Em *e, int dst, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_MOV_IMM); i.dst_vreg = dst; i.imm = imm; emit(e, i, K_FIXED); } +static void movf(Em *e, int dst, float f) { uint32_t u; memcpy(&u, &f, 4); movi(e, dst, u); } +static void movrz(Em *e, int dst) { BlackwellIRInsn i = I0(BW_IR_MOV_RZ); i.dst_vreg = dst; emit(e, i, K_FIXED); } +/* dst = a * imm + c (c may be NOREG for RZ) */ +static void imadi(Em *e, int dst, int a, uint32_t imm, int c) { BlackwellIRInsn i = I0(BW_IR_IMAD); i.dst_vreg = dst; i.src1_vreg = a; i.imm = imm; i.src3_vreg = c; emit(e, i, K_FIXED); } +/* dst = a * b + c (registers; c may be NOREG) */ +static void imadr(Em *e, int dst, int a, int b, int c) { BlackwellIRInsn i = I0(BW_IR_IMAD); i.dst_vreg = dst; i.src1_vreg = a; i.src2_vreg = b; i.src3_vreg = c; emit(e, i, K_FIXED); } +static void iadd3(Em *e, int dst, int a, int b) { BlackwellIRInsn i = I0(BW_IR_IADD3); i.dst_vreg = dst; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void lop3xor(Em *e, int dst, int a, int b) { BlackwellIRInsn i = I0(BW_IR_LOP3_XOR); i.dst_vreg = dst; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void lop3andi(Em *e, int dst, int a, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_LOP3_AND); i.dst_vreg = dst; i.src1_vreg = a; i.imm = imm; emit(e, i, K_FIXED); } +static void shri(Em *e, int dst, int a, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_SHF_R); i.dst_vreg = dst; i.src1_vreg = a; i.imm = imm; emit(e, i, K_FIXED); } +/* dst64 = idx * imm + base64 (byte address) */ +static void wide(Em *e, int dst64, int idx, uint32_t imm, int base64) { BlackwellIRInsn i = I0(BW_IR_IMAD_WIDE); i.dst_vreg = dst64; i.src1_vreg = idx; i.imm = imm; i.src3_vreg = base64; emit(e, i, K_FIXED); } +static void ldg(Em *e, int dst, int addr64, int udesc) { BlackwellIRInsn i = I0(BW_IR_LDG_E); i.dst_vreg = dst; i.src1_vreg = addr64; i.ureg = udesc; emit(e, i, K_VAR); } +static void ldg16(Em *e, int dst, int addr64, int udesc) { BlackwellIRInsn i = I0(BW_IR_LDG_E_U16); i.dst_vreg = dst; i.src1_vreg = addr64; i.ureg = udesc; emit(e, i, K_VAR); } +static void stg(Em *e, int addr64, int val, int udesc) { BlackwellIRInsn i = I0(BW_IR_STG_E); i.src1_vreg = addr64; i.src2_vreg = val; i.ureg = udesc; emit(e, i, K_STORE); } +static void e_fadd(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FADD); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void e_fsub(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FSUB); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void e_fmul(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FMUL); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void e_ffma(Em *e, int d, int a, int b, int c) { BlackwellIRInsn i = I0(BW_IR_FFMA); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; i.src3_vreg = c; emit(e, i, K_FIXED); } +static void e_fmax(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FMNMX_MAX); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void mufu(Em *e, BlackwellIROpcode op, int d, int a) { BlackwellIRInsn i = I0(op); i.dst_vreg = d; i.src1_vreg = a; emit(e, i, K_VAR); } +/* SHFL and BAR.SYNC are refused inside an open reconvergence region (omega #308): on a split + * warp they read inactive lanes / count a partial warp, which is what produced wrong dims on + * the chip on 2026-10-04. The build fails closed instead. */ +static int in_region(Em *e) { if (e->rg.depth > 0) { e->err = -1; return 1; } return 0; } +static void shfl_down(Em *e, int d, int a, uint32_t off) { if (in_region(e)) return; BlackwellIRInsn i = I0(BW_IR_SHFL_DOWN); i.dst_vreg = d; i.src1_vreg = a; i.imm = off; emit(e, i, K_VAR); } +static void sts32(Em *e, int addr, int val) { BlackwellIRInsn i = I0(BW_IR_STS32); i.src1_vreg = addr; i.src2_vreg = val; emit(e, i, K_STORE); } +static void lds32(Em *e, int d, int addr) { BlackwellIRInsn i = I0(BW_IR_LDS32); i.dst_vreg = d; i.src1_vreg = addr; emit(e, i, K_VAR); } +static void bar_sync(Em *e) { if (in_region(e)) return; emit(e, I0(BW_IR_BAR_SYNC), K_SYNC); } +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_back_if_not_p0(Em *e, int target) { BlackwellIRInsn i = I0(BW_IR_BRA); i.predicate_p0 = true; i.predicate_not = true; i.imm = (uint32_t)(target - here(e)); emit(e, i, K_BRA); } +/* @P0 BRA forward; the target is patched in when known */ +static int bra_fwd_if_p0(Em *e) { int at = here(e); BlackwellIRInsn i = I0(BW_IR_BRA); i.predicate_p0 = true; i.imm = 0; emit(e, i, K_BRA); return at; } +static void patch_fwd(Em *e, int at) { if (at >= 0 && (size_t)at < e->p->count) e->p->insns[at].imm = (uint32_t)(here(e) - at); else e->err = -1; } + +/* ---- structured reconvergence regions (omega #308); same API as the elementwise emitter ---- */ +enum { RX_ALWAYS, RX_IF_P0, RX_IF_NOT_P0 }; +static int region_begin(Em *e) { + int bar = bw_regions_next_bar(&e->rg); + if (bar < 0) { e->err = -1; return -1; } + int at = here(e); + BlackwellIRInsn i = I0(BW_IR_BSSY); i.bar_reg = (uint8_t)bar; i.imm = 2; emit(e, i, K_BSSY); + if (bw_regions_begin(&e->rg, at) < 0) e->err = -1; + return bar; +} +static void region_exit(Em *e, int cond) { + int at = here(e); + BlackwellIRInsn i = I0(BW_IR_BRA); i.imm = 1; + if (cond != RX_ALWAYS) { i.predicate_p0 = true; i.predicate_not = (cond == RX_IF_NOT_P0); } + emit(e, i, K_BRA); + if (bw_regions_exit(&e->rg, at) < 0) e->err = -1; +} +static void region_join(Em *e) { + if (e->rg.depth <= 0) { e->err = -1; return; } + int d = e->rg.depth - 1, bsync = here(e); + BlackwellIRInsn i = I0(e->rg_mutant == 1 ? BW_IR_NOP : BW_IR_BSYNC); i.bar_reg = (uint8_t)d; emit(e, i, K_BSYNC); + if (e->rg_mutant == 1) { + BwRegions *r = &e->rg; r->depth--; + e->p->insns[r->bssy_at[d]].imm = (uint32_t)(bsync + 1 - r->bssy_at[d]); + for (int k = 0; k < r->n_exits[d]; k++) e->p->insns[r->exits[d][k]].imm = (uint32_t)(bsync - r->exits[d][k]); + return; + } + if (bw_regions_join(&e->rg, e->p, bsync) != d) e->err = -1; +} +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; +} +/* Loops nest; loop_end() extends every value defined before the loop and read inside + * it to the back-branch (the linear-scan allocator knows nothing about back-edges). */ +static void loop_begin(Em *e) { + if (e->depth >= AT_MAX_LOOPS || e->n_loops >= AT_MAX_LOOPS) { e->err = -1; return; } + e->stack[e->depth++] = here(e); +} +static void loop_end(Em *e) { + if (e->depth == 0 || e->n_loops >= AT_MAX_LOOPS) { e->err = -1; return; } + int start = e->stack[--e->depth], end = here(e) - 1; + e->loop_start[e->n_loops] = start; e->loop_end[e->n_loops] = end; e->n_loops++; + 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; + } +} +/* A value first defined inside a loop may not be read after it before being redefined. */ +static int check_loop_invariant(const Em *e) { + const OmegaRegAlloc *ra = &e->p->regalloc; + for (int L = 0; L < e->n_loops; L++) + for (int v = 0; v < ra->num_vregs; v++) { + int fd = ra->intervals[v].first_def; + if (fd < e->loop_start[L] || fd > e->loop_end[L]) continue; + for (size_t i = (size_t)e->loop_end[L] + 1; i < e->p->count; i++) { + const BlackwellIRInsn *in = &e->p->insns[i]; + if (in->src1_vreg == v || in->src2_vreg == v || in->src3_vreg == v) return -1; + if (in->dst_vreg == v && !in->is_uniform) break; + } + } + return 0; +} + +/* Kernel argument words (constant bank 0 at 0x380; the bank is 1024 bytes, so 32 words fit). */ +#define ARG_Q 0x380u +#define ARG_POOL 0x388u +#define ARG_OUT 0x390u +#define ARG_TAB 0x398u +#define ARG_MAXB 0x3a0u /* words per block-table row */ +#define ARG_SCALE 0x3a4u /* bits of log2(e) / sqrt(head_dim) */ +#define ARG_BSTRIDE 0x3a8u /* bytes between staged blocks */ +#define ARG_TSTRIDE 0x3acu /* bytes between tokens */ +#define ARG_KVP 0x3b0u /* bytes from the K plane to the V plane */ +#define ARG_HSTRIDE 0x3b4u /* bytes between kv heads */ +#define ARG_NQH 0x3b8u /* query heads (q and out row count per sequence) */ +#define ARG_CTXOFF 0x3bcu /* byte offset of the context-length array inside the table buffer */ +#define ARG_WORDS 16u +#define DESC_OFF 0x358u + +/* Head dimension is a kernel parameter (64 or 128, see KSpec.hd). Shared memory is four arrays of hd words: + * q at SH_Q, s then p at hd*4, token byte offsets at hd*8, warp partials at hd*12 (hd 64: 0, 256, 512, 768, + * the layout of every cut before head_dim 128). */ +#define SH_Q 0u +#define F32_NEG_INF 0xff800000u + +/* divergent (omega #308 regression R2): 0 = production branch-free chunk loop; 1 = the + * lane-dependent "j >= ctx" branch restored inside a reconvergence region (BSSY/BSYNC) so + * the SHFL reductions run on a joined warp; 2 = the same with the BSYNC dropped (the + * 2026-10-04 bug shape, a negative control the host simulator must catch). */ +typedef struct { bool f32; uint32_t log2bs, log2gqa; int mutant; int divergent; uint32_t hd; } KSpec; + +static void gen_attention(Em *e, const KSpec *k) { + const uint32_t elem = k->f32 ? 4u : 2u; + const uint32_t kstep = k->f32 ? 8u : 4u; /* bytes per inner iteration: two dims */ + const uint32_t HD = k->hd, SH_S = HD * 4u, SH_O = HD * 8u, SH_R = HD * 12u; /* warps per CTA: HD / 32 */ + int udesc = UV64(e), A = V64(e), B = V64(e), C = V64(e), D = V64(e); + int tid = V(e), h = V(e), seq = V(e); + int p_maxb = V(e), scale = V(e), p_bstride = V(e), p_tstride = V(e), p_kvp = V(e), p_hstride = V(e), p_nqh = V(e), p_ctxoff = V(e); + ldcu64(e, udesc, DESC_OFF); + ldc64(e, A, ARG_Q); ldc64(e, B, ARG_POOL); ldc64(e, C, ARG_OUT); ldc64(e, D, ARG_TAB); + ldc32(e, p_maxb, ARG_MAXB); ldc32(e, scale, ARG_SCALE); ldc32(e, p_bstride, ARG_BSTRIDE); ldc32(e, p_tstride, ARG_TSTRIDE); + ldc32(e, p_kvp, ARG_KVP); ldc32(e, p_hstride, ARG_HSTRIDE); ldc32(e, p_nqh, ARG_NQH); ldc32(e, p_ctxoff, ARG_CTXOFF); + s2r(e, tid, BW_SR_TID_X); s2r(e, h, BW_SR_CTAID_X); s2r(e, seq, BW_SR_CTAID_Y); + + int c1 = V(e), c4 = V(e), c32 = V(e), c64 = V(e), c256 = V(e), c512 = V(e), c768 = V(e), c896 = V(e), zero = V(e); + /* c32 / c64 keep their hd 64 names: the inner (dim pair) loop trip count HD / 2 and the chunk size HD */ + movi(e, c1, 1); movi(e, c4, 4); movi(e, c32, HD / 2); movi(e, c64, HD); + movi(e, c256, SH_S); movi(e, c512, SH_O); movi(e, c768, SH_R); movi(e, c896, SH_R + 128); movrz(e, zero); + /* warp partials 2 and 3 (lane 0 of warps 2 and 3): only a 128-thread CTA has them. Created and emitted only + * when HD == 128, so the hd 64 program (vreg numbering, instruction sequence) is exactly the one before. */ + int c1024 = -1, c1152 = -1, rc_ = -1, rd_ = -1; + if (HD == 128) { c1024 = V(e); c1152 = V(e); rc_ = V(e); rd_ = V(e); movi(e, c1024, SH_R + 256); movi(e, c1152, SH_R + 384); } + + /* q[tid] -> shared; out address kept for the end. Row = seq * num_q_heads + head for + * both q and out (flattened head-major, the oracle's layout). The head-wiring mutants + * swap the row of head h with h ^ 1 on one side only. */ + int tid4 = V(e), qrow = V(e), qoff = V(e), qaddr = V64(e), qv = V(e), oaddr = V64(e); + int hq = h, ho = h; + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_Q_ROW) { hq = V(e); lop3xor(e, hq, h, c1); } + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_OUT_ROW) { ho = V(e); lop3xor(e, ho, h, c1); } + imadi(e, tid4, tid, 4, NOREG); + imadr(e, qrow, seq, p_nqh, hq); + imadi(e, qoff, qrow, HD * 4, tid4); + wide(e, qaddr, qoff, 1, A); + ldg(e, qv, qaddr, udesc); + sts32(e, tid4, qv); /* SH_Q + tid*4 */ + if (ho == hq) wide(e, oaddr, qoff, 1, C); + else { + int orow = V(e), ooff = V(e); + imadr(e, orow, seq, p_nqh, ho); + imadi(e, ooff, orow, HD * 4, tid4); + wide(e, oaddr, ooff, 1, C); + } + + /* kv head offset, this sequence's table row and context length */ + int kvh = V(e), kvoff = V(e), t1 = V(e), tab = V64(e), ca = V64(e), ctx = V(e), vb = V64(e); + shri(e, kvh, h, k->log2gqa); + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_KV_HEAD) lop3xor(e, kvh, kvh, c1); + imadr(e, kvoff, kvh, p_hstride, NOREG); + imadr(e, t1, seq, p_maxb, NOREG); + imadi(e, t1, t1, 4, NOREG); + wide(e, tab, t1, 1, D); + imadi(e, t1, seq, 4, p_ctxoff); + wide(e, ca, t1, 1, D); + ldg(e, ctx, ca, udesc); + /* V column base for dimension tid: pool + kv plane + tid * elem. The kv head offset is + * already inside the per-token offset phase A leaves in shared memory (found by the host + * simulator: adding it here too read V from the wrong head for every kv head but 0). */ + wide(e, vb, tid, elem, B); + wide(e, vb, p_kvp, 1, vb); + + int M = V(e), L = V(e), acc = V(e), base = V(e), sOff = V(e), oOff = V(e), rOff = V(e); + movi(e, M, F32_NEG_INF); + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) movrz(e, L); else movf(e, L, 1.0f); /* alpha = 0 on the first chunk clears it */ + movrz(e, acc); movrz(e, base); + iadd3(e, sOff, tid4, c256); iadd3(e, oOff, tid4, c512); iadd3(e, rOff, tid4, c768); + bar_sync(e); /* q visible to every thread */ + isetp_ge_u32(e, zero, ctx); /* ctx == 0: out = 0 */ + int bZ = bra_fwd_if_p0(e); + + /* ---------------- chunk loop ---------------- */ + int j = V(e), s = V(e), koff = V(e); + int bi = V(e), sl = V(e), ta = V64(e), blk = V(e), ka = V64(e), dot = V(e), d = V(e); + int x = V(e), lo = V(e), hi = V(e), qa = V(e), qb = V(e), q0 = V(e), q1 = V(e), ka2 = V64(e), j1 = V(e); + int dneg = V(e), over = V(e), ot = V(e), ctxm1 = V(e), cm1 = V(e), cninf = V(e), nb = V(e), ns = V(e); + movi(e, cm1, 0xFFFFFFFFu); iadd3(e, ctxm1, ctx, cm1); movi(e, cninf, F32_NEG_INF); + loop_begin(e); + int Lout = here(e); + /* No branch here: a warp split by "j >= ctx" stays split (the IR has no reconvergence + * instruction) and the SHFL reductions below then read inactive lanes, which is undefined + * (wrong dims tid >= tail on the chip, 2026-10-04). over = (j >= ctx) as 0/1 from the sign of + * ctx-1-j; out-of-range lanes read token `base` (always < ctx here) and their score + * is forced to -inf after the dot product with s = -max(-s, nb), nb = -inf or +inf. */ + iadd3(e, j, base, tid); + movi(e, s, F32_NEG_INF); + movrz(e, koff); + if (k->divergent) { + /* omega #308 R2: the lane-dependent branch, inside a reconvergence region. Lanes with + * j >= ctx skip phase A (s stays -inf, koff 0); the BSYNC at region_join rejoins them + * before the SHFL reductions below. divergent == 2 drops that BSYNC (negative control). */ + region_begin(e); + isetp_ge_u32(e, j, ctx); + region_exit(e, RX_IF_P0); + } else { + imadi(e, dneg, j, 0xFFFFFFFFu, ctxm1); /* ctx - 1 - j */ + shri(e, over, dneg, 31); + imadr(e, ot, over, tid, NOREG); + imadi(e, j, ot, 0xFFFFFFFFu, j); /* j - over*tid */ + } + /* phase A: token j */ + shri(e, bi, j, k->log2bs); + lop3andi(e, sl, j, (1u << k->log2bs) - 1u); + wide(e, ta, bi, 4, tab); + ldg(e, blk, ta, udesc); + imadr(e, koff, blk, p_bstride, NOREG); + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_SLOT) { + /* K read from slot (t + 1) % block_size, V from the right slot: a K/V mismatch. + * (Shifting both only permutes matched pairs inside a full block, which softmax cannot see.) */ + int sl1 = V(e); + iadd3(e, j1, j, c1); lop3andi(e, sl1, j1, (1u << k->log2bs) - 1u); + imadr(e, sl1, sl1, p_tstride, koff); + iadd3(e, sl1, sl1, kvoff); + wide(e, ka, sl1, 1, B); + imadr(e, koff, sl, p_tstride, koff); + iadd3(e, koff, koff, kvoff); + } else { + imadr(e, koff, sl, p_tstride, koff); + iadd3(e, koff, koff, kvoff); + wide(e, ka, koff, 1, B); + } + movrz(e, dot); movrz(e, d); + loop_begin(e); + int Lin = here(e); + if (k->f32) { + ldg(e, lo, ka, udesc); + wide(e, ka2, c1, 4, ka); + ldg(e, hi, ka2, udesc); + } else { + ldg(e, x, ka, udesc); + imadi(e, lo, x, 0x10000u, NOREG); /* low bf16 -> f32: bits << 16 */ + lop3andi(e, hi, x, 0xffff0000u); /* high bf16 -> f32: keep the top half */ + } + imadi(e, qa, d, 8, NOREG); + lds32(e, q0, qa); + iadd3(e, qb, qa, c4); + lds32(e, q1, qb); + e_ffma(e, dot, q0, lo, dot); + e_ffma(e, dot, q1, hi, dot); + wide(e, ka, c1, kstep, ka); + iadd3(e, d, d, c1); + isetp_ge_u32(e, d, c32); + bra_back_if_not_p0(e, Lin); + loop_end(e); + e_fmul(e, s, dot, scale); + if (k->divergent) { + region_join(e); /* every lane back before the cross-lane reductions */ + } else { + imadi(e, nb, over, 0x80000000u, cninf); /* over ? +inf : -inf (bits) */ + e_fsub(e, ns, zero, s); e_fmax(e, ns, ns, nb); e_fsub(e, s, zero, ns); + } + sts32(e, sOff, s); + sts32(e, oOff, koff); + + /* chunk max */ + int t = V(e), mw = V(e), ra = V(e), rb = V(e), mc = V(e), Mn = V(e), diff = V(e), alpha = V(e), parg = V(e), p = V(e), sw = V(e), lc = V(e); + static const uint32_t steps[5] = { 16, 8, 4, 2, 1 }; + shfl_down(e, t, s, steps[0]); e_fmax(e, mw, s, t); + for (int i = 1; i < 5; i++) { shfl_down(e, t, mw, steps[i]); e_fmax(e, mw, mw, t); } + sts32(e, rOff, mw); + bar_sync(e); + lds32(e, ra, c768); lds32(e, rb, c896); + e_fmax(e, mc, ra, rb); + if (HD == 128) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); e_fmax(e, mc, mc, rc_); e_fmax(e, mc, mc, rd_); } + e_fmax(e, Mn, M, mc); + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) { + movf(e, alpha, 1.0f); + mufu(e, BW_IR_MUFU_EX2, p, s); + e_fmax(e, M, Mn, mc); + } else { + e_fsub(e, diff, M, Mn); + mufu(e, BW_IR_MUFU_EX2, alpha, diff); + e_fmax(e, M, Mn, mc); /* M = Mn */ + e_fsub(e, parg, s, Mn); + mufu(e, BW_IR_MUFU_EX2, p, parg); + } + bar_sync(e); /* everyone has read the max partials before they are overwritten */ + sts32(e, sOff, p); + shfl_down(e, t, p, steps[0]); e_fadd(e, sw, p, t); + for (int i = 1; i < 5; i++) { shfl_down(e, t, sw, steps[i]); e_fadd(e, sw, sw, t); } + sts32(e, rOff, sw); + bar_sync(e); + lds32(e, ra, c768); lds32(e, rb, c896); + e_fadd(e, lc, ra, rb); + if (HD == 128) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); e_fadd(e, lc, lc, rc_); e_fadd(e, lc, lc, rd_); } + e_ffma(e, L, L, alpha, lc); + if (k->mutant != OMEGA_GPU_ATTN_MUTANT_NO_RESCALE) e_fmul(e, acc, acc, alpha); + + /* phase B: dimension tid over the chunk's tokens */ + int kk = V(e), tt = V(e), oa = V(e), ko = V(e), pa = V(e), pv = V(e), va = V64(e), v = V(e); + movrz(e, kk); + loop_begin(e); + int LB = here(e); + iadd3(e, tt, base, kk); + isetp_ge_u32(e, tt, ctx); + int bB = bra_fwd_if_p0(e); + imadi(e, oa, kk, 4, c512); + lds32(e, ko, oa); + imadi(e, pa, kk, 4, c256); + lds32(e, pv, pa); + wide(e, va, ko, 1, vb); + if (k->f32) ldg(e, v, va, udesc); + else { ldg16(e, v, va, udesc); imadi(e, v, v, 0x10000u, NOREG); } + e_ffma(e, acc, pv, v, acc); + iadd3(e, kk, kk, c1); + isetp_ge_u32(e, kk, c64); + bra_back_if_not_p0(e, LB); + loop_end(e); + patch_fwd(e, bB); + bar_sync(e); /* phase B reads of s/p and offsets finish before the next chunk writes them */ + iadd3(e, base, base, c64); + isetp_ge_u32(e, base, ctx); + bra_back_if_not_p0(e, Lout); + loop_end(e); + + patch_fwd(e, bZ); + int inv = V(e), o = V(e); + mufu(e, BW_IR_MUFU_RCP, inv, L); + e_fmul(e, o, acc, inv); + stg(e, oaddr, o, udesc); + tail(e); +} + +#define AT_GPR_BUDGET 64u + +static int build_kernel(const KSpec *k, OmegaBlackwellKernel *kernel, BlackwellIRProgram **keep) { + BlackwellIRProgram *prog = calloc(1, sizeof *prog); + if (!prog) return OMEGA_GPU_ATTN_CODEGEN_FAIL; + omega_bw_ir_init(prog); + Em e; memset(&e, 0, sizeof e); e.p = prog; + e.rg_mutant = (k->divergent == 2) ? 1 : 0; + gen_attention(&e, k); + if (e.depth != 0) e.err = -1; + if (e.rg.depth != 0) e.err = -1; /* a region left open has no join: refuse the build */ + int rc = OMEGA_GPU_ATTN_CODEGEN_FAIL; + int ra_rc = (e.err == 0) ? omega_bw_regalloc_solve(prog) : -1; + int loop_rc = (ra_rc == 0) ? check_loop_invariant(&e) : -1; +#ifdef OMEGA_ATTN_DEBUG + fprintf(stderr, "attn codegen f32=%d log2bs=%u log2gqa=%u mutant=%d emit_err=%d insns=%zu vregs=%d regalloc=%d loops=%d peak_gpr=%u\n", + (int)k->f32, k->log2bs, k->log2gqa, k->mutant, e.err, prog->count, prog->regalloc.num_vregs, ra_rc, loop_rc, prog->regalloc.peak_gpr_usage); +#endif + if (e.err == 0 && ra_rc == 0 && loop_rc == 0 && prog->regalloc.peak_gpr_usage <= AT_GPR_BUDGET) { + size_t max_bytes = (size_t)BW_MAX_IR_INSNS * 16; + memset(kernel, 0, sizeof *kernel); + kernel->code = malloc(max_bytes); + size_t emitted = 0; + if (kernel->code && omega_bw_encode_program(prog, kernel->code, max_bytes, &emitted) == 0) { + kernel->code_size = emitted; + kernel->insn_count = emitted / 16; + kernel->gpr_count = prog->regalloc.peak_gpr_usage; + kernel->uniform_gpr_count = prog->regalloc.peak_ugpr_usage; + sha256_hash(kernel->code, kernel->code_size, kernel->code_digest); + rc = OMEGA_GPU_ATTN_OK; + } else { + free(kernel->code); kernel->code = NULL; + } + } + if (keep && rc == OMEGA_GPU_ATTN_OK) *keep = prog; else free(prog); + return rc; +} + +/* --------------------------------------------------------- kernel cache */ + +/* One kernel per KSpec; the device copy is uploaded once and stays resident for + * the process (cut 4b). The IR program is kept for the host simulator. */ +static int g_mutant; +static int g_divergent; /* omega #308 R2 test hook: see KSpec.divergent */ +static bool g_dedupe = true; /* shared-prefix staging dedupe; false = legacy per-sequence staging (test hook) */ +typedef struct { int used; KSpec k; OmegaBlackwellKernel kernel; BlackwellIRProgram *prog; NvrmMem code; } Slot; +static OmegaGpuAttnSim g_sim; +static Slot g_cache[8]; +static OmegaGpuScratch g_q, g_pool, g_tab, g_out; /* staging, grown to the high-water mark, reused per call */ +static bool g_hooked; +#define LOCK() omega_gpu_session_lock() +#define UNLOCK() omega_gpu_session_unlock() + +void omega_gpu_attention_test_set_simulator(OmegaGpuAttnSim sim) { LOCK(); g_sim = sim; UNLOCK(); } +void omega_gpu_attention_test_set_dedupe(bool on) { LOCK(); g_dedupe = on; UNLOCK(); } + +static void cache_clear_locked(void) { + for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) + if (g_cache[i].used) { free(g_cache[i].kernel.code); free(g_cache[i].prog); omega_gpu_session_free(&g_cache[i].code); memset(&g_cache[i], 0, sizeof g_cache[i]); } +} + +void omega_gpu_attention_cache_clear(void) { + LOCK(); + cache_clear_locked(); + UNLOCK(); +} + +/* Called by the session (lock held, device still open) right before it closes. */ +static void on_session_close(void) { + cache_clear_locked(); + omega_gpu_session_scratch_free(&g_q); omega_gpu_session_scratch_free(&g_pool); + omega_gpu_session_scratch_free(&g_tab); omega_gpu_session_scratch_free(&g_out); +} + +void omega_gpu_attention_test_set_mutant(OmegaGpuAttnMutant m) { + LOCK(); + g_mutant = (int)m; + cache_clear_locked(); + UNLOCK(); +} + +/* Caller holds the lock. Builds the kernel if needed; uploads the device copy when + * `upload` (the chip path; the simulator never needs one). */ +static int kernel_for(bool f32, uint32_t log2bs, uint32_t log2gqa, uint32_t hd, bool upload, Slot **out, bool *hit) { + KSpec k = { .f32 = f32, .log2bs = log2bs, .log2gqa = log2gqa, .mutant = g_mutant, .divergent = g_divergent, .hd = hd }; + Slot *s = NULL; + for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) + if (g_cache[i].used && g_cache[i].k.f32 == k.f32 && g_cache[i].k.log2bs == k.log2bs && g_cache[i].k.log2gqa == k.log2gqa && g_cache[i].k.mutant == k.mutant && g_cache[i].k.divergent == k.divergent && g_cache[i].k.hd == k.hd) { /* field compare: memcmp would read struct padding */ + s = &g_cache[i]; *hit = true; break; + } + if (!s) { + OmegaBlackwellKernel kern; BlackwellIRProgram *kp = NULL; + int rc = build_kernel(&k, &kern, &kp); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + size_t slot = 0; + for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) if (!g_cache[i].used) { slot = i; break; } + s = &g_cache[slot]; + if (s->used) { free(s->kernel.code); free(s->prog); omega_gpu_session_free(&s->code); } /* full: evict slot 0 */ + memset(s, 0, sizeof *s); + s->used = 1; s->k = k; s->kernel = kern; s->prog = kp; + *hit = false; + } + if (upload && !s->code.cpu) { + if (omega_gpu_session_alloc_code(s->kernel.code_size, &s->code) != 0) return OMEGA_GPU_ATTN_CHIP_FAIL; + memcpy(s->code.cpu, s->kernel.code, s->kernel.code_size); + __asm__ volatile("dsb sy" ::: "memory"); + } + *out = s; + return OMEGA_GPU_ATTN_OK; +} + +int omega_gpu_attention_codegen_hd(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, uint32_t head_dim, OmegaBlackwellKernel *kernel) { + if (!kernel || log2_block_size > 16 || log2_gqa > 6) return OMEGA_GPU_ATTN_BAD_ARGS; + if (head_dim != 64u && head_dim != 128u) return OMEGA_GPU_ATTN_TOO_LARGE; + LOCK(); + KSpec k = { .f32 = kv_f32, .log2bs = log2_block_size, .log2gqa = log2_gqa, .mutant = g_mutant, .divergent = g_divergent, .hd = head_dim }; + UNLOCK(); + return build_kernel(&k, kernel, NULL); +} + +int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, OmegaBlackwellKernel *kernel) { + return omega_gpu_attention_codegen_hd(kv_f32, log2_block_size, log2_gqa, OMEGA_GPU_ATTN_HEAD_DIM, kernel); +} + +const char *omega_gpu_attention_last_error(void) { return omega_gpu_session_last_error(); } + +/* ------------------------------------------------------------ launcher */ + +#define AT_POISON 0xffbadbadu +#define AT_WAIT_MS 600000ull + +static uint64_t now_ns(void) { + struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); + return (uint64_t)t.tv_sec * 1000000000ULL + (uint64_t)t.tv_nsec; +} + +typedef OmegaGpuAttnLaunch Launch; + +/* Caller holds the lock. Chip path: open the shared device on first use. */ +static int dev_open_locked(void) { + if (!g_hooked) { (void)omega_gpu_session_on_close(on_session_close); g_hooked = true; } + return omega_gpu_session_open() ? OMEGA_GPU_ATTN_OK : OMEGA_GPU_ATTN_CHIP_FAIL; +} + +/* Where a call stages the KV slice it is about to hand the kernel: straight into the + * device staging buffer on the chip path (one copy), a host buffer under the simulator. + * Caller holds the lock; the result is valid until the next staging call. */ +static void *stage_target(size_t bytes, void **host_tmp) { + *host_tmp = NULL; + if (g_sim) { *host_tmp = malloc(bytes ? bytes : 1); return *host_tmp; } + if (omega_gpu_session_scratch(&g_pool, bytes) != 0) return NULL; + return g_pool.mem.cpu; +} + +/* One launch through the shared session (omega_gpu_session_launch: shader-cache + * invalidate, constant bank, QMD0/QMD1, first marker, L2_FLUSH_DIRTY, second marker), + * then readback and the poison scan. L->pool may already be the pool staging buffer. */ +static int run_launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) { + if (omega_gpu_session_scratch(&g_q, L->q_bytes) || omega_gpu_session_scratch(&g_tab, L->tab_bytes) || + omega_gpu_session_scratch(&g_out, L->out_bytes) || (L->pool != g_pool.mem.cpu && omega_gpu_session_scratch(&g_pool, L->pool_bytes))) + return OMEGA_GPU_ATTN_CHIP_FAIL; + memcpy(g_q.mem.cpu, L->q, L->q_bytes); + if (L->pool != g_pool.mem.cpu) memcpy(g_pool.mem.cpu, L->pool, L->pool_bytes); + memcpy(g_tab.mem.cpu, L->tab, L->tab_bytes); + size_t out_words = L->out_bytes / 4; + uint32_t *out_dev = (uint32_t *)g_out.mem.cpu; + for (size_t i = 0; i < out_words; i++) out_dev[i] = AT_POISON; + __asm__ volatile("dsb sy" ::: "memory"); + + uint32_t args[ARG_WORDS]; + args[0] = (uint32_t)g_q.mem.va; args[1] = (uint32_t)(g_q.mem.va >> 32); + args[2] = (uint32_t)g_pool.mem.va; args[3] = (uint32_t)(g_pool.mem.va >> 32); + args[4] = (uint32_t)g_out.mem.va; args[5] = (uint32_t)(g_out.mem.va >> 32); + args[6] = (uint32_t)g_tab.mem.va; args[7] = (uint32_t)(g_tab.mem.va >> 32); + memcpy(&args[8], L->params, sizeof L->params); + OmegaGpuLaunch GL = { + .code_va = ks->code.va, .gpr_count = AT_GPR_BUDGET, .threads_x = ks->k.hd, .threads_y = 1, .shared_bytes = 16u * ks->k.hd, /* 4 arrays of hd words: 1024 B for hd 64 (the QMD default), 2048 B for hd 128 */ + .grid_x = L->grid_x, .grid_y = L->grid_y, .num_elements = out_words, + .args = args, .n_args = ARG_WORDS, .timeout_ms = AT_WAIT_MS, + }; + uint64_t elapsed = 0; uint32_t marker = 0; + if (omega_gpu_session_launch(&GL, &elapsed, &marker) != 0) return OMEGA_GPU_ATTN_CHIP_FAIL; + + memcpy(L->out, g_out.mem.cpu, L->out_bytes); + uint32_t unwritten = 0; + for (size_t i = 0; i < out_words; i++) if (((uint32_t *)L->out)[i] == AT_POISON) unwritten++; + if (info) { + info->chip_calls++; + info->elapsed_ns += elapsed; + info->completion_marker = marker; + info->unwritten_words += unwritten; + info->threads_per_cta = ks->k.hd; + info->ctas_last_launch = L->grid_x * L->grid_y; + } + return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; +} + +/* Caller holds the lock. Accounts the launch's q / table / output traffic (the KV + * staging bytes are accounted where the slices are copied). */ +static int launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) { + if (info) { info->q_bytes += L->q_bytes; info->tab_bytes += L->tab_bytes; info->out_bytes += L->out_bytes; info->kv_source = OMEGA_GPU_ATTN_KV_STAGED; } + if (g_sim) return g_sim(ks->prog, L, info); + return run_launch(ks, L, info); +} + +/* ------------------------------------------------------- public entries */ + +static void info_begin(OmegaGpuAttnInfo *info, const OmegaBlackwellKernel *k, bool hit) { + if (!info) return; + memset(info, 0, sizeof *info); + info->kernel_cache_hit = hit; + info->gpr_count = k->gpr_count; + info->insn_count = (uint32_t)k->insn_count; + snprintf(info->target_chip, sizeof info->target_chip, "NVIDIA DGX Spark (Grace Blackwell GB10)"); + info->sm_architecture = 121; +} +static uint32_t f2u(float f) { uint32_t u; memcpy(&u, &f, 4); return u; } +static int log2_exact(uint32_t v, uint32_t *out) { + if (v == 0 || (v & (v - 1))) return -1; + uint32_t l = 0; while ((1u << l) != v) l++; + *out = l; return 0; +} +/* log2(e) / sqrt(head_dim) with the square roots as literals (8 and 11.313708498984761 = sqrt(128), both exactly what sqrt() returns): + * the library must not need libm (omegatool links without -lm; a constant head_dim folded sqrt away, a runtime one does not). */ +static float score_scale(uint32_t hd) { return (float)(1.4426950408889634 / (hd == 128u ? 11.313708498984761 : 8.0)); } + +/* Common head-shape checks; returns log2 of the gqa ratio. */ +static int check_heads(uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, uint32_t *log2gqa) { + if (num_q_heads == 0 || num_kv_heads == 0 || head_dim == 0) return OMEGA_GPU_ATTN_BAD_ARGS; + if ((head_dim != 64u && head_dim != 128u) || num_q_heads > OMEGA_GPU_ATTN_MAX_Q_HEADS) return OMEGA_GPU_ATTN_TOO_LARGE; + if (num_q_heads % num_kv_heads != 0 || log2_exact(num_q_heads / num_kv_heads, log2gqa) != 0) return OMEGA_GPU_ATTN_BAD_ARGS; + return OMEGA_GPU_ATTN_OK; +} + +/* Common prologue of every chip entry (lock held on success): device, kernel, info. */ +static int begin(bool f32, uint32_t log2bs, uint32_t log2gqa, uint32_t hd, Slot **ks, OmegaGpuAttnInfo *info) { + LOCK(); + int rc = g_sim ? OMEGA_GPU_ATTN_OK : dev_open_locked(); + bool hit = false; + if (rc == OMEGA_GPU_ATTN_OK) rc = kernel_for(f32, log2bs, log2gqa, hd, !g_sim, ks, &hit); + if (rc != OMEGA_GPU_ATTN_OK) { UNLOCK(); return rc; } + info_begin(info, &(*ks)->kernel, hit); + return OMEGA_GPU_ATTN_OK; +} + +int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const float *v_cache, + uint32_t seq_len, uint32_t num_q_heads, uint32_t num_kv_heads, + uint32_t head_dim, float *out, OmegaGpuAttnInfo *info) { + uint64_t t0 = now_ns(); + if (!q || !k_cache || !v_cache || !out) return OMEGA_GPU_ATTN_BAD_ARGS; + uint32_t log2gqa; + int rc = check_heads(num_q_heads, num_kv_heads, head_dim, &log2gqa); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + if (seq_len > OMEGA_GPU_ATTN_MAX_GQA_CTX) return OMEGA_GPU_ATTN_TOO_LARGE; + const uint32_t HD = head_dim; + size_t n_out = (size_t)num_q_heads * HD; + if (seq_len == 0) { memset(out, 0, n_out * 4); if (info) { memset(info, 0, sizeof *info); info->call_ns = now_ns() - t0; } return OMEGA_GPU_ATTN_OK; } + Slot *ks = NULL; + const uint32_t log2bs = 12; /* one block of 4096 slots */ + rc = begin(true, log2bs, log2gqa, HD, &ks, info); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + size_t plane = (size_t)seq_len * num_kv_heads * HD * 4; + void *host_tmp = NULL; + uint8_t *pool = stage_target(2 * plane, &host_tmp); + if (!pool) { UNLOCK(); return OMEGA_GPU_ATTN_CHIP_FAIL; } + memcpy(pool, k_cache, plane); + memcpy(pool + plane, v_cache, plane); + if (info) { info->kv_bytes_staged += 2 * plane; info->kv_bytes_naive += 2 * plane; info->kv_blocks_logical += 1; info->kv_blocks_unique += 1; } /* one contiguous pseudo-block */ + uint32_t tab[2] = { 0, seq_len }; /* table row {0}, then the context length at byte 4 */ + Launch L = { + .q = q, .q_bytes = n_out * 4, .pool = pool, .pool_bytes = 2 * plane, .tab = tab, .tab_bytes = sizeof tab, + .out = out, .out_bytes = n_out * 4, .grid_x = num_q_heads, .grid_y = 1, + .params = { 1, f2u(score_scale(HD)), (uint32_t)(2 * plane), num_kv_heads * HD * 4, (uint32_t)plane, HD * 4, num_q_heads, 4 } + }; + rc = launch(ks, &L, info); + free(host_tmp); + UNLOCK(); + if (info) info->call_ns = now_ns() - t0; + return rc; +} + +/* Paged path shared by the single and batched entries. tables[s] has n_blocks[s] entries + * (already filtered of negatives), ctx[s] the context length. */ +static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayout *ly, + const uint32_t *const *tables, const uint32_t *n_blocks, const uint32_t *ctx, + uint32_t num_seqs, uint32_t layer_idx, uint32_t num_q_heads, uint32_t num_kv_heads, + uint32_t head_dim, float *out, OmegaGpuAttnInfo *info) { + uint64_t t0 = now_ns(); + uint32_t log2gqa, log2bs; + int rc = check_heads(num_q_heads, num_kv_heads, head_dim, &log2gqa); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + const uint32_t HD = head_dim; + if (!ly || layer_idx >= ly->num_layers || log2_exact(ly->block_size, &log2bs) != 0) return OMEGA_GPU_ATTN_BAD_ARGS; + /* the oracle addresses heads as kv_head * head_dim * 2 inside a token: the layout must agree */ + if (ly->head_stride_bytes != HD * 2 || ly->token_stride_bytes != (uint64_t)num_kv_heads * HD * 2 || + ly->kv_plane_stride_bytes != (uint64_t)ly->block_size * ly->token_stride_bytes || + ly->layer_stride_bytes != 2 * ly->kv_plane_stride_bytes || ly->block_stride_bytes < (uint64_t)ly->num_layers * ly->layer_stride_bytes) + return OMEGA_GPU_ATTN_BAD_ARGS; + size_t row = (size_t)num_q_heads * HD; + /* effective context per sequence and block id range check */ + uint32_t *eff = calloc(num_seqs ? num_seqs : 1, sizeof *eff); + if (!eff) return OMEGA_GPU_ATTN_CHIP_FAIL; + for (uint32_t s = 0; s < num_seqs; s++) { + uint64_t cap = (uint64_t)n_blocks[s] * ly->block_size; + eff[s] = (uint32_t)(ctx[s] < cap ? ctx[s] : cap); + for (uint32_t b = 0; b < n_blocks[s]; b++) { + uint64_t id = tables[s][b]; + if (id >= ly->num_blocks || id * ly->block_stride_bytes + (uint64_t)(layer_idx + 1) * ly->layer_stride_bytes > ly->pool_bytes) { free(eff); return OMEGA_GPU_ATTN_BAD_ARGS; } + } + } + Slot *ks = NULL; + rc = begin(false, log2bs, log2gqa, HD, &ks, info); + if (rc != OMEGA_GPU_ATTN_OK) { free(eff); return rc; } + uint32_t seqs_per_launch = OMEGA_GPU_ATTN_MAX_CTAS / num_q_heads; + if (seqs_per_launch == 0) seqs_per_launch = 1; + uint32_t maxb = 1; + for (uint32_t s = 0; s < num_seqs; s++) if (n_blocks[s] > maxb) maxb = n_blocks[s]; + /* Dedupe map: physical block id -> staged slot of the current launch (-1 = not staged yet), + * plus the list of ids touched by the launch (in slot order) so the reset is O(unique). */ + int32_t *slot_of = NULL; uint32_t *touched = NULL; + if (g_dedupe) { + size_t nb = ly->num_blocks ? ly->num_blocks : 1; + slot_of = malloc(nb * sizeof *slot_of); + touched = malloc(nb * sizeof *touched); + if (!slot_of || !touched) { free(slot_of); free(touched); free(eff); UNLOCK(); return OMEGA_GPU_ATTN_CHIP_FAIL; } + memset(slot_of, 0xff, nb * sizeof *slot_of); /* every entry -1 */ + } + for (uint32_t s0 = 0; s0 < num_seqs && rc == OMEGA_GPU_ATTN_OK; s0 += seqs_per_launch) { + uint32_t ns = num_seqs - s0 < seqs_per_launch ? num_seqs - s0 : seqs_per_launch; + /* logical references: every sequence's blocks up to its (truncated) context */ + uint32_t total = 0; + for (uint32_t s = 0; s < ns; s++) total += eff[s0 + s] ? (eff[s0 + s] + ly->block_size - 1) / ly->block_size : 0; + uint32_t *tab = calloc((size_t)ns * maxb + ns, sizeof *tab); + if (!tab) { rc = OMEGA_GPU_ATTN_CHIP_FAIL; break; } + /* pass 1: assign staged slots. Dedupe keys on the PHYSICAL block id (not the table + * position): a CoW prefix block shared by several branches gets one slot. Each + * sequence's compact table keeps its own block order and truncated context. */ + uint32_t g = 0; + for (uint32_t s = 0; s < ns; s++) { + uint32_t need = eff[s0 + s] ? (eff[s0 + s] + ly->block_size - 1) / ly->block_size : 0; + for (uint32_t b = 0; b < need; b++) { + uint32_t id = tables[s0 + s][b]; + if (g_dedupe) { + if (slot_of[id] < 0) { slot_of[id] = (int32_t)g; touched[g] = id; g++; } + tab[(size_t)s * maxb + b] = (uint32_t)slot_of[id]; + } else { + tab[(size_t)s * maxb + b] = g++; /* legacy: one slot per reference */ + } + } + tab[(size_t)ns * maxb + s] = eff[s0 + s]; + } + uint64_t staged_bytes = (uint64_t)(g ? g : 1) * ly->layer_stride_bytes; + if (staged_bytes > 0xffffffffull) { free(tab); rc = OMEGA_GPU_ATTN_TOO_LARGE; break; } + void *host_tmp = NULL; + uint8_t *staged = stage_target((size_t)staged_bytes, &host_tmp); + if (!staged) { free(tab); rc = OMEGA_GPU_ATTN_CHIP_FAIL; break; } + /* pass 2: copy each staged slot's (physical block, layer) slice exactly once */ + if (g_dedupe) { + for (uint32_t u = 0; u < g; u++) { + const uint8_t *src = pool + (size_t)touched[u] * ly->block_stride_bytes + (size_t)layer_idx * ly->layer_stride_bytes; + memcpy(staged + (size_t)u * ly->layer_stride_bytes, src, (size_t)ly->layer_stride_bytes); + slot_of[touched[u]] = -1; /* reset for the next launch */ + } + } else { + uint32_t w = 0; + for (uint32_t s = 0; s < ns; s++) { + uint32_t need = eff[s0 + s] ? (eff[s0 + s] + ly->block_size - 1) / ly->block_size : 0; + for (uint32_t b = 0; b < need; b++, w++) { + const uint8_t *src = pool + (size_t)tables[s0 + s][b] * ly->block_stride_bytes + (size_t)layer_idx * ly->layer_stride_bytes; + memcpy(staged + (size_t)w * ly->layer_stride_bytes, src, (size_t)ly->layer_stride_bytes); + } + } + } + if (info) { + info->kv_blocks_logical += total; info->kv_blocks_unique += g; + info->kv_bytes_staged += (uint64_t)g * ly->layer_stride_bytes; + info->kv_bytes_naive += (uint64_t)total * ly->layer_stride_bytes; + } + Launch L = { + .q = q + (size_t)s0 * row, .q_bytes = (size_t)ns * row * 4, .pool = staged, .pool_bytes = (size_t)staged_bytes, + .tab = tab, .tab_bytes = ((size_t)ns * maxb + ns) * 4, .out = out + (size_t)s0 * row, .out_bytes = (size_t)ns * row * 4, + .grid_x = num_q_heads, .grid_y = ns, + .params = { maxb, f2u(score_scale(HD)), (uint32_t)ly->layer_stride_bytes, (uint32_t)ly->token_stride_bytes, + (uint32_t)ly->kv_plane_stride_bytes, (uint32_t)ly->head_stride_bytes, num_q_heads, ns * maxb * 4 } + }; + rc = launch(ks, &L, info); + free(host_tmp); free(tab); + } + UNLOCK(); + free(eff); free(slot_of); free(touched); + if (info) info->call_ns = now_ns() - t0; + return rc; +} + +int omega_gpu_paged_attention_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const uint32_t *block_ids, uint32_t num_block_ids, + uint32_t context_len, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info) { + if (!q || !pool || !layout || !out || (num_block_ids && !block_ids)) return OMEGA_GPU_ATTN_BAD_ARGS; + const uint32_t *tables[1] = { block_ids }; + uint32_t nb[1] = { num_block_ids }, cx[1] = { context_len }; + return paged_core(q, pool, layout, tables, nb, cx, 1, layer_idx, num_q_heads, num_kv_heads, head_dim, out, info); +} + +int omega_gpu_paged_attention_batch_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const int32_t *block_tables, const int32_t *context_lens, + uint32_t max_blocks_per_seq, uint32_t num_seqs, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info) { + if (!q || !pool || !layout || !out || !block_tables || !context_lens || num_seqs == 0) return OMEGA_GPU_ATTN_BAD_ARGS; + /* the oracle's rules: ctx <= 0 -> 0; a table row past the array -> empty; negatives removed */ + uint32_t **tables = calloc(num_seqs, sizeof *tables); + uint32_t *nb = calloc(num_seqs, sizeof *nb), *cx = calloc(num_seqs, sizeof *cx); + if (!tables || !nb || !cx) { free(tables); free(nb); free(cx); return OMEGA_GPU_ATTN_CHIP_FAIL; } + int rc = OMEGA_GPU_ATTN_OK; + for (uint32_t s = 0; s < num_seqs; s++) { + cx[s] = context_lens[s] > 0 ? (uint32_t)context_lens[s] : 0; + tables[s] = calloc(max_blocks_per_seq ? max_blocks_per_seq : 1, sizeof **tables); + if (!tables[s]) { rc = OMEGA_GPU_ATTN_CHIP_FAIL; break; } + for (uint32_t b = 0; b < max_blocks_per_seq; b++) { + int32_t v = block_tables[(size_t)s * max_blocks_per_seq + b]; + if (v >= 0) tables[s][nb[s]++] = (uint32_t)v; + } + } + if (rc == OMEGA_GPU_ATTN_OK) + rc = paged_core(q, pool, layout, (const uint32_t *const *)tables, nb, cx, num_seqs, layer_idx, num_q_heads, num_kv_heads, head_dim, out, info); + for (uint32_t s = 0; s < num_seqs; s++) free(tables[s]); + free(tables); free(nb); free(cx); + return rc; +} + +static const char *const k_mutant_names[OMEGA_GPU_ATTN_MUTANT_COUNT] = { + "none", "NO_MAX", "KV_HEAD", "SLOT", "NO_RESCALE", "Q_ROW", "OUT_ROW" +}; +_Static_assert(sizeof k_mutant_names / sizeof k_mutant_names[0] == OMEGA_GPU_ATTN_MUTANT_COUNT, "mutant name table"); + +const char *omega_gpu_attention_mutant_name(OmegaGpuAttnMutant m) { + return (m >= 0 && m < OMEGA_GPU_ATTN_MUTANT_COUNT && k_mutant_names[m]) ? k_mutant_names[m] : "?"; +} + +const char *omega_gpu_attention_rc_name(int rc) { + switch (rc) { + case OMEGA_GPU_ATTN_OK: return "OK"; + case OMEGA_GPU_ATTN_BAD_ARGS: return "BAD_ARGS"; + case OMEGA_GPU_ATTN_TOO_LARGE: return "TOO_LARGE"; + case OMEGA_GPU_ATTN_CODEGEN_FAIL: return "CODEGEN_FAIL"; + case OMEGA_GPU_ATTN_CHIP_FAIL: return "CHIP_FAIL"; + case OMEGA_GPU_ATTN_UNWRITTEN: return "UNWRITTEN"; + default: return "UNKNOWN"; + } +} + +/* omega #308 R2 test hook: 0 production, 1 lane-dependent branch inside a reconvergence + * region, 2 the same with the BSYNC dropped (negative control). Clears the kernel cache. */ +void omega_gpu_attention_test_set_divergent(int mode) { + LOCK(); + g_divergent = (mode < 0 || mode > 2) ? 0 : mode; + cache_clear_locked(); + UNLOCK(); +} diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/omega_gpu_attention_api.h b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/omega_gpu_attention_api.h new file mode 100644 index 000000000..0e8af5a28 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/omega_gpu_attention_api.h @@ -0,0 +1,214 @@ +#ifndef OMEGA_GPU_ATTENTION_API_H +#define OMEGA_GPU_ATTENTION_API_H +/* + * omega_gpu_attention_api: native (no CUDA) decode attention for the AIEN + * inference stack (FB-1 cut 5, 2026-10-04). + * + * Two kernel families, one query per (sequence, query head), generated by our + * own codegen (src/omega_blackwell_codegen.c IR) and launched through the same + * chip-proven sequence as cuts 1b and 4: every buffer GPU-uncached (nvos.h + * NVOS32_ATTR2_GPU_CACHEABLE: system memory cached by the GPU is not coherent + * with CPU mappings), shader caches invalidated before the launch (clcec0.h + * NVCEC0_INVALIDATE_SHADER_CACHES, cut 1b finding), first marker, + * L2_FLUSH_DIRTY, second marker (C3 tail), poison-filled output scanned for + * unwritten words after readback. + * + * The math follows aien-sovereign-core crates/aien-inference-abi/src/backend.rs + * (ReferenceCpuBackend / TensorBackend defaults), read 2026-10-04 at main 8b5caed: + * gqa_attention(out, q, k_cache, v_cache, seq_len, num_q_heads, num_kv_heads, head_dim) + * k_cache / v_cache are f32 [seq_len][num_kv_heads][head_dim]; query head h reads + * kv head h / (num_q_heads / num_kv_heads); score = (q . k) / sqrt(head_dim); + * softmax over all seq_len tokens (no mask: one query attends to the whole history); + * out[h] = sum_t softmax_t v_t. seq_len == 0 writes zeros. + * paged_attention(out, q, pool, block_ids, context_len, layer_idx, ...) + * the KV pool is bf16 in aien-kv-cache's canonical layout (KvLayout strides in + * bytes: block, layer, kv plane (0 = K, 1 = V), token, head); token t lives in + * block_ids[t / block_size] at slot t % block_size; tokens whose block index is + * past the end of block_ids are dropped; context_len == 0 or no blocks writes zeros. + * paged_attention_batch: per sequence s, context_lens[s] <= 0 means 0, the block + * table row is block_tables[s*max_blocks .. (s+1)*max_blocks] (empty if that row + * runs past the array), negative entries are removed (the rest close up). + * + * Chip math: scores in f32 (FFMA over the head), online softmax per chunk of + * head_dim tokens: running max (FMNMX), p = EX2((s - m) * log2 e) folded into the + * score scale, rescale factor alpha = EX2(m_old - m_new), f32 sums, final MUFU.RCP. + * bf16 K is read as 32-bit pairs (LDG.E) and widened by a 16-bit shift (bf16 is + * the top half of an f32); bf16 V by LDG.E.U16 and the same shift. f32 K/V are + * read directly. Tolerances are stated and justified in tests/gpu_attention_test.c. + * + * Launch envelope: at most OMEGA_GPU_ATTN_MAX_CTAS CTAs per launch (investigation + * I42, same as cuts 1b and 4): grid = (num_q_heads, sequences per launch). + * Shared memory: the QMD declares 16 * head_dim bytes (clcec0qmd.h SHARED_MEMORY_SIZE_SHIFTED7, + * src/omega_blackwell_qmd.c word 36); the kernel uses exactly 4 arrays of head_dim words: + * 1024 bytes for head_dim 64 (TinyLlama, Llama-3.2-1B; the QMD default) and 2048 bytes for + * head_dim 128 (Qwen3-4B, CPU phase: host simulators only, GB10 parity NOT_RUN). head_dim is a + * kernel parameter (64 or 128): threads per CTA = head_dim = chunk size, one warp partial per + * 32 threads in the softmax reductions. + * + * Staging: the host copies q, the referenced KV blocks' layer slice, the (compacted, + * renumbered) block tables and the context lengths into GPU-uncached staging buffers + * for each launch and copies the result back. The kernel itself walks the block + * table; a resident pool handle is a later cut. Since the attention hardening cut + * (2026-10-04) a launch stages each physical block's layer slice once however many + * sequences of the batch reference it (shared CoW prefixes), and OmegaGpuAttnInfo + * reports the bytes staged against the per-sequence (naive) figure. + * + * Cut 4b (2026-10-04): the device, channel and launch scratch are the process-wide + * session shared with the matmul and elementwise APIs (omega_gpu_session.h): one + * open per process instead of one per call (~40 ms), kernels resident after first + * use, staging buffers reused at their high-water mark (the KV slice is written + * straight into the device staging buffer). Calls serialise on one lock. + */ +#include +#include +#include +#include "omega_blackwell_matmul.h" /* OmegaBlackwellKernel */ +#ifdef __cplusplus +extern "C" { +#endif + +enum { + OMEGA_GPU_ATTN_OK = 0, + OMEGA_GPU_ATTN_BAD_ARGS = -1, /* NULL pointer, zero dimension, head mapping or block id out of range */ + OMEGA_GPU_ATTN_TOO_LARGE = -2, /* head_dim not in {64, 128}, num_q_heads > 64, context past the envelope */ + OMEGA_GPU_ATTN_CODEGEN_FAIL = -3, /* our codegen refused or exceeded the register budget */ + OMEGA_GPU_ATTN_CHIP_FAIL = -4, /* device open, alloc, submit, marker or release failed */ + OMEGA_GPU_ATTN_UNWRITTEN = -5 /* output words still equal to their poison after the run */ +}; + +#define OMEGA_GPU_ATTN_HEAD_DIM 64u /* the original head_dim; threads per CTA = head_dim (one thread per dimension / per token of a chunk) */ +#define OMEGA_GPU_ATTN_HEAD_DIM_128 128u /* the second supported head_dim (Qwen3-4B) */ +#define OMEGA_GPU_ATTN_MAX_CTAS 64u +#define OMEGA_GPU_ATTN_MAX_Q_HEADS 64u +#define OMEGA_GPU_ATTN_MAX_GQA_CTX 4096u /* contiguous path: one block of 2^12 slots */ + +/* Mirror of aien-kv-cache KvLayoutDesc (crates/aien-kv-cache/src/lib.rs, main 8b5caed), + * field for field, strides in bytes. */ +typedef struct { + uint64_t block_stride_bytes; + uint64_t layer_stride_bytes; + uint64_t kv_plane_stride_bytes; + uint64_t token_stride_bytes; + uint64_t head_stride_bytes; + uint64_t pool_bytes; + uint32_t num_blocks; + uint32_t num_layers; + uint32_t block_size; /* must be a power of two (the kernel shifts and masks) */ +} OmegaGpuKvLayout; + +typedef struct { + uint32_t chip_calls; /* launches made */ + uint64_t elapsed_ns; /* sum of submit-to-second-marker over the launches */ + uint64_t call_ns; /* wall time of the whole API call (staging, launches, copy-out) */ + uint32_t completion_marker; /* first marker word of the last launch */ + uint32_t unwritten_words; /* poison words left in the outputs (0 on OK) */ + uint32_t gpr_count, insn_count; + bool kernel_cache_hit; /* the kernel was already generated */ + uint32_t ctas_last_launch, threads_per_cta; + char target_chip[64]; + uint32_t sm_architecture; + /* Appended (attention hardening cut, 2026-10-04): transfer accounting for the call. + * Existing field order above is ABI; sovereign-core mirrors this struct field for field. */ + uint64_t kv_bytes_staged; /* KV layer-slice bytes actually copied into staging (sum over launches) */ + uint64_t kv_bytes_naive; /* what per-sequence staging would have copied (every sequence its own blocks) */ + uint32_t kv_blocks_logical; /* block references summed over sequences, truncated to each context */ + uint32_t kv_blocks_unique; /* distinct (physical block, layer) slices staged, summed over launches */ + uint64_t q_bytes, tab_bytes, out_bytes; /* q, block-table/context and result traffic (sum over launches) */ + uint32_t kv_source; /* OMEGA_GPU_ATTN_KV_STAGED; a resident pool is a later cut */ +} OmegaGpuAttnInfo; +#define OMEGA_GPU_ATTN_KV_STAGED 0u + +/* Contiguous f32 KV (TensorBackend::gqa_attention). q and out: [num_q_heads][head_dim]. */ +int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const float *v_cache, + uint32_t seq_len, uint32_t num_q_heads, uint32_t num_kv_heads, + uint32_t head_dim, float *out, OmegaGpuAttnInfo *info); + +/* Paged bf16 KV (TensorBackend::paged_attention). pool points at the pool base. */ +int omega_gpu_paged_attention_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const uint32_t *block_ids, uint32_t num_block_ids, + uint32_t context_len, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info); + +/* Batched (TensorBackend::paged_attention_batch). block_tables: [num_seqs][max_blocks_per_seq] i32 + * (negative = none), context_lens: [num_seqs] i32. q and out: [num_seqs][num_q_heads][head_dim]. */ +int omega_gpu_paged_attention_batch_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const int32_t *block_tables, const int32_t *context_lens, + uint32_t max_blocks_per_seq, uint32_t num_seqs, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info); + +const char *omega_gpu_attention_rc_name(int rc); +void omega_gpu_attention_cache_clear(void); + +/* Stage name of the most recent CHIP_FAIL ("" if none), shared with the other GPU APIs + * (omega_gpu_session_last_error); an open failure carries the driver text. */ +const char *omega_gpu_attention_last_error(void); + +/* Test hooks. Mutants are deliberately wrong kernels the parity test must catch; + * never set in production. */ +typedef enum { + OMEGA_GPU_ATTN_MUTANT_NONE = 0, + OMEGA_GPU_ATTN_MUTANT_NO_MAX, /* softmax without the running-max subtraction (overflows for large scores) */ + OMEGA_GPU_ATTN_MUTANT_KV_HEAD, /* reads kv head (h / ratio) ^ 1 */ + OMEGA_GPU_ATTN_MUTANT_SLOT, /* K read from slot (t + 1) % block_size while V keeps slot t (K/V mismatch) */ + OMEGA_GPU_ATTN_MUTANT_NO_RESCALE, /* the accumulator is not rescaled when the max moves between chunks */ + /* Head-wiring mutants (attention hardening cut, 2026-10-04). Both swap the rows of + * query heads h and h ^ 1, so they need num_q_heads even (>= 2); never run them on a + * one-head shape (row h ^ 1 of the last sequence would be past the buffer). */ + OMEGA_GPU_ATTN_MUTANT_Q_ROW, /* q loaded from query-head row h ^ 1 (kv head and output row stay h) */ + OMEGA_GPU_ATTN_MUTANT_OUT_ROW, /* the correct result for head h stored in flattened output row h ^ 1 */ + OMEGA_GPU_ATTN_MUTANT_COUNT /* one past the last mutant: every battery enumerates 1 .. COUNT-1 */ +} OmegaGpuAttnMutant; +void omega_gpu_attention_test_set_mutant(OmegaGpuAttnMutant m); + +/* TEST ONLY (omega #308 regression R2). 0 = production branch-free chunk loop; 1 = the + * lane-dependent j >= ctx branch restored inside a BSSY/BSYNC reconvergence region; + * 2 = that kernel with the BSYNC dropped (negative control: the host simulator must refuse + * it). Clears the kernel cache. */ +void omega_gpu_attention_test_set_divergent(int mode); +/* "none", "NO_MAX", ... ; "?" past COUNT. The table is checked against COUNT at compile time. */ +const char *omega_gpu_attention_mutant_name(OmegaGpuAttnMutant m); + +/* Generate a kernel without launching (host tests, nvdisasm listings). + * log2_block_size: shift for token -> block; log2_gqa: shift for query head -> kv head. */ +int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, + OmegaBlackwellKernel *kernel); + +/* The same with an explicit head_dim (64 or 128; anything else is TOO_LARGE). The 4-argument + * omega_gpu_attention_codegen above is head_dim 64 and emits the same bytes as before head_dim 128 existed. */ +int omega_gpu_attention_codegen_hd(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, uint32_t head_dim, + OmegaBlackwellKernel *kernel); + +/* One launch as the launcher sees it (test hook below). Pointers are host buffers; + * params are the eight argument words after the four buffer addresses: + * max_blocks, scale bits, block stride, token stride, kv plane stride, head stride, + * num_q_heads, context-array byte offset. */ +typedef struct { + const void *q; size_t q_bytes; + const void *pool; size_t pool_bytes; + const void *tab; size_t tab_bytes; + void *out; size_t out_bytes; + uint32_t grid_x, grid_y; + uint32_t params[8]; +} OmegaGpuAttnLaunch; + +/* Host simulator hook (tests): when set, every launch runs the allocated IR program + * through `sim` instead of the chip. Lets the whole battery run on the host first + * (review before chip time). The program is post register allocation. */ +struct BlackwellIRProgramTag; +typedef int (*OmegaGpuAttnSim)(const void *prog /* const BlackwellIRProgram * */, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info); +void omega_gpu_attention_test_set_simulator(OmegaGpuAttnSim sim); + +/* Shared-prefix staging dedupe (attention hardening cut, 2026-10-04): within one launch + * every (physical block, layer) slice referenced by the batch is staged once, keyed by the + * physical block id, and every sequence's compact table points at that one staged slot. + * On by default. `false` selects the legacy per-sequence staging (every sequence copies + * its own blocks), kept as the reference fallback and as the negative control of the + * staging-byte tests. Test hook; never cleared in production. */ +void omega_gpu_attention_test_set_dedupe(bool on); + +#ifdef __cplusplus +} +#endif +#endif /* OMEGA_GPU_ATTENTION_API_H */ diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/receipt.json b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/receipt.json new file mode 100644 index 000000000..6422d8e6b --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/receipt.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_V1","tolerances":{"rel":2e-4,"abs":2e-5,"large_scores_rel":1e-3,"large_scores_abs":1e-4},"cases":[{"case":"gqa_f32_tinyllama_32q4kv_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":215777,"call_ns":158628444,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2048,"kv_bytes_naive":2048,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00189431,"pass":true,"chip_elapsed_ns":104032,"call_ns":224241,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":34816,"kv_bytes_naive":34816,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00189409,"pass":true,"chip_elapsed_ns":209825,"call_ns":369154,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0028582,"pass":true,"chip_elapsed_ns":1227829,"call_ns":1874200,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"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)"},{"case":"gqa_f32_tinyllama_32q4kv_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00174821,"pass":true,"chip_elapsed_ns":104128,"call_ns":219633,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":133120,"kv_bytes_naive":133120,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00197914,"pass":true,"chip_elapsed_ns":103632,"call_ns":108208,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00177573,"pass":true,"chip_elapsed_ns":102865,"call_ns":107025,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":264192,"kv_bytes_naive":264192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00259576,"pass":true,"chip_elapsed_ns":288321,"call_ns":297602,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":614400,"kv_bytes_naive":614400,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00247545,"pass":true,"chip_elapsed_ns":581315,"call_ns":625123,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2048000,"kv_bytes_naive":2048000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":104113,"call_ns":214433,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096,"kv_bytes_naive":4096,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00174276,"pass":true,"chip_elapsed_ns":102657,"call_ns":105521,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":69632,"kv_bytes_naive":69632,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_llama32_1b_32q8kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00161378,"pass":true,"chip_elapsed_ns":206785,"call_ns":313506,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0029454,"pass":true,"chip_elapsed_ns":1125493,"call_ns":2422075,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"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)"},{"case":"gqa_f32_llama32_1b_32q8kv_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0014332,"pass":true,"chip_elapsed_ns":103441,"call_ns":196001,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":266240,"kv_bytes_naive":266240,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00186415,"pass":true,"chip_elapsed_ns":103505,"call_ns":111521,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00185519,"pass":true,"chip_elapsed_ns":103024,"call_ns":111088,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":528384,"kv_bytes_naive":528384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00162705,"pass":true,"chip_elapsed_ns":205201,"call_ns":225905,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1228800,"kv_bytes_naive":1228800,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00330327,"pass":true,"chip_elapsed_ns":720227,"call_ns":827396,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096000,"kv_bytes_naive":4096000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_large_scores_32q4kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.105395,"pass":true,"chip_elapsed_ns":205585,"call_ns":357634,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"NO_MAX:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_mha_16q16kv_ctx300","n":1024,"rc":"OK","violations":0,"worst_scaled_err":0.00197746,"pass":true,"chip_elapsed_ns":308210,"call_ns":482691,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2457600,"kv_bytes_naive":2457600,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":3,"mutants_caught":3,"mutant_note":"Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":103297,"call_ns":184657,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":16384,"kv_bytes_naive":16384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.002096,"pass":true,"chip_elapsed_ns":103008,"call_ns":178496,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00199949,"pass":true,"chip_elapsed_ns":205409,"call_ns":312609,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00336531,"pass":true,"chip_elapsed_ns":1022885,"call_ns":1081701,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00182741,"pass":true,"chip_elapsed_ns":103696,"call_ns":217585,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":81920,"kv_bytes_naive":81920,"kv_blocks_unique":5,"kv_blocks_logical":5,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00191997,"pass":true,"chip_elapsed_ns":102720,"call_ns":106272,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":131072,"kv_bytes_naive":131072,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00192425,"pass":true,"chip_elapsed_ns":102656,"call_ns":106432,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":147456,"kv_bytes_naive":147456,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00243899,"pass":true,"chip_elapsed_ns":305682,"call_ns":311362,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":311296,"kv_bytes_naive":311296,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00547531,"pass":true,"chip_elapsed_ns":307362,"call_ns":311330,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":163840,"kv_bytes_naive":1032192,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":104529,"call_ns":205297,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00223287,"pass":true,"chip_elapsed_ns":103377,"call_ns":195505,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00167964,"pass":true,"chip_elapsed_ns":206465,"call_ns":321745,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00358689,"pass":true,"chip_elapsed_ns":1126326,"call_ns":1250262,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00228809,"pass":true,"chip_elapsed_ns":104368,"call_ns":220561,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":163840,"kv_bytes_naive":163840,"kv_blocks_unique":5,"kv_blocks_logical":5,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00160376,"pass":true,"chip_elapsed_ns":204705,"call_ns":209697,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00173996,"pass":true,"chip_elapsed_ns":205233,"call_ns":210881,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":294912,"kv_bytes_naive":294912,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00303696,"pass":true,"chip_elapsed_ns":205153,"call_ns":215489,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":622592,"kv_bytes_naive":622592,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00420311,"pass":true,"chip_elapsed_ns":309921,"call_ns":316657,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":327680,"kv_bytes_naive":2064384,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_batch_3seq_32q8kv_ctx40_0_100","n":6144,"rc":"OK","violations":0,"worst_scaled_err":0.00181424,"pass":true,"chip_elapsed_ns":207361,"call_ns":484883,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":229376,"kv_bytes_naive":229376,"kv_blocks_unique":7,"kv_blocks_logical":7,"mutants_run":4,"mutants_caught":4,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_shared_prefix_4seq_8q2kv_10pre","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00188498,"pass":true,"chip_elapsed_ns":204353,"call_ns":315745,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":155648,"kv_bytes_naive":401408,"kv_blocks_unique":19,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2046)"},{"case":"paged_bf16_shared_prefix_4seq_32q8kv_10pre","n":8192,"rc":"OK","violations":0,"worst_scaled_err":0.0024233,"pass":true,"chip_elapsed_ns":410770,"call_ns":541202,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":950272,"kv_bytes_naive":1605632,"kv_blocks_unique":29,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181)"}],"mutant_count":6,"mutants":{"NO_MAX":{"run":1,"caught":1},"KV_HEAD":{"run":11,"caught":11},"SLOT":{"run":9,"caught":9},"NO_RESCALE":{"run":4,"caught":4},"Q_ROW":{"run":6,"caught":6},"OUT_ROW":{"run":6,"caught":6}},"device_opens":1,"checks":122,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_PASS"} diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/run.log b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/run.log new file mode 100644 index 000000000..02eecfa7c --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/run.log @@ -0,0 +1,49 @@ +PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=215777 call_ns=158628444 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=104032 call_ns=224241 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=209825 call_ns=369154 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=1227829 call_ns=1874200 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=104128 call_ns=219633 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=103632 call_ns=108208 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=102865 call_ns=107025 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=288321 call_ns=297602 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=581315 call_ns=625123 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=104113 call_ns=214433 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=102657 call_ns=105521 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=206785 call_ns=313506 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=1125493 call_ns=2422075 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=103441 call_ns=196001 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=103505 call_ns=111521 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=103024 call_ns=111088 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=205201 call_ns=225905 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=720227 call_ns=827396 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.105395 chip_ns=205585 call_ns=357634 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.00197746 chip_ns=308210 call_ns=482691 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=103297 call_ns=184657 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.002096 chip_ns=103008 call_ns=178496 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00199949 chip_ns=205409 call_ns=312609 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.00336531 chip_ns=1022885 call_ns=1081701 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00182741 chip_ns=103696 call_ns=217585 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.00191997 chip_ns=102720 call_ns=106272 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.00192425 chip_ns=102656 call_ns=106432 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.00243899 chip_ns=305682 call_ns=311362 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.00547531 chip_ns=307362 call_ns=311330 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=104529 call_ns=205297 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.00223287 chip_ns=103377 call_ns=195505 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00167964 chip_ns=206465 call_ns=321745 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.00358689 chip_ns=1126326 call_ns=1250262 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=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00228809 chip_ns=104368 call_ns=220561 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.00160376 chip_ns=204705 call_ns=209697 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.00173996 chip_ns=205233 call_ns=210881 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.00303696 chip_ns=205153 call_ns=215489 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.00420311 chip_ns=309921 call_ns=316657 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00181424 chip_ns=207361 call_ns=484883 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=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00188498 chip_ns=204353 call_ns=315745 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.0024233 chip_ns=410770 call_ns=541202 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=1 +PASS: 122 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sim.log b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sim.log new file mode 100644 index 000000000..1b2f889f1 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sim.log @@ -0,0 +1,49 @@ +PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=7063506 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.00189313 chip_ns=0 call_ns=9404301 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.00183169 chip_ns=0 call_ns=36128558 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.00274869 chip_ns=0 call_ns=240149571 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.00145684 chip_ns=0 call_ns=10720275 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.00206007 chip_ns=0 call_ns=15212521 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.00165735 chip_ns=0 call_ns=18126216 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.00201893 chip_ns=0 call_ns=36123469 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.00297055 chip_ns=0 call_ns=117788023 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=0 call_ns=3291856 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.00187227 chip_ns=0 call_ns=4412389 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.00201723 chip_ns=0 call_ns=30164049 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=0 call_ns=241391929 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.00195964 chip_ns=0 call_ns=10810196 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.00170583 chip_ns=0 call_ns=15357834 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.0017034 chip_ns=0 call_ns=18254311 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.00187268 chip_ns=0 call_ns=36529327 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.00303901 chip_ns=0 call_ns=118994492 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.105626 chip_ns=0 call_ns=30188833 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.00197746 chip_ns=0 call_ns=18207752 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=3195919 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.0020981 chip_ns=0 call_ns=4435030 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00182155 chip_ns=0 call_ns=31127637 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.00365795 chip_ns=0 call_ns=246501570 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00173051 chip_ns=0 call_ns=10890564 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.00189837 chip_ns=0 call_ns=15718603 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.00172729 chip_ns=0 call_ns=18529337 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.00210268 chip_ns=0 call_ns=37252099 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.00547531 chip_ns=0 call_ns=121383032 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=0 call_ns=3192448 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.00215313 chip_ns=0 call_ns=4440038 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.0021938 chip_ns=0 call_ns=31121750 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.00358689 chip_ns=0 call_ns=246881460 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=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00163443 chip_ns=0 call_ns=10888613 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.00186221 chip_ns=0 call_ns=15712060 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.00163299 chip_ns=0 call_ns=18537274 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.00264235 chip_ns=0 call_ns=37315780 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.00399855 chip_ns=0 call_ns=121584553 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00179162 chip_ns=0 call_ns=14523958 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=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00208743 chip_ns=0 call_ns=24332901 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.0024233 chip_ns=0 call_ns=97358213 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=0 +PASS: 122 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sweep.json b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sweep.json new file mode 100644 index 000000000..e5bcc0d39 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sweep.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_SWEEP_V1","path":"paged_bf16","head_dim":64,"block_size":16,"timed_calls":20,"host_simulator":false,"tolerances":{"rel":2e-4,"abs":2e-5},"hardware_counters":"unavailable (SM occupancy, bandwidth utilisation, cache hit rates are not observable through this path)","points":[{"q_heads":1,"kv_heads":1,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":64,"out_width":64,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00162825,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":1,"threads_per_cta":64,"call_ms_median":0.1035,"call_ms_p90":0.1045,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":256,"tab_bytes":68,"out_bytes":256,"kv_source":"staged"},{"q_heads":1,"kv_heads":1,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":64,"out_width":64,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00286577,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":1,"threads_per_cta":64,"call_ms_median":0.4097,"call_ms_p90":0.4109,"kernel_ms_median":0.4079,"kernel_ms_p90":0.4093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":256,"tab_bytes":516,"out_bytes":256,"kv_source":"staged"},{"q_heads":2,"kv_heads":1,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00274735,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.1037,"call_ms_p90":0.1043,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1037,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":512,"tab_bytes":68,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":1,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00293219,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.4097,"call_ms_p90":0.4103,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4085,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":512,"tab_bytes":516,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":2,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00285429,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.1038,"call_ms_p90":0.1045,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1037,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":512,"tab_bytes":68,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":2,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00344759,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.4101,"call_ms_p90":0.4115,"kernel_ms_median":0.4077,"kernel_ms_p90":0.4091,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":512,"tab_bytes":516,"out_bytes":512,"kv_source":"staged"},{"q_heads":4,"kv_heads":1,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00195521,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1038,"call_ms_p90":0.1045,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":1,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00455218,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4098,"call_ms_p90":0.4104,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4086,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":2,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00195668,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1039,"call_ms_p90":0.1042,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":2,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00429287,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4104,"call_ms_p90":0.4118,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4094,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":4,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00208557,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1041,"call_ms_p90":0.1044,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":4,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00447204,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4120,"call_ms_p90":0.4130,"kernel_ms_median":0.4083,"kernel_ms_p90":0.4090,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":8,"kv_heads":1,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00244755,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1036,"call_ms_p90":0.1615,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1605,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":1,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00561397,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4085,"call_ms_p90":0.4103,"kernel_ms_median":0.4066,"kernel_ms_p90":0.4085,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":2,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00277137,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1041,"call_ms_p90":0.1047,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":2,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00478059,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4107,"call_ms_p90":0.4117,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4091,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":4,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00220051,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1044,"call_ms_p90":0.1050,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":4,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0051977,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4123,"call_ms_p90":0.4130,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4088,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":8,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00240979,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1047,"call_ms_p90":0.1050,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":8,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00466806,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4155,"call_ms_p90":0.4172,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4092,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":16,"kv_heads":1,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00249826,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1042,"call_ms_p90":0.1043,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":1,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00536905,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4090,"call_ms_p90":0.4114,"kernel_ms_median":0.4067,"kernel_ms_p90":0.4087,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":2,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00239844,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1045,"call_ms_p90":0.1049,"kernel_ms_median":0.1029,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":2,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00570392,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4113,"call_ms_p90":0.4124,"kernel_ms_median":0.4083,"kernel_ms_p90":0.4093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":4,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00278498,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1047,"call_ms_p90":0.1052,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1035,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":4,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00518169,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4129,"call_ms_p90":0.4140,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4092,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":8,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00262688,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1052,"call_ms_p90":0.1057,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":8,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0059316,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4171,"call_ms_p90":0.4182,"kernel_ms_median":0.4083,"kernel_ms_p90":0.4093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":16,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00239914,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1060,"call_ms_p90":0.1063,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":16,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00553838,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4239,"call_ms_p90":0.4262,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4099,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":24,"kv_heads":1,"gqa_ratio":24,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":1,"gqa_ratio":24,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":2,"gqa_ratio":12,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":2,"gqa_ratio":12,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":3,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00306755,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1049,"call_ms_p90":0.1057,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":36864,"kv_bytes_naive":196608,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":3,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00539717,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6157,"call_ms_p90":0.6168,"kernel_ms_median":0.6116,"kernel_ms_p90":0.6125,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":233472,"kv_bytes_naive":1572864,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":4,"gqa_ratio":6,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":4,"gqa_ratio":6,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":6,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00326846,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1054,"call_ms_p90":0.1066,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1043,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":73728,"kv_bytes_naive":393216,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":6,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00527248,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6186,"call_ms_p90":0.7199,"kernel_ms_median":0.6117,"kernel_ms_p90":0.7129,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":466944,"kv_bytes_naive":3145728,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":8,"gqa_ratio":3,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":8,"gqa_ratio":3,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":12,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00338069,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1060,"call_ms_p90":0.1063,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":147456,"kv_bytes_naive":786432,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":12,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00538782,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6261,"call_ms_p90":0.7264,"kernel_ms_median":0.6117,"kernel_ms_p90":0.7124,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":933888,"kv_bytes_naive":6291456,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":24,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00259323,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1074,"call_ms_p90":0.1078,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":294912,"kv_bytes_naive":1572864,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":24,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00737519,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.5394,"call_ms_p90":0.5459,"kernel_ms_median":0.5100,"kernel_ms_p90":0.5122,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1867776,"kv_bytes_naive":12582912,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":32,"kv_heads":1,"gqa_ratio":32,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00241453,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1051,"call_ms_p90":0.1054,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1031,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":1,"gqa_ratio":32,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00525453,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4110,"call_ms_p90":0.4122,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4092,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":2,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0031327,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1053,"call_ms_p90":0.1057,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":2,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00648224,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4120,"call_ms_p90":0.4129,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4091,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":4,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00316999,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1056,"call_ms_p90":0.1066,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1039,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":4,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00599161,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4134,"call_ms_p90":0.4144,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4091,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":8,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00278167,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1059,"call_ms_p90":0.1062,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":8,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.005897,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4179,"call_ms_p90":0.4188,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4091,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":16,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00268895,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1070,"call_ms_p90":0.1076,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":16,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00571167,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4281,"call_ms_p90":0.4319,"kernel_ms_median":0.4086,"kernel_ms_p90":0.4096,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":32,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00256581,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1088,"call_ms_p90":0.1095,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1035,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":393216,"kv_bytes_naive":2097152,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":32,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00647965,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4510,"call_ms_p90":0.4554,"kernel_ms_median":0.4088,"kernel_ms_p90":0.4097,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":2490368,"kv_bytes_naive":16777216,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":64,"kv_heads":1,"gqa_ratio":64,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00332208,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1067,"call_ms_p90":0.1070,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":1,"gqa_ratio":64,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00559141,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.4130,"call_ms_p90":0.4137,"kernel_ms_median":0.4083,"kernel_ms_p90":0.4092,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":2,"gqa_ratio":32,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00286709,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1070,"call_ms_p90":0.1076,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1037,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":2,"gqa_ratio":32,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00639622,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0417,"call_ms_p90":1.1251,"kernel_ms_median":1.0297,"kernel_ms_p90":1.1198,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":4,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00399345,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1121,"call_ms_p90":0.1161,"kernel_ms_median":0.1047,"kernel_ms_p90":0.1081,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":4,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00618912,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0327,"call_ms_p90":1.0472,"kernel_ms_median":1.0197,"kernel_ms_p90":1.0296,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":8,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0028507,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1072,"call_ms_p90":0.1095,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":8,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00529008,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0300,"call_ms_p90":1.0342,"kernel_ms_median":1.0185,"kernel_ms_p90":1.0205,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":16,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00272721,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1085,"call_ms_p90":0.1090,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":16,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00565958,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0419,"call_ms_p90":1.0718,"kernel_ms_median":1.0194,"kernel_ms_p90":1.0428,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":32,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00282842,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1102,"call_ms_p90":0.1274,"kernel_ms_median":0.1027,"kernel_ms_p90":0.1105,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":393216,"kv_bytes_naive":2097152,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":32,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00670759,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0806,"call_ms_p90":1.1389,"kernel_ms_median":1.0205,"kernel_ms_p90":1.0480,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":2490368,"kv_bytes_naive":16777216,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":64,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00284045,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1157,"call_ms_p90":0.1176,"kernel_ms_median":0.1035,"kernel_ms_p90":0.1037,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":786432,"kv_bytes_naive":4194304,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":64,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00870193,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.1689,"call_ms_p90":1.2626,"kernel_ms_median":1.0257,"kernel_ms_p90":1.1222,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":4980736,"kv_bytes_naive":33554432,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"}],"points_total":72,"points_supported":64,"points_unsupported":8,"device_opens":1,"checks":73,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_SWEEP_PASS"} diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sweep.log b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sweep.log new file mode 100644 index 000000000..379a9cf0e --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/sweep.log @@ -0,0 +1,74 @@ +PASS sweep 1q/ 1kv ratio 1 ctx 256: launches=1 ctas=1 call_ms med=0.103 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=256 tab=68 out=256 worst=0.00162825 +PASS sweep 1q/ 1kv ratio 1 ctx 2048: launches=1 ctas=1 call_ms med=0.410 p90=0.411 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=256 tab=516 out=256 worst=0.00286577 +PASS sweep 2q/ 1kv ratio 2 ctx 256: launches=1 ctas=2 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.104 kv_staged=12288 (naive 65536) blocks=3/16 q=512 tab=68 out=512 worst=0.00274735 +PASS sweep 2q/ 1kv ratio 2 ctx 2048: launches=1 ctas=2 call_ms med=0.410 p90=0.410 kernel_ms med=0.408 p90=0.408 kv_staged=77824 (naive 524288) blocks=19/128 q=512 tab=516 out=512 worst=0.00293219 +PASS sweep 2q/ 2kv ratio 1 ctx 256: launches=1 ctas=2 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.104 kv_staged=24576 (naive 131072) blocks=3/16 q=512 tab=68 out=512 worst=0.00285429 +PASS sweep 2q/ 2kv ratio 1 ctx 2048: launches=1 ctas=2 call_ms med=0.410 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=512 tab=516 out=512 worst=0.00344759 +PASS sweep 4q/ 1kv ratio 4 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.104 kv_staged=12288 (naive 65536) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00195521 +PASS sweep 4q/ 1kv ratio 4 ctx 2048: launches=1 ctas=4 call_ms med=0.410 p90=0.410 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00455218 +PASS sweep 4q/ 2kv ratio 2 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00195668 +PASS sweep 4q/ 2kv ratio 2 ctx 2048: launches=1 ctas=4 call_ms med=0.410 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00429287 +PASS sweep 4q/ 4kv ratio 1 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00208557 +PASS sweep 4q/ 4kv ratio 1 ctx 2048: launches=1 ctas=4 call_ms med=0.412 p90=0.413 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00447204 +PASS sweep 8q/ 1kv ratio 8 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.161 kernel_ms med=0.103 p90=0.161 kv_staged=12288 (naive 65536) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00244755 +PASS sweep 8q/ 1kv ratio 8 ctx 2048: launches=1 ctas=8 call_ms med=0.409 p90=0.410 kernel_ms med=0.407 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00561397 +PASS sweep 8q/ 2kv ratio 4 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.104 kv_staged=24576 (naive 131072) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00277137 +PASS sweep 8q/ 2kv ratio 4 ctx 2048: launches=1 ctas=8 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00478059 +PASS sweep 8q/ 4kv ratio 2 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.104 kv_staged=49152 (naive 262144) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00220051 +PASS sweep 8q/ 4kv ratio 2 ctx 2048: launches=1 ctas=8 call_ms med=0.412 p90=0.413 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=2048 tab=516 out=2048 worst=0.0051977 +PASS sweep 8q/ 8kv ratio 1 ctx 256: launches=1 ctas=8 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00240979 +PASS sweep 8q/ 8kv ratio 1 ctx 2048: launches=1 ctas=8 call_ms med=0.416 p90=0.417 kernel_ms med=0.408 p90=0.409 kv_staged=622592 (naive 4194304) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00466806 +PASS sweep 16q/ 1kv ratio 16 ctx 256: launches=1 ctas=16 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00249826 +PASS sweep 16q/ 1kv ratio 16 ctx 2048: launches=1 ctas=16 call_ms med=0.409 p90=0.411 kernel_ms med=0.407 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00536905 +PASS sweep 16q/ 2kv ratio 8 ctx 256: launches=1 ctas=16 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00239844 +PASS sweep 16q/ 2kv ratio 8 ctx 2048: launches=1 ctas=16 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00570392 +PASS sweep 16q/ 4kv ratio 4 ctx 256: launches=1 ctas=16 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.104 kv_staged=49152 (naive 262144) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00278498 +PASS sweep 16q/ 4kv ratio 4 ctx 2048: launches=1 ctas=16 call_ms med=0.413 p90=0.414 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00518169 +PASS sweep 16q/ 8kv ratio 2 ctx 256: launches=1 ctas=16 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.104 kv_staged=98304 (naive 524288) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00262688 +PASS sweep 16q/ 8kv ratio 2 ctx 2048: launches=1 ctas=16 call_ms med=0.417 p90=0.418 kernel_ms med=0.408 p90=0.409 kv_staged=622592 (naive 4194304) blocks=19/128 q=4096 tab=516 out=4096 worst=0.0059316 +PASS sweep 16q/16kv ratio 1 ctx 256: launches=1 ctas=16 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=196608 (naive 1048576) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00239914 +PASS sweep 16q/16kv ratio 1 ctx 2048: launches=1 ctas=16 call_ms med=0.424 p90=0.426 kernel_ms med=0.408 p90=0.410 kv_staged=1245184 (naive 8388608) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00553838 +PASS sweep 24q/ 1kv ratio 24 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 1kv ratio 24 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 2kv ratio 12 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 2kv ratio 12 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 3kv ratio 8 ctx 256: launches=1 ctas=24 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.104 kv_staged=36864 (naive 196608) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00306755 +PASS sweep 24q/ 3kv ratio 8 ctx 2048: launches=1 ctas=24 call_ms med=0.616 p90=0.617 kernel_ms med=0.612 p90=0.613 kv_staged=233472 (naive 1572864) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00539717 +PASS sweep 24q/ 4kv ratio 6 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 4kv ratio 6 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 6kv ratio 4 ctx 256: launches=1 ctas=24 call_ms med=0.105 p90=0.107 kernel_ms med=0.103 p90=0.104 kv_staged=73728 (naive 393216) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00326846 +PASS sweep 24q/ 6kv ratio 4 ctx 2048: launches=1 ctas=24 call_ms med=0.619 p90=0.720 kernel_ms med=0.612 p90=0.713 kv_staged=466944 (naive 3145728) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00527248 +PASS sweep 24q/ 8kv ratio 3 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 8kv ratio 3 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/12kv ratio 2 ctx 256: launches=1 ctas=24 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=147456 (naive 786432) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00338069 +PASS sweep 24q/12kv ratio 2 ctx 2048: launches=1 ctas=24 call_ms med=0.626 p90=0.726 kernel_ms med=0.612 p90=0.712 kv_staged=933888 (naive 6291456) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00538782 +PASS sweep 24q/24kv ratio 1 ctx 256: launches=1 ctas=24 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.103 kv_staged=294912 (naive 1572864) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00259323 +PASS sweep 24q/24kv ratio 1 ctx 2048: launches=1 ctas=24 call_ms med=0.539 p90=0.546 kernel_ms med=0.510 p90=0.512 kv_staged=1867776 (naive 12582912) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00737519 +PASS sweep 32q/ 1kv ratio 32 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00241453 +PASS sweep 32q/ 1kv ratio 32 ctx 2048: launches=1 ctas=32 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00525453 +PASS sweep 32q/ 2kv ratio 16 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=8192 tab=68 out=8192 worst=0.0031327 +PASS sweep 32q/ 2kv ratio 16 ctx 2048: launches=1 ctas=32 call_ms med=0.412 p90=0.413 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00648224 +PASS sweep 32q/ 4kv ratio 8 ctx 256: launches=1 ctas=32 call_ms med=0.106 p90=0.107 kernel_ms med=0.103 p90=0.104 kv_staged=49152 (naive 262144) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00316999 +PASS sweep 32q/ 4kv ratio 8 ctx 2048: launches=1 ctas=32 call_ms med=0.413 p90=0.414 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00599161 +PASS sweep 32q/ 8kv ratio 4 ctx 256: launches=1 ctas=32 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00278167 +PASS sweep 32q/ 8kv ratio 4 ctx 2048: launches=1 ctas=32 call_ms med=0.418 p90=0.419 kernel_ms med=0.408 p90=0.409 kv_staged=622592 (naive 4194304) blocks=19/128 q=8192 tab=516 out=8192 worst=0.005897 +PASS sweep 32q/16kv ratio 2 ctx 256: launches=1 ctas=32 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.104 kv_staged=196608 (naive 1048576) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00268895 +PASS sweep 32q/16kv ratio 2 ctx 2048: launches=1 ctas=32 call_ms med=0.428 p90=0.432 kernel_ms med=0.409 p90=0.410 kv_staged=1245184 (naive 8388608) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00571167 +PASS sweep 32q/32kv ratio 1 ctx 256: launches=1 ctas=32 call_ms med=0.109 p90=0.110 kernel_ms med=0.103 p90=0.103 kv_staged=393216 (naive 2097152) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00256581 +PASS sweep 32q/32kv ratio 1 ctx 2048: launches=1 ctas=32 call_ms med=0.451 p90=0.455 kernel_ms med=0.409 p90=0.410 kv_staged=2490368 (naive 16777216) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00647965 +PASS sweep 64q/ 1kv ratio 64 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.107 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00332208 +PASS sweep 64q/ 1kv ratio 64 ctx 2048: launches=1 ctas=64 call_ms med=0.413 p90=0.414 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00559141 +PASS sweep 64q/ 2kv ratio 32 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.104 kv_staged=24576 (naive 131072) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00286709 +PASS sweep 64q/ 2kv ratio 32 ctx 2048: launches=1 ctas=64 call_ms med=1.042 p90=1.125 kernel_ms med=1.030 p90=1.120 kv_staged=155648 (naive 1048576) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00639622 +PASS sweep 64q/ 4kv ratio 16 ctx 256: launches=1 ctas=64 call_ms med=0.112 p90=0.116 kernel_ms med=0.105 p90=0.108 kv_staged=49152 (naive 262144) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00399345 +PASS sweep 64q/ 4kv ratio 16 ctx 2048: launches=1 ctas=64 call_ms med=1.033 p90=1.047 kernel_ms med=1.020 p90=1.030 kv_staged=311296 (naive 2097152) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00618912 +PASS sweep 64q/ 8kv ratio 8 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.110 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=16384 tab=68 out=16384 worst=0.0028507 +PASS sweep 64q/ 8kv ratio 8 ctx 2048: launches=1 ctas=64 call_ms med=1.030 p90=1.034 kernel_ms med=1.019 p90=1.021 kv_staged=622592 (naive 4194304) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00529008 +PASS sweep 64q/16kv ratio 4 ctx 256: launches=1 ctas=64 call_ms med=0.109 p90=0.109 kernel_ms med=0.103 p90=0.104 kv_staged=196608 (naive 1048576) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00272721 +PASS sweep 64q/16kv ratio 4 ctx 2048: launches=1 ctas=64 call_ms med=1.042 p90=1.072 kernel_ms med=1.019 p90=1.043 kv_staged=1245184 (naive 8388608) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00565958 +PASS sweep 64q/32kv ratio 2 ctx 256: launches=1 ctas=64 call_ms med=0.110 p90=0.127 kernel_ms med=0.103 p90=0.110 kv_staged=393216 (naive 2097152) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00282842 +PASS sweep 64q/32kv ratio 2 ctx 2048: launches=1 ctas=64 call_ms med=1.081 p90=1.139 kernel_ms med=1.020 p90=1.048 kv_staged=2490368 (naive 16777216) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00670759 +PASS sweep 64q/64kv ratio 1 ctx 256: launches=1 ctas=64 call_ms med=0.116 p90=0.118 kernel_ms med=0.103 p90=0.104 kv_staged=786432 (naive 4194304) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00284045 +PASS sweep 64q/64kv ratio 1 ctx 2048: launches=1 ctas=64 call_ms med=1.169 p90=1.263 kernel_ms med=1.026 p90=1.122 kv_staged=4980736 (naive 33554432) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00870193 +sweep: 72 points (64 supported, 8 unsupported by the kernel envelope), device_opens=1 +PASS: 73 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/timing.json b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/timing.json new file mode 100644 index 000000000..f50e6ad57 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/timing.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_TIMING_V1","gate_median_ms":3.0,"calls":100,"cases":[{"case":"gqa_f32_tinyllama_32q4kv_ctx2048","first_call_ms":121.789,"ok_calls":100,"violations":0,"worst_scaled_err":0.00323017,"median_ms":1.1992,"p90_ms":1.2046,"min_ms":1.1867,"max_ms":1.6036,"chip_us_mean":1131.7,"device_opens":1,"pass":true}],"checks":2,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_TIMING_PASS"} diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/timing.log b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/timing.log new file mode 100644 index 000000000..f6087a2f2 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/FB1-CUT5-7dd92dc/timing.log @@ -0,0 +1,2 @@ +PASS timing gqa_f32_tinyllama_32q4kv_ctx2048 first_call_ms=121.789 ok_calls=100/100 violations=0 worst_scaled_err=0.00323017 median_ms=1.199 p90_ms=1.205 min_ms=1.187 max_ms=1.604 chip_us_mean=1131.7 device_opens=1 +PASS: 2 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/NOTES.md b/evidence/FB1-CUT5-HD128-7dd92dc/NOTES.md new file mode 100644 index 000000000..d0eae2977 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/NOTES.md @@ -0,0 +1,8 @@ +# omega#323 GB10 receipts on the rebased head (session d6d82f, 2026-10-07) +Code under test: omega 7dd92dc (omega#323 rebased onto omega main 917e8b9, which carries omega#324's 2 KB code-buffer tail). Physics 6d7cf0d. Driver 580.173.02. Tree clean (ground.txt). +Hold 03:14:25Z-03:14:38Z via quietlock (window.sh in this folder). Nothing rerun or edited after the run. +- hd64 regression (tools/run_gpu_attention_chip.sh, FB1-CUT5-7dd92dc/): run 122/0, sweep 73/0, timing 2/0, sim 122/0. +- hd128 battery (gpu_attention_test --hd 128): PASS 126/0, receipt-hd128.json; every ctx256 case passes (Qwen3-4B shape 32q/8kv ctx256 worst_scaled_err 0.0022). +- kernel-log.txt: no Xid during the hold. +- The earlier FAIL receipts in evidence/FB1-CUT5-HD128-5a9f759 (ctx256 Xid 31, pre-#324) are kept unchanged. Cause and red/green: omega#324 evidence/CODEPAD-PREFETCH-f1d57c5. +- LIMITS: one pass of each battery, not a rate. Commits after 7dd92dc add only this folder and the crumb recompile. diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/SHA256SUMS b/evidence/FB1-CUT5-HD128-7dd92dc/SHA256SUMS new file mode 100644 index 000000000..733a8135a --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/SHA256SUMS @@ -0,0 +1,21 @@ +fbbfaed9a894256ed76ccf5272d3f4f8adde979be71dfa7ac965c71c76cb7e37 ./end.txt +7377faa169d26cfe93b79c1024d97473deac677a68395ca8f51dfdbe2c27caaa ./FB1-CUT5-7dd92dc/build.log +531f8e1a0e28de36ece4b2d45bfb0186682e46ab865dd90d0c9449260e15cd2b ./FB1-CUT5-7dd92dc/device.txt +4f83db25193278a4eab50202656a69aa151ac416f6cd3c047063f256d34f0611 ./FB1-CUT5-7dd92dc/gpu_attention_test.c +adb89be06da592d860aaab5a31fc2c7aed478fde9535c23eb3a0604b3b844c06 ./FB1-CUT5-7dd92dc/omega_gpu_attention_api.c +470d114d0488d74d8f149b8bdcd1568b33f4676db17001a77f19e44bef754cb1 ./FB1-CUT5-7dd92dc/omega_gpu_attention_api.h +260359db1c3d0c5e257b747f426468fcff898966a830e464f04bc662aceef156 ./FB1-CUT5-7dd92dc/receipt.json +894c962ad34958b3cb3edbe82bdfbd2fd8be00f332eb48a7b933d6de874e3b3b ./FB1-CUT5-7dd92dc/run.log +3094ef8189a833f18c0c1a24fe3a224df7758fa6ed89261f3baff416f37d49ce ./FB1-CUT5-7dd92dc/sim.log +6b87b77e3d8532d0af9ff8c670b533a14b6d42771bec6c68566fafca79c89ceb ./FB1-CUT5-7dd92dc/sweep.json +c2764d16a56ae8892421bf27839e3a5e4c23da2b618d607248e45178dd37ac5f ./FB1-CUT5-7dd92dc/sweep.log +b92a19cf40acf471555c3914b990f1b633e49714e0d1d910eecacfebfb41ca20 ./FB1-CUT5-7dd92dc/timing.json +14c2fbeee7f3eeaf3ea230b1115f50164c29c154b6c647e618ec9d1913d80700 ./FB1-CUT5-7dd92dc/timing.log +8e95ac556c1d72ec069c44c1b81c18d8e92a7edb9e84f41d194d918c31a3d52c ./ground.txt +c01f979dad9705f415fdec8ba4f55e24f362e027bc2b8816305c80ab487fc4b7 ./hd64-runner.log +19c4e28b2f54ea8f217db4e622b0a5c758efa7b77ce2dc0394b6d159568c0b2e ./kernel-log.txt +0de60e200e6c79d3eba85e6830cd162b58d3bf09556b88ebc8c1f3ab1358cdae ./receipt-hd128.json +5d513ba89aa059e829615e9258553d35784a483c1e6a64d9682b567793e5f4ff ./run-hd128.log +f914f18ba8723b1e3ead3f0681699821b256f46f36b78e596f665b6c3923c929 ./start.txt +1ffe52d39b73fec6ab906fa53ed1d6dea535cb377725180749c8717f3d0b9dd4 ./status.txt +f78093e7c8714af6657628f3a59b46a01dc319022abf569dbbe7fa85a3769cf4 ./window.sh diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/end.txt b/evidence/FB1-CUT5-HD128-7dd92dc/end.txt new file mode 100644 index 000000000..7ba7777a0 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/end.txt @@ -0,0 +1 @@ +2026-10-07T03:14:38Z diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/ground.txt b/evidence/FB1-CUT5-HD128-7dd92dc/ground.txt new file mode 100644 index 000000000..37092654e --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/ground.txt @@ -0,0 +1,5 @@ +omega 7dd92dc3f9db1a21aeedc7f38b629e5ce4358d4e dirty=0 +physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +580.173.02 +7.0.0-1019-nvidia +xid_lines_before=2 diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/hd64-runner.log b/evidence/FB1-CUT5-HD128-7dd92dc/hd64-runner.log new file mode 100644 index 000000000..e760d1b8a --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/hd64-runner.log @@ -0,0 +1,4 @@ +PASS: 122 checks, 0 failed +PASS: 73 checks, 0 failed +PASS: 2 checks, 0 failed +FB1-CUT5 chip gate rc=0 (sweep rc=0 timing rc=0) receipt=/home/drakestapleton/workspace/hive/WATTN/receipts/final-7dd92dc/FB1-CUT5-7dd92dc/receipt.json sweep=/home/drakestapleton/workspace/hive/WATTN/receipts/final-7dd92dc/FB1-CUT5-7dd92dc/sweep.json diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/kernel-log.txt b/evidence/FB1-CUT5-HD128-7dd92dc/kernel-log.txt new file mode 100644 index 000000000..6ba17d74f --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/kernel-log.txt @@ -0,0 +1 @@ +-- No entries -- diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/receipt-hd128.json b/evidence/FB1-CUT5-HD128-7dd92dc/receipt-hd128.json new file mode 100644 index 000000000..a2e41c587 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/receipt-hd128.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_V1","tolerances":{"rel":2e-4,"abs":2e-5,"large_scores_rel":1e-3,"large_scores_abs":1e-4},"cases":[{"case":"gqa_f32_qwen3_4b_32q8kv_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":183777,"call_ns":122541934,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8192,"kv_bytes_naive":8192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00198312,"pass":true,"chip_elapsed_ns":103761,"call_ns":234962,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":139264,"kv_bytes_naive":139264,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00219175,"pass":true,"chip_elapsed_ns":311650,"call_ns":645171,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00376301,"pass":true,"chip_elapsed_ns":1325638,"call_ns":3271647,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":16777216,"kv_bytes_naive":16777216,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=OK,bad=4090) NO_RESCALE:CAUGHT(rc=OK,bad=3905) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086)"},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.0019369,"pass":true,"chip_elapsed_ns":204785,"call_ns":383394,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1040384,"kv_bytes_naive":1040384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00195072,"pass":true,"chip_elapsed_ns":205809,"call_ns":221393,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00222211,"pass":true,"chip_elapsed_ns":205473,"call_ns":220881,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1056768,"kv_bytes_naive":1056768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00262496,"pass":true,"chip_elapsed_ns":309314,"call_ns":354082,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2457600,"kv_bytes_naive":2457600,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00318626,"pass":true,"chip_elapsed_ns":715300,"call_ns":893029,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8192000,"kv_bytes_naive":8192000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":103873,"call_ns":238369,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096,"kv_bytes_naive":4096,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00213223,"pass":true,"chip_elapsed_ns":102657,"call_ns":106913,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":69632,"kv_bytes_naive":69632,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095)"},{"case":"gqa_f32_gqa8_32q4kv_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00193136,"pass":true,"chip_elapsed_ns":206673,"call_ns":326641,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00246504,"pass":true,"chip_elapsed_ns":1325158,"call_ns":1502375,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=OK,bad=4084) NO_RESCALE:CAUGHT(rc=OK,bad=3914) Q_ROW:CAUGHT(rc=OK,bad=4078) OUT_ROW:CAUGHT(rc=OK,bad=4078)"},{"case":"gqa_f32_gqa8_32q4kv_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00243573,"pass":true,"chip_elapsed_ns":206545,"call_ns":316865,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":520192,"kv_bytes_naive":520192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00180964,"pass":true,"chip_elapsed_ns":169025,"call_ns":177985,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00188256,"pass":true,"chip_elapsed_ns":204465,"call_ns":212993,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":528384,"kv_bytes_naive":528384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00199715,"pass":true,"chip_elapsed_ns":206865,"call_ns":225330,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1228800,"kv_bytes_naive":1228800,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00296202,"pass":true,"chip_elapsed_ns":612819,"call_ns":696195,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096000,"kv_bytes_naive":4096000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_large_scores_32q4kv_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.0734338,"pass":true,"chip_elapsed_ns":207633,"call_ns":223985,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"NO_MAX:CAUGHT(rc=OK,bad=4096)"},{"case":"gqa_f32_mha_16q16kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00270879,"pass":true,"chip_elapsed_ns":310034,"call_ns":528563,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4915200,"kv_bytes_naive":4915200,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":3,"mutants_caught":3,"mutant_note":"Q_ROW:CAUGHT(rc=OK,bad=2043) OUT_ROW:CAUGHT(rc=OK,bad=2048) KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":104592,"call_ns":196305,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00226843,"pass":true,"chip_elapsed_ns":103216,"call_ns":189041,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":131072,"kv_bytes_naive":131072,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4094)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00208125,"pass":true,"chip_elapsed_ns":207601,"call_ns":313185,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00452839,"pass":true,"chip_elapsed_ns":1119973,"call_ns":1302070,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4082) SLOT:CAUGHT(rc=OK,bad=4080) NO_RESCALE:CAUGHT(rc=OK,bad=3749) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00214904,"pass":true,"chip_elapsed_ns":206017,"call_ns":308321,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00186122,"pass":true,"chip_elapsed_ns":103633,"call_ns":113073,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00167553,"pass":true,"chip_elapsed_ns":205681,"call_ns":216401,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":589824,"kv_bytes_naive":589824,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00198758,"pass":true,"chip_elapsed_ns":207553,"call_ns":227633,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1245184,"kv_bytes_naive":1245184,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00529051,"pass":true,"chip_elapsed_ns":307154,"call_ns":319282,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":655360,"kv_bytes_naive":4128768,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":77313,"call_ns":186353,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00260372,"pass":true,"chip_elapsed_ns":103377,"call_ns":182545,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4096) SLOT:CAUGHT(rc=OK,bad=4094)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00241584,"pass":true,"chip_elapsed_ns":205761,"call_ns":301265,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00291129,"pass":true,"chip_elapsed_ns":1021429,"call_ns":1121893,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4086) SLOT:CAUGHT(rc=OK,bad=4081) NO_RESCALE:CAUGHT(rc=OK,bad=3543) Q_ROW:CAUGHT(rc=OK,bad=4082) OUT_ROW:CAUGHT(rc=OK,bad=4082)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00214133,"pass":true,"chip_elapsed_ns":104352,"call_ns":198529,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00222376,"pass":true,"chip_elapsed_ns":104192,"call_ns":110496,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00203403,"pass":true,"chip_elapsed_ns":103585,"call_ns":110241,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":294912,"kv_bytes_naive":294912,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00186326,"pass":true,"chip_elapsed_ns":257985,"call_ns":268593,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":622592,"kv_bytes_naive":622592,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00422018,"pass":true,"chip_elapsed_ns":204705,"call_ns":212433,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":327680,"kv_bytes_naive":2064384,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_batch_3seq_32q8kv_ctx40_0_100","n":12288,"rc":"OK","violations":0,"worst_scaled_err":0.00189546,"pass":true,"chip_elapsed_ns":208801,"call_ns":541987,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":458752,"kv_bytes_naive":458752,"kv_blocks_unique":7,"kv_blocks_logical":7,"mutants_run":4,"mutants_caught":4,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=8189) SLOT:CAUGHT(rc=OK,bad=8186) Q_ROW:CAUGHT(rc=OK,bad=8180) OUT_ROW:CAUGHT(rc=OK,bad=8180)"},{"case":"paged_bf16_shared_prefix_4seq_8q2kv_10pre","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.0020284,"pass":true,"chip_elapsed_ns":207601,"call_ns":302929,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":311296,"kv_bytes_naive":802816,"kv_blocks_unique":19,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4093) SLOT:CAUGHT(rc=OK,bad=4094)"},{"case":"paged_bf16_shared_prefix_4seq_32q8kv_10pre","n":16384,"rc":"OK","violations":0,"worst_scaled_err":0.00267069,"pass":true,"chip_elapsed_ns":411122,"call_ns":544786,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":1900544,"kv_bytes_naive":3211264,"kv_blocks_unique":29,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=16378) SLOT:CAUGHT(rc=OK,bad=16365)"}],"mutant_count":6,"mutants":{"NO_MAX":{"run":1,"caught":1},"KV_HEAD":{"run":11,"caught":11},"SLOT":{"run":9,"caught":9},"NO_RESCALE":{"run":4,"caught":4},"Q_ROW":{"run":6,"caught":6},"OUT_ROW":{"run":6,"caught":6}},"device_opens":1,"checks":122,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_PASS"} diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/run-hd128.log b/evidence/FB1-CUT5-HD128-7dd92dc/run-hd128.log new file mode 100644 index 000000000..9e7241e43 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/run-hd128.log @@ -0,0 +1,56 @@ +PASS gqa_f32_qwen3_4b_32q8kv_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=183777 call_ns=122541934 calls=1 unwritten=0 kv_staged=8192/8192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00198312 chip_ns=103761 call_ns=234962 calls=1 unwritten=0 kv_staged=139264/139264 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00219175 chip_ns=311650 call_ns=645171 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00376301 chip_ns=1325638 call_ns=3271647 calls=1 unwritten=0 kv_staged=16777216/16777216 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=4090) NO_RESCALE:CAUGHT(rc=OK,bad=3905) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086) +PASS gqa_f32_qwen3_4b_32q8kv_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.0019369 chip_ns=204785 call_ns=383394 calls=1 unwritten=0 kv_staged=1040384/1040384 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00195072 chip_ns=205809 call_ns=221393 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00222211 chip_ns=205473 call_ns=220881 calls=1 unwritten=0 kv_staged=1056768/1056768 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00262496 chip_ns=309314 call_ns=354082 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00318626 chip_ns=715300 call_ns=893029 calls=1 unwritten=0 kv_staged=8192000/8192000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=103873 call_ns=238369 calls=1 unwritten=0 kv_staged=4096/4096 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00213223 chip_ns=102657 call_ns=106913 calls=1 unwritten=0 kv_staged=69632/69632 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=4095) +PASS gqa_f32_gqa8_32q4kv_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00193136 chip_ns=206673 call_ns=326641 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00246504 chip_ns=1325158 call_ns=1502375 calls=1 unwritten=0 kv_staged=8388608/8388608 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=4084) NO_RESCALE:CAUGHT(rc=OK,bad=3914) Q_ROW:CAUGHT(rc=OK,bad=4078) OUT_ROW:CAUGHT(rc=OK,bad=4078) +PASS gqa_f32_gqa8_32q4kv_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.00243573 chip_ns=206545 call_ns=316865 calls=1 unwritten=0 kv_staged=520192/520192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00180964 chip_ns=169025 call_ns=177985 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00188256 chip_ns=204465 call_ns=212993 calls=1 unwritten=0 kv_staged=528384/528384 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00199715 chip_ns=206865 call_ns=225330 calls=1 unwritten=0 kv_staged=1228800/1228800 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00296202 chip_ns=612819 call_ns=696195 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.0734338 chip_ns=207633 call_ns=223985 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 1/1 NO_MAX:CAUGHT(rc=OK,bad=4096) +PASS gqa_f32_mha_16q16kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00270879 chip_ns=310034 call_ns=528563 calls=1 unwritten=0 kv_staged=4915200/4915200 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=2043) OUT_ROW:CAUGHT(rc=OK,bad=2048) KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=104592 call_ns=196305 calls=1 unwritten=0 kv_staged=65536/65536 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00226843 chip_ns=103216 call_ns=189041 calls=1 unwritten=0 kv_staged=131072/131072 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4094) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00208125 chip_ns=207601 call_ns=313185 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=16/16 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00452839 chip_ns=1119973 call_ns=1302070 calls=1 unwritten=0 kv_staged=8388608/8388608 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=4082) SLOT:CAUGHT(rc=OK,bad=4080) NO_RESCALE:CAUGHT(rc=OK,bad=3749) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.00214904 chip_ns=206017 call_ns=308321 calls=1 unwritten=0 kv_staged=524288/524288 blocks=8/8 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00186122 chip_ns=103633 call_ns=113073 calls=1 unwritten=0 kv_staged=524288/524288 blocks=8/8 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00167553 chip_ns=205681 call_ns=216401 calls=1 unwritten=0 kv_staged=589824/589824 blocks=9/9 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00198758 chip_ns=207553 call_ns=227633 calls=1 unwritten=0 kv_staged=1245184/1245184 blocks=19/19 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00529051 chip_ns=307154 call_ns=319282 calls=1 unwritten=0 kv_staged=655360/4128768 blocks=10/63 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=77313 call_ns=186353 calls=1 unwritten=0 kv_staged=32768/32768 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_gqa8_32q4kv_bs16_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00260372 chip_ns=103377 call_ns=182545 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=4096) SLOT:CAUGHT(rc=OK,bad=4094) +PASS paged_bf16_gqa8_32q4kv_bs16_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00241584 chip_ns=205761 call_ns=301265 calls=1 unwritten=0 kv_staged=524288/524288 blocks=16/16 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00291129 chip_ns=1021429 call_ns=1121893 calls=1 unwritten=0 kv_staged=4194304/4194304 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=4086) SLOT:CAUGHT(rc=OK,bad=4081) NO_RESCALE:CAUGHT(rc=OK,bad=3543) Q_ROW:CAUGHT(rc=OK,bad=4082) OUT_ROW:CAUGHT(rc=OK,bad=4082) +PASS paged_bf16_gqa8_32q4kv_bs16_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.00214133 chip_ns=104352 call_ns=198529 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00222376 chip_ns=104192 call_ns=110496 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00203403 chip_ns=103585 call_ns=110241 calls=1 unwritten=0 kv_staged=294912/294912 blocks=9/9 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00186326 chip_ns=257985 call_ns=268593 calls=1 unwritten=0 kv_staged=622592/622592 blocks=19/19 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00422018 chip_ns=204705 call_ns=212433 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=12288 rc=OK violations=0 worst_scaled_err=0.00189546 chip_ns=208801 call_ns=541987 calls=2 unwritten=0 kv_staged=458752/458752 blocks=7/7 | mutants 4/4 KV_HEAD:CAUGHT(rc=OK,bad=8189) SLOT:CAUGHT(rc=OK,bad=8186) Q_ROW:CAUGHT(rc=OK,bad=8180) OUT_ROW:CAUGHT(rc=OK,bad=8180) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=4096 rc=OK violations=0 worst_scaled_err=0.0020284 chip_ns=207601 call_ns=302929 calls=1 unwritten=0 kv_staged=311296/802816 blocks=19/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=4093) SLOT:CAUGHT(rc=OK,bad=4094) +PASS paged_bf16_shared_prefix_4seq_32q8kv_10pre n=16384 rc=OK violations=0 worst_scaled_err=0.00267069 chip_ns=411122 call_ns=544786 calls=2 unwritten=0 kv_staged=1900544/3211264 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=16378) SLOT:CAUGHT(rc=OK,bad=16365) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=1 + hd128 dominant token 5 (warp 0 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 40 (warp 1 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 70 (warp 2 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 100 (warp 3 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 127 (warp 3 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 131 (warp 0 of chunk 1): rc OK, 0 bad, worst 0 + hd128 dominant token 299 (warp 1 of chunk 2): rc OK, 0 bad, worst 0 +PASS: 126 checks, 0 failed diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/start.txt b/evidence/FB1-CUT5-HD128-7dd92dc/start.txt new file mode 100644 index 000000000..de84b6568 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/start.txt @@ -0,0 +1 @@ +2026-10-07T03:14:25Z diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/status.txt b/evidence/FB1-CUT5-HD128-7dd92dc/status.txt new file mode 100644 index 000000000..2939da908 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/status.txt @@ -0,0 +1,2 @@ +hd64 rc=0 +hd128 rc=0 diff --git a/evidence/FB1-CUT5-HD128-7dd92dc/window.sh b/evidence/FB1-CUT5-HD128-7dd92dc/window.sh new file mode 100755 index 000000000..1cd21d385 --- /dev/null +++ b/evidence/FB1-CUT5-HD128-7dd92dc/window.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# omega#323 final-head GB10 receipts (d6d82f), head 7dd92dc. hd64 regression runner, then hd128 battery. Never kill. +set -u +R=$HOME/workspace/hive/WATTN/receipts/final-7dd92dc; O=$HOME/workspace/hive/WATTN/omega +T0=$(date -u +%FT%TZ); echo "$T0" > $R/start.txt +{ echo "omega $(git -C $O rev-parse HEAD) dirty=$(git -C $O status --porcelain | wc -l)"; echo "physics $(git -C $O/../physics rev-parse HEAD)"; + nvidia-smi --query-gpu=driver_version --format=csv,noheader; uname -r; + journalctl -k --no-pager -o short-iso | grep -c 'Xid' | sed 's/^/xid_lines_before=/'; } > $R/ground.txt 2>&1 +(cd $O && PHYSICS_DIR=$O/../physics tools/run_gpu_attention_chip.sh $R > $R/hd64-runner.log 2>&1); echo "hd64 rc=$?" >> $R/status.txt +(cd $O && ./build/gpu_attention_test --hd 128 --out $R/receipt-hd128.json > $R/run-hd128.log 2>&1); echo "hd128 rc=$?" >> $R/status.txt +journalctl -k --no-pager -o short-iso --since "$(date -d "$T0" '+%F %T')" > $R/kernel-log.txt 2>&1 +date -u +%FT%TZ > $R/end.txt +cd $R && find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS diff --git a/src/.crumb b/src/.crumb index 506892a48..6fe9bf266 100644 --- a/src/.crumb +++ b/src/.crumb @@ -134,7 +134,7 @@ }, { "digest": "f10ed6fdd6a931cddda0159cdef1c98ddb3526c58595b3ca60631cc380410799", - "last_commit": "e09adff", + "last_commit": "917e8b9", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, @@ -170,14 +170,14 @@ } ], "children_root": "sha256:564cf410317a627d546c0c234bd632ba414ca943ecca4fd4c8eccc45d863bb48", - "compiled_at": "2026-10-07T02:42:06Z", + "compiled_at": "2026-10-07T03:13:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:b029d6586df469b9c198b733749582f7fe724c1a35b62af7583a08c1df67b392", + "digest": "sha256:5729b9d1050029412a0e1a360ba7dc7e85eea057191ba1919a1bda6ea1a06e97", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 412, - "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", - "source_tree": "sha256:3c0fefc1510f9a906df161fcd778a3464d053ba8a5c7b96814c1970f18de609c" + "generated_at_commit": "1c5339d25afc3e0a70e0aee20a3f41c486b37644", + "source_tree": "sha256:b8bd54bb1b5f84bbdaed37d38a932f7ce09857bda46549fca454ae8d5f787260" }, "owner_lane": "", "provenance": { diff --git a/src/omega_gpu_attention_api.c b/src/omega_gpu_attention_api.c index 96fae92af..f22f3e975 100644 --- a/src/omega_gpu_attention_api.c +++ b/src/omega_gpu_attention_api.c @@ -9,8 +9,8 @@ * argument rules (dropped tokens past the table, negative table entries, zero * context) on the host. * - * One CTA per (query head, sequence), 64 threads (= head_dim). The context is - * walked in chunks of 64 tokens: + * One CTA per (query head, sequence), head_dim threads (64 or 128; the text below says 64, the + * constants scale with KSpec.hd). The context is walked in chunks of head_dim tokens: * phase A thread t owns token base+t: block lookup, K dot q (f32 FFMA), s = dot * scale * (scale folds 1/sqrt(d) and log2 e), s and the token's byte offset go to shared; * reduce chunk max (SHFL.DOWN tree per warp, lane partials to shared, BAR.SYNC, 2 LDS), @@ -20,8 +20,9 @@ * Then out[d] = acc * RCP(l). The first chunk sees m = -inf, so alpha = EX2(-inf) = 0 and * the initial l and acc drop out (PTX ISA ex2.approx: ex2(-Inf) = +0). * - * Shared memory (1024 bytes, the QMD's declared size): [0,256) q, [256,512) s then p, - * [512,768) token byte offsets, [768,1024) warp partials for the reductions. + * Shared memory (16 * head_dim bytes; hd 64: 1024 bytes, the QMD default): [0,4hd) q, [4hd,8hd) s then p, + * [8hd,12hd) token byte offsets, [12hd,16hd) warp partials for the reductions (hd 64: 0, 256, 512, + * 768; hd 128: 0, 512, 1024, 1536; the partials of warp w are read at 12hd + 128w). */ #include "omega_gpu_attention_api.h" #include "omega_blackwell_codegen.h" @@ -212,22 +213,22 @@ static int check_loop_invariant(const Em *e) { #define ARG_WORDS 16u #define DESC_OFF 0x358u -#define HD OMEGA_GPU_ATTN_HEAD_DIM +/* Head dimension is a kernel parameter (64 or 128, see KSpec.hd). Shared memory is four arrays of hd words: + * q at SH_Q, s then p at hd*4, token byte offsets at hd*8, warp partials at hd*12 (hd 64: 0, 256, 512, 768, + * the layout of every cut before head_dim 128). */ #define SH_Q 0u -#define SH_S 256u -#define SH_O 512u -#define SH_R 768u #define F32_NEG_INF 0xff800000u /* divergent (omega #308 regression R2): 0 = production branch-free chunk loop; 1 = the * lane-dependent "j >= ctx" branch restored inside a reconvergence region (BSSY/BSYNC) so * the SHFL reductions run on a joined warp; 2 = the same with the BSYNC dropped (the * 2026-10-04 bug shape, a negative control the host simulator must catch). */ -typedef struct { bool f32; uint32_t log2bs, log2gqa; int mutant; int divergent; } KSpec; +typedef struct { bool f32; uint32_t log2bs, log2gqa; int mutant; int divergent; uint32_t hd; } KSpec; static void gen_attention(Em *e, const KSpec *k) { const uint32_t elem = k->f32 ? 4u : 2u; const uint32_t kstep = k->f32 ? 8u : 4u; /* bytes per inner iteration: two dims */ + const uint32_t HD = k->hd, SH_S = HD * 4u, SH_O = HD * 8u, SH_R = HD * 12u; /* warps per CTA: HD / 32 */ int udesc = UV64(e), A = V64(e), B = V64(e), C = V64(e), D = V64(e); int tid = V(e), h = V(e), seq = V(e); int p_maxb = V(e), scale = V(e), p_bstride = V(e), p_tstride = V(e), p_kvp = V(e), p_hstride = V(e), p_nqh = V(e), p_ctxoff = V(e); @@ -238,8 +239,13 @@ static void gen_attention(Em *e, const KSpec *k) { s2r(e, tid, BW_SR_TID_X); s2r(e, h, BW_SR_CTAID_X); s2r(e, seq, BW_SR_CTAID_Y); int c1 = V(e), c4 = V(e), c32 = V(e), c64 = V(e), c256 = V(e), c512 = V(e), c768 = V(e), c896 = V(e), zero = V(e); - movi(e, c1, 1); movi(e, c4, 4); movi(e, c32, 32); movi(e, c64, 64); + /* c32 / c64 keep their hd 64 names: the inner (dim pair) loop trip count HD / 2 and the chunk size HD */ + movi(e, c1, 1); movi(e, c4, 4); movi(e, c32, HD / 2); movi(e, c64, HD); movi(e, c256, SH_S); movi(e, c512, SH_O); movi(e, c768, SH_R); movi(e, c896, SH_R + 128); movrz(e, zero); + /* warp partials 2 and 3 (lane 0 of warps 2 and 3): only a 128-thread CTA has them. Created and emitted only + * when HD == 128, so the hd 64 program (vreg numbering, instruction sequence) is exactly the one before. */ + int c1024 = -1, c1152 = -1, rc_ = -1, rd_ = -1; + if (HD == 128) { c1024 = V(e); c1152 = V(e); rc_ = V(e); rd_ = V(e); movi(e, c1024, SH_R + 256); movi(e, c1152, SH_R + 384); } /* q[tid] -> shared; out address kept for the end. Row = seq * num_q_heads + head for * both q and out (flattened head-major, the oracle's layout). The head-wiring mutants @@ -380,6 +386,7 @@ static void gen_attention(Em *e, const KSpec *k) { bar_sync(e); lds32(e, ra, c768); lds32(e, rb, c896); e_fmax(e, mc, ra, rb); + if (HD == 128) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); e_fmax(e, mc, mc, rc_); e_fmax(e, mc, mc, rd_); } e_fmax(e, Mn, M, mc); if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) { movf(e, alpha, 1.0f); @@ -400,6 +407,7 @@ static void gen_attention(Em *e, const KSpec *k) { bar_sync(e); lds32(e, ra, c768); lds32(e, rb, c896); e_fadd(e, lc, ra, rb); + if (HD == 128) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); e_fadd(e, lc, lc, rc_); e_fadd(e, lc, lc, rd_); } e_ffma(e, L, L, alpha, lc); if (k->mutant != OMEGA_GPU_ATTN_MUTANT_NO_RESCALE) e_fmul(e, acc, acc, alpha); @@ -521,11 +529,11 @@ void omega_gpu_attention_test_set_mutant(OmegaGpuAttnMutant m) { /* Caller holds the lock. Builds the kernel if needed; uploads the device copy when * `upload` (the chip path; the simulator never needs one). */ -static int kernel_for(bool f32, uint32_t log2bs, uint32_t log2gqa, bool upload, Slot **out, bool *hit) { - KSpec k = { .f32 = f32, .log2bs = log2bs, .log2gqa = log2gqa, .mutant = g_mutant, .divergent = g_divergent }; +static int kernel_for(bool f32, uint32_t log2bs, uint32_t log2gqa, uint32_t hd, bool upload, Slot **out, bool *hit) { + KSpec k = { .f32 = f32, .log2bs = log2bs, .log2gqa = log2gqa, .mutant = g_mutant, .divergent = g_divergent, .hd = hd }; Slot *s = NULL; for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) - if (g_cache[i].used && g_cache[i].k.f32 == k.f32 && g_cache[i].k.log2bs == k.log2bs && g_cache[i].k.log2gqa == k.log2gqa && g_cache[i].k.mutant == k.mutant && g_cache[i].k.divergent == k.divergent) { /* field compare: memcmp would read struct padding */ + if (g_cache[i].used && g_cache[i].k.f32 == k.f32 && g_cache[i].k.log2bs == k.log2bs && g_cache[i].k.log2gqa == k.log2gqa && g_cache[i].k.mutant == k.mutant && g_cache[i].k.divergent == k.divergent && g_cache[i].k.hd == k.hd) { /* field compare: memcmp would read struct padding */ s = &g_cache[i]; *hit = true; break; } if (!s) { @@ -549,14 +557,19 @@ static int kernel_for(bool f32, uint32_t log2bs, uint32_t log2gqa, bool upload, return OMEGA_GPU_ATTN_OK; } -int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, OmegaBlackwellKernel *kernel) { +int omega_gpu_attention_codegen_hd(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, uint32_t head_dim, OmegaBlackwellKernel *kernel) { if (!kernel || log2_block_size > 16 || log2_gqa > 6) return OMEGA_GPU_ATTN_BAD_ARGS; + if (head_dim != 64u && head_dim != 128u) return OMEGA_GPU_ATTN_TOO_LARGE; LOCK(); - KSpec k = { .f32 = kv_f32, .log2bs = log2_block_size, .log2gqa = log2_gqa, .mutant = g_mutant, .divergent = g_divergent }; + KSpec k = { .f32 = kv_f32, .log2bs = log2_block_size, .log2gqa = log2_gqa, .mutant = g_mutant, .divergent = g_divergent, .hd = head_dim }; UNLOCK(); return build_kernel(&k, kernel, NULL); } +int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, OmegaBlackwellKernel *kernel) { + return omega_gpu_attention_codegen_hd(kv_f32, log2_block_size, log2_gqa, OMEGA_GPU_ATTN_HEAD_DIM, kernel); +} + const char *omega_gpu_attention_last_error(void) { return omega_gpu_session_last_error(); } /* ------------------------------------------------------------ launcher */ @@ -609,7 +622,7 @@ static int run_launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) { args[6] = (uint32_t)g_tab.mem.va; args[7] = (uint32_t)(g_tab.mem.va >> 32); memcpy(&args[8], L->params, sizeof L->params); OmegaGpuLaunch GL = { - .code_va = ks->code.va, .gpr_count = AT_GPR_BUDGET, .threads_x = HD, .threads_y = 1, + .code_va = ks->code.va, .gpr_count = AT_GPR_BUDGET, .threads_x = ks->k.hd, .threads_y = 1, .shared_bytes = 16u * ks->k.hd, /* 4 arrays of hd words: 1024 B for hd 64 (the QMD default), 2048 B for hd 128 */ .grid_x = L->grid_x, .grid_y = L->grid_y, .num_elements = out_words, .args = args, .n_args = ARG_WORDS, .timeout_ms = AT_WAIT_MS, }; @@ -624,7 +637,7 @@ static int run_launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) { info->elapsed_ns += elapsed; info->completion_marker = marker; info->unwritten_words += unwritten; - info->threads_per_cta = HD; + info->threads_per_cta = ks->k.hd; info->ctas_last_launch = L->grid_x * L->grid_y; } return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; @@ -655,22 +668,24 @@ static int log2_exact(uint32_t v, uint32_t *out) { uint32_t l = 0; while ((1u << l) != v) l++; *out = l; return 0; } -static float score_scale(void) { return (float)(1.4426950408889634 / sqrt((double)HD)); } +/* log2(e) / sqrt(head_dim) with the square roots as literals (8 and 11.313708498984761 = sqrt(128), both exactly what sqrt() returns): + * the library must not need libm (omegatool links without -lm; a constant head_dim folded sqrt away, a runtime one does not). */ +static float score_scale(uint32_t hd) { return (float)(1.4426950408889634 / (hd == 128u ? 11.313708498984761 : 8.0)); } /* Common head-shape checks; returns log2 of the gqa ratio. */ static int check_heads(uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, uint32_t *log2gqa) { if (num_q_heads == 0 || num_kv_heads == 0 || head_dim == 0) return OMEGA_GPU_ATTN_BAD_ARGS; - if (head_dim != HD || num_q_heads > OMEGA_GPU_ATTN_MAX_Q_HEADS) return OMEGA_GPU_ATTN_TOO_LARGE; + if ((head_dim != 64u && head_dim != 128u) || num_q_heads > OMEGA_GPU_ATTN_MAX_Q_HEADS) return OMEGA_GPU_ATTN_TOO_LARGE; if (num_q_heads % num_kv_heads != 0 || log2_exact(num_q_heads / num_kv_heads, log2gqa) != 0) return OMEGA_GPU_ATTN_BAD_ARGS; return OMEGA_GPU_ATTN_OK; } /* Common prologue of every chip entry (lock held on success): device, kernel, info. */ -static int begin(bool f32, uint32_t log2bs, uint32_t log2gqa, Slot **ks, OmegaGpuAttnInfo *info) { +static int begin(bool f32, uint32_t log2bs, uint32_t log2gqa, uint32_t hd, Slot **ks, OmegaGpuAttnInfo *info) { LOCK(); int rc = g_sim ? OMEGA_GPU_ATTN_OK : dev_open_locked(); bool hit = false; - if (rc == OMEGA_GPU_ATTN_OK) rc = kernel_for(f32, log2bs, log2gqa, !g_sim, ks, &hit); + if (rc == OMEGA_GPU_ATTN_OK) rc = kernel_for(f32, log2bs, log2gqa, hd, !g_sim, ks, &hit); if (rc != OMEGA_GPU_ATTN_OK) { UNLOCK(); return rc; } info_begin(info, &(*ks)->kernel, hit); return OMEGA_GPU_ATTN_OK; @@ -685,11 +700,12 @@ int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const floa int rc = check_heads(num_q_heads, num_kv_heads, head_dim, &log2gqa); if (rc != OMEGA_GPU_ATTN_OK) return rc; if (seq_len > OMEGA_GPU_ATTN_MAX_GQA_CTX) return OMEGA_GPU_ATTN_TOO_LARGE; + const uint32_t HD = head_dim; size_t n_out = (size_t)num_q_heads * HD; if (seq_len == 0) { memset(out, 0, n_out * 4); if (info) { memset(info, 0, sizeof *info); info->call_ns = now_ns() - t0; } return OMEGA_GPU_ATTN_OK; } Slot *ks = NULL; const uint32_t log2bs = 12; /* one block of 4096 slots */ - rc = begin(true, log2bs, log2gqa, &ks, info); + rc = begin(true, log2bs, log2gqa, HD, &ks, info); if (rc != OMEGA_GPU_ATTN_OK) return rc; size_t plane = (size_t)seq_len * num_kv_heads * HD * 4; void *host_tmp = NULL; @@ -702,7 +718,7 @@ int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const floa Launch L = { .q = q, .q_bytes = n_out * 4, .pool = pool, .pool_bytes = 2 * plane, .tab = tab, .tab_bytes = sizeof tab, .out = out, .out_bytes = n_out * 4, .grid_x = num_q_heads, .grid_y = 1, - .params = { 1, f2u(score_scale()), (uint32_t)(2 * plane), num_kv_heads * HD * 4, (uint32_t)plane, HD * 4, num_q_heads, 4 } + .params = { 1, f2u(score_scale(HD)), (uint32_t)(2 * plane), num_kv_heads * HD * 4, (uint32_t)plane, HD * 4, num_q_heads, 4 } }; rc = launch(ks, &L, info); free(host_tmp); @@ -721,6 +737,7 @@ static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayou uint32_t log2gqa, log2bs; int rc = check_heads(num_q_heads, num_kv_heads, head_dim, &log2gqa); if (rc != OMEGA_GPU_ATTN_OK) return rc; + const uint32_t HD = head_dim; if (!ly || layer_idx >= ly->num_layers || log2_exact(ly->block_size, &log2bs) != 0) return OMEGA_GPU_ATTN_BAD_ARGS; /* the oracle addresses heads as kv_head * head_dim * 2 inside a token: the layout must agree */ if (ly->head_stride_bytes != HD * 2 || ly->token_stride_bytes != (uint64_t)num_kv_heads * HD * 2 || @@ -740,7 +757,7 @@ static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayou } } Slot *ks = NULL; - rc = begin(false, log2bs, log2gqa, &ks, info); + rc = begin(false, log2bs, log2gqa, HD, &ks, info); if (rc != OMEGA_GPU_ATTN_OK) { free(eff); return rc; } uint32_t seqs_per_launch = OMEGA_GPU_ATTN_MAX_CTAS / num_q_heads; if (seqs_per_launch == 0) seqs_per_launch = 1; @@ -811,7 +828,7 @@ static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayou .q = q + (size_t)s0 * row, .q_bytes = (size_t)ns * row * 4, .pool = staged, .pool_bytes = (size_t)staged_bytes, .tab = tab, .tab_bytes = ((size_t)ns * maxb + ns) * 4, .out = out + (size_t)s0 * row, .out_bytes = (size_t)ns * row * 4, .grid_x = num_q_heads, .grid_y = ns, - .params = { maxb, f2u(score_scale()), (uint32_t)ly->layer_stride_bytes, (uint32_t)ly->token_stride_bytes, + .params = { maxb, f2u(score_scale(HD)), (uint32_t)ly->layer_stride_bytes, (uint32_t)ly->token_stride_bytes, (uint32_t)ly->kv_plane_stride_bytes, (uint32_t)ly->head_stride_bytes, num_q_heads, ns * maxb * 4 } }; rc = launch(ks, &L, info); diff --git a/src/omega_gpu_attention_api.h b/src/omega_gpu_attention_api.h index f4931c2a6..0e8af5a28 100644 --- a/src/omega_gpu_attention_api.h +++ b/src/omega_gpu_attention_api.h @@ -38,9 +38,12 @@ * * Launch envelope: at most OMEGA_GPU_ATTN_MAX_CTAS CTAs per launch (investigation * I42, same as cuts 1b and 4): grid = (num_q_heads, sequences per launch). - * Shared memory: the QMD declares 1024 bytes (clcec0qmd.h SHARED_MEMORY_SIZE_SHIFTED7, - * src/omega_blackwell_qmd.c word 36); the kernel uses exactly 4 x 256 bytes for - * head_dim 64, so head_dim is fixed at 64 in this cut (TinyLlama and Llama-3.2-1B). + * Shared memory: the QMD declares 16 * head_dim bytes (clcec0qmd.h SHARED_MEMORY_SIZE_SHIFTED7, + * src/omega_blackwell_qmd.c word 36); the kernel uses exactly 4 arrays of head_dim words: + * 1024 bytes for head_dim 64 (TinyLlama, Llama-3.2-1B; the QMD default) and 2048 bytes for + * head_dim 128 (Qwen3-4B, CPU phase: host simulators only, GB10 parity NOT_RUN). head_dim is a + * kernel parameter (64 or 128): threads per CTA = head_dim = chunk size, one warp partial per + * 32 threads in the softmax reductions. * * Staging: the host copies q, the referenced KV blocks' layer slice, the (compacted, * renumbered) block tables and the context lengths into GPU-uncached staging buffers @@ -67,13 +70,14 @@ extern "C" { enum { OMEGA_GPU_ATTN_OK = 0, OMEGA_GPU_ATTN_BAD_ARGS = -1, /* NULL pointer, zero dimension, head mapping or block id out of range */ - OMEGA_GPU_ATTN_TOO_LARGE = -2, /* head_dim != 64, num_q_heads > 64, context past the envelope */ + OMEGA_GPU_ATTN_TOO_LARGE = -2, /* head_dim not in {64, 128}, num_q_heads > 64, context past the envelope */ OMEGA_GPU_ATTN_CODEGEN_FAIL = -3, /* our codegen refused or exceeded the register budget */ OMEGA_GPU_ATTN_CHIP_FAIL = -4, /* device open, alloc, submit, marker or release failed */ OMEGA_GPU_ATTN_UNWRITTEN = -5 /* output words still equal to their poison after the run */ }; -#define OMEGA_GPU_ATTN_HEAD_DIM 64u /* threads per CTA = head_dim (one thread per dimension / per token of a chunk) */ +#define OMEGA_GPU_ATTN_HEAD_DIM 64u /* the original head_dim; threads per CTA = head_dim (one thread per dimension / per token of a chunk) */ +#define OMEGA_GPU_ATTN_HEAD_DIM_128 128u /* the second supported head_dim (Qwen3-4B) */ #define OMEGA_GPU_ATTN_MAX_CTAS 64u #define OMEGA_GPU_ATTN_MAX_Q_HEADS 64u #define OMEGA_GPU_ATTN_MAX_GQA_CTX 4096u /* contiguous path: one block of 2^12 slots */ @@ -171,6 +175,11 @@ const char *omega_gpu_attention_mutant_name(OmegaGpuAttnMutant m); int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, OmegaBlackwellKernel *kernel); +/* The same with an explicit head_dim (64 or 128; anything else is TOO_LARGE). The 4-argument + * omega_gpu_attention_codegen above is head_dim 64 and emits the same bytes as before head_dim 128 existed. */ +int omega_gpu_attention_codegen_hd(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, uint32_t head_dim, + OmegaBlackwellKernel *kernel); + /* One launch as the launcher sees it (test hook below). Pointers are host buffers; * params are the eight argument words after the four buffer addresses: * max_blocks, scale bits, block stride, token stride, kv plane stride, head stride, diff --git a/tests/.crumb b/tests/.crumb index 94c254676..e9b0adc88 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -284,14 +284,14 @@ } ], "children_root": "sha256:c630c07cfd744174cf35b42b04d96bbb15dfedb76557947943c412d3219586c5", - "compiled_at": "2026-10-07T02:42:06Z", + "compiled_at": "2026-10-07T03:13:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:bcc2c5b959587ff0b115cd4664886cbca17cf7fc0f36a601f1b5c7edb9f05b7d", + "digest": "sha256:8c43418cb6e8c35217c6b43b3db332d5f4b061bdf3f62c44d735d251aa5b0793", "evidence_files": 11, "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2", "files": 818, - "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", - "source_tree": "sha256:8dac66cd864267c9213b963add2bd94859d0acef2d846982c54c77fc83b309d3" + "generated_at_commit": "1c5339d25afc3e0a70e0aee20a3f41c486b37644", + "source_tree": "sha256:b536f1c05324b9abc23c7239ede46b9aa1941690e4e3a95f693168140f8f68ce" }, "owner_lane": "", "provenance": { diff --git a/tests/gpu_attention_test.c b/tests/gpu_attention_test.c index 1f0019a50..80ff4b01f 100644 --- a/tests/gpu_attention_test.c +++ b/tests/gpu_attention_test.c @@ -42,6 +42,7 @@ static int g_checks, g_failed; static int g_sim_mode; /* --sim: the host simulator never opens the device */ static int g_divergent; /* --divergent (omega #308 R2): the j >= ctx branch inside a BSSY/BSYNC region */ +static uint32_t g_hd = 64; /* --hd 128: the whole battery at head_dim 128 (Qwen3-4B shapes); both simulators size the CTA from it */ #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; } @@ -131,7 +132,7 @@ static int nvdisasm_check(bool f32, const char *name, const char *const *must, i const char *nv = "/usr/local/cuda/bin/nvdisasm"; if (access(nv, X_OK) != 0) { printf("nvdisasm: not present, listing check skipped for %s\n", name); return 0; } OmegaBlackwellKernel k; memset(&k, 0, sizeof k); - if (omega_gpu_attention_codegen(f32, f32 ? 12 : 4, 3, &k) != OMEGA_GPU_ATTN_OK) return -1; + if (omega_gpu_attention_codegen_hd(f32, f32 ? 12 : 4, 3, g_hd, &k) != OMEGA_GPU_ATTN_OK) return -1; char bin[64], lst[64], cmd[256]; snprintf(bin, sizeof bin, "/tmp/omega_attn_%s_%d.bin", name, (int)getpid()); snprintf(lst, sizeof lst, "/tmp/omega_attn_%s_%d.sass", name, (int)getpid()); @@ -168,7 +169,8 @@ static OmegaGpuKvLayout layout_for(uint32_t num_blocks, uint32_t bs, uint32_t la static void host_only(void) { float q[64 * 64], kv[64 * 64], out[64 * 64]; memset(q, 0, sizeof q); memset(kv, 0, sizeof kv); CHECK(omega_gpu_gqa_attention_f32(NULL, kv, kv, 1, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "NULL q refused"); - CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 4, 128, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "head_dim 128 refused (TOO_LARGE)"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 4, 96, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "head_dim 96 refused (TOO_LARGE)"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 4, 256, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "head_dim 256 refused (TOO_LARGE)"); CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 6, 2, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "gqa ratio 3 refused"); CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 5, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "32 q heads / 5 kv heads refused"); CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, OMEGA_GPU_ATTN_MAX_GQA_CTX + 1, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "context past the envelope refused"); @@ -193,7 +195,7 @@ static void host_only(void) { for (int f32 = 0; f32 < 2; f32++) { const char *name = f32 ? "gqa_f32" : "paged_bf16"; OmegaBlackwellKernel k; memset(&k, 0, sizeof k); - int rc = omega_gpu_attention_codegen(f32 != 0, f32 ? 12 : 4, 3, &k); + int rc = omega_gpu_attention_codegen_hd(f32 != 0, f32 ? 12 : 4, 3, g_hd, &k); CHECK(rc == OMEGA_GPU_ATTN_OK && k.code_size > 0 && k.gpr_count <= 64, "%s kernel generated (rc %s, %zu insns, %u gprs)", name, omega_gpu_attention_rc_name(rc), k.insn_count, k.gpr_count); printf("codegen %s: %zu insns, %u gprs, %u ugprs\n", name, k.insn_count, k.gpr_count, k.uniform_gpr_count); /* every mutant (1 .. COUNT-1) is a distinct kernel: different from the baseline and from @@ -203,7 +205,7 @@ static void host_only(void) { for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) { omega_gpu_attention_test_set_mutant((OmegaGpuAttnMutant)m); memset(&k, 0, sizeof k); - int mrc = omega_gpu_attention_codegen(f32 != 0, f32 ? 12 : 4, 3, &k); + int mrc = omega_gpu_attention_codegen_hd(f32 != 0, f32 ? 12 : 4, 3, g_hd, &k); CHECK(mrc == OMEGA_GPU_ATTN_OK && k.gpr_count <= 64, "%s mutant %s generated (rc %s, %u gprs)", name, omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), omega_gpu_attention_rc_name(mrc), k.gpr_count); CHECK(strcmp(omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), "?") != 0, "mutant %d has a name", m); memcpy(digests[m], k.code_digest, 32); @@ -215,7 +217,7 @@ static void host_only(void) { CHECK(strcmp(omega_gpu_attention_mutant_name(OMEGA_GPU_ATTN_MUTANT_COUNT), "?") == 0, "COUNT has no name"); /* a different shape key is a different kernel */ memset(&k, 0, sizeof k); - CHECK(omega_gpu_attention_codegen(f32 != 0, f32 ? 12 : 4, 2, &k) == OMEGA_GPU_ATTN_OK && memcmp(digests[0], k.code_digest, 32) != 0, "%s log2gqa 2 kernel differs from log2gqa 3", name); + CHECK(omega_gpu_attention_codegen_hd(f32 != 0, f32 ? 12 : 4, 2, g_hd, &k) == OMEGA_GPU_ATTN_OK && memcmp(digests[0], k.code_digest, 32) != 0, "%s log2gqa 2 kernel differs from log2gqa 3", name); free(k.code); CHECK(nvdisasm_check(f32 != 0, name, f32 ? must_f32 : must_bf16, (f32 ? 11 : 14) + (g_divergent ? 2 : 0)) == 0, "%s nvdisasm listing decodes and shows the expected instructions", name); } @@ -265,11 +267,11 @@ static void run_mutants(Case *c, const int *ms, RunFn run, void *ctx, float *got } typedef struct { const float *q, *kc, *vc; uint32_t seq, nqh, nkv; } GqaCtx; -static int run_gqa(void *p, float *got, OmegaGpuAttnInfo *info) { GqaCtx *c = p; return omega_gpu_gqa_attention_f32(c->q, c->kc, c->vc, c->seq, c->nqh, c->nkv, 64, got, info); } +static int run_gqa(void *p, float *got, OmegaGpuAttnInfo *info) { GqaCtx *c = p; return omega_gpu_gqa_attention_f32(c->q, c->kc, c->vc, c->seq, c->nqh, c->nkv, g_hd, got, info); } typedef struct { const float *q; const uint8_t *pool; const OmegaGpuKvLayout *ly; const uint32_t *ids; uint32_t nids, ctx, layer, nqh, nkv; } PagedCtx; -static int run_paged(void *p, float *got, OmegaGpuAttnInfo *info) { PagedCtx *c = p; return omega_gpu_paged_attention_bf16(c->q, c->pool, c->ly, c->ids, c->nids, c->ctx, c->layer, c->nqh, c->nkv, 64, got, info); } +static int run_paged(void *p, float *got, OmegaGpuAttnInfo *info) { PagedCtx *c = p; return omega_gpu_paged_attention_bf16(c->q, c->pool, c->ly, c->ids, c->nids, c->ctx, c->layer, c->nqh, c->nkv, g_hd, got, info); } typedef struct { const float *q; const uint8_t *pool; const OmegaGpuKvLayout *ly; const int32_t *tables, *ctxs; uint32_t maxb, nseq, layer, nqh, nkv; } BatchCtx; -static int run_batch(void *p, float *got, OmegaGpuAttnInfo *info) { BatchCtx *c = p; return omega_gpu_paged_attention_batch_bf16(c->q, c->pool, c->ly, c->tables, c->ctxs, c->maxb, c->nseq, c->layer, c->nqh, c->nkv, 64, got, info); } +static int run_batch(void *p, float *got, OmegaGpuAttnInfo *info) { BatchCtx *c = p; return omega_gpu_paged_attention_batch_bf16(c->q, c->pool, c->ly, c->tables, c->ctxs, c->maxb, c->nseq, c->layer, c->nqh, c->nkv, g_hd, got, info); } /* single vs batched parity and repeat (L6-KV, CAND-0 coverage): each sequence of a batch, run * alone through the single-sequence entry point with the batch's own rules applied by hand * (negative table entries removed, ctx <= 0 -> 0), must equal its row of the batched output bit @@ -277,7 +279,7 @@ static int run_batch(void *p, float *got, OmegaGpuAttnInfo *info) { BatchCtx *c * called again with the same inputs: kernel cache hit, bit-identical output, identical staging * counters. `got` must hold the batched output of `bc`. */ static void batch_single_repeat_checks(const char *name, const BatchCtx *bc, const float *got, const Case *c) { - size_t row = (size_t)bc->nqh * 64, n = (size_t)bc->nseq * row; + size_t row = (size_t)bc->nqh * g_hd, n = (size_t)bc->nseq * row; float *one = malloc(row * 4), *again = malloc(n * 4); uint32_t *ids = malloc((bc->maxb ? bc->maxb : 1) * 4); for (uint32_t s = 0; s < bc->nseq; s++) { @@ -286,12 +288,12 @@ static void batch_single_repeat_checks(const char *name, const BatchCtx *bc, con uint32_t ctx = bc->ctxs[s] > 0 ? (uint32_t)bc->ctxs[s] : 0; for (size_t i = 0; i < row; i++) one[i] = -7.0f; /* poison: an unwritten row cannot match */ OmegaGpuAttnInfo si; - int src = omega_gpu_paged_attention_bf16(bc->q + (size_t)s * row, bc->pool, bc->ly, ids, nb, ctx, bc->layer, bc->nqh, bc->nkv, 64, one, &si); + int src = omega_gpu_paged_attention_bf16(bc->q + (size_t)s * row, bc->pool, bc->ly, ids, nb, ctx, bc->layer, bc->nqh, bc->nkv, g_hd, one, &si); CHECK(src == OMEGA_GPU_ATTN_OK && memcmp(one, got + (size_t)s * row, row * 4) == 0, "%s: sequence %u alone (single entry point, %u blocks, ctx %u) is bit-identical to its batched row (rc=%s)", name, s, nb, ctx, omega_gpu_attention_rc_name(src)); } OmegaGpuAttnInfo ri; - int rrc = omega_gpu_paged_attention_batch_bf16(bc->q, bc->pool, bc->ly, bc->tables, bc->ctxs, bc->maxb, bc->nseq, bc->layer, bc->nqh, bc->nkv, 64, again, &ri); + int rrc = omega_gpu_paged_attention_batch_bf16(bc->q, bc->pool, bc->ly, bc->tables, bc->ctxs, bc->maxb, bc->nseq, bc->layer, bc->nqh, bc->nkv, g_hd, again, &ri); CHECK(rrc == OMEGA_GPU_ATTN_OK && ri.kernel_cache_hit && memcmp(again, got, n * 4) == 0 && ri.kv_bytes_staged == c->kv_staged && ri.kv_bytes_naive == c->kv_naive && ri.kv_blocks_unique == c->blk_unique && ri.kv_blocks_logical == c->blk_logical, "%s: repeated batch call is a cache hit, bit-identical, same staging counters (rc=%s hit=%d staged %" PRIu64 "/%" PRIu64 ")", @@ -305,11 +307,17 @@ static int chip(const char *out_path) { if (out_path && !out) { printf("cannot open %s\n", out_path); return 2; } if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_V1\",\"tolerances\":{\"rel\":2e-4,\"abs\":2e-5,\"large_scores_rel\":1e-3,\"large_scores_abs\":1e-4},\"cases\":["); uint32_t seed = 0xfb1c0005u; - const uint32_t hd = 64; - const struct { uint32_t nqh, nkv; const char *model; } shapes[2] = { { 32, 4, "tinyllama" }, { 32, 8, "llama32_1b" } }; + const uint32_t hd = g_hd; + typedef struct { uint32_t nqh, nkv; const char *model; } Shape; + const Shape shapes64[2] = { { 32, 4, "tinyllama" }, { 32, 8, "llama32_1b" } }; + /* head_dim 128: Qwen3-4B (32 q heads, 8 kv heads, GQA 4:1) and a ratio-8 shape */ + const Shape shapes128[2] = { { 32, 8, "qwen3_4b" }, { 32, 4, "gqa8" } }; + const Shape *shapes = hd == 128 ? shapes128 : shapes64; /* 65, 129, 300 and 1000 end in a partial 64-token chunk after whole ones: the case that * caught the diverged-warp shuffle on the chip (2026-10-04); 1, 17, 128, 256, 2048 did not. */ - const uint32_t ctxs[9] = { 1, 17, 256, 2048, 65, 128, 129, 300, 1000 }; + /* head_dim 128 chunks are 128 tokens: 127, 128, 129 straddle a chunk, 300 and 1000 end in a partial one */ + const uint32_t ctxs64[9] = { 1, 17, 256, 2048, 65, 128, 129, 300, 1000 }, ctxs128[9] = { 1, 17, 256, 2048, 127, 128, 129, 300, 1000 }; + const uint32_t *ctxs = hd == 128 ? ctxs128 : ctxs64; const int no_mutants[1] = { 0 }; /* 1. contiguous f32 KV (gqa_attention) */ @@ -532,8 +540,11 @@ static int chip(const char *out_path) { * SHFL therefore requires one path across the warp, or the simulator stops with error 7. */ typedef struct { uint32_t r[256]; int pc; int p0; int done; uint64_t path; } SimThr; static uint32_t sim_cbank[256]; -static uint8_t sim_shared[1024]; -#define SIM_T 64 +static uint8_t sim_shared[4096]; +#define SIM_TMAX 128 +#define SIM_T ((int)g_hd) /* threads per CTA = head_dim */ +static uint32_t g_smem_cap; /* negative control: pretend the QMD declared this many bytes (0 = the real 16 * head_dim) */ +#define SIM_SMEM (g_smem_cap ? g_smem_cap : 16u * g_hd) /* the shared memory the QMD declares for this kernel (launcher: shared_bytes = 16 * head_dim) */ static int g_sim_err; static int g_trace, g_trace_launch; static uint32_t g_trace_cx; static uint32_t rd(const SimThr *t, int v, const BlackwellIRProgram *p) { if (v < 0) return 0; int ph = p->regalloc.vreg_to_phys[v]; return ph < 0 ? 0 : t->r[ph & 0xff]; } @@ -573,8 +584,8 @@ static int sim_step(SimThr *t, const BlackwellIRProgram *p, uint32_t tid, uint32 case BW_IR_LDG_E: { uint32_t x; memcpy(&x, (const void *)(uintptr_t)rd64(t, in->src1_vreg, p), 4); wr(t, in->dst_vreg, x, p); break; } case BW_IR_LDG_E_U16: { uint16_t x; memcpy(&x, (const void *)(uintptr_t)rd64(t, in->src1_vreg, p), 2); wr(t, in->dst_vreg, x, p); break; } case BW_IR_STG_E: memcpy((void *)(uintptr_t)rd64(t, in->src1_vreg, p), &b, 4); break; - case BW_IR_LDS32: { uint32_t x; if (a + 4 > sizeof sim_shared) { g_sim_err = 3; t->done = 1; return 0; } memcpy(&x, sim_shared + a, 4); wr(t, in->dst_vreg, x, p); break; } - case BW_IR_STS32: if (a + 4 > sizeof sim_shared) { g_sim_err = 3; t->done = 1; return 0; } memcpy(sim_shared + a, &b, 4); break; + case BW_IR_LDS32: { uint32_t x; if (a + 4 > SIM_SMEM) { g_sim_err = 3; t->done = 1; return 0; } memcpy(&x, sim_shared + a, 4); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_STS32: if (a + 4 > SIM_SMEM) { g_sim_err = 3; t->done = 1; return 0; } memcpy(sim_shared + a, &b, 4); break; case BW_IR_FADD: wr(t, in->dst_vreg, f2u_(u2f(a) + u2f(b)), p); break; case BW_IR_FSUB: wr(t, in->dst_vreg, f2u_(u2f(a) - u2f(b)), p); break; case BW_IR_FMUL: wr(t, in->dst_vreg, f2u_(u2f(a) * u2f(b)), p); break; @@ -600,7 +611,7 @@ static int sim_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAt memcpy(&sim_cbank[0x3a0 / 4], L->params, sizeof L->params); uint32_t *outw = L->out; for (size_t i = 0; i < L->out_bytes / 4; i++) outw[i] = 0xffbadbadu; g_sim_err = 0; - static SimThr th[SIM_T]; + static SimThr th[SIM_TMAX]; g_trace_launch++; if (getenv("ATTN_SIM_TRACE")) { g_trace = 1; g_trace_cx = (uint32_t)atoi(getenv("ATTN_SIM_TRACE")); } for (uint32_t cy = 0; cy < L->grid_y && !g_sim_err; cy++) for (uint32_t cx = 0; cx < L->grid_x && !g_sim_err; cx++) { memset(th, 0, sizeof th); memset(sim_shared, 0, sizeof sim_shared); @@ -618,7 +629,7 @@ static int sim_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAt if (in->op == BW_IR_SHFL_DOWN) { for (int i = 0; i < SIM_T; i++) if (!th[i].done && !th[i & ~31].done && th[i].path != th[i & ~31].path) g_sim_err = 7; if (g_sim_err) break; - uint32_t src[SIM_T]; + uint32_t src[SIM_TMAX]; for (int i = 0; i < SIM_T; i++) src[i] = rd(&th[i], in->src1_vreg, p); for (int i = 0; i < SIM_T; i++) { int lane = i & 31, from = lane + (int)(in->imm & 31); wr(&th[i], in->dst_vreg, from < 32 ? src[(i & ~31) + from] : src[i], p); } } @@ -789,7 +800,7 @@ static int ws_attn_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaG int err = 0; char msg[240] = ""; for (int order = 0; order < 2 && !err && copy; order++) { WsSim s; memset(&s, 0, sizeof s); - s.p = p; s.threads = SIM_T; s.smem = sim_shared; s.smem_bytes = sizeof sim_shared; s.order = order; + s.p = p; s.threads = SIM_T; s.smem = sim_shared; s.smem_bytes = SIM_SMEM; s.order = order; uint64_t qa = (uintptr_t)L->q, pa = (uintptr_t)L->pool, oa = (uintptr_t)L->out, ta = (uintptr_t)L->tab; s.cbank[0x380 / 4] = (uint32_t)qa; s.cbank[0x380 / 4 + 1] = (uint32_t)(qa >> 32); s.cbank[0x388 / 4] = (uint32_t)pa; s.cbank[0x388 / 4 + 1] = (uint32_t)(pa >> 32); @@ -813,10 +824,11 @@ static int ws_attn_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaG /* Negative control for --divergent --sim: mode 2 builds the same kernel with the BSYNC dropped; * the warp simulator must reject it (the whole point of the simulator: the old one could not). */ static void divergent_negative_control(void) { - enum { SEQ = 65, NQH = 8, NKV = 2, HD = 64 }; + enum { SEQ = 65, NQH = 8, NKV = 2 }; + const uint32_t HD = g_hd; float *q = malloc(NQH * HD * 4), *kv = malloc((size_t)SEQ * NKV * HD * 4), *out = malloc(NQH * HD * 4); uint32_t seed = 0x308u; - for (int i = 0; i < NQH * HD; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (uint32_t i = 0; i < NQH * HD; i++) q[i] = frand(&seed, -1.0f, 1.0f); for (size_t i = 0; i < (size_t)SEQ * NKV * HD; i++) kv[i] = frand(&seed, -1.0f, 1.0f); omega_gpu_attention_test_set_divergent(2); int rc = omega_gpu_gqa_attention_f32(q, kv, kv, SEQ, NQH, NKV, HD, out, NULL); @@ -827,6 +839,114 @@ static void divergent_negative_control(void) { free(q); free(kv); free(out); } +/* ------------------------------------------------------------ head_dim 128 (CPU phase) + * Checks that need the public API only, so the same code runs on the host simulators now and on + * the chip in the coordinated window. Run with --hd 128 (--sim for the host simulators). + * They target what head_dim 128 changed: four warps per CTA, so the chunk max and the chunk sum + * each combine FOUR warp partials (lane 0 of warps 0..3), and 128-token chunks. + * (a) uniform scores (K = 0): every weight is 1, the output is the mean of V over the context; + * a sum that drops the partial of warp 2 or 3 gives about twice the mean; + * (b) one dominant token with a score above the f32 exponent range (EX2 overflows without the + * right running max): the token sits in each of the four warps of chunk 0 and in the later, + * partial chunks; a max that ignores warp 2 or 3 overflows to inf / NaN. + * Negative controls: the comparison rejects the answer of a different token, and a shared-memory + * declaration of 1024 bytes (the head_dim 64 size) is refused by the simulators. */ +static void hd128_checks(void) { + const uint32_t hd = 128, nqh = 8, nkv = 2, seq = 300; + uint32_t seed = 0x128u; + size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = 1.0f; + for (size_t i = 0; i < nkvs; i++) vc[i] = frand(&seed, -1.0f, 1.0f); + OmegaGpuAttnInfo info; + /* (a) uniform */ + memset(kc, 0, nkvs * 4); + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + int rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + double w; size_t bad = compare(got, want, n, 2e-4, 2e-5, &w); + CHECK(rc == OMEGA_GPU_ATTN_OK && bad == 0 && info.threads_per_cta == 128, "hd128 uniform scores: mean of V over 300 tokens (rc %s, %zu bad, worst %g, %u threads)", omega_gpu_attention_rc_name(rc), bad, w, info.threads_per_cta); + float *half = malloc(n * 4); for (size_t i = 0; i < n; i++) half[i] = want[i] * 0.5f; + size_t neg = compare(got, half, n, 2e-4, 2e-5, &w); + CHECK(neg > n / 2, "hd128 uniform negative control: a result with the sum of two warps dropped (half the mean) is flagged (%zu of %zu)", neg, n); + free(half); + /* (b) one dominant token */ + static const uint32_t pos[] = { 5, 40, 70, 100, 127, 128 + 3, 256 + 43 }; + int all_ok = 1; size_t worst_bad = 0; + for (size_t pi = 0; pi < sizeof pos / sizeof pos[0]; pi++) { + memset(kc, 0, nkvs * 4); + for (uint32_t kvh = 0; kvh < nkv; kvh++) for (uint32_t d = 0; d < hd; d++) kc[((size_t)pos[pi] * nkv + kvh) * hd + d] = 12.0f; /* dot 1536, scaled by log2e / sqrt(128): about 2^196 */ + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + bad = compare(got, want, n, 2e-4, 2e-5, &w); + if (rc != OMEGA_GPU_ATTN_OK || bad) { all_ok = 0; if (bad > worst_bad) worst_bad = bad; } + printf(" hd128 dominant token %u (warp %u of chunk %u): rc %s, %zu bad, worst %g\n", pos[pi], (pos[pi] % 128) / 32, pos[pi] / 128, omega_gpu_attention_rc_name(rc), bad, w); + if (pi == 0) { + /* negative control: the answer of token 6 instead of token 5 must be flagged */ + float *other = malloc(n * 4); + for (uint32_t h = 0; h < nqh; h++) for (uint32_t d = 0; d < hd; d++) other[h * hd + d] = vc[((size_t)6 * nkv + h / (nqh / nkv)) * hd + d]; + size_t negb = compare(got, other, n, 2e-4, 2e-5, &w); + CHECK(negb > n / 2, "hd128 dominant-token negative control: the neighbouring token's V is flagged (%zu of %zu)", negb, n); + free(other); + } + } + CHECK(all_ok, "hd128 dominant token in every warp and chunk: exact max/sum over four warp partials (worst bad %zu)", worst_bad); + /* a kernel that needs 2048 bytes of shared memory must not run in a 1024-byte declaration (simulators only: they bound shared accesses) */ + if (g_sim_mode) { + g_smem_cap = 1024; + rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, NULL); + g_smem_cap = 0; + CHECK(rc == OMEGA_GPU_ATTN_CHIP_FAIL, "hd128 kernel refused under a 1024-byte shared-memory declaration (rc %s)", omega_gpu_attention_rc_name(rc)); + rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, NULL); + CHECK(rc == OMEGA_GPU_ATTN_OK, "hd128 kernel runs under the 2048-byte declaration (rc %s)", omega_gpu_attention_rc_name(rc)); + } + free(q); free(kc); free(vc); free(got); free(want); +} + +/* 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 origin/main c0369e6 (before head_dim + * 128 existed); 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, 160, "6e2b1ea2ca58327391287177e606a5317422e06301e5a8c75d2ce45eed20ff2b" }, + { false, 4, 2, 160, "230443d951335a363614bac31c5ce6be9f42ab6192e450851c7238efcc383868" }, + { false, 4, 0, 160, "a0629e402901f5ae4ee07f893f032793774c444f0646db8f40f0d8f943bf4c97" }, + { true, 12, 3, 160, "c3dc2fbbdfafc9ad0aee4213590bc75b21f122ade285d0f9ce3cbf9a76a23a30" }, + { true, 12, 2, 160, "90fb6c755be466a9b37fd3b817a6ae43016e15b0c35c45bb37da40aa73ca5ba4" }, + { true, 12, 0, 160, "a5443e2b274b2b9c620f54f9aa05aefef9e05956450144e0e31046d32a5b62a9" }, +}; +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) { + char hex[65]; + for (size_t i = 0; i < sizeof k_pins64 / sizeof k_pins64[0]; i++) { + const Pin *p = &k_pins64[i]; + OmegaBlackwellKernel k; memset(&k, 0, sizeof k); + int rc = omega_gpu_attention_codegen_hd(p->f32, p->log2bs, p->log2gqa, 64, &k); + hex_digest(k.code_digest, hex); + CHECK(rc == OMEGA_GPU_ATTN_OK && k.insn_count == p->insns && strcmp(hex, p->sha256) == 0, "hd64 %s log2bs %u log2gqa %u: encoded kernel is byte-identical to main c0369e6 (%zu insns, sha256 %.12s)", p->f32 ? "f32 " : "bf16", p->log2bs, p->log2gqa, k.insn_count, hex); + free(k.code); + /* the 4-argument entry point is the same kernel */ + OmegaBlackwellKernel k4; memset(&k4, 0, sizeof k4); + CHECK(omega_gpu_attention_codegen(p->f32, p->log2bs, p->log2gqa, &k4) == OMEGA_GPU_ATTN_OK && memcmp(k4.code_digest, k.code_digest, 32) == 0, "hd64 4-argument codegen entry is the same kernel"); + free(k4.code); + /* head_dim 128: encodes, inside the register budget, a different (longer) program */ + OmegaBlackwellKernel k2; memset(&k2, 0, sizeof k2); + int rc2 = omega_gpu_attention_codegen_hd(p->f32, p->log2bs, p->log2gqa, 128, &k2); + CHECK(rc2 == OMEGA_GPU_ATTN_OK && k2.code_size > 0 && k2.gpr_count <= 64 && k2.insn_count > p->insns && memcmp(k2.code_digest, k.code_digest, 32) != 0, + "hd128 %s log2bs %u log2gqa %u: kernel encodes (%zu insns vs %zu, %u gprs)", p->f32 ? "f32 " : "bf16", p->log2bs, p->log2gqa, k2.insn_count, p->insns, k2.gpr_count); + free(k2.code); + } + OmegaBlackwellKernel kx; memset(&kx, 0, sizeof kx); + CHECK(omega_gpu_attention_codegen_hd(false, 4, 3, 96, &kx) == OMEGA_GPU_ATTN_TOO_LARGE, "codegen refuses head_dim 96"); + CHECK(omega_gpu_attention_codegen_hd(false, 4, 3, 256, &kx) == OMEGA_GPU_ATTN_TOO_LARGE, "codegen refuses head_dim 256"); + /* negative control for the pin itself: a one-bit change to a pinned digest must not match */ + OmegaBlackwellKernel kn; memset(&kn, 0, sizeof kn); + (void)omega_gpu_attention_codegen_hd(k_pins64[0].f32, k_pins64[0].log2bs, k_pins64[0].log2gqa, 64, &kn); + kn.code_digest[0] ^= 1u; hex_digest(kn.code_digest, hex); + CHECK(strcmp(hex, k_pins64[0].sha256) != 0, "pin negative control: a flipped digest bit does not match the pin"); + free(kn.code); +} + + int main(int argc, char **argv) { const char *out_path = NULL; int host = 0, sim = 0, timing_mode = 0, sweep_mode = 0; for (int i = 1; i < argc; i++) { @@ -835,15 +955,18 @@ int main(int argc, char **argv) { else if (strcmp(argv[i], "--divergent") == 0) g_divergent = 1; else if (strcmp(argv[i], "--timing") == 0) timing_mode = 1; else if (strcmp(argv[i], "--sweep") == 0) sweep_mode = 1; + else if (strcmp(argv[i], "--hd") == 0 && i + 1 < argc) g_hd = (uint32_t)atoi(argv[++i]); else if (strcmp(argv[i], "--out") == 0 && i + 1 < argc) out_path = argv[++i]; } + if (g_hd != 64 && g_hd != 128) { printf("--hd must be 64 or 128\n"); return 2; } + if (g_hd == 128 && (timing_mode || sweep_mode)) { printf("--hd 128 supports the battery and --host-only (timing and sweep are head_dim 64 only)\n"); return 2; } if (g_divergent) omega_gpu_attention_test_set_divergent(1); if (sim) { g_sim_mode = 1; omega_gpu_attention_test_set_simulator(g_divergent ? ws_attn_launch : sim_launch); } if (sim && g_divergent && !host) divergent_negative_control(); - if (host) host_only(); + if (host) { host_only(); hd_codegen_checks(); } else if (timing_mode) { if (timing(out_path) != 0) return 2; } else if (sweep_mode) { if (sweep(out_path) != 0) return 2; } - else if (chip(out_path) != 0) return 2; + else { if (chip(out_path) != 0) return 2; if (g_hd == 128) hd128_checks(); } printf("%s: %d checks, %d failed\n", g_failed ? "FAIL" : "PASS", g_checks, g_failed); return g_failed ? 1 : 0; }