From 020f059a299f18e6c65c3f55c64e5251c23b2230 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 16 Oct 2026 02:44:38 -0500 Subject: [PATCH 1/4] gpu attention: fix the hd 128 host-only tier and run the attention host tiers in CI (#470) Two test-side defects, no kernel change: - the host-only register bound was 64 for both head dims. Cut K (#417) raised AT_GPR_BUDGET to 96 on chip evidence (battery 225/225); the codegen refuses anything above it and every launch declares exactly 96. hd 64 keeps 64 (its program is unchanged since before cut K), hd 128 follows the budget, as the pinned-digest check already did. - the nvdisasm listing parser matched lines starting '/*0', which stops at byte offset 0x1000, so every listing looked cut at 256 instructions. It now matches any hex offset comment and requires one listing line per 16-byte slot of the kernel. New host-suites-3 job runs make test-gpu-attention (hd 64 and 128, host-only, both simulators, sweep). Co-Authored-By: Claude Opus 5.5 --- tests/gpu_attention_test.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/gpu_attention_test.c b/tests/gpu_attention_test.c index 45790315a..684f61096 100644 --- a/tests/gpu_attention_test.c +++ b/tests/gpu_attention_test.c @@ -45,6 +45,11 @@ 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 */ +/* Host-only register bound (omega#470). hd 64 kernels are the program from before cut K (#417 keeps them byte-identical, + * see the hd64 digest pins) and stay under 64. hd 128 follows AT_GPR_BUDGET in src/omega_gpu_attention_api.c (96 since + * cut K, chip battery 225/225): the codegen refuses any kernel above it and every launch declares exactly that many + * registers, so a peak under it changes nothing on the chip. The pinned-digest check further down uses the same 96. */ +#define ATTN_GPR_BOUND (g_hd == 64 ? 64u : 96u) #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; } @@ -130,6 +135,18 @@ static size_t compare(const float *got, const float *want, size_t n, double rel, } /* ------------------------------------------------------------- host only */ +/* One instruction line of an nvdisasm listing: leading blanks, then the byte offset as a hex comment, "/" "*" hex "*" "/". + * omega#470: the old test matched the text "/" "*" "0", which stops at offset 0x1000, so every listing looked cut off at + * 256 instructions and any opcode first emitted past 4 KiB (the hd 128 kernels are 512 and 624 instructions) was missed. */ +static bool is_sass_insn_line(const char *line) { + while (*line == ' ' || *line == '\t') line++; + if (line[0] != '/' || line[1] != '*') return false; + const char *p = line + 2; + int digits = 0; + while ((*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F')) { p++; digits++; } + return digits >= 4 && p[0] == '*' && p[1] == '/'; +} + 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; } @@ -142,11 +159,12 @@ static int nvdisasm_check(bool f32, const char *name, const char *const *must, i 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); + const int want_insns = (int)(k.code_size / 16); /* every 16-byte slot, padding included, is one listing line */ 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; + if (!is_sass_insn_line(line)) 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; @@ -154,9 +172,9 @@ static int nvdisasm_check(bool f32, const char *name, const char *const *must, i 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); + printf("nvdisasm %s: rc=%d insns=%d of %d undecodable=%d missing=%d (%s)\n", name, rc, insns, want_insns, bad, miss, lst); unlink(bin); - return (rc == 0 && bad == 0 && miss == 0) ? 0 : -1; + return (rc == 0 && insns == want_insns && 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) { @@ -198,7 +216,7 @@ static void host_only(void) { 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); + CHECK(rc == OMEGA_GPU_ATTN_OK && k.code_size > 0 && k.gpr_count <= ATTN_GPR_BOUND, "%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 */ @@ -208,7 +226,7 @@ static void host_only(void) { 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(mrc == OMEGA_GPU_ATTN_OK && k.gpr_count <= ATTN_GPR_BOUND, "%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); From f4fdc181593e857b2d90d1d2b7622990fbb594b6 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 18 Oct 2026 09:42:33 -0500 Subject: [PATCH 2/4] crumb: recompile with the pinned tool (aien-architecture d0f0b95) Co-Authored-By: Claude Opus 5.5 --- tests/.crumb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/.crumb b/tests/.crumb index bd5535a8b..ae5fc17b4 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -296,14 +296,14 @@ } ], "children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8", - "compiled_at": "2026-10-16T19:04:20Z", + "compiled_at": "2026-10-18T14:42:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", + "digest": "sha256:f2dedfc3667b63bdfa8e5d8a9083ab03de3211d5526ec57edd04634a41608350", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", "files": 1270, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc" + "generated_at_commit": "32edeecf9a0da675daf817d8a796560464c574ac", + "source_tree": "sha256:4fca7aa54b30ab84af255e4c6afb7ab9884c41d9ed3acf559dc92c51edb1c28e" }, "owner_lane": "", "provenance": { From 097921dd6b2c7679d988e93aceab49b21b0e5f69 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 19 Oct 2026 16:55:03 -0500 Subject: [PATCH 3/4] gates: run test-gpu-attention on the Spark (OMEGA-GPU-ATTENTION) The hosted host-suites-3.yml job this PR added was removed with the hosted test workflows (#564). Same command and checks (6 PASS lines, no FAIL), now a local gate step: pinned Physics at physics.lock, lock check on, host only. The Spark has nvdisasm, so the listing check runs here. Co-Authored-By: Claude Opus 5.5 --- tests/gates/omega-gpu-attention.gate | 24 ++++++++++++++++++++++++ tests/gates/run.sh | 8 ++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/gates/omega-gpu-attention.gate diff --git a/tests/gates/omega-gpu-attention.gate b/tests/gates/omega-gpu-attention.gate new file mode 100644 index 000000000..35a0752b5 --- /dev/null +++ b/tests/gates/omega-gpu-attention.gate @@ -0,0 +1,24 @@ +# tests/gates/omega-gpu-attention.gate +# Mirrors hosted: host-suites-3.yml gpu-attention (omega#470) with physics-src at physics.lock: attention host tiers at head_dim 64 and 128 (refusals, codegen, register bound, nvdisasm listing, both warp simulators, sweep); 6 PASS lines, no FAIL; host only, no chip +gate: OMEGA-GPU-ATTENTION +manifest_version: 2 +owner: omega +requires: + - host +inputs: + - Makefile + - mk/ + - src/ + - tests/gpu_attention_test.c + - tests/bw_warp_sim.h + - physics.lock + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["gpu-attention"] +expects: + exit: 0 + verdict: PASS +timeout: 20m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/run.sh b/tests/gates/run.sh index 6c5c918d5..116cd1368 100755 --- a/tests/gates/run.sh +++ b/tests/gates/run.sh @@ -154,6 +154,14 @@ case "$step" in n=$(grep -c 'matches frozen digest' build/digest.log); obs frozen_digests_matched "$n" test "$n" -ge 1 ;; + gpu-attention) # host-suites-3.yml gpu-attention (omega#470): physics-src at physics.lock, lock check on; + # host-only, sim and sweep tiers, nothing touches a GPU (the Spark has nvdisasm, so the + # listing check runs here where the hosted runner printed "skipped") + physics_pin; set -o pipefail; mkdir -p build + make -j"$(nproc)" test-gpu-attention | tee build/attn.log + test "$(grep -cE '^PASS: [0-9]+ checks, 0 failed$' build/attn.log)" -eq 6 + ! grep -qE '^FAIL' build/attn.log + ;; numeric-transc-full) make $NOPHYS test-numeric-transc-full ;; m6|m7|m8|m9|m10|m11|m12|m13|m14|m15|m17|m5|m19|m19r-qualify|gate14-combine) physics_pin; set -o pipefail; mkdir -p build From 4e9cfbe7aaa9947f5fdf4dbb527a43958fb9ce84 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 19 Oct 2026 16:56:56 -0500 Subject: [PATCH 4/4] crumb: recompile after the gate port Co-Authored-By: Claude Opus 5.5 --- .crumb | 16 ++++++++-------- tests/.crumb | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.crumb b/.crumb index d121d2dad..d7959b7c5 100644 --- a/.crumb +++ b/.crumb @@ -83,8 +83,8 @@ "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", - "last_commit": "88e24bdd", + "digest": "d0bbdf27743f6a051c3c884da516f9625b3bd78c616bad43faa83c44718e1d82", + "last_commit": "097921dd", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -95,15 +95,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:e1a8c008214ad5dbc33a3e184d7e882dc56d1d50f9bd14c58f8773992961557e", - "compiled_at": "2026-10-18T21:10:38Z", + "children_root": "sha256:3325ceaed00eb246fba4872639998127a3d89112766b7bf37aabfc6fadc5804e", + "compiled_at": "2026-10-19T21:56:52Z", "compiler": "crumb-compile/1", - "digest": "sha256:be7220db494238bb4c33023d1df17286c35f947336bee5fc2e0405c136ec3e73", + "digest": "sha256:080f2219f9ccc088a25121daa8992453a52657205240122b89b75bb8564edcca", "evidence_files": 11127, "evidence_root": "sha256:4528085ec1661c442b64fb5dc8def65067ea2620ff88e42bcf52d58b7642ea6e", - "files": 14100, - "generated_at_commit": "f4a9849fb127f8d2d664dfc56890752ad180c507", - "source_tree": "sha256:21f93defce6c9ba159a4bd31083db787e156dfaa4afb80c3427cf88f732f8258" + "files": 14101, + "generated_at_commit": "097921dd6b2c7679d988e93aceab49b21b0e5f69", + "source_tree": "sha256:fb3f3ab014fc86527ab88f71dda1c9368bd69e8e2e7b0c2da16d6724543a6911" }, "owner_lane": "", "provenance": { diff --git a/tests/.crumb b/tests/.crumb index ae5fc17b4..308e2d511 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -296,14 +296,14 @@ } ], "children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8", - "compiled_at": "2026-10-18T14:42:29Z", + "compiled_at": "2026-10-19T21:56:52Z", "compiler": "crumb-compile/1", - "digest": "sha256:f2dedfc3667b63bdfa8e5d8a9083ab03de3211d5526ec57edd04634a41608350", + "digest": "sha256:d0bbdf27743f6a051c3c884da516f9625b3bd78c616bad43faa83c44718e1d82", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", - "files": 1270, - "generated_at_commit": "32edeecf9a0da675daf817d8a796560464c574ac", - "source_tree": "sha256:4fca7aa54b30ab84af255e4c6afb7ab9884c41d9ed3acf559dc92c51edb1c28e" + "files": 1271, + "generated_at_commit": "097921dd6b2c7679d988e93aceab49b21b0e5f69", + "source_tree": "sha256:4fa639daf0903ca0c898bf68b1d56110d7fd8bff26b4a1481af0e80a6c0adbc5" }, "owner_lane": "", "provenance": {