omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
GitHub aien-dev/omega-mv#496 (code only)
Apply it
git checkout -b patch-39e0b5a6d7371030 a8ffd2b912c84197d08f963b05f9c7d8b30a3f8a curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/39e0b5a6d7371030.patch | git am
Provenance
github-import 1
aien-dev/omega-mv
496
4e9cfbe7aaa9947f5fdf4dbb527a43958fb9ce84
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":496,"url":"https://github.com/aien-dev/omega-mv/pull/496","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:04Z","metadata":"unavailable","state_derived":true}
Changes
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 bd5535a8b..308e2d511 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-19T21:56:52Z", "compiler": "crumb-compile/1", - "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", + "digest": "sha256:d0bbdf27743f6a051c3c884da516f9625b3bd78c616bad43faa83c44718e1d82", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", - "files": 1270, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc" + "files": 1271, + "generated_at_commit": "097921dd6b2c7679d988e93aceab49b21b0e5f69", + "source_tree": "sha256:4fa639daf0903ca0c898bf68b1d56110d7fd8bff26b4a1481af0e80a6c0adbc5" }, "owner_lane": "", "provenance": { 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 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);