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#984 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/aca7d62ec7857831.bundle -o aca7d62ec7857831.bundle git fetch aca7d62ec7857831.bundle refs/pull/984/head
Provenance
github-import 1
aien-dev/omega-mv
984
1aa50434045602e49b510ce810993f617493bf57
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":984,"url":"https://github.com/aien-dev/omega-mv/pull/984","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:39Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index a4721f628..e73f2709a 100644 --- a/.crumb +++ b/.crumb @@ -48,7 +48,7 @@ }, { "digest": "ea388ed4a2b02a78ae7b648bc725a37f5caa270eadd16f324e34a4cadbe2c7c2", - "last_commit": "8be6f9941", + "last_commit": "4376c2112", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -59,20 +59,20 @@ "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "433a4a8f9136953b8b117742979d0a72ca80e184c7334733c258c34fee783758", - "last_commit": "a773c94b5", + "digest": "e42ed0520e8c87d3dd48b5d783ca0cdfc8da3edf78b5af42632b80a88767b5ee", + "last_commit": "ef6929058", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, { "digest": "e3b64c1dcb1f3780099de62f72c818627e4dfea55a7978c84170d0d31126b162", - "last_commit": "81404672e", + "last_commit": "f5c9bd89a", "name": "native", "purpose": "Handwritten .om units of omega-mv that are not part of the seed ladder: the ORIG-4 shadow adviso" }, { "digest": "0cf0eba142c8b72205e4a3f002c1899f3961b07e3188815460d8f09673c69b88", - "last_commit": "1d6277d75", + "last_commit": "f56a372ae", "name": "neuralese", "purpose": "Bounded untrusted representation envelopes and explicit checked Omega decoding; learned extensio" }, @@ -84,38 +84,38 @@ }, { "digest": "c48e49ac936f1ca243f52f7464c9503249e1c057a7fd64d405c369efda42ca69", - "last_commit": "64942e2df", + "last_commit": "f5c9bd89a", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "2b1f6a7cc1f495b61295d671fbfa1d28c8a70e60a0027aae54004950f8b3c9e2", - "last_commit": "3c983bc35", + "digest": "9012a90be787f9574d70b8cbc453dac0f995b0e2ff3f4a2ff8e95d190d7b7e55", + "last_commit": "ef6929058", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "7da8be2f96d621486ed03ea16d7ec3f3e922f9fde6ad14c127aaf8b8f5cc4992", - "last_commit": "8be6f9941", + "digest": "912d0edd6b46a30ef5f330416c4fe6be1dfb764a5e6cfad3b60e93b79fd6c6bd", + "last_commit": "ef6929058", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { - "digest": "14876755ba307b209e117b1b52937476bd6f6f80751a0006751b0734ff35dd3a", - "last_commit": "8be6f9941", + "digest": "5a673a62f8a762806b0551d1c92bcb9643a929a64e2e98b8eadf47ecbe2f798e", + "last_commit": "ef6929058", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:b376dae462f2084266e2797caadbacf561ba57fe1a29c9b73126bf030585f5db", - "compiled_at": "2026-10-31T01:00:52Z", + "children_root": "sha256:46edaa9a8238ef1587bc7062ff2873d3df8299b41ed76c01557099e6c58292cf", + "compiled_at": "2026-10-31T02:19:12Z", "compiler": "crumb-compile/1", - "digest": "sha256:b8341a27be16dd19a5324b6b37306ad5ab97a314bf413d779090f724732f6bf3", + "digest": "sha256:d56a26f9e4cf88cdfb063ebaf5324cbadd18595b73d40d40c6c4e91e9906fbae", "evidence_files": 14602, "evidence_root": "sha256:f915fb4ec0599ad30874d7adbbb95f142c988f42f3f1b89ce2751909caa5eaf8", "files": 21669, - "generated_at_commit": "8be6f9941258bcab4339d885a72a5c0792a8979d", - "source_tree": "sha256:52566376bd13a07d65a1f1cd48a1cf5087045011ce32da3ab1d8fe0bdf384b5c" + "generated_at_commit": "ef69290586a1757b4412058995045c5bc0d38bf6", + "source_tree": "sha256:b312330de381d5bb2c17f39a921f66d0e907df4bb0d41901e5c4ef5fe5315a89" }, "owner_lane": "", "provenance": { diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d89a8e187..6d217a7ff 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -7,6 +7,8 @@ The current development method is [Human-Directed Agentic Engineering (HDAE)](RE | Model | What it did | |---|---| +| Claude Opus 5.5 (via omp) | C6 zero-nvdisasm repair: #589's hazard cross-check had brought back a call to `/usr/local/cuda/bin/nvdisasm` and the gate's `zero_nvdisasm.*` work dir turned PATH lookups into false nvdisasm execs. `tests/bw_hazard_test.c --disasm` now cross-checks with our decoder in process; the gate runs it as a dynamic row, refuses a work dir or checkout path naming nvdisasm (NOT_RUN) and fails closed when mktemp fails. Decoder rows for the sweep's HMMA.16816.F32, LDG/STG .STRONG.SYS and ATOMG.E.ADD.STRONG.SYS forms and IMAD.SHL 2^7/2^8; the hazard sweep's kernels joined the `test-sm121dis` corpus (2,980 kernels), which `check.sh` now compares `SM121DIS_JOBS` at a time. Closed four fail-open paths, each reproduced before the fix and refused after: a stale PASS read back from a symlinked work dir, a red check that accepted NOT_RUN, a kernel dump cut short by a full disk kept under its full name, and an empty work dir left when strace is missing. Host evidence only. | +| Claude Opus 5.5 (via omp) | #975 (squash `b5ab3fe94`, which carried no row of its own): `shell: bash` on the dagsim steps of `aien-verification.yml` and `om-units-arm64.yml`, so a failing make fails the step through its `tee`, and `test "${PIPESTATUS[0]}" = 0` after the Intel SPIR-V smoke pipeline in `irspirv-intel-cpu.yml`. Codex's draft #973 (Refs #938) proposed the same two `shell: bash` lines; #975 supersedes it. | | Claude Opus 5.5 (via omp) | Train r3 final smoke (every gate rc 0 on `a00e134c`, CPUs 10-19 at nice 19) and the `om/tls/README.md` test table brought to the train tree from those logs: the `TLS_NET=1` row (`interop=99 ... mutants=62/62`, net=PASS), the ec, ecdh and x509 rows, new mlkem, rev and hostile rows, and the `openssl verify` differences (23 of 106 cases, five new refusals from the x509-limbo fixes), omc `62775d2a`. | | Claude Opus 5.5 (via omp) | Train r3 GEN-1 protocol pins: #951 and main changed `docs/one_layer/OMEGESE.md`, so `gencheck manifest` failed on #486's pin (`9d8795bc`); re-hashed it to the train content `533887c7` and `GEN_PROTOCOL_V1.md` for a new §15 line (revision stays 1, no protocol content changed), after a consult; `make test-gen-protocol` 159 ok, 0 failed. | | Claude Opus 5.5 (via omp) | Train r3 TLS fuzz replay repair: #859's chain check needs an authority key id on every non-self-issued certificate, so `gen_seeds.py` now writes SKI on every certificate and AKI below the root; `fz_detch` pins every key-share byte (both x25519 copies and the ML-KEM-768 encapsulation key rebuilt from a fixed seed) so the ClientHello is deterministic; `hrr_*` expects `KEY_SHARE` (011) for an HRR naming an already-shared group (RFC 8446 §4.1.4); seeds regenerated and the 21 new crafted x509 seeds given EXPECT lines that match `cases.txt`. | diff --git a/Makefile b/Makefile index b6ceafb76..bf39ac9c7 100644 --- a/Makefile +++ b/Makefile @@ -2767,17 +2767,17 @@ test-gpu-gpr-boundary: $(GPU_GPR_BOUNDARY_TEST) # omega-mv#554: static scoreboard hazard checker (RAW / WAR / WAW) over the encoded bytes of every kernel the generators # build, after the launchers' patch steps. Host only: decoder vs encoder, the pre-#553 attend red receipt -# (tests/fixtures/bw_hazard), negative controls, then the sweep. test-bw-hazard-nvdisasm adds the decoder cross-check -# against nvdisasm (offline oracle, /usr/local/cuda/bin) on every distinct kernel: one nvdisasm call per kernel, over -# ten minutes on the Spark (2026-10-19: 2360 kernels, 1028064 instructions, 0 mismatched). +# (tests/fixtures/bw_hazard), negative controls, then the sweep. test-bw-hazard-nvdisasm (the name it had when it +# called nvdisasm) adds the decoder cross-check against Omega's own sm_121 disassembler, in process, on every distinct +# kernel (bar C6: every check that called nvdisasm calls ours; test-sm121dis checks that disassembler against the oracle). .PHONY: test-bw-hazard test-bw-hazard-nvdisasm BW_HAZARD_TEST = $(OUT_DIR)/bw_hazard_test -$(BW_HAZARD_TEST): tests/bw_hazard_test.c src/omega_bw_hazard.c src/omega_bw_hazard.h $(OUT_DIR)/libomega_gpu.a +$(BW_HAZARD_TEST): tests/bw_hazard_test.c src/omega_bw_hazard.c src/omega_bw_hazard.h src/omega_sm121_disasm.h $(OUT_DIR)/libomega_gpu.a $(CC) $(CFLAGS) -o $@ tests/bw_hazard_test.c src/omega_bw_hazard.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm test-bw-hazard: $(BW_HAZARD_TEST) $(BW_HAZARD_TEST) test-bw-hazard-nvdisasm: $(BW_HAZARD_TEST) - $(BW_HAZARD_TEST) --nvdisasm + $(BW_HAZARD_TEST) --disasm # OWN-30B T3 (2026-10-13): HMMA arithmetic probe (host model self-checks; chip run under the GB10 lock). GPU_TC_PROBE_TEST = $(OUT_DIR)/gpu_tc_probe_test diff --git a/mk/.crumb b/mk/.crumb index a05a9ada8..f9a3a84e3 100644 --- a/mk/.crumb +++ b/mk/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-30T19:49:59Z", + "compiled_at": "2026-10-31T02:04:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:433a4a8f9136953b8b117742979d0a72ca80e184c7334733c258c34fee783758", + "digest": "sha256:e42ed0520e8c87d3dd48b5d783ca0cdfc8da3edf78b5af42632b80a88767b5ee", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 97, - "generated_at_commit": "5ba2b25e33d0dc5a742bc2e80bf7cb3098490e31", - "source_tree": "sha256:2d4d3ea1046ff89aa72010ef3721e13afb9beb942a19b17d33ebc7a9c4243975" + "generated_at_commit": "bfb791feab971401d7e2322f3aee5fdbf3e0b96f", + "source_tree": "sha256:8488e483c6826d7cffd3ae766adcac11308788bb45530d01a4dd35f339cdf5d3" }, "owner_lane": "", "provenance": { diff --git a/mk/sm121dis.mk b/mk/sm121dis.mk index d29fcba32..b82fc54d3 100644 --- a/mk/sm121dis.mk +++ b/mk/sm121dis.mk @@ -18,7 +18,7 @@ sm121dis-corpus-bins: $(addprefix $(OUT_DIR)/,gpu_matmul_api_test gpu_elementwis gpu_moe_window_test gpu_fp8_api_test gpu_decode_attn_test gpu_router_test gpu_bf16_gemv_test gpu_tern_test gpu_fp8gemm_test \ gpu_tc_probe_test gpu_tc_peak_test gpu_pf_mem_test gpu_qmma_probe_test gpu_cmdlist_test gpu_decode_graph_test gpu_tcgemm_test \ gpu_prefill_attn_test gpu_pfgemm_test gpu_qgemm_test gpu_pfhost_test gpu_gpr_boundary_test \ - gpu_scan_test gpu_gemm_test gpu_streams_test gpu_isolation_test) \ + gpu_scan_test gpu_gemm_test gpu_streams_test gpu_isolation_test bw_hazard_test) \ build/test_omega_divsqrt_gb10_cpu build/test_omega_ldst_gb10_cpu .PHONY: test-sm121dis sm121dis-corpus-bins test-sm121dis-corpus-controls @@ -30,6 +30,8 @@ test-sm121dis: $(SM121DIS) $(SM121DIS_RED) sm121dis-corpus-bins test-sm121dis-co sh tools/sm121dis/check.sh $(SM121DIS) $(SM121DIS_K) $(OUT_DIR)/sm121dis-work @if sh tools/sm121dis/check.sh $(SM121DIS_RED) $(SM121DIS_K) $(OUT_DIR)/sm121dis-red > $(OUT_DIR)/sm121dis-red.log 2>&1; then \ echo "RED CHECK BROKEN: the faulty decoder passed"; exit 1; \ + elif ! grep -q '^VERDICT FAIL' $(OUT_DIR)/sm121dis-red.log; then \ + echo "RED CHECK BROKEN: the faulty decoder's run did not reach a verdict"; tail -3 $(OUT_DIR)/sm121dis-red.log; exit 1; \ else echo "red check: the faulty decoder FAILS the comparison, as it must ($$(grep -c '^\[FAIL\]' $(OUT_DIR)/sm121dis-red.log) kernels)"; fi # The provenance checks (tools/divsqrt_nvdisasm_check.sh, tools/ldst_nvdisasm_check.sh, test-numeric-reduce-nvdisasm) @@ -44,7 +46,7 @@ endif # provenance check with a decoy nvdisasm first on PATH, the CUDA directories removed from PATH, and strace on execve; # then its own red check plants two calls to nvdisasm and must see the gate FAIL. .PHONY: test-zero-nvdisasm -test-zero-nvdisasm: $(SM121DIS) build/sm121dis $(addprefix $(OUT_DIR)/,gpu_attention_test gpu_elementwise_test gpu_fp8_api_test gpu_reconv_test) +test-zero-nvdisasm: $(SM121DIS) build/sm121dis build/test_omega_reduce_cpu $(addprefix $(OUT_DIR)/,gpu_attention_test gpu_elementwise_test gpu_fp8_api_test gpu_reconv_test bw_hazard_test) PHYSICS_DIR="$(PHYSICS_DIR)" sh tools/sm121dis/zero_nvdisasm.sh $(OUT_DIR) @if PHYSICS_DIR="$(PHYSICS_DIR)" sh tools/sm121dis/zero_nvdisasm.sh $(OUT_DIR) --red > $(OUT_DIR)/zero-nvdisasm-red.log 2>&1; then \ echo "RED CHECK BROKEN: the planted nvdisasm calls passed the gate"; exit 1; \ diff --git a/src/.crumb b/src/.crumb index 8df088f06..23bda83f5 100644 --- a/src/.crumb +++ b/src/.crumb @@ -80,7 +80,7 @@ }, { "digest": "806198eda65f998c287abd251928120d01ab44a1e0f1e05ad2e055212967c80c", - "last_commit": "7f9437429", + "last_commit": "f5c9bd89a", "name": "compiler", "purpose": "Directory src/compiler. Purpose not yet described by a human." }, @@ -116,7 +116,7 @@ }, { "digest": "e0eee44045097fd7edf9f542b96bfdfc42813ecf6f27c25bd1c57f7adf985bc4", - "last_commit": "d43d19b44", + "last_commit": "f5c9bd89a", "name": "osh", "purpose": "osh (Omega-native shell, arch#158) lexer unit: layout list, generator, osh_lex.osc, C reference " }, @@ -146,7 +146,7 @@ }, { "digest": "43126cdfbfc4a67b3ab8785a1358a861960954e0374b7118781d06f117f9de5c", - "last_commit": "b99ffb73f", + "last_commit": "f56a372ae", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, @@ -182,20 +182,20 @@ }, { "digest": "e832df528a0a0992e817f879c5b7df52c33b8445f30fc2743e5c0fa5ad6e6b2a", - "last_commit": "52c62d6c4", + "last_commit": "f5c9bd89a", "name": "visor", "purpose": "Directory src/visor. Purpose not yet described by a human." } ], "children_root": "sha256:6ade3e583c9df260fbfc768469dae662b88153725b14f7086431861419cfffe3", - "compiled_at": "2026-10-30T18:16:56Z", + "compiled_at": "2026-10-31T02:04:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:2b1f6a7cc1f495b61295d671fbfa1d28c8a70e60a0027aae54004950f8b3c9e2", + "digest": "sha256:9012a90be787f9574d70b8cbc453dac0f995b0e2ff3f4a2ff8e95d190d7b7e55", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 597, - "generated_at_commit": "14fa8bdf24eb4b9ad0758759285e6dbc0979d84c", - "source_tree": "sha256:cedd48c5d680affcd564b3120480b0e04d0afe4f9975693490336809718624fa" + "generated_at_commit": "bfb791feab971401d7e2322f3aee5fdbf3e0b96f", + "source_tree": "sha256:b8bf26d065c3c020685c6aa7e02ad1486bc21200050947e1efe0304c538c32ec" }, "owner_lane": "", "provenance": { diff --git a/src/omega_blackwell_codegen.c b/src/omega_blackwell_codegen.c index 48c4e3e2e..a0520f4c9 100644 --- a/src/omega_blackwell_codegen.c +++ b/src/omega_blackwell_codegen.c @@ -1158,9 +1158,12 @@ void omega_kernel_dump(const uint8_t *code, size_t len) { int fd = open(path, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0600); if (fd < 0) return; FILE *f = fdopen(fd, "wb"); - if (!f) { close(fd); return; } - if (fwrite(code, 1, len, f) != len) BW_DIAG("omega_kernel_dump: short write %s\n", path); - if (fclose(f) != 0) BW_DIAG("omega_kernel_dump: close failed %s\n", path); + if (!f) { close(fd); unlink(path); BW_DIAG("omega_kernel_dump: write failed, removed %s\n", path); return; } + /* A body cut short (a full disk) must not stay under its full-content name: it would be compared as a smaller kernel + * and, created O_EXCL, never rewritten. tools/sm121dis/corpus.sh fails on these diagnostics. */ + int bad = fwrite(code, 1, len, f) != len; + if (fclose(f) != 0) bad = 1; + if (bad) { unlink(path); BW_DIAG("omega_kernel_dump: write failed, removed %s\n", path); } #else (void)code; (void)len; #endif diff --git a/src/omega_sm121_disasm.c b/src/omega_sm121_disasm.c index 796db0339..17a1ef14b 100644 --- a/src/omega_sm121_disasm.c +++ b/src/omega_sm121_disasm.c @@ -196,6 +196,7 @@ static const Row ROWS[] = { { 0x000000000000723eull, 0x00000010ffull, "F2FP.BF16.F32.PACK_AB %d, %a, %b" }, /* tensor cores */ { 0x000000000000723cull, 0x00041800ull, "HMMA.16816.F32.BF16 %d, %a, %b, %c" }, + { 0x000000000000723cull, 0x00001800ull, "HMMA.16816.F32 %d, %a, %b, %c" }, { 0x000000000000727aull, 0x00002c00ull, "QMMA.16832.F32.E4M3.E4M3 %d, %a, %b, %c" }, { 0x0000000000007308ull, 0x00000800ull, "MUFU.EX2 %d, %b" }, { 0x0000000000007308ull, 0x00001000ull, "MUFU.RCP %d, %b" }, @@ -203,6 +204,13 @@ static const Row ROWS[] = { /* memory */ { 0x0000000000007981ull, 0x0c1e1100ull, "LDG.E%z %d, desc[%B][%a.64%o]" }, { 0x0000000000007986ull, 0x0c101100ull, "STG.E%z desc[%C][%a.64%o], %b" }, + /* the .STRONG.SYS forms (and ATOMG) are the ones the bw_hazard_test sweep builds (decode_attn); only the 32-bit + * size and the PT predicate seen there are rows, every other bit pattern stays reported, not guessed. The sweep + * has these forms only with a zero offset, so their %o is checked by the plain LDG/STG rows above (same opcode, + * same offset field, nonzero offsets throughout the corpus), not by a STRONG listing of its own */ + { 0x0000000000007981ull, 0x0c1f5900ull, "LDG.E.STRONG.SYS %d, desc[%B][%a.64%o]" }, + { 0x0000000000007986ull, 0x0c115900ull, "STG.E.STRONG.SYS desc[%C][%a.64%o], %b" }, + { 0x80000000000079a8ull, 0x081f5100ull, "ATOMG.E.ADD.STRONG.SYS PT, %d, desc[%C][%a.64], %b" }, { 0x0000000000007984ull, 0x08000800ull, "LDS %d, [%a+%B]" }, { 0x0000000000007988ull, 0x08000800ull, "STS [%a+%C], %b" }, { 0x0000000000007984ull, 0x00000000ull, "LDS%z %d, [%a%o]" }, @@ -228,10 +236,10 @@ static int imad_imm(Out *w, uint64_t lo, uint64_t hi) { if (imm == 0) name = "IMAD.MOV"; /* d = c */ else if (imm == 1) name = c == 255 ? "IMAD.MOV" : "IMAD.IADD"; /* d = a, d = a + c */ else if (c == 255 && (imm & (imm - 1)) == 0) { - /* a shift. Seen in the corpus: .SHL for 2^1..2^6, 2^9, 2^10, 2^12, 2^20; plain IMAD for 2^16 and 2^31 */ + /* a shift. Seen in the corpus: .SHL for 2^1..2^10, 2^12, 2^20; plain IMAD for 2^16 and 2^31 */ int n = __builtin_ctz(imm); if (n == 16 || n == 31) name = "IMAD"; - else if (n <= 6 || n == 9 || n == 10 || n == 12 || n == 20) name = "IMAD.SHL"; + else if (n <= 10 || n == 12 || n == 20) name = "IMAD.SHL"; else return -1; } put(w, "%s ", name); diff --git a/tests/.crumb b/tests/.crumb index 07099fa99..95e554682 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -134,7 +134,7 @@ }, { "digest": "e83c52ffc46da0e9df448bc5d28a70b08a8cbcd6858e8adea7a842791717c024", - "last_commit": "7f9437429", + "last_commit": "f5c9bd89a", "name": "compiler", "purpose": "Directory tests/compiler. Purpose not yet described by a human." }, @@ -200,13 +200,13 @@ }, { "digest": "a4e1544a88e0b71ced2340ed880985b6ceaad797023b74a683d470971a8d47d4", - "last_commit": "81404672e", + "last_commit": "f5c9bd89a", "name": "orig4", "purpose": "ORIG-4 shadow advisor tests: shadow-test.om (in-process checks over the SYNTHETIC fixture and th" }, { "digest": "628d85f858a9ed11e4502064192aeb797bf9fe6f73a3932db520d5b9c22d43f1", - "last_commit": "d43d19b44", + "last_commit": "f5c9bd89a", "name": "osh", "purpose": "osh lexer host driver, vendored aien-protocols PR#16 draft vectors (5ae5292)" }, @@ -272,7 +272,7 @@ }, { "digest": "891ced287901fa14a10e93dce7dae2ada551f7b69752098f957d1471bff4d072", - "last_commit": "64942e2df", + "last_commit": "f5c9bd89a", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -302,20 +302,20 @@ }, { "digest": "aad47a6f37231afcd415798fcd7f18cbcb541066bb958c09d44cb755ce385057", - "last_commit": "436ceaae8", + "last_commit": "f5c9bd89a", "name": "visor", "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], "children_root": "sha256:4e202b52b2c80d88dc93220a0c00cda479e52c2e63f847fbb30b9b1f426294f5", - "compiled_at": "2026-10-31T01:00:52Z", + "compiled_at": "2026-10-31T02:04:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:7da8be2f96d621486ed03ea16d7ec3f3e922f9fde6ad14c127aaf8b8f5cc4992", + "digest": "sha256:912d0edd6b46a30ef5f330416c4fe6be1dfb764a5e6cfad3b60e93b79fd6c6bd", "evidence_files": 74, "evidence_root": "sha256:9aa38bf7dcfa5eb3499356a0a2a1dd7704fedfae2d16822a7c9e1400f3a72723", "files": 2047, - "generated_at_commit": "8be6f9941258bcab4339d885a72a5c0792a8979d", - "source_tree": "sha256:b87f5e28319d3d0799b39f20b6dfa6915b41d8cc7df9290f6ca32b9e5009db17" + "generated_at_commit": "bfb791feab971401d7e2322f3aee5fdbf3e0b96f", + "source_tree": "sha256:424e2f21f1165871b6851f3f9649b6dcb53bda9dd6e54de25ace0841c8e4de96" }, "owner_lane": "", "provenance": { diff --git a/tests/bw_hazard_test.c b/tests/bw_hazard_test.c index c546f7699..e052b0904 100644 --- a/tests/bw_hazard_test.c +++ b/tests/bw_hazard_test.c @@ -10,9 +10,12 @@ * 4. sweep: every generator over its accepted shapes (production kernels, mutant 0), encoded and patched as the * launchers do; every finding is printed and must be on the triaged list below. * - * --nvdisasm: additionally cross-checks the decoder against nvdisasm (offline oracle, CUDA 13 -b SM121) on every - * distinct kernel: the base registers each instruction names must be the ones the decoder found. */ + * --disasm: additionally cross-checks the decoder against Omega's own sm_121 disassembler (src/omega_sm121_disasm.c, + * in process) on every distinct kernel: the base registers each instruction names must be the ones the decoder found. + * The disassembler is checked word for word against nvdisasm by test-sm121dis; this test never calls nvdisasm (bar C6 + * of docs/OMEGA.md: every check that called nvdisasm calls ours). */ #include "omega_bw_hazard.h" +#include "omega_sm121_disasm.h" #include "omega_blackwell_codegen.h" #include "omega_blackwell_codegen_moe.h" #include "omega_blackwell_codegen_moe2.h" @@ -38,7 +41,7 @@ #include <string.h> #include <unistd.h> -static int g_checks, g_failed, g_nvdisasm; +static int g_checks, g_failed, g_disasm; static const char *g_dump_dir; /* --dump DIR: write each distinct kernel with findings as DIR/<family>-<n>.bin (triage) */ #define CHECK(c, ...) do { g_checks++; if (!(c)) { g_failed++; printf("FAIL: "); printf(__VA_ARGS__); printf("\n"); } } while (0) @@ -348,7 +351,7 @@ static Known g_known[] = { static uint64_t fnv(const uint8_t *p, size_t n) { uint64_t h = 1469598103934665603ull; for (size_t i = 0; i < n; i++) { h ^= p[i]; h *= 1099511628211ull; } return h; } -static void nvdisasm_cross_check(const char *family, const char *variant, const uint8_t *code, size_t len); +static void disasm_cross_check(const char *family, const char *variant, const uint8_t *code, size_t len); static void sweep_bytes(const char *family, const char *variant, const uint8_t *code, size_t len) { g_variants++; @@ -381,7 +384,7 @@ static void sweep_bytes(const char *family, const char *variant, const uint8_t * if (fd >= 0 && !f) close(fd); if (f) { fwrite(code, 1, len, f); fclose(f); printf("DUMP %s = %s %s\n", path, family, variant); } } - if (g_nvdisasm) nvdisasm_cross_check(family, variant, code, len); + if (g_disasm) disasm_cross_check(family, variant, code, len); } /* encode + the launcher's patch steps */ @@ -563,30 +566,25 @@ static void sweep(void) { if (omega_bw_ir_append(&g_prog, &ex) >= 0 && omega_bw_ir_append(&g_prog, &self) >= 0 && omega_bw_regalloc_solve(&g_prog) == 0) sweep_prog("cmdlist_nop", "-", P_NONE); } } -/* ----------------------------------------------------------------------------------------- nvdisasm cross-check */ -static size_t g_nv_insns, g_nv_bad, g_nv_kernels; +/* ----------------------------------------------------------------------------------- disassembler cross-check (C6) */ +static size_t g_dis_insns, g_dis_bad, g_dis_kernels; static int decoded_has(const OmegaBwInsn *d, int reg, int uniform) { for (unsigned j = 0; j < d->nr; j++) if (d->rd[j].uniform == uniform && d->rd[j].reg == reg) return 1; for (unsigned j = 0; j < d->nw; j++) if (d->wr[j].uniform == uniform && d->wr[j].reg == reg) return 1; return 0; } -static void nvdisasm_cross_check(const char *family, const char *variant, const uint8_t *code, size_t len) { - char path[] = "/tmp/bw_hazard_nvdisasm_XXXXXX"; - int fd = mkstemp(path); if (fd < 0) { CHECK(0, "mkstemp"); return; } - FILE *f = fdopen(fd, "wb"); fwrite(code, 1, len, f); fclose(f); - char cmd[600]; snprintf(cmd, sizeof cmd, "/usr/local/cuda/bin/nvdisasm -b SM121 -raw '%s' 2>&1", path); - FILE *p = popen(cmd, "r"); - if (!p) { remove(path); CHECK(0, "nvdisasm popen"); return; } - char line[1024]; size_t seen = 0; g_nv_kernels++; - while (fgets(line, sizeof line, p)) { - char *s = strstr(line, "/*"); if (!s || s[6] != '*' || s[7] != '/') continue; /* the address field, e.g. 0040 */ - unsigned addr; if (sscanf(s + 2, "%4x", &addr) != 1) continue; - size_t pc = addr / 16u; if (pc * 16u >= len) continue; - char *t = s + 8; while (*t == ' ') t++; - char *end = strchr(t, ';'); if (end) *end = 0; - OmegaBwInsn d; if (omega_bw_decode(code + pc * 16u, &d) != 0) continue; /* unreachable padding words are not decoded either */ - seen++; g_nv_insns++; - /* every register token nvdisasm prints must be a base register the decoder has, and vice versa */ +static void disasm_cross_check(const char *family, const char *variant, const uint8_t *code, size_t len) { + size_t seen = 0; g_dis_kernels++; + for (size_t pc = 0; pc * 16u + 16u <= len; pc++) { + const uint8_t *w = code + pc * 16u; + OmegaBwInsn d; if (omega_bw_decode(w, &d) != 0) continue; /* unreachable padding words are not decoded either */ + seen++; g_dis_insns++; + uint64_t lo = 0, hi = 0; + for (int i = 7; i >= 0; i--) { lo = lo << 8 | w[i]; hi = hi << 8 | w[8 + i]; } + char t[256]; + int rc = omega_sm121_disasm(lo, hi, pc * 16u, t, sizeof t); + if (rc != 0) { g_dis_bad++; if (g_dis_bad <= 20) printf("DISASM UNKNOWN %s %s IR %zu: decoder %s, disassembler rc %d lo %016llx hi %016llx\n", family, variant, pc, d.name, rc, (unsigned long long)lo, (unsigned long long)hi); continue; } + /* every register token the disassembler prints must be a base register the decoder has, and vice versa */ int nvr[16], nvu[16], nn = 0, nu = 0; for (char *q = t; *q; q++) { int uni = 0; char *r = q; @@ -605,16 +603,15 @@ static void nvdisasm_cross_check(const char *family, const char *variant, const for (int i = 0; i < (o->uniform ? nu : nn); i++) if ((o->uniform ? nvu[i] : nvr[i]) == o->reg) f2 = 1; ok = f2; } - if (!ok) { g_nv_bad++; if (g_nv_bad <= 20) printf("NVDISASM MISMATCH %s %s IR %zu: '%s' vs decoder %s (%u reads, %u writes)\n", family, variant, pc, t, d.name, d.nr, d.nw); } + if (!ok) { g_dis_bad++; if (g_dis_bad <= 20) printf("DISASM MISMATCH %s %s IR %zu: '%s' vs decoder %s (%u reads, %u writes)\n", family, variant, pc, t, d.name, d.nr, d.nw); } } - int st = pclose(p); remove(path); - CHECK(st == 0 && seen > 0, "%s %s: nvdisasm ran (status %d, %zu instructions)", family, variant, st, seen); + CHECK(seen > 0, "%s %s: disassembled %zu instructions", family, variant, seen); } int main(int argc, char **argv) { const char *dir = "tests/fixtures/bw_hazard"; for (int i = 1; i < argc; i++) { - if (!strcmp(argv[i], "--nvdisasm")) g_nvdisasm = 1; + if (!strcmp(argv[i], "--disasm")) g_disasm = 1; else if (!strcmp(argv[i], "--fixtures") && i + 1 < argc) dir = argv[++i]; else if (!strcmp(argv[i], "--dump") && i + 1 < argc) g_dump_dir = argv[++i]; } @@ -640,9 +637,9 @@ int main(int argc, char **argv) { printf("sweep: %zu variants built, %zu distinct kernels, %zu clean, %zu with findings, %zu findings, %zu not checked\n", g_variants, g_nseen, clean, g_nseen - clean - g_unchecked, g_findings_total, g_unchecked); CHECK(g_nseen >= 50, "the sweep built only %zu distinct kernels", g_nseen); - if (g_nvdisasm) { - printf("nvdisasm cross-check: %zu kernels, %zu instructions, %zu mismatched\n", g_nv_kernels, g_nv_insns, g_nv_bad); - CHECK(g_nv_bad == 0 && g_nv_insns > 0, "nvdisasm cross-check"); + if (g_disasm) { + printf("disassembler cross-check (sm121dis, in process): %zu kernels, %zu instructions, %zu mismatched\n", g_dis_kernels, g_dis_insns, g_dis_bad); + CHECK(g_dis_bad == 0 && g_dis_insns > 0, "disassembler cross-check"); } printf("bw_hazard_test: %d checks, %d failed: %s\n", g_checks, g_failed, g_failed ? "FAIL" : "PASS"); return g_failed ? 1 : 0; diff --git a/tools/.crumb b/tools/.crumb index b1ba66109..1b56386ad 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -62,14 +62,14 @@ } ], "children_root": "sha256:8d3d3b952374b3b72e667521f07bf028c4c02bcefff772ad1a71cfff3e5266f2", - "compiled_at": "2026-10-31T01:00:52Z", + "compiled_at": "2026-10-31T02:04:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:14876755ba307b209e117b1b52937476bd6f6f80751a0006751b0734ff35dd3a", + "digest": "sha256:5a673a62f8a762806b0551d1c92bcb9643a929a64e2e98b8eadf47ecbe2f798e", "evidence_files": 17, "evidence_root": "sha256:47b1bcb263a96edaab5a4a5214d92ebc385d5511b120201567d280410a749703", "files": 411, - "generated_at_commit": "8be6f9941258bcab4339d885a72a5c0792a8979d", - "source_tree": "sha256:fc08da23533ebc8a36ff562ce404ebde90499530eace6c9416d312b500e1630b" + "generated_at_commit": "bfb791feab971401d7e2322f3aee5fdbf3e0b96f", + "source_tree": "sha256:6b1e752a93cbe7df14c9f0b0929045a09f39f9781306b3807877398cbf2debd4" }, "owner_lane": "", "provenance": { diff --git a/tools/sm121dis/README.md b/tools/sm121dis/README.md index c10aeb978..590f48f38 100644 --- a/tools/sm121dis/README.md +++ b/tools/sm121dis/README.md @@ -6,11 +6,15 @@ the decoder is `src/omega_sm121_disasm.c`, this folder holds the command line an ## What it proves -- Every kernel the library builds without the chip (each GPU test in its host-only and simulator modes, plus the - numeric kernels) is collected and compared word by word with `nvdisasm`, text and spacing included. All 331 - kernels (59,152 instruction words) agree. +- Every kernel the library builds without the chip (each GPU test in its host-only and simulator modes, the + numeric kernels, and every kernel the hazard checker's sweep builds) is collected and compared word by word with + `nvdisasm`, text and spacing included. All 2,980 kernels (1,218,992 instruction words) agree (2026-10-30, host). + The receipts in `evidence/C6-DISASM/` predate the sweep kernels: 331 kernels (59,152 words) on 2026-10-24, 402 kernels + (74,096 words) on 2026-10-25. - A copy of the decoder with one planted fault (`SM121DIS_MUTANT`, first source register off by one bit) must fail - that comparison, and does, on every kernel. + that comparison with a verdict, and does on 2,979 of the 2,980 kernels. The one it cannot touch is a sweep kernel of + 32 words that is only EXIT, a branch and padding: it has no source register for the fault to change. +- A kernel that could not be saved whole (a full disk) fails the collection; it is never compared cut short. - A word the decoder does not know is printed as `?? <hex>` and fails the check. It is never guessed. ## How to run it @@ -26,7 +30,12 @@ The checks that used to call `nvdisasm` now call ours: - the listing checks inside `tests/gpu_elementwise_test.c`, `gpu_fp8_api_test.c`, `gpu_reconv_test.c`, `gpu_attention_test.c` and `bench/prime_race/tests/gb10_sieve_host_test.c` (linked in, `omega_sm121_listing`); - `tools/divsqrt_nvdisasm_check.sh`, `tools/ldst_nvdisasm_check.sh` and `make test-numeric-reduce-nvdisasm` - (the `build/sm121dis` command). The script and target names are kept so older receipts still line up. + (the `build/sm121dis` command); +- the hazard checker's register cross-check, `tests/bw_hazard_test.c --disasm` (`make test-bw-hazard-nvdisasm`, + linked in, `omega_sm121_disasm`), over every kernel its sweep builds. Those kernels are in the comparison corpus. + +The script and target names are kept so older receipts still line up. `make test-zero-nvdisasm` proves that none +of these checks runs `nvdisasm`. ## Files @@ -34,5 +43,5 @@ The checks that used to call `nvdisasm` now call ours: |---|---| | `sm121dis.c` | command line: a listing, `-b SM121` (called like nvdisasm), `--pairs` (for the comparison), `--version` | | `corpus.sh` | runs every GPU test with `OMEGA_KERNEL_DUMP_DIR` set, so each kernel the library encodes is saved | -| `check.sh` | compares our text with nvdisasm's for every saved kernel; PASS only when every word agrees | +| `check.sh` | compares our text with nvdisasm's for every saved kernel, `SM121DIS_JOBS` at a time (default: every CPU the process may use); PASS only when every word agrees | | `oracle_pairs.sh` | turns nvdisasm's listing into the same one-line-per-word form | diff --git a/tools/sm121dis/check.sh b/tools/sm121dis/check.sh index da0f27c4a..7091e0a5d 100755 --- a/tools/sm121dis/check.sh +++ b/tools/sm121dis/check.sh @@ -3,24 +3,55 @@ # Per kernel: PASS when every word's text is the same (spacing collapsed), else FAIL with the first differences. # Exit 0 only when every kernel passes; 2 when nvdisasm or a kernel is missing. nvdisasm is a decoder used offline as # the reference (docs/OMEGA.md C6); nothing it prints is used anywhere else. +# Kernels are checked SM121DIS_JOBS at a time (default: every CPU this process may use); each writes +# <work-dir>/<name>.res and the report below reads them back in kernel order, so it is the same at any job count. +# A kernel without a result fails. set -u -DIS=$1; DIR=$2; WORK=$3 HERE=$(cd "$(dirname "$0")" && pwd) NVDISASM=${NVDISASM:-/usr/local/cuda/bin/nvdisasm} + +if [ "${1:-}" = --one ]; then + # check.sh --one <sm121dis> <work-dir> <kernel.bin>: one kernel. First line of .res: PASS|FAIL <words>; the rest + # is what the report prints for it. Written under a temporary name and renamed, so a cut-short check leaves none. + DIS=$2; WORK=$3; f=$4 + b=$(basename "$f" .bin) + if ! "$NVDISASM" -b SM121 -hex "$f" > "$WORK/$b.nv" 2>&1; then + { echo "FAIL 0"; echo "[FAIL] $b: nvdisasm refused it"; head -3 "$WORK/$b.nv"; } > "$WORK/$b.res.tmp" + else + sh "$HERE/oracle_pairs.sh" "$WORK/$b.nv" > "$WORK/$b.want" + "$DIS" --pairs "$f" | sed 's/[[:space:]]\{1,\}/ /g' > "$WORK/$b.got" + n=$(wc -l < "$WORK/$b.want") + if [ "$n" -gt 0 ] && cmp -s "$WORK/$b.want" "$WORK/$b.got"; then + { echo "PASS $n"; echo "[PASS] $b: $n words"; } > "$WORK/$b.res.tmp" + else + { echo "FAIL $n"; echo "[FAIL] $b: $(diff "$WORK/$b.want" "$WORK/$b.got" | grep -c '^<') of $n words differ" + diff "$WORK/$b.want" "$WORK/$b.got" | head -6; } > "$WORK/$b.res.tmp" + fi + fi + mv "$WORK/$b.res.tmp" "$WORK/$b.res" + exit 0 +fi + +DIS=$1; DIR=$2; WORK=$3 [ -x "$NVDISASM" ] || { echo "VERDICT NOT_RUN: $NVDISASM missing"; exit 2; } ls "$DIR"/*.bin >/dev/null 2>&1 || { echo "VERDICT NOT_RUN: no kernels in $DIR"; exit 2; } mkdir -p "$WORK" +# "$WORK/." so a work dir that is a symlink (to /dev/shm, say) is swept too; a stale PASS must never be read back. +find "$WORK/." -maxdepth 1 \( -name '*.res' -o -name '*.res.tmp' \) -exec rm -f {} + echo "oracle: $("$NVDISASM" --version | grep -o "release [0-9.]*, V[0-9.]*")" +JOBS=${SM121DIS_JOBS:-$(nproc 2>/dev/null || echo 1)} +for f in "$DIR"/*.bin; do printf '%s\0' "$f"; done | xargs -0 -n 1 -P "$JOBS" sh "$HERE/check.sh" --one "$DIS" "$WORK" k=0; bad=0; words=0 for f in "$DIR"/*.bin; do b=$(basename "$f" .bin) - "$NVDISASM" -b SM121 -hex "$f" > "$WORK/$b.nv" 2>&1 || { echo "[FAIL] $b: nvdisasm refused it"; head -3 "$WORK/$b.nv"; bad=$((bad + 1)); k=$((k + 1)); continue; } - sh "$HERE/oracle_pairs.sh" "$WORK/$b.nv" > "$WORK/$b.want" - "$DIS" --pairs "$f" | sed 's/[[:space:]]\{1,\}/ /g' > "$WORK/$b.got" - n=$(wc -l < "$WORK/$b.want"); words=$((words + n)) - if [ "$n" -gt 0 ] && cmp -s "$WORK/$b.want" "$WORK/$b.got"; then echo "[PASS] $b: $n words" - else echo "[FAIL] $b: $(diff "$WORK/$b.want" "$WORK/$b.got" | grep -c '^<') of $n words differ"; diff "$WORK/$b.want" "$WORK/$b.got" | head -6; bad=$((bad + 1)); fi k=$((k + 1)) + if [ -f "$WORK/$b.res" ] && read -r st n < "$WORK/$b.res"; then + sed 1d "$WORK/$b.res" + words=$((words + n)) + [ "$st" = PASS ] || bad=$((bad + 1)) + else + echo "[FAIL] $b: no result"; bad=$((bad + 1)) + fi done echo "kernels: $k, words: $words, failed kernels: $bad" [ $bad = 0 ] && { echo "VERDICT PASS"; exit 0; } diff --git a/tools/sm121dis/corpus.sh b/tools/sm121dis/corpus.sh index 4a3cf792a..03e3df762 100755 --- a/tools/sm121dis/corpus.sh +++ b/tools/sm121dis/corpus.sh @@ -17,6 +17,12 @@ run() { echo "VERDICT FAIL: corpus producer failed: $*" >&2 exit "$rc" fi + # src/omega_blackwell_codegen.c omega_kernel_dump: a kernel that could not be written whole is missing from the corpus + if grep -q '^omega_kernel_dump: ' "$K/producer.log"; then + grep '^omega_kernel_dump: ' "$K/producer.log" >&2 + echo "VERDICT FAIL: kernels not captured whole: $*" >&2 + exit 1 + fi rm -f "$K/producer.log" } for t in gpu_matmul_api_test gpu_elementwise_test gpu_reconv_test gpu_attention_test gpu_moe_window_test gpu_fp8_api_test \ @@ -33,6 +39,9 @@ for t in gpu_scan_test gpu_gemm_test gpu_streams_test; do run "$OUT/$t" --host-only; run "$OUT/$t" --sim done run "$OUT/gpu_isolation_test" --host-only +# the hazard checker's sweep (every generator over its accepted shapes, patched as the launchers do): bw_hazard_test +# --disasm reads each of these kernels through our disassembler, so each is compared with nvdisasm here +run "$OUT/bw_hazard_test" mkdir -p "$K/numeric" run build/test_omega_divsqrt_gb10_cpu --dump "$K/numeric" run build/test_omega_ldst_gb10_cpu --dump "$K/numeric" diff --git a/tools/sm121dis/corpus_selftest.sh b/tools/sm121dis/corpus_selftest.sh index 061c618cd..d3ffdb11a 100644 --- a/tools/sm121dis/corpus_selftest.sh +++ b/tools/sm121dis/corpus_selftest.sh @@ -1,10 +1,11 @@ #!/bin/sh -# A missing or failing producer must invalidate the disassembler corpus. +# A missing or failing producer, or one that exits 0 after a kernel could not be dumped whole, must invalidate the +# disassembler corpus. set -eu HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) WORK=$(mktemp -d "${TMPDIR:-/tmp}/sm121dis-corpus-control.XXXXXX") trap 'rm -rf "$WORK"' EXIT HUP INT TERM -mkdir "$WORK/bin" "$WORK/missing" "$WORK/failing" +mkdir "$WORK/bin" "$WORK/missing" "$WORK/failing" "$WORK/partial" rc=0 sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/missing" > "$WORK/missing.log" 2>&1 || rc=$? [ "$rc" -eq 127 ] && grep -q 'VERDICT FAIL: corpus producer failed:' "$WORK/missing.log" || { @@ -18,4 +19,11 @@ sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/failing" > "$WORK/failing.log" 2>&1 || r grep -q 'VERDICT FAIL: corpus producer failed:' "$WORK/failing.log" || { echo 'FAIL: a failing producer did not invalidate the corpus'; exit 1; } +# exit 0, but omega_kernel_dump reported a kernel it could not write whole (src/omega_blackwell_codegen.c) +printf '#!/bin/sh\necho "omega_kernel_dump: write failed, removed /x/k.bin" >&2\nexit 0\n' > "$WORK/bin/gpu_matmul_api_test" +rc=0 +sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/partial" > "$WORK/partial.log" 2>&1 || rc=$? +[ "$rc" -eq 1 ] && grep -q 'VERDICT FAIL: kernels not captured whole:' "$WORK/partial.log" || { + echo 'FAIL: a kernel not captured whole did not invalidate the corpus'; exit 1; +} echo 'PASS: missing and failing corpus producers are refused' diff --git a/tools/sm121dis/zero_nvdisasm.sh b/tools/sm121dis/zero_nvdisasm.sh index 54fc36fa6..f70960870 100644 --- a/tools/sm121dis/zero_nvdisasm.sh +++ b/tools/sm121dis/zero_nvdisasm.sh @@ -3,7 +3,7 @@ # # Two checks, both must pass: # 1. Static. No file under src/ tests/ tools/ mk/ or the Makefile names the CUDA toolkit directory or looks -# up an nvdisasm binary. The one declared exception is the oracle harness of the 331-kernel comparison, +# up an nvdisasm binary. The one declared exception is the oracle harness of the nvdisasm comparison, # tools/sm121dis/check.sh and oracle_pairs.sh, which exists to compare Omega's decoder WITH nvdisasm. # 2. Dynamic. Every listing check and provenance check runs (a) with a DECOY nvdisasm first on PATH that records # each call and fails, (b) with every CUDA directory removed from PATH, and (c) under strace -f tracing execve. @@ -12,14 +12,18 @@ # # Usage: PHYSICS_DIR=<pinned physics checkout> sh tools/sm121dis/zero_nvdisasm.sh [build-dir] # after: make PHYSICS_DIR=... build/sm121dis build/gpu_attention_test build/gpu_elementwise_test \ -# build/gpu_fp8_api_test build/gpu_reconv_test build/test_omega_reduce_cpu +# build/gpu_fp8_api_test build/gpu_reconv_test build/bw_hazard_test build/test_omega_reduce_cpu # Last line: "ZERO-NVDISASM: PASS (...)" or "ZERO-NVDISASM: FAIL (...)". Exit 0 only on PASS. set -u OUT=${1:-build} -WORK=$(mktemp -d "${TMPDIR:-/tmp}/zero_nvdisasm.XXXXXX") -fail=0 - command -v strace > /dev/null 2>&1 || { echo "ZERO-NVDISASM: NOT_RUN (strace missing)"; exit 2; } +# The work dir holds the decoy, which is first on PATH, so every PATH lookup (make, gcc's as and ld, ...) tries it and +# appears in the trace; its path therefore must not contain "nvdisasm", or those lookups would match the execve check. +# The same holds for the checkout: any execve of a repo binary by absolute path would name it. +WORK=$(mktemp -d "${TMPDIR:-/tmp}/zero_nvd.XXXXXX") || { echo "ZERO-NVDISASM: NOT_RUN (no work dir under ${TMPDIR:-/tmp})"; exit 2; } +case $WORK in *nvdisasm*) echo "ZERO-NVDISASM: NOT_RUN (the work dir $WORK names nvdisasm; set TMPDIR elsewhere)"; rmdir "$WORK"; exit 2;; esac +case $PWD in *nvdisasm*) echo "ZERO-NVDISASM: NOT_RUN (the checkout $PWD names nvdisasm; run it from another path)"; rmdir "$WORK"; exit 2;; esac +fail=0 # 1. static hits=$(grep -rnE '/usr/local/cuda|command -v nvdisasm|which nvdisasm|cuda/bin/nvdisasm' src tests tools mk Makefile 2>/dev/null \ @@ -57,6 +61,7 @@ run fp8 "$OUT/gpu_fp8_api_test" --host-only run reconv "$OUT/gpu_reconv_test" --host-only run divsqrt sh tools/divsqrt_nvdisasm_check.sh run ldst sh tools/ldst_nvdisasm_check.sh +run hazard "$OUT/bw_hazard_test" --disasm run reduce make ${PHYSICS_DIR:+PHYSICS_DIR=$PHYSICS_DIR} test-numeric-reduce-nvdisasm if [ "${2:-}" = "--red" ]; then # Red check of the gate itself: two planted shell-outs, one by name (the decoy must catch it) and one by the