From 8d4ed3680a7a77368fb9606fcefe0d9815e9b2d6 Mon Sep 17 00:00:00 2001 From: aien-spark Date: Tue, 27 Oct 2026 03:13:42 -0500 Subject: [PATCH 1/2] kernels: root causes of the sm_80/86/89 failures, fixes in cubin.om and the listings, pending images and an offline oracle The seed rentals (RTX 4090, A100, RTX 3090) failed every image except vecadd v7 and neg v7. Four causes, each with chip evidence from the CloudKernels runs: A ABI 8 LOAD_FAIL 200: no .note.nv.tkinfo. cubin.om writes it. B ABI 7 alu/ctl 715: 16 registers recorded for code that writes R15/R14; Volta+ reserves 2. cubin.om records REGS+2 and refuses a low REGS (exit 6). C neg v8 "NEG_DETECTED" rows were load failures (documented; kit/ck.py already classifies them). D alu WRONG after the B fix: instructions 4 and 10 set a scoreboard with stall 1 and the next instruction waited on it before it was armed (Mesa NAK: bars[bar] + 2). alu.s2/ctl.s2 stall 2; cubin.om refuses the pattern (exit 7). build.sh rebuilds 24 pending images (hashes in kernels/pending/SHA256SUMS, not in the kit) and requires three refusals. kernels/src/oracle.sh checks cubins with nvdisasm/cuobjdump/readelf as read-only oracles; log in evidence/oracle-2026-10-27/. Chip re-run on sm_80/86/89: NOT_RUN. --- .crumb | 14 +- .github/workflows/ci.yml | 14 +- AGENTS.md | 6 +- DEPENDENCIES.md | 13 +- README.md | 67 ++++- evidence/oracle-2026-10-27/build.log | 29 ++ evidence/oracle-2026-10-27/oracle.log | 390 ++++++++++++++++++++++++++ kernels/.crumb | 10 +- kernels/pending/SHA256SUMS | 24 ++ kernels/src/alu.s2 | 165 +++++++++++ kernels/src/build.sh | 71 ++++- kernels/src/ctl.s2 | 256 +++++++++++++++++ kernels/src/cubin.om | 228 +++++++++++++-- kernels/src/oracle.sh | 107 +++++++ 14 files changed, 1346 insertions(+), 48 deletions(-) create mode 100644 evidence/oracle-2026-10-27/build.log create mode 100644 evidence/oracle-2026-10-27/oracle.log create mode 100644 kernels/pending/SHA256SUMS create mode 100644 kernels/src/alu.s2 create mode 100644 kernels/src/ctl.s2 create mode 100755 kernels/src/oracle.sh diff --git a/.crumb b/.crumb index a430c84..cf1f744 100644 --- a/.crumb +++ b/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [ { - "digest": "4b47ab98285a3fe89acf7a5caee2a2e841fdfb55d3f7d7251590ff561f701da1", + "digest": "71fbdee0d9edf423514e31ae369794db46597a939973e8d20910ccfae735e0f0", "last_commit": "400ded3", "name": "kernels", "purpose": "six Omega-encoded v7 cubins (vecadd/neg for sm_80/86/89), their sources and the byte-for-byte re" }, { "digest": "8e3ac951b50701b6f674f27c168b08a33f1f1f12332835afb81dbd79e97caa29", - "last_commit": "d6c2697", + "last_commit": "be6e65a", "name": "kit", "purpose": "interim Python kit: ./run drives bench.py, ck.py calls libcuda through ctypes" }, @@ -27,15 +27,15 @@ "purpose": "receipt schema, validator, PR gate, board builder, one-off CloudKernels import" } ], - "children_root": "sha256:204922b59c04ee99d300738bdc821766a9756b39e068126cb77f9e5383963693", - "compiled_at": "2026-10-27T00:43:21Z", + "children_root": "sha256:f56220cfd343cefb6c7566dd30361a36dbe2328c9cbc596cb6b4fb8bbc1a3660", + "compiled_at": "2026-10-27T08:13:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:c1f9f12171298d1c1af413484a1c3de558050958953e6aede3ca6c11539272ed", + "digest": "sha256:7b98da2584eb4ef7cf6597e6e3504fabb14a3010fe8832d530ff170ec046f48b", "evidence_files": 16, "evidence_root": "sha256:2ca05055761936745894bcf785980f7eab0a2c0edf5d40a7067d653b0e9f5d63", "files": 49, - "generated_at_commit": "d6c269716e53b64343f4973f1a98328d5dc289af", - "source_tree": "sha256:bb3c6d2485641dc558cff08aec8b7e5b7f3d853f867864a39746e69e01273bb6" + "generated_at_commit": "be6e65acafa9f75e705a308100bc5ddec8bfaa66", + "source_tree": "sha256:727346737d8f214fff14debfb89d13d1ea2f3bb3992b1e56bb426b41758e4929" } }, "name": "omega-gpu-bench", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2537760..c2719a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,8 @@ # CI: the kit and validator tests (no GPU; the fixture driver stands in for libcuda and is rejected as -# evidence), and a rebuild of all six kernels from source with the pinned Omega tools on a GitHub-hosted -# arm64 machine. Host evidence on a GitHub runner; it never touches a GPU. +# evidence), and a rebuild of the six kit cubins and the 24 pending images from source with the pinned +# Omega tools on a GitHub-hosted arm64 machine, including the scoreboard and register refusals. +# Host evidence on a GitHub runner; it never touches a GPU. kernels/src/oracle.sh needs a CUDA toolkit +# and does not run here (NOT_RUN in CI; see README "Offline oracle"). name: ci on: push: @@ -29,7 +31,7 @@ jobs: git init --quiet ../omega-mv git -C ../omega-mv fetch --quiet --depth 1 https://github.com/aien-dev/omega-mv.git 7ca3f989cbd62e77de1dd7d23919edd083fd2113 git -C ../omega-mv checkout --quiet FETCH_HEAD - - name: rebuild the six cubins and compare with kernels/SHA256SUMS + - name: rebuild the six cubins and the 24 pending images, compare with kernels/SHA256SUMS and kernels/pending/SHA256SUMS, require the three refusals run: kernels/src/build.sh ../omega-mv - name: negative control (neg.cuda.s2 changed back to vecadd's operand must fail the comparison) run: | @@ -37,3 +39,9 @@ jobs: awk 'NR==72{print "r.1 5"; next}{print}' kernels/src/neg.cuda.s2 > ../mutated/src/neg.cuda.s2 if ../mutated/src/build.sh ../omega-mv; then echo "negative control passed: the check cannot fail"; exit 1; fi echo "negative control rejected as expected" + - name: negative control (one stall changed in alu.s2 must fail the pending comparison) + run: | + rm -rf ../mutated && cp -r kernels ../mutated + awk 'NR==45{print " c 14 0 7 7 63 0"; next}{print}' kernels/src/alu.s2 > ../mutated/src/alu.s2 + if ../mutated/src/build.sh ../omega-mv; then echo "negative control passed: the check cannot fail"; exit 1; fi + echo "negative control rejected as expected" diff --git a/AGENTS.md b/AGENTS.md index a89bdbf..ff3ebeb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,8 +8,10 @@ A receipt is self-reported, not hardware qualification. Spell it "Aien"; page and README copy is first person singular. - **Kernels:** only add a cubin together with its source in `kernels/src/`, a `build.sh` rebuild that - reproduces it byte for byte, and a matching `neg` negative control. The CloudKernels alu/ctl and v8 - cubins are excluded on purpose (they fail with CUDA_ERROR_ILLEGAL_INSTRUCTION or crash 12.x drivers). + reproduces it byte for byte, and a matching `neg` negative control. The alu/ctl and v8 images are + fixed in source (README "Known losses") but stay in `kernels/pending/` (hashes only) until a chip run + on sm_80/86/89 passes; never move them into the kit on host evidence alone. Never remove the + scoreboard (exit 7) or register (exit 6) refusals from `cubin.om` or `build.sh`. - **Language:** the kit and tools are interim Python and sh; each has its Omega successor in DEPENDENCIES.md. New host programs go there with version, purpose and replacement. - **Never run `./run` against a shared or production GPU host without its owner's window.** Use diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 2e151ce..4830834 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -10,8 +10,17 @@ replaces it. | aien-dev/omega-mv `seed/out/omc` | commit 7ca3f989, sha256 `2c824805…029f` | compiles `cubin.om` | first-party (Omega's seed compiler) | | aien-dev/omega-mv `seed/rung2/asm2.bin` | sha256 `6988abe0…69c4` | assembles the `.cuda.s2` listings | first-party | | aien-dev/omega-mv `seed/sm80/sm80.tbl` | sha256 `c77a731d…670f` | Ampere/Ada encoding table (checked against Mesa NAK in omega-mv PR 836) | first-party | -| `kernels/src/cubin.om`, `vecadd.cuda.s2` | sha256 `8f2c7f5d…89e9`, `f8cb69e0…504a` | cubin writer and kernel listing, vendored until omega-mv PR 836's successor commits them | first-party; moves to omega-mv | -| POSIX sh, coreutils, git (GitHub `ubuntu-24.04-arm` image) | runner image | runs the build steps and hashes | host tools, coordination only | +| `kernels/src/cubin.om` | sha256 `e40ea98d…de50` | cubin writer (ABI 7 and 8 with `.note.nv.tkinfo`, register reserve, exit 6 register and exit 7 scoreboard refusals), vendored from omega-mv branch `ck/cubin-om` (PR 864, 76639738) plus the scoreboard check; PR 864 is on hold for the CudaLicenseRisk Q6 decision | first-party; moves to omega-mv with PR 864 | +| `kernels/src/vecadd.cuda.s2`, `alu.s2`, `ctl.s2` | sha256 `f8cb69e0…504a`, `87dd8cab…0359`, `c82663d3…2a49` | kernel listings (alu and ctl stall 2 after a scoreboard set at instructions 4 and 10) | first-party; move to omega-mv `seed/sm80/` | +| POSIX sh, awk, coreutils, git (GitHub `ubuntu-24.04-arm` image) | runner image | runs the build steps and hashes; awk writes the two 1-cycle negative listings | host tools, coordination only | + +## Offline oracle (`kernels/src/oracle.sh`, local only, not in CI) + +| Dependency | Version | What it does | Omega replacement | +| --- | --- | --- | --- | +| `kernels/src/oracle.sh` | sha256 `886e4e0c…4e63` | INTERIM sh and awk: header, tkinfo, decode, register and scoreboard checks over any cubin | an Omega cubin reader in omega-mv that decodes the same fields from the bytes; `oracle.sh` stays as its independent cross-check | +| `nvdisasm`, `cuobjdump` (NVIDIA CUDA toolkit) | 13.0 V13.0.88 on the Spark (`evidence/oracle-2026-10-27/oracle.log`) | read-only oracles: decode, register count, control bits; run only on our own cubins and on nvcc builds of our own probe sources, never on extracted NVIDIA binaries | none: they are the independent referee, like Mesa NAK | +| GNU readelf (binutils) | 2.42 | read-only: section list | the Omega cubin reader | ## Run path (`./run` on the developer's machine) diff --git a/README.md b/README.md index 57e3985..1c7e9f6 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,77 @@ the same libcuda path with the same cubins (`origin: cloudkernels-import`, allow `receipts/imports.sha256`, raw output in `evidence/cloudkernels/`). That harness did not hash the output or time the kernel, so those rows say "not timed". +## Known losses: what failed on the seed rows, and why + +The seed rentals ran 8 images per architecture (alu, ctl, vecadd, neg × ABI 7 and 8). Only vecadd v7 +passed and neg v7 failed the way it should. These are my losses and their causes; nothing below has been +re-run on an sm_80/86/89 chip yet. + +| Class | Rows (of 22 failing) | What the driver said | Root cause | Evidence | +| --- | --- | --- | --- | --- | +| A | alu, ctl, vecadd v8 on every card (9) | `cuModuleLoadData: 200 CUDA_ERROR_INVALID_IMAGE` | an ABI 8 cubin needs a `.note.nv.tkinfo` section; cubin.om wrote none | the same vecadd v8 with tkinfo loads and passes, without it (`v8dNoTk`, `v8old`) LOAD_FAIL 200 on RTX_4090-002933 (driver 615.71.09) | +| B | alu, ctl v7 on every card, sm_80 builds on the 4090 and 3090 too (10) | `cuCtxSynchronize: 715 CUDA_ERROR_ILLEGAL_INSTRUCTION` | the cubin recorded 16 registers while alu writes R15 and ctl R14; Volta and later reserve 2 more, so the kernel ran past its allocation | on RTX_4090-002933 the same alu machine code with 16 registers (`alu_sm89_v7old`) RUN_FAIL 715 and with 18 (`alu_sm89_v7`) ran to completion (then hit D); ctl v7 with 17 PASS | +| C | neg v8 on every card (3) | `NEG_DETECTED` with error `200` | not a pass: the old harness called a load failure a detected negative. `kit/ck.py` classifies it as LOAD_FAIL | the `error` field of those rows | +| D | alu after the B fix (only on later 4090 rentals) | WRONG (33 to 289 words, always in the float output) or 700/716/717 | instructions 4 (ULDC UR5) and 10 (LDC.64 R6) set a scoreboard and stalled 1 cycle; the wait at the next instruction ran before the scoreboard was armed, so IMAD.WIDE at instruction 14 could read R6 before LDC wrote it. Mesa NAK arms a scoreboard 2 cycles after issue (`calc_instr_deps.rs`, `bars[bar] + 2`, Mesa 02f13375) | alu v7 WRONG 129 and v8 WRONG 225 on RTX_4090-002933; the same bytes WRONG 33 on RTX_4090-005123 and 257 on RTX_4090-010516, PASS once on RTX_4090-004535 (a race); a wait at instruction 12, 13 or 14 PASS, at 16 or later WRONG (RTX_4090-005123) | + +Rows: A100_PCIE_40GB-231428 (driver 570.211.01), RTX_3090-231552 (580.159.03) and RTX_4090-231340 +(580.65.06) in `evidence/cloudkernels/`. The later 4090 runs are in the CloudKernels lane's run logs +(`~/handoffs/CloudKernels/runs//res/results.jsonl` on the Spark), not in this repository. ctl v7 +carries the same 1-cycle schedule as alu and passed anyway; I count that as luck, not evidence. +`launch_s` in those logs is one launch's wall time for a correctness run, not a throughput figure. + +Fixes (IMPLEMENTED, EXERCISED on the host only): + +- `kernels/src/cubin.om` writes `.note.nv.tkinfo` for ABI 8 (A), records REGS + 2 and refuses a REGS + below the highest register with exit 6 (B), and refuses with exit 7 any instruction that sets a + scoreboard with stall 0, or with stall 1 when the next instruction waits on it or stalls 0 (D). +- `kernels/src/alu.s2` and `ctl.s2` stall 2 at instructions 4 and 10. +- `build.sh` rebuilds 24 pending images (alu, ctl, vecadd, neg × sm_80/86/89 × ABI 7/8) and checks them + against `kernels/pending/SHA256SUMS`, then requires three refusals: alu and ctl with the old 1-cycle + stall (exit 7; the alu machine code it would have produced equals the bytes that went WRONG on + RTX_4090-005123 and -010516) and alu with REGS 15 (exit 6). + +The pending images stay out of the kit until they run on a chip. That re-run is NOT_RUN. The command, +for whoever holds the rental budget (CloudKernels lane, OpenResearch account): + +```sh +kernels/src/build.sh ../omega-mv /tmp/ogb +mkdir -p ~/handoffs/CloudKernels/payload-gbf/cub +cp /tmp/ogb/pending/*.cubin ~/handoffs/CloudKernels/payload-gbf/cub/ +cp ~/handoffs/CloudKernels/payload-r7/run.sh ~/handoffs/CloudKernels/payload-r7/ck.py ~/handoffs/CloudKernels/payload-gbf/ +cd ~/handoffs/CloudKernels +CK_PAYLOAD=payload-gbf python3 box.py gpu RTX_4090 20 vast +CK_PAYLOAD=payload-gbf python3 box.py gpu A100_PCIE_40GB 20 vast +CK_PAYLOAD=payload-gbf python3 box.py gpu RTX_3090 20 vast +``` + +Pass means: every alu, ctl and vecadd image PASS and every neg image NEG_DETECTED with no error, on each +card, repeated at least 10 times for alu (the D race passed once by chance on RTX_4090-004535). + +## Offline oracle + +`kernels/src/oracle.sh` checks cubins with NVIDIA's disassembler tools as read-only oracles: header +(OSABI, ABI version, e_flags), `.note.nv.tkinfo` for ABI 8, `nvdisasm` decode, `cuobjdump -res-usage` +registers ≥ highest register + 3, and a set-to-wait distance of at least 2 cycles for every scoreboard. +It needs a CUDA toolkit, so CI does not run it (NOT_RUN there); I ran it on the Spark with CUDA 13.0 +V13.0.88 (`evidence/oracle-2026-10-27/oracle.log`): + +- the 6 kit cubins and 24 pending images: 150 of 150 checks PASS; +- positive control, nvcc 13.0 builds of three probe kernels for sm_80/86/89: 45 of 45 PASS; +- negative control, the 27 images that ran on the rentals: every image that failed on a chip fails here + in its class (A: tkinfo; B: regs; D: sb), and the 6 vecadd and neg v7 images that behaved on the chip + pass. ctl also fails `sb`, the latent hazard above. + +The v8 header rule (OSABI 0x41, e_flags `0x6000000 | SM << 8 | 4`) comes from what nvcc 13.0 writes and +the driver loads, not from a specification. LLVM main (930a3d47) names `ELFOSABI_CUDA_V2 = 41`, decimal; +I have not checked whether that is a typo or a different value. + ## Rebuild the kernels ```sh git clone https://github.com/aien-dev/omega-mv ../omega-mv git -C ../omega-mv fetch origin 7ca3f989cbd62e77de1dd7d23919edd083fd2113 && git -C ../omega-mv checkout FETCH_HEAD -kernels/src/build.sh ../omega-mv # aarch64 Linux; prints PASS when all six match +kernels/src/build.sh ../omega-mv # aarch64 Linux; prints PASS for the six kit cubins, the 24 pending images and three refusals ``` ## Tests diff --git a/evidence/oracle-2026-10-27/build.log b/evidence/oracle-2026-10-27/build.log new file mode 100644 index 0000000..b099090 --- /dev/null +++ b/evidence/oracle-2026-10-27/build.log @@ -0,0 +1,29 @@ +2026-10-27T08:08:54Z +host: Linux 7.0.0-1019-nvidia aarch64; omega-mv 7ca3f989cbd62e77de1dd7d23919edd083fd2113 +$ nice -n 19 taskset -c 10-14 sh kernels/src/build.sh ../omega-mv /tmp/gbf/out +pin ok ../omega-mv/seed/out/omc +pin ok ../omega-mv/seed/rung2/asm2.bin +pin ok ../omega-mv/seed/sm80/sm80.tbl +pin ok /home/drakestapleton/work/GpuBenchFix/omega-gpu-bench/kernels/src/cubin.om +PASS: 6 cubins rebuilt from source are byte-identical to kernels/SHA256SUMS +PASS: 24 pending cubins rebuilt from source are byte-identical to kernels/pending/SHA256SUMS +PASS: refused (alu scoreboard waited 1 cycle after it was set, exit 7) +PASS: refused (ctl scoreboard waited 1 cycle after it was set, exit 7) +PASS: refused (alu REGS 15 below R15, exit 6) +exit 0 + +## the two CI negative controls, run locally (2026-10-27T08:12:20Z) +$ (neg.cuda.s2 line 72 -> "r.1 5") build.sh +FAIL: rebuilt cubins differ from kernels/SHA256SUMS +FAIL: pending cubins differ from kernels/pending/SHA256SUMS +PASS: refused (alu scoreboard waited 1 cycle after it was set, exit 7) +PASS: refused (ctl scoreboard waited 1 cycle after it was set, exit 7) +PASS: refused (alu REGS 15 below R15, exit 6) +exit 1 (must be nonzero) +$ (alu.s2 line 45 stall 15 -> 14) build.sh +PASS: 6 cubins rebuilt from source are byte-identical to kernels/SHA256SUMS +FAIL: pending cubins differ from kernels/pending/SHA256SUMS +PASS: refused (alu scoreboard waited 1 cycle after it was set, exit 7) +PASS: refused (ctl scoreboard waited 1 cycle after it was set, exit 7) +PASS: refused (alu REGS 15 below R15, exit 6) +exit 1 (must be nonzero) diff --git a/evidence/oracle-2026-10-27/oracle.log b/evidence/oracle-2026-10-27/oracle.log new file mode 100644 index 0000000..dafb515 --- /dev/null +++ b/evidence/oracle-2026-10-27/oracle.log @@ -0,0 +1,390 @@ +2026-10-27T08:09:05Z +host: Linux 7.0.0-1019-nvidia aarch64; nvdisasm/cuobjdump from /usr/local/cuda (CUDA 13.0 V13.0.88) + +## 1. this repository: kernels/*.cubin and the 24 pending cubins from build.log +$ sh kernels/src/oracle.sh kernels/*.cubin /tmp/gbf/out/pending/*.cubin +oracle: Build cuda_13.0.r13.0/compiler.36400806_0; GNU readelf (GNU Binutils for Ubuntu) 2.42 +PASS hdr neg_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo neg_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode neg_sm80_v7 nvdisasm exit 0 +PASS regs neg_sm80_v7 REG 16, highest register R9, want at least 12 +PASS sb neg_sm80_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo neg_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode neg_sm86_v7 nvdisasm exit 0 +PASS regs neg_sm86_v7 REG 16, highest register R9, want at least 12 +PASS sb neg_sm86_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo neg_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode neg_sm89_v7 nvdisasm exit 0 +PASS regs neg_sm89_v7 REG 16, highest register R9, want at least 12 +PASS sb neg_sm89_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo vecadd_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm80_v7 nvdisasm exit 0 +PASS regs vecadd_sm80_v7 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm80_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo vecadd_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm86_v7 nvdisasm exit 0 +PASS regs vecadd_sm86_v7 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm86_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo vecadd_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm89_v7 nvdisasm exit 0 +PASS regs vecadd_sm89_v7 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm89_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alu_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo alu_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode alu_sm80_v7 nvdisasm exit 0 +PASS regs alu_sm80_v7 REG 18, highest register R15, want at least 18 +PASS sb alu_sm80_v7 30 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alu_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo alu_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode alu_sm80_v8 nvdisasm exit 0 +PASS regs alu_sm80_v8 REG 18, highest register R15, want at least 18 +PASS sb alu_sm80_v8 30 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alu_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo alu_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode alu_sm86_v7 nvdisasm exit 0 +PASS regs alu_sm86_v7 REG 18, highest register R15, want at least 18 +PASS sb alu_sm86_v7 30 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alu_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo alu_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode alu_sm86_v8 nvdisasm exit 0 +PASS regs alu_sm86_v8 REG 18, highest register R15, want at least 18 +PASS sb alu_sm86_v8 30 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alu_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo alu_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode alu_sm89_v7 nvdisasm exit 0 +PASS regs alu_sm89_v7 REG 18, highest register R15, want at least 18 +PASS sb alu_sm89_v7 30 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alu_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo alu_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode alu_sm89_v8 nvdisasm exit 0 +PASS regs alu_sm89_v8 REG 18, highest register R15, want at least 18 +PASS sb alu_sm89_v8 30 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr ctl_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo ctl_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode ctl_sm80_v7 nvdisasm exit 0 +PASS regs ctl_sm80_v7 REG 17, highest register R14, want at least 17 +PASS sb ctl_sm80_v7 48 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr ctl_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo ctl_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode ctl_sm80_v8 nvdisasm exit 0 +PASS regs ctl_sm80_v8 REG 17, highest register R14, want at least 17 +PASS sb ctl_sm80_v8 48 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr ctl_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo ctl_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode ctl_sm86_v7 nvdisasm exit 0 +PASS regs ctl_sm86_v7 REG 17, highest register R14, want at least 17 +PASS sb ctl_sm86_v7 48 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr ctl_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo ctl_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode ctl_sm86_v8 nvdisasm exit 0 +PASS regs ctl_sm86_v8 REG 17, highest register R14, want at least 17 +PASS sb ctl_sm86_v8 48 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr ctl_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo ctl_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode ctl_sm89_v7 nvdisasm exit 0 +PASS regs ctl_sm89_v7 REG 17, highest register R14, want at least 17 +PASS sb ctl_sm89_v7 48 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr ctl_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo ctl_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode ctl_sm89_v8 nvdisasm exit 0 +PASS regs ctl_sm89_v8 REG 17, highest register R14, want at least 17 +PASS sb ctl_sm89_v8 48 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo neg_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode neg_sm80_v7 nvdisasm exit 0 +PASS regs neg_sm80_v7 REG 16, highest register R9, want at least 12 +PASS sb neg_sm80_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo neg_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode neg_sm80_v8 nvdisasm exit 0 +PASS regs neg_sm80_v8 REG 16, highest register R9, want at least 12 +PASS sb neg_sm80_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo neg_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode neg_sm86_v7 nvdisasm exit 0 +PASS regs neg_sm86_v7 REG 16, highest register R9, want at least 12 +PASS sb neg_sm86_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo neg_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode neg_sm86_v8 nvdisasm exit 0 +PASS regs neg_sm86_v8 REG 16, highest register R9, want at least 12 +PASS sb neg_sm86_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo neg_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode neg_sm89_v7 nvdisasm exit 0 +PASS regs neg_sm89_v7 REG 16, highest register R9, want at least 12 +PASS sb neg_sm89_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neg_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo neg_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode neg_sm89_v8 nvdisasm exit 0 +PASS regs neg_sm89_v8 REG 16, highest register R9, want at least 12 +PASS sb neg_sm89_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo vecadd_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm80_v7 nvdisasm exit 0 +PASS regs vecadd_sm80_v7 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm80_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo vecadd_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode vecadd_sm80_v8 nvdisasm exit 0 +PASS regs vecadd_sm80_v8 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm80_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo vecadd_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm86_v7 nvdisasm exit 0 +PASS regs vecadd_sm86_v7 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm86_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo vecadd_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode vecadd_sm86_v8 nvdisasm exit 0 +PASS regs vecadd_sm86_v8 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm86_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo vecadd_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm89_v7 nvdisasm exit 0 +PASS regs vecadd_sm89_v7 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm89_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo vecadd_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode vecadd_sm89_v8 nvdisasm exit 0 +PASS regs vecadd_sm89_v8 REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm89_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +exit 0 + +## 2. positive control: nvcc 13.0 builds of three probe kernels (Class B oracle output, local only, not committed) +$ nvcc -arch=sm_80 -cubin -O3 -o alunvcc_sm80_v8.cubin alu.cu +$ nvcc -arch=sm_80 -cubin -O3 -o vanvcc_sm80_v8.cubin va.cu +$ nvcc -arch=sm_80 -cubin -O3 -o rnvcc_sm80_v8.cubin r.cu +$ nvcc -arch=sm_86 -cubin -O3 -o alunvcc_sm86_v8.cubin alu.cu +$ nvcc -arch=sm_86 -cubin -O3 -o vanvcc_sm86_v8.cubin va.cu +$ nvcc -arch=sm_86 -cubin -O3 -o rnvcc_sm86_v8.cubin r.cu +$ nvcc -arch=sm_89 -cubin -O3 -o alunvcc_sm89_v8.cubin alu.cu +$ nvcc -arch=sm_89 -cubin -O3 -o vanvcc_sm89_v8.cubin va.cu +$ nvcc -arch=sm_89 -cubin -O3 -o rnvcc_sm89_v8.cubin r.cu +sources (sha256, in /home/drakestapleton/handoffs/CloudKernels/tmp-backup/ck2/): +960114624540af8412aca47f107791e6d8e92e7e1044291ffce7e651f522d5dc alu.cu +fd7f46e5221c655a93bd1430c4b040b1bce21dc2cb7b6c296ae6cad5988cc4fa va.cu +ebea4b770a502a0652427fb8f1b69e61d224cfb9299c66cb725f8a087a903788 r.cu +$ sh kernels/src/oracle.sh /tmp/gbf/pc/*.cubin +oracle: Build cuda_13.0.r13.0/compiler.36400806_0; GNU readelf (GNU Binutils for Ubuntu) 2.42 +PASS hdr alunvcc_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo alunvcc_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode alunvcc_sm80_v8 nvdisasm exit 0 +PASS regs alunvcc_sm80_v8 REG 14, highest register R11, want at least 14 +PASS sb alunvcc_sm80_v8 40 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alunvcc_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo alunvcc_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode alunvcc_sm86_v8 nvdisasm exit 0 +PASS regs alunvcc_sm86_v8 REG 14, highest register R11, want at least 14 +PASS sb alunvcc_sm86_v8 40 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr alunvcc_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo alunvcc_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode alunvcc_sm89_v8 nvdisasm exit 0 +PASS regs alunvcc_sm89_v8 REG 14, highest register R11, want at least 14 +PASS sb alunvcc_sm89_v8 40 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr rnvcc_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo rnvcc_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode rnvcc_sm80_v8 nvdisasm exit 0 +PASS regs rnvcc_sm80_v8 REG 30, highest register R27, want at least 30 +PASS sb rnvcc_sm80_v8 128 instructions, shortest set-to-wait 3 cycles, 0 shorter than 2 +PASS hdr rnvcc_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo rnvcc_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode rnvcc_sm86_v8 nvdisasm exit 0 +PASS regs rnvcc_sm86_v8 REG 40, highest register R37, want at least 40 +PASS sb rnvcc_sm86_v8 128 instructions, shortest set-to-wait 6 cycles, 0 shorter than 2 +PASS hdr rnvcc_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo rnvcc_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode rnvcc_sm89_v8 nvdisasm exit 0 +PASS regs rnvcc_sm89_v8 REG 40, highest register R37, want at least 40 +PASS sb rnvcc_sm89_v8 128 instructions, shortest set-to-wait 6 cycles, 0 shorter than 2 +PASS hdr vanvcc_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +PASS tkinfo vanvcc_sm80_v8 .note.nv.tkinfo sections: 1 +PASS decode vanvcc_sm80_v8 nvdisasm exit 0 +PASS regs vanvcc_sm80_v8 REG 12, highest register R9, want at least 12 +PASS sb vanvcc_sm80_v8 32 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vanvcc_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +PASS tkinfo vanvcc_sm86_v8 .note.nv.tkinfo sections: 1 +PASS decode vanvcc_sm86_v8 nvdisasm exit 0 +PASS regs vanvcc_sm86_v8 REG 12, highest register R9, want at least 12 +PASS sb vanvcc_sm86_v8 32 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vanvcc_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo vanvcc_sm89_v8 .note.nv.tkinfo sections: 1 +PASS decode vanvcc_sm89_v8 nvdisasm exit 0 +PASS regs vanvcc_sm89_v8 REG 12, highest register R9, want at least 12 +PASS sb vanvcc_sm89_v8 32 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +exit 0 + +## 3. negative control: the images that failed on chip (CloudKernels payload, unchanged since before the rentals) +payload/cub ran on RTX_4090-231340, A100_PCIE_40GB-231428, RTX_3090-231552 (evidence/cloudkernels/*/results.jsonl); +alur7_sm89_v8base = payload-r7/cub/alu_sm89_v8base.cubin (WRONG on RTX_4090-010516); vecadd_sm89_v8old, +vecadd_sm89_v8dNoTk = payload-r3/cub (LOAD_FAIL 200 on RTX_4090-002933). sha256: +4679d7ea0e87693e1cf5a073d067d090ea5a5c2f89cb17659aa9663b06f01154 aluhist_sm80_v7.cubin +1a9e4018ac9c92ee51f7afa4b17db5ffe7eda5ad90d0013f071eee5c76a7e953 aluhist_sm80_v8.cubin +62a126bde7ed3203217421335ae6a5d3c779b201d290a206d19eafe3ac57fe1a aluhist_sm86_v7.cubin +d2fa7cabf5b6e42ab1993a80405add652bb9ad28a796f3d3a1405bfd83adfb3f aluhist_sm86_v8.cubin +329e625eb03fe1d059058f114607732a17bdee9fa3df0b3c8077c64c6322c082 aluhist_sm89_v7.cubin +28799703bdcafb40d4595cfe265f5eea1a4bc7cda1f626430fdf1efded6b56b5 aluhist_sm89_v8.cubin +feda95f1bac8398b2bc9f39cb5c10f6373cec5e4985589f5f8f57853e0a80577 alur7_sm89_v8base.cubin +261b804ba9d2ef115a416d52c73033f432c7a67a57a77a89db4fc7a2073577fe ctlhist_sm80_v7.cubin +bb87fa7be2b759dd67d681bad130e41434e099fa2380e0f0a4ef59f3ec8814c0 ctlhist_sm80_v8.cubin +e2b3478d335082d8b18b543562304bd02f7f877e2121d27e2f608cdc6f03670a ctlhist_sm86_v7.cubin +d766d701320cf39a32ec84fa2445db3f65dc5567e722173970d87f6489da969c ctlhist_sm86_v8.cubin +ae561bfd4b02c66a351c970b7980cf9ceac054eb4044f82f6050ae3167a8c085 ctlhist_sm89_v7.cubin +e8fac0b8b503bad6f2c12ace52292c2903311c7a88e71a6bbd6ac4b3cb39a77a ctlhist_sm89_v8.cubin +c99156d05d69eacb5aed13c9c2059dd31dc7e66005c654f0048c23e6e81c7418 neghist_sm80_v7.cubin +030106ea0b07f3e6acdb34f96b1c36425169f7fc02a0e71ba88b9929a928f859 neghist_sm80_v8.cubin +9a39a29a77b354f218fbb49942ba72171aaadc6cd36de13f1c096e40de9e6a58 neghist_sm86_v7.cubin +35925ffdf17bdbcb2ee245b25c085f1663ff2a83ed0fb0555974676949765748 neghist_sm86_v8.cubin +d949c29a75fa1d5b7a7892ee39370446e3d2c6e1e0e738001ab946bdb758a5b9 neghist_sm89_v7.cubin +7d2d598b067bdf9317a72140447a4e7bf417630e28c84ecfa09644112ca1e7e9 neghist_sm89_v8.cubin +824c3acff65239384c4121e4c4ca65db5ce086d6a5303f71b2c2f16a88eff8c1 vecadd_sm89_v8dNoTk.cubin +c0da89459dcea2fc8b36e1015133e34d7f289ef7734a2a145849ba8532505771 vecadd_sm89_v8old.cubin +b9fe4b043e9c3adc2d5552d82fb924122b4dbfdca6d4d684f08cfd6670f3cd6e vecaddhist_sm80_v7.cubin +8a46a0112a8649d159ef3be7c87a7bd207c9c3df4f939e6d1d192c75d4d63ec5 vecaddhist_sm80_v8.cubin +2e166ba0b1ec2918521830d65f92a1badfb8c3601e396c4f6b4a1bc6d4044549 vecaddhist_sm86_v7.cubin +fcbb97f8bceefd807ab0591b5b72dd3e3479dc77d08ab3387989705835aa068a vecaddhist_sm86_v8.cubin +2e71dc66b564dc15174d3c059aed10189485da1e5a637dfa49bc3e6f42e196e0 vecaddhist_sm89_v7.cubin +c0da89459dcea2fc8b36e1015133e34d7f289ef7734a2a145849ba8532505771 vecaddhist_sm89_v8.cubin +$ sh kernels/src/oracle.sh /tmp/gbf/hist/*.cubin +oracle: Build cuda_13.0.r13.0/compiler.36400806_0; GNU readelf (GNU Binutils for Ubuntu) 2.42 +PASS hdr aluhist_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo aluhist_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode aluhist_sm80_v7 nvdisasm exit 0 +FAIL regs aluhist_sm80_v7 REG 16, highest register R15, want at least 18 +FAIL sb aluhist_sm80_v7 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr aluhist_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +FAIL tkinfo aluhist_sm80_v8 .note.nv.tkinfo sections: 0 +PASS decode aluhist_sm80_v8 nvdisasm exit 0 +FAIL regs aluhist_sm80_v8 REG 16, highest register R15, want at least 18 +FAIL sb aluhist_sm80_v8 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr aluhist_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo aluhist_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode aluhist_sm86_v7 nvdisasm exit 0 +FAIL regs aluhist_sm86_v7 REG 16, highest register R15, want at least 18 +FAIL sb aluhist_sm86_v7 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr aluhist_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +FAIL tkinfo aluhist_sm86_v8 .note.nv.tkinfo sections: 0 +PASS decode aluhist_sm86_v8 nvdisasm exit 0 +FAIL regs aluhist_sm86_v8 REG 16, highest register R15, want at least 18 +FAIL sb aluhist_sm86_v8 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr aluhist_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo aluhist_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode aluhist_sm89_v7 nvdisasm exit 0 +FAIL regs aluhist_sm89_v7 REG 16, highest register R15, want at least 18 +FAIL sb aluhist_sm89_v7 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr aluhist_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +FAIL tkinfo aluhist_sm89_v8 .note.nv.tkinfo sections: 0 +PASS decode aluhist_sm89_v8 nvdisasm exit 0 +FAIL regs aluhist_sm89_v8 REG 16, highest register R15, want at least 18 +FAIL sb aluhist_sm89_v8 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr alur7_sm89_v8base OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +PASS tkinfo alur7_sm89_v8base .note.nv.tkinfo sections: 1 +PASS decode alur7_sm89_v8base nvdisasm exit 0 +PASS regs alur7_sm89_v8base REG 18, highest register R15, want at least 18 +FAIL sb alur7_sm89_v8base 30 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr ctlhist_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo ctlhist_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode ctlhist_sm80_v7 nvdisasm exit 0 +FAIL regs ctlhist_sm80_v7 REG 16, highest register R14, want at least 17 +FAIL sb ctlhist_sm80_v7 48 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr ctlhist_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +FAIL tkinfo ctlhist_sm80_v8 .note.nv.tkinfo sections: 0 +PASS decode ctlhist_sm80_v8 nvdisasm exit 0 +FAIL regs ctlhist_sm80_v8 REG 16, highest register R14, want at least 17 +FAIL sb ctlhist_sm80_v8 48 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr ctlhist_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo ctlhist_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode ctlhist_sm86_v7 nvdisasm exit 0 +FAIL regs ctlhist_sm86_v7 REG 16, highest register R14, want at least 17 +FAIL sb ctlhist_sm86_v7 48 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr ctlhist_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +FAIL tkinfo ctlhist_sm86_v8 .note.nv.tkinfo sections: 0 +PASS decode ctlhist_sm86_v8 nvdisasm exit 0 +FAIL regs ctlhist_sm86_v8 REG 16, highest register R14, want at least 17 +FAIL sb ctlhist_sm86_v8 48 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr ctlhist_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo ctlhist_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode ctlhist_sm89_v7 nvdisasm exit 0 +FAIL regs ctlhist_sm89_v7 REG 16, highest register R14, want at least 17 +FAIL sb ctlhist_sm89_v7 48 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr ctlhist_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +FAIL tkinfo ctlhist_sm89_v8 .note.nv.tkinfo sections: 0 +PASS decode ctlhist_sm89_v8 nvdisasm exit 0 +FAIL regs ctlhist_sm89_v8 REG 16, highest register R14, want at least 17 +FAIL sb ctlhist_sm89_v8 48 instructions, shortest set-to-wait 1 cycles, 2 shorter than 2: 0040->0050 00a0->00b0 +PASS hdr neghist_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo neghist_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode neghist_sm80_v7 nvdisasm exit 0 +PASS regs neghist_sm80_v7 REG 16, highest register R9, want at least 12 +PASS sb neghist_sm80_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neghist_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +FAIL tkinfo neghist_sm80_v8 .note.nv.tkinfo sections: 0 +PASS decode neghist_sm80_v8 nvdisasm exit 0 +PASS regs neghist_sm80_v8 REG 16, highest register R9, want at least 12 +PASS sb neghist_sm80_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neghist_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo neghist_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode neghist_sm86_v7 nvdisasm exit 0 +PASS regs neghist_sm86_v7 REG 16, highest register R9, want at least 12 +PASS sb neghist_sm86_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neghist_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +FAIL tkinfo neghist_sm86_v8 .note.nv.tkinfo sections: 0 +PASS decode neghist_sm86_v8 nvdisasm exit 0 +PASS regs neghist_sm86_v8 REG 16, highest register R9, want at least 12 +PASS sb neghist_sm86_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neghist_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo neghist_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode neghist_sm89_v7 nvdisasm exit 0 +PASS regs neghist_sm89_v7 REG 16, highest register R9, want at least 12 +PASS sb neghist_sm89_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr neghist_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +FAIL tkinfo neghist_sm89_v8 .note.nv.tkinfo sections: 0 +PASS decode neghist_sm89_v8 nvdisasm exit 0 +PASS regs neghist_sm89_v8 REG 16, highest register R9, want at least 12 +PASS sb neghist_sm89_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm89_v8dNoTk OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +FAIL tkinfo vecadd_sm89_v8dNoTk .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm89_v8dNoTk nvdisasm exit 0 +PASS regs vecadd_sm89_v8dNoTk REG 12, highest register R9, want at least 12 +PASS sb vecadd_sm89_v8dNoTk 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecadd_sm89_v8old OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +FAIL tkinfo vecadd_sm89_v8old .note.nv.tkinfo sections: 0 +PASS decode vecadd_sm89_v8old nvdisasm exit 0 +PASS regs vecadd_sm89_v8old REG 16, highest register R9, want at least 12 +PASS sb vecadd_sm89_v8old 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecaddhist_sm80_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x500550, want 0x33 7 0x500550 +PASS tkinfo vecaddhist_sm80_v7 .note.nv.tkinfo sections: 0 +PASS decode vecaddhist_sm80_v7 nvdisasm exit 0 +PASS regs vecaddhist_sm80_v7 REG 16, highest register R9, want at least 12 +PASS sb vecaddhist_sm80_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecaddhist_sm80_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005004, want 0x41 8 0x6005004 +FAIL tkinfo vecaddhist_sm80_v8 .note.nv.tkinfo sections: 0 +PASS decode vecaddhist_sm80_v8 nvdisasm exit 0 +PASS regs vecaddhist_sm80_v8 REG 16, highest register R9, want at least 12 +PASS sb vecaddhist_sm80_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecaddhist_sm86_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x560556, want 0x33 7 0x560556 +PASS tkinfo vecaddhist_sm86_v7 .note.nv.tkinfo sections: 0 +PASS decode vecaddhist_sm86_v7 nvdisasm exit 0 +PASS regs vecaddhist_sm86_v7 REG 16, highest register R9, want at least 12 +PASS sb vecaddhist_sm86_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecaddhist_sm86_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005604, want 0x41 8 0x6005604 +FAIL tkinfo vecaddhist_sm86_v8 .note.nv.tkinfo sections: 0 +PASS decode vecaddhist_sm86_v8 nvdisasm exit 0 +PASS regs vecaddhist_sm86_v8 REG 16, highest register R9, want at least 12 +PASS sb vecaddhist_sm86_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecaddhist_sm89_v7 OSABI 0x33 ABIVERSION 7 e_flags 0x590559, want 0x33 7 0x590559 +PASS tkinfo vecaddhist_sm89_v7 .note.nv.tkinfo sections: 0 +PASS decode vecaddhist_sm89_v7 nvdisasm exit 0 +PASS regs vecaddhist_sm89_v7 REG 16, highest register R9, want at least 12 +PASS sb vecaddhist_sm89_v7 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +PASS hdr vecaddhist_sm89_v8 OSABI 0x41 ABIVERSION 8 e_flags 0x6005904, want 0x41 8 0x6005904 +FAIL tkinfo vecaddhist_sm89_v8 .note.nv.tkinfo sections: 0 +PASS decode vecaddhist_sm89_v8 nvdisasm exit 0 +PASS regs vecaddhist_sm89_v8 REG 16, highest register R9, want at least 12 +PASS sb vecaddhist_sm89_v8 20 instructions, shortest set-to-wait 2 cycles, 0 shorter than 2 +exit 1 diff --git a/kernels/.crumb b/kernels/.crumb index b57ecbc..3281b8b 100644 --- a/kernels/.crumb +++ b/kernels/.crumb @@ -3,17 +3,17 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-27T00:24:36Z", + "compiled_at": "2026-10-27T08:13:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:4b47ab98285a3fe89acf7a5caee2a2e841fdfb55d3f7d7251590ff561f701da1", + "digest": "sha256:71fbdee0d9edf423514e31ae369794db46597a939973e8d20910ccfae735e0f0", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 11, - "generated_at_commit": "400ded3e143a26fd8e495ff3f7c5214f9153a08f", - "source_tree": "sha256:b156040adeb9e27fac3d4ca79316647a37f0b86ea732320aa66535d886849253" + "generated_at_commit": "be6e65acafa9f75e705a308100bc5ddec8bfaa66", + "source_tree": "sha256:db7d2f9eaf031c2d673f6317bee1edbaac3428b788349e2c9d1cf2ee357d0220" } }, "name": "kernels", - "purpose": "six Omega-encoded v7 cubins (vecadd/neg for sm_80/86/89), their sources and the byte-for-byte rebuild", + "purpose": "six Omega-encoded v7 cubins (vecadd/neg for sm_80/86/89), their sources and the byte-for-byte rebuild; 24 pending alu/ctl/vecadd/neg v7+v8 images (hashes only, kept out of the kit until a chip run) and the read-only nvdisasm/cuobjdump/readelf oracle", "schema_version": "1.0.0" } diff --git a/kernels/pending/SHA256SUMS b/kernels/pending/SHA256SUMS new file mode 100644 index 0000000..c034393 --- /dev/null +++ b/kernels/pending/SHA256SUMS @@ -0,0 +1,24 @@ +bcc824209d99f6fc47a1155f9e2d4566b84509e2d26b8d647a5a3a4a1552acb2 alu_sm80_v7.cubin +b19bfa94ed96658bb420cc4c24412a75b8f1960bee72b8891e89c2aba52e5385 alu_sm80_v8.cubin +c8713268d8882dc86a2c6c06cdc575f74a69ea7d39f85259029b2c08d670f790 alu_sm86_v7.cubin +a2ae2898a71ba984b3cb84bebe3d2c0e566d833f3db41b9da557f52cf54e0b68 alu_sm86_v8.cubin +bf424eeb8e25dc826cac7cfdaaba153d33d6b091e12773a678661d2c25358a6a alu_sm89_v7.cubin +6125315e7669eab4864e5419bdcca79286656c6f79f00428b1c0b697c9641753 alu_sm89_v8.cubin +c30fd11e7c69f1744ef48f1dba8137728cc0174f7f731724c2908c70f5d04f5a ctl_sm80_v7.cubin +0c6da5978d83a2c9f4684f814d1bee5bbfa1a8ec754967dbb3e0333d1d9c6ea5 ctl_sm80_v8.cubin +c8730a4e1a84871b52d3516b3a3bb0578a97ebdd59e8ebc73b2826649ad81c43 ctl_sm86_v7.cubin +71eab0c2b01f0a032a4a00b5fd4dd24842386da54314d7ec1643b35aaaa57923 ctl_sm86_v8.cubin +e59a652e134b4905a725eb87415096bdc807c5dab50c5a736926b1f97567f414 ctl_sm89_v7.cubin +804d49bfae5a410ea1c8a2e1ce03dfa9bf5add2a4bde2306a369466617a7df08 ctl_sm89_v8.cubin +c99156d05d69eacb5aed13c9c2059dd31dc7e66005c654f0048c23e6e81c7418 neg_sm80_v7.cubin +8905aeb42afaf61afdcdc137b0ea760446453834d5b3bf71dab2a40be77381d2 neg_sm80_v8.cubin +9a39a29a77b354f218fbb49942ba72171aaadc6cd36de13f1c096e40de9e6a58 neg_sm86_v7.cubin +2fedd356ebf5a54ae4fe755a4ab71e8b7fedcd0aef763b5c1b08eb1fec1daec9 neg_sm86_v8.cubin +d949c29a75fa1d5b7a7892ee39370446e3d2c6e1e0e738001ab946bdb758a5b9 neg_sm89_v7.cubin +be8cc535e9de3f60ed468265a6d6f719cb6daf4c4af82982737f0c5506a711f7 neg_sm89_v8.cubin +b9fe4b043e9c3adc2d5552d82fb924122b4dbfdca6d4d684f08cfd6670f3cd6e vecadd_sm80_v7.cubin +d78e1268a498705153b14d14e4e9ca834f421537d4b64a16b5a75fd156bf16af vecadd_sm80_v8.cubin +2e166ba0b1ec2918521830d65f92a1badfb8c3601e396c4f6b4a1bc6d4044549 vecadd_sm86_v7.cubin +23e4f1acfcef6de0284d81f5c96ab83a1c3bc86a715f29337b0310c0d685af4e vecadd_sm86_v8.cubin +2e71dc66b564dc15174d3c059aed10189485da1e5a637dfa49bc3e6f42e196e0 vecadd_sm89_v7.cubin +24ab79757782d8fa5e58b51dab211f85a32d0e4730bdf25702192f426ddc4423 vecadd_sm89_v8.cubin diff --git a/kernels/src/alu.s2 b/kernels/src/alu.s2 new file mode 100644 index 0000000..9e7a4fd --- /dev/null +++ b/kernels/src/alu.s2 @@ -0,0 +1,165 @@ +; alu.s2 -- integer and float ALU on sm_80, out of one 32-bit input per thread: +; oi[i] = (y = rotl(x ^ 0x5a5a5a5a, 7) * 0x9e3779b1 + i) > 0x80000000 ? y : x +; of[i] = (unsigned)(((float)(x & 0xffff) * 0.5f + 3.0f) squared) x = a[i], i < n +; Parameters: a 0x160, oi 0x168, of 0x170, n 0x178 (cubin signature pppu). +; Written by hand in asm2's language with the names of sm80.tbl, CUDA ABI constant bank +; (c[0x0][0x0] blockDim.x, 0x28 stack top, parameters from 0x160): the layout NVIDIA's driver fills +; when the kernel is loaded through cuModuleLoadData (seed/sm80/cubin.om writes the matching .nv.info). +; Schedule, conservative on purpose: every fixed-latency instruction stalls 15 cycles; every +; variable-latency one (NAK's has_fixed_latency, `NAKREF_LAT=1 nakref listing`) sets a scoreboard +; and the next instruction that needs anything waits on all six (mask 63). A scoreboard is armed +; 2 cycles after the instruction that sets it issues (Mesa NAK calc_instr_deps.rs, `bars[bar] + 2`), +; so a setter whose next instruction waits stalls 2, not 1: instructions 4 and 10 stalled 1, the +; wait at 11 could miss scoreboard 2 and IMAD.WIDE at 14 read a stale R6 (wrong words or an address +; fault on an RTX 4090). cubin.om refuses such a listing with exit 7. +; Referee: `nakref listing 80 ` must give the same bytes as asm2 + sm80.tbl. +; 0 LDC R1, c[0x0][0x28] stack top (CUDA ABI) + ldc.0 7 1 255 + cb.1 0x28 0 + ldc.2 4 0 + c 1 1 7 7 0 0 +; 1 S2R R9, SR_CTAID.X + s2r.0 7 9 + z.1 + s2r.2 0x25 + c 1 1 0 7 0 0 +; 2 ULDC UR4, c[0x0][0x0] blockDim.x + uldc.0 7 4 + cb.1 0x0 0 + uldc.2 4 + c 1 1 1 7 0 0 +; 3 S2R R0, SR_TID.X + s2r.0 7 0 + z.1 + s2r.2 0x21 + c 1 1 2 7 0 0 +; 4 ULDC UR5, c[0x0][0x178] n + uldc.0 7 5 + cb.1 0x178 0 + uldc.2 4 + c 2 1 3 7 0 0 +; 5 IMAD R9, R9, UR4, R0 i = block * blockDim + thread + imad.u.0 7 9 9 + u.1 4 + imad.u.2 0 0 + c 15 0 7 7 63 0 +; 6 ISETP.GE.U32.AND P0, PT, R9, UR5, PT + isetp.u.0 7 9 + u.1 5 + isetp.u.2 7 0 0 0 6 0 7 + c 15 0 7 7 0 0 +; 7 @P0 EXIT + exit.0 0 + z.1 + exit.2 + c 5 1 7 7 0 0 +; 8 LDC.64 R2, c[0x0][0x160] first pointer + ldc.0 7 2 255 + cb.1 0x160 0 + ldc.2 5 0 + c 1 1 0 7 0 0 +; 9 LDC.64 R4, c[0x0][0x168] second pointer + ldc.0 7 4 255 + cb.1 0x168 0 + ldc.2 5 0 + c 1 1 1 7 0 0 +; 10 LDC.64 R6, c[0x0][0x170] third pointer + ldc.0 7 6 255 + cb.1 0x170 0 + ldc.2 5 0 + c 2 1 2 7 0 0 +; 11 IMAD.WIDE.U32 R2, R9, 0x4, R2 + imadw.i.0 7 2 9 + n.1 4 + imad.2 2 0 + c 15 0 7 7 63 0 +; 12 LDG.E R10, [R2.64] + ldg.0 7 10 2 + ldg.1 63 0 + ldg.2 0 1 4 7 1 1 + c 2 1 3 7 0 0 +; 13 IMAD.WIDE.U32 R4, R9, 0x4, R4 + imadw.i.0 7 4 9 + n.1 4 + imad.2 4 0 + c 15 0 7 7 0 0 +; 14 IMAD.WIDE.U32 R6, R9, 0x4, R6 + imadw.i.0 7 6 9 + n.1 4 + imad.2 6 0 + c 15 0 7 7 0 0 +; 15 LOP3.LUT R11, R10, 0x5a5a5a5a, RZ, 0x3c y = x ^ 0x5a5a5a5a + lop3.i.0 7 11 10 + n.1 0x5a5a5a5a + lop3.2 255 0x3c + c 15 0 7 7 63 0 +; 16 SHF.L.W.U32.HI R11, R11, 0x7, R11 y = rotl(y, 7) + shf.i.0 7 11 11 + n.1 7 + shf.2 11 3 1 0 1 + c 15 0 7 7 0 0 +; 17 IMAD R11, R11, 0x9e3779b1, R9 y = y * 0x9e3779b1 + i + imad.i.0 7 11 11 + n.1 0x9e3779b1 + imad.2 9 0 + c 15 0 7 7 0 0 +; 18 ISETP.GT.U32.AND P0, PT, R11, 0x80000000, PT + isetp.i.0 7 11 + n.1 0x80000000 + isetp.2 7 0 0 0 4 0 7 + c 15 0 7 7 0 0 +; 19 SEL R12, R11, R10, P0 z = y > 0x80000000 ? y : x + sel.0 7 12 11 + r.1 10 + sel.2 0 + c 15 0 7 7 0 0 +; 20 STG.E [R4.64], R12 + stg.0 7 4 + stg.1 12 0 + stg.2 63 1 4 7 1 1 + c 2 1 7 4 0 0 +; 21 LOP3.LUT R13, R10, 0xffff, RZ, 0xc0 x & 0xffff + lop3.i.0 7 13 10 + n.1 0xffff + lop3.2 255 0xc0 + c 15 0 7 7 0 0 +; 22 I2F.U32 R13, R13 (float) + i2f.0 7 13 + r.1 13 + i2f.2 0 2 0 2 + c 2 1 0 7 0 0 +; 23 MOV R14, 0x40400000 3.0f + mov.i.0 7 14 + n.1 0x40400000 + mov.2 15 + c 15 0 7 7 0 0 +; 24 FFMA R13, R13, 0.5, R14 f * 0.5 + 3 + ffma.i.0 7 13 13 + n.1 0x3f000000 + ffma.2 14 0 0 0 0 + c 15 0 7 7 63 0 +; 25 FMUL R13, R13, R13 + fmul.0 7 13 13 + r.1 13 + fmul.2 0 0 0 0 + c 15 0 7 7 0 0 +; 26 F2I.U32.TRUNC R15, R13 + f2i.0 7 15 + r.1 13 + f2i.2 0 2 3 0 2 + c 2 1 1 7 0 0 +; 27 STG.E [R6.64], R15 + stg.0 7 6 + stg.1 15 0 + stg.2 63 1 4 7 1 1 + c 2 1 7 5 63 0 +; 28 EXIT after every scoreboard + exit.0 7 + z.1 + exit.2 + c 5 1 7 7 63 0 +; 29 BRA to itself + bra.0 7 + bra.1 0x0fffffff + bra.2 -1 7 + c 0 0 7 7 0 0 diff --git a/kernels/src/build.sh b/kernels/src/build.sh index 3779d9d..3523b4e 100755 --- a/kernels/src/build.sh +++ b/kernels/src/build.sh @@ -1,5 +1,7 @@ #!/bin/sh -# kernels/src/build.sh -- rebuild every kernel in kernels/ from source and compare with kernels/SHA256SUMS. +# kernels/src/build.sh -- rebuild every kernel in kernels/ from source and compare with kernels/SHA256SUMS; +# build the pending images (not in the kit) and compare with kernels/pending/SHA256SUMS; run the +# packer's negative controls. # # kernels/src/build.sh OMEGA_MV_CHECKOUT [OUT_DIR] # @@ -11,17 +13,22 @@ # The kernel sources and the cubin writer are in this directory: # vecadd.cuda.s2 c[i] = a[i] + b[i], hand-written for asm2 with the CUDA kernel-parameter ABI # neg.cuda.s2 the same with one operand changed (R4 for R5): the run's negative control -# cubin.om wraps asm2 machine code in a cubin (CUDA 12 style container, "v7") -# vecadd.cuda.s2 and cubin.om are copies of files in the CudaArch lane's omega-mv worktree that are not -# yet committed to omega-mv; their sha256 are pinned below until they land there. -# Exit 0 when all six rebuilt cubins equal kernels/SHA256SUMS, 1 otherwise. Runs on aarch64 Linux only -# (CI: GitHub's ubuntu-24.04-arm). The script is coordination only; every byte comes from Omega tools. +# alu.s2 integer and float ALU probe (pending: not in the kit) +# ctl.s2 divergent loop, if/else, warp reduction, atomic (pending: not in the kit) +# cubin.om wraps asm2 machine code in a cubin: container v7 (CUDA 12 style) or v8 (CUDA 13) +# cubin.om is the ck/cubin-om version (omega-mv draft #864, 76639738a) plus the scoreboard check +# (exit 7); alu.s2 and ctl.s2 are the same branch's listings with the scoreboard fix. None of them is +# in omega-mv main yet, so cubin.om's sha256 is pinned below until it lands there. +# Exit 0 when the six kit cubins equal kernels/SHA256SUMS, the pending cubins equal +# kernels/pending/SHA256SUMS and every negative control is refused; 1 otherwise. Runs on aarch64 Linux +# only (CI: GitHub's ubuntu-24.04-arm). The script is coordination only; every byte comes from Omega +# tools. set -eu MV=${1:?usage: kernels/src/build.sh OMEGA_MV_CHECKOUT [OUT_DIR]} SRC=$(cd "$(dirname "$0")" && pwd) KER=$(dirname "$SRC") OUT=${2:-$(mktemp -d)} -mkdir -p "$OUT" +mkdir -p "$OUT/pending" "$OUT/negative" fail=0 pin() { # pin FILE SHA256 got=$(sha256sum "$1" | cut -d' ' -f1) @@ -32,15 +39,20 @@ pin() { # pin FILE SHA256 pin "$MV/seed/out/omc" 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f pin "$MV/seed/rung2/asm2.bin" 6988abe072fac3cdef2240d5ad13a3ecd8fb576fa09112d344b9e7c2315969c4 pin "$MV/seed/sm80/sm80.tbl" c77a731d07498fbd16410a2be385adfacb0fe0e3b11000cf3126bf882115670f -pin "$SRC/cubin.om" 8f2c7f5d56410233f162479b300c91fb30b19183bf4f89400efa5d00255289e9 +pin "$SRC/cubin.om" e40ea98d40533512b91297711963743db4d44d83edd014d703fc1f4dcf9dde50 "$MV/seed/out/omc" < "$SRC/cubin.om" > "$OUT/cubin" chmod +x "$OUT/cubin" +asm() { # asm LISTING OUT.bin + cat "$MV/seed/sm80/sm80.tbl" "$1" | "$MV/seed/rung2/asm2.bin" > "$2" +} + +# The kit: container v7, API 128, params pppu. REGS 14 (the cubin records 16, as the published kit +# always did; vecadd needs 10). for k in vecadd neg; do - cat "$MV/seed/sm80/sm80.tbl" "$SRC/$k.cuda.s2" | "$MV/seed/rung2/asm2.bin" > "$OUT/$k.bin" + asm "$SRC/$k.cuda.s2" "$OUT/$k.bin" for sm in 80 86 89; do - # cubin SM ABI API REGS NAME SIG: container v7 (CUDA 12 style), API 128, 16 registers, params pppu - "$OUT/cubin" $sm 7 128 16 $k pppu < "$OUT/$k.bin" > "$OUT/${k}_sm${sm}_v7.cubin" + "$OUT/cubin" $sm 7 128 14 $k pppu < "$OUT/$k.bin" > "$OUT/${k}_sm${sm}_v7.cubin" done done (cd "$OUT" && sha256sum *_v7.cubin) > "$OUT/SHA256SUMS" @@ -50,4 +62,41 @@ else echo "FAIL: rebuilt cubins differ from kernels/SHA256SUMS"; diff "$KER/SHA256SUMS" "$OUT/SHA256SUMS" || true fail=1 fi + +# Pending images: every kernel in containers v7 (API 128) and v8 (API 130) for sm_80, sm_86 and +# sm_89. REGS is the highest register a listing names plus 1 (alu R15, ctl R14, vecadd/neg R9 + the +# kit's 14). They wait for a chip run on each architecture before any joins the kit. +asm "$SRC/alu.s2" "$OUT/alu.bin" +asm "$SRC/ctl.s2" "$OUT/ctl.bin" +for k in vecadd:14 neg:14 alu:16 ctl:15; do + n=${k%:*}; r=${k#*:} + for sm in 80 86 89; do + "$OUT/cubin" $sm 7 128 $r $n pppu < "$OUT/$n.bin" > "$OUT/pending/${n}_sm${sm}_v7.cubin" + "$OUT/cubin" $sm 8 130 $r $n pppu < "$OUT/$n.bin" > "$OUT/pending/${n}_sm${sm}_v8.cubin" + done +done +(cd "$OUT/pending" && sha256sum *.cubin) > "$OUT/pending/SHA256SUMS" +if cmp -s "$OUT/pending/SHA256SUMS" "$KER/pending/SHA256SUMS"; then + echo "PASS: 24 pending cubins rebuilt from source are byte-identical to kernels/pending/SHA256SUMS" +else + echo "FAIL: pending cubins differ from kernels/pending/SHA256SUMS" + diff "$KER/pending/SHA256SUMS" "$OUT/pending/SHA256SUMS" || true + fail=1 +fi + +# Negative controls: the packer must refuse each of these with the named exit code. +refuse() { # refuse WANT LABEL BIN ARGS... + want=$1 label=$2 bin=$3; shift 3 + rc=0; "$OUT/cubin" "$@" < "$bin" > "$OUT/negative/out.cubin" || rc=$? + if [ $rc -eq "$want" ]; then echo "PASS: refused ($label, exit $rc)"; else echo "FAIL: $label gave exit $rc, want $want"; fail=1; fi +} +# alu/ctl as they ran on the RTX 4090: instructions 4 and 10 stall 1 cycle before a wait. +for k in alu ctl; do + awk '/^; 4 ULDC UR5/ || /^; 10 LDC.64 R6/ { m = 1 } m && /^ c 2 1 / { sub(/^ c 2 1 /, " c 1 1 "); m = 0 } { print }' \ + "$SRC/$k.s2" > "$OUT/negative/$k.stall1.s2" + asm "$OUT/negative/$k.stall1.s2" "$OUT/negative/$k.stall1.bin" + refuse 7 "$k scoreboard waited 1 cycle after it was set" "$OUT/negative/$k.stall1.bin" 89 7 128 16 $k pppu +done +# alu writes R15: REGS 15 leaves it outside the allocation (the original 715 ILLEGAL_INSTRUCTION). +refuse 6 "alu REGS 15 below R15" "$OUT/alu.bin" 89 7 128 15 alu pppu exit $fail diff --git a/kernels/src/ctl.s2 b/kernels/src/ctl.s2 new file mode 100644 index 0000000..798035e --- /dev/null +++ b/kernels/src/ctl.s2 @@ -0,0 +1,256 @@ +; ctl.s2 -- control flow on sm_80: a divergent loop, a divergent if/else (BSSY/BSYNC reconvergence), +; a warp butterfly reduction (SHFL.BFLY) and a global atomic (RED.ADD): +; k = a[i] & 15; s = sum of j*j for j < k; s = i odd ? s ^ 0xff : s + 3; o[i] = s +; *sum += (sum of s over the warp), added once per warp by lane 0 i < n +; Parameters: a 0x160, o 0x168, sum 0x170, n 0x178 (cubin signature pppu). Launch whole warps (n a +; multiple of 32): the reduction assumes all 32 lanes are present. +; Written by hand in asm2's language with the names of sm80.tbl, CUDA ABI constant bank +; (c[0x0][0x0] blockDim.x, 0x28 stack top, parameters from 0x160): the layout NVIDIA's driver fills +; when the kernel is loaded through cuModuleLoadData (seed/sm80/cubin.om writes the matching .nv.info). +; Schedule, conservative on purpose: every fixed-latency instruction stalls 15 cycles; every +; variable-latency one (NAK's has_fixed_latency, `NAKREF_LAT=1 nakref listing`) sets a scoreboard +; and the next instruction that needs anything waits on all six (mask 63). A scoreboard is armed +; 2 cycles after the instruction that sets it issues (Mesa NAK calc_instr_deps.rs, `bars[bar] + 2`), +; so a setter whose next instruction waits stalls 2, not 1 (instructions 4 and 10 stalled 1 before; +; ctl passed on chip anyway, the same race broke alu). cubin.om refuses such a listing with exit 7. +; Referee: `nakref listing 80 ` must give the same bytes as asm2 + sm80.tbl. +; 0 LDC R1, c[0x0][0x28] stack top (CUDA ABI) + ldc.0 7 1 255 + cb.1 0x28 0 + ldc.2 4 0 + c 1 1 7 7 0 0 +; 1 S2R R9, SR_CTAID.X + s2r.0 7 9 + z.1 + s2r.2 0x25 + c 1 1 0 7 0 0 +; 2 ULDC UR4, c[0x0][0x0] blockDim.x + uldc.0 7 4 + cb.1 0x0 0 + uldc.2 4 + c 1 1 1 7 0 0 +; 3 S2R R0, SR_TID.X + s2r.0 7 0 + z.1 + s2r.2 0x21 + c 1 1 2 7 0 0 +; 4 ULDC UR5, c[0x0][0x178] n + uldc.0 7 5 + cb.1 0x178 0 + uldc.2 4 + c 2 1 3 7 0 0 +; 5 IMAD R9, R9, UR4, R0 i = block * blockDim + thread + imad.u.0 7 9 9 + u.1 4 + imad.u.2 0 0 + c 15 0 7 7 63 0 +; 6 ISETP.GE.U32.AND P0, PT, R9, UR5, PT + isetp.u.0 7 9 + u.1 5 + isetp.u.2 7 0 0 0 6 0 7 + c 15 0 7 7 0 0 +; 7 @P0 EXIT + exit.0 0 + z.1 + exit.2 + c 5 1 7 7 0 0 +; 8 LDC.64 R2, c[0x0][0x160] first pointer + ldc.0 7 2 255 + cb.1 0x160 0 + ldc.2 5 0 + c 1 1 0 7 0 0 +; 9 LDC.64 R4, c[0x0][0x168] second pointer + ldc.0 7 4 255 + cb.1 0x168 0 + ldc.2 5 0 + c 1 1 1 7 0 0 +; 10 LDC.64 R6, c[0x0][0x170] third pointer + ldc.0 7 6 255 + cb.1 0x170 0 + ldc.2 5 0 + c 2 1 2 7 0 0 +; 11 IMAD.WIDE.U32 R2, R9, 0x4, R2 + imadw.i.0 7 2 9 + n.1 4 + imad.2 2 0 + c 15 0 7 7 63 0 +; 12 LDG.E R10, [R2.64] + ldg.0 7 10 2 + ldg.1 63 0 + ldg.2 0 1 4 7 1 1 + c 2 1 3 7 0 0 +; 13 IMAD.WIDE.U32 R4, R9, 0x4, R4 + imadw.i.0 7 4 9 + n.1 4 + imad.2 4 0 + c 15 0 7 7 0 0 +; 14 LOP3.LUT R10, R10, 0xf, RZ, 0xc0 k = a[i] & 15 + lop3.i.0 7 10 10 + n.1 0xf + lop3.2 255 0xc0 + c 15 0 7 7 63 0 +; 15 MOV R11, 0x0 s + mov.i.0 7 11 + n.1 0 + mov.2 15 + c 15 0 7 7 0 0 +; 16 MOV R12, 0x0 j + mov.i.0 7 12 + n.1 0 + mov.2 15 + c 15 0 7 7 0 0 +; 17 BSSY B0, to 24 (loop reconvergence) + bssy.0 7 0 + bssy.1 6 + bssy.2 7 + c 15 0 7 7 0 0 +; 18 loop: ISETP.GE.U32.AND P1, PT, R12, R10, PT + isetp.0 7 12 + r.1 10 + isetp.2 7 0 0 0 6 1 7 + c 15 0 7 7 0 0 +; 19 @P1 BRA to 23 + bra.0 1 + bra.1 3 + bra.2 0 7 + c 5 1 7 7 0 0 +; 20 IMAD R11, R12, R12, R11 s += j * j + imad.0 7 11 12 + r.1 12 + imad.2 11 0 + c 15 0 7 7 0 0 +; 21 IADD3 R12, R12, 0x1, RZ j++ + iadd3.i.0 7 12 12 + n.1 1 + iadd3.2 255 7 7 + c 15 0 7 7 0 0 +; 22 BRA to 18 (back) + bra.0 7 + bra.1 0x0ffffffb + bra.2 -1 7 + c 5 1 7 7 0 0 +; 23 BSYNC B0 + bsync.0 7 0 + z.1 + bsync.2 7 + c 15 0 7 7 0 0 +; 24 LOP3.LUT R13, R9, 0x1, RZ, 0xc0 i & 1 + lop3.i.0 7 13 9 + n.1 1 + lop3.2 255 0xc0 + c 15 0 7 7 0 0 +; 25 ISETP.NE.U32.AND P0, PT, R13, 0x0, PT + isetp.i.0 7 13 + n.1 0 + isetp.2 7 0 0 0 5 0 7 + c 15 0 7 7 0 0 +; 26 BSSY B1, to 32 (if/else reconvergence) + bssy.0 7 1 + bssy.1 5 + bssy.2 7 + c 15 0 7 7 0 0 +; 27 @P0 BRA to 30 odd lanes + bra.0 0 + bra.1 2 + bra.2 0 7 + c 5 1 7 7 0 0 +; 28 IADD3 R11, R11, 0x3, RZ even: s += 3 + iadd3.i.0 7 11 11 + n.1 3 + iadd3.2 255 7 7 + c 15 0 7 7 0 0 +; 29 BRA to 31 + bra.0 7 + bra.1 1 + bra.2 0 7 + c 5 1 7 7 0 0 +; 30 LOP3.LUT R11, R11, 0xff, RZ, 0x3c odd: s ^= 0xff + lop3.i.0 7 11 11 + n.1 0xff + lop3.2 255 0x3c + c 15 0 7 7 0 0 +; 31 BSYNC B1 + bsync.0 7 1 + z.1 + bsync.2 7 + c 15 0 7 7 0 0 +; 32 STG.E [R4.64], R11 + stg.0 7 4 + stg.1 11 0 + stg.2 63 1 4 7 1 1 + c 2 1 7 4 0 0 +; 33 SHFL.BFLY PT, R14, R11, 0x10, 0x1f + shfl.ii.0 7 14 11 + shfl.ii.1 0x1f 16 3 + shfl.ci.2 7 + c 2 1 0 7 0 0 +; 34 IADD3 R11, R11, R14, RZ + iadd3.0 7 11 11 + r.1 14 + iadd3.2 255 7 7 + c 15 0 7 7 63 0 +; 35 SHFL.BFLY PT, R14, R11, 0x8, 0x1f + shfl.ii.0 7 14 11 + shfl.ii.1 0x1f 8 3 + shfl.ci.2 7 + c 2 1 0 7 0 0 +; 36 IADD3 R11, R11, R14, RZ + iadd3.0 7 11 11 + r.1 14 + iadd3.2 255 7 7 + c 15 0 7 7 63 0 +; 37 SHFL.BFLY PT, R14, R11, 0x4, 0x1f + shfl.ii.0 7 14 11 + shfl.ii.1 0x1f 4 3 + shfl.ci.2 7 + c 2 1 0 7 0 0 +; 38 IADD3 R11, R11, R14, RZ + iadd3.0 7 11 11 + r.1 14 + iadd3.2 255 7 7 + c 15 0 7 7 63 0 +; 39 SHFL.BFLY PT, R14, R11, 0x2, 0x1f + shfl.ii.0 7 14 11 + shfl.ii.1 0x1f 2 3 + shfl.ci.2 7 + c 2 1 0 7 0 0 +; 40 IADD3 R11, R11, R14, RZ + iadd3.0 7 11 11 + r.1 14 + iadd3.2 255 7 7 + c 15 0 7 7 63 0 +; 41 SHFL.BFLY PT, R14, R11, 0x1, 0x1f + shfl.ii.0 7 14 11 + shfl.ii.1 0x1f 1 3 + shfl.ci.2 7 + c 2 1 0 7 0 0 +; 42 IADD3 R11, R11, R14, RZ + iadd3.0 7 11 11 + r.1 14 + iadd3.2 255 7 7 + c 15 0 7 7 63 0 +; 43 LOP3.LUT R13, R0, 0x1f, RZ, 0xc0 lane + lop3.i.0 7 13 0 + n.1 0x1f + lop3.2 255 0xc0 + c 15 0 7 7 0 0 +; 44 ISETP.EQ.U32.AND P0, PT, R13, 0x0, PT + isetp.i.0 7 13 + n.1 0 + isetp.2 7 0 0 0 2 0 7 + c 15 0 7 7 0 0 +; 45 @P0 RED.E.ADD.STRONG.GPU [R6.64], R11 lane 0: *sum += warp total + red.0 0 6 + stg.1 11 0 + red.2 63 1 0 7 1 0 1 + c 2 1 7 5 0 0 +; 46 EXIT after every scoreboard + exit.0 7 + z.1 + exit.2 + c 5 1 7 7 63 0 +; 47 BRA to itself + bra.0 7 + bra.1 0x0fffffff + bra.2 -1 7 + c 0 0 7 7 0 0 diff --git a/kernels/src/cubin.om b/kernels/src/cubin.om index 6a2d426..a26bbdf 100644 --- a/kernels/src/cubin.om +++ b/kernels/src/cubin.om @@ -1,27 +1,48 @@ note cubin.om -- wraps asm2 machine code for one kernel in a cubin, the ELF that NVIDIA's CUDA note driver loads with cuModuleLoadData. It follows the CUDA kernel-parameter ABI, not CUDA++'s: -note parameters sit in constant bank 0 from byte 352 (sm_8x), 528 (sm_90) or 896 (sm_120). -note The layout was read from nvcc 13.0 and CUDA 12.8 cubins with readelf and cuobjdump -elf +note parameters sit in constant bank 0 from byte 352 (sm_8x), 528 (sm_90) or 896 (sm_100 on). +note The layout was read from nvcc 13.0 cubins of my own probe kernels with readelf and cuobjdump -elf note (field values only, no bytes copied) and from CUDApp src/omega_cubin.c (sm_121): note 1 .shstrtab 2 .strtab 3 .symtab 4 .nv.info 5 .nv.callgraph 6 .note.nv.cuinfo note 7 .text.NAME 8 .nv.constant0.NAME 9 .nv.info.NAME, and from sm_90 on also -note 10 .nv.compat 11 .nv.shared.reserved.0; then the section headers, then the program -note headers (PHDR, LOAD of the header table, LOAD text, [LOAD shared,] LOAD constant bank). +note 10 .nv.compat 11 .nv.shared.reserved.0; ABI 8 appends .note.nv.tkinfo, which every +note NVIDIA ABI 8 cubin read carries (nvcc 13.0 sm_80/89/90/100/103/120) and +note .note.nv.cuinfo links to; then the section headers, then the program headers (PHDR, +note LOAD of the header table, LOAD text, [LOAD shared,] LOAD constant bank). +note From sm_90 the .text sh_info is the kernel symbol alone (nvcc 13.0 sm_90/120); +note below sm_90 it also carries the register count in bits 24..31 (nvcc 13.0 sm_89). +note ABI 7 constants (ELFOSABI_CUDA 51, ELFABIVERSION_CUDA_V1 7, EF_CUDA_SM*) are LLVM's ELF.h. +note From sm_90 .note.nv.cuinfo has SHF_INFO_LINK and sh_info .nv.compat (nvcc 13.0 sm_90/120). note symbols: 1 section .text, 2 section .nv.constant0, 3 the kernel (global function). note usage: cubin SM ABI API REGS NAME SIG < code.bin > kernel.cubin -note SM 80 86 87 89 90 or 120 +note SM 80 86 87 89 90 100 103 or 120 (nvcc 13.0 sm_100, sm_103 and sm_120 emit the same +note vecadd instruction bytes; their cubins differ in e_flags, the compat value +note CAN_FASTPATH_FINALIZE (sm_100 9, sm_103 0, sm_120 80) and EIATTR_SW_WAR (8 on +note sm_90/100/103, 0 on sm_120)) note ABI 8 (CUDA 13 style: OS/ABI 0x41, e_flags 0x6000000 | SM << 8 | 4, or | 2 from sm_100) note or 7 (CUDA 12 style: OS/ABI 0x33, e_flags SM << 16 | 0x500 | SM; below sm_100 only) note API the EIATTR_CUDA_API_VERSION number (130 = CUDA 13.0, 128 = CUDA 12.8) -note REGS registers per thread (1..255) +note REGS general registers the code uses: highest Rn written or read, plus one, counting the +note top register of every 64- and 128-bit pair (1..253). The cubin records REGS + 2: +note from Volta on the hardware burns 2 GPRs for the program counter (Mesa NAK +note sm70.rs hw_reserved_gprs; nvcc 13.0 records highest Rn + 3, measured on three +note sm_89 kernels). Recording the bare count makes the top 2 registers illegal: +note alu/ctl with REGS 16 writing R14/R15 raised CUDA_ERROR_ILLEGAL_INSTRUCTION (715). note NAME kernel symbol, 1..32 bytes of [A-Za-z0-9_] note SIG one letter per parameter in order: p = 8-byte pointer, u = 4-byte integer (1..16) note stdin: the instruction bytes, a whole number of 16-byte instructions, below 65536 bytes, note with at least one EXIT (its offsets go into EIATTR_EXIT_INSTR_OFFSETS). -note exit 0 written; 1 usage; 2 bad number; 3 bad name or signature; 4 bad input; 5 write failed. - -text tsn ".shstrtab|.strtab|.symtab|.nv.info|.nv.callgraph|.note.nv.cuinfo|.text.|.nv.constant0.|.nv.info.|.nv.compat|.nv.shared.reserved.0|" +note exit 0 written; 1 usage; 2 bad number; 3 bad name or signature; 4 bad input; 5 write failed; +note 6 REGS below a register named in byte 2 (bits 16..23) of an instruction other than +note control flow and NOP: the destination field of the Volta+ formats. The check is +note conservative (that byte also holds uniform and barrier register numbers) and partial (it +note cannot see the top half of a register pair or source registers); +note 7 a scoreboard set less than 2 cycles before an instruction that waits on it (see sbchk). + +text tsn ".shstrtab|.strtab|.symtab|.nv.info|.nv.callgraph|.note.nv.cuinfo|.text.|.nv.constant0.|.nv.info.|.nv.compat|.nv.shared.reserved.0|.note.nv.tkinfo|" text tnv "NVIDIA Corp" +note the .note.nv.tkinfo strings: tool, tool version, build, options (the SM is appended) +text ttk "cubin.om|Aien CUDA++ cubin.om (omega-mv seed/sm80)|omega-mv seed/sm80|-arch sm_" global ob uchar 262144 global tx uchar 65536 @@ -58,6 +79,8 @@ const VPB ulong 12 const VNEW ulong 13 const VNPH ulong 14 const VRES ulong 15 +const VNSB ulong 16 +const VTK ulong 17 fn b1 o ulong x ulong to void put ob o uchar and x 255 @@ -149,6 +172,9 @@ end if or eq sm 90 eq sm 120 ok = true end +if or eq sm 100 eq sm 103 +ok = true +end if not ok exit 2 end @@ -161,7 +187,7 @@ end if or lt api 1 gt api 1000 exit 2 end -if or lt rg 1 gt rg 255 +if or lt rg 1 gt rg 253 exit 2 end put v VSM sm @@ -188,6 +214,12 @@ end if ge sm 100 put v VRES 64 end +put v VNSB get v VNS +put v VTK 0 +if eq abi 8 +put v VTK get v VNS +put v VNS add get v VNS 1 +end names sigs end @@ -257,6 +289,88 @@ end put v VTL t end +note REGS must cover every register named in byte 2 of an instruction (255 is RZ); the +note control-flow opcodes 0x940..0x95f (BRA, EXIT, BSSY, BSYNC, CALL, RET, WARPSYNC, ...) and +note NOP (0x918) keep branch offsets or nothing there and are skipped. The cubin then records +note REGS + 2 for the 2 GPRs Volta+ hardware keeps for the program counter +fn regchk to void +t = get v VTL +m = ulong 0 +i = ulong 0 +while lt i t +r = ulong get tx add i 2 +op = and or ulong get tx i shl ulong get tx add i 1 8 4095 +if ne r 255 +if ne and op 4064 2368 +if ne op 2328 +if ge r m +m = add r 1 +end +end +end +end +i = add i 16 +end +rg = get v VREG +if lt rg m +exit 6 +end +put v VREG add rg 2 +end + +note the 24 control bits 104..127 of the instruction at byte i (Volta+ layout: stall 105..108, +note yield 109, write scoreboard 110..112, read scoreboard 113..115, wait mask 116..121) +fn cbits i ulong to ulong +ret or or ulong get tx add i 13 shl ulong get tx add i 14 8 shl ulong get tx add i 15 16 +end + +note A scoreboard (0..5; 7 is none) set by an instruction is not visible to an instruction that +note issues less than 2 cycles later: waiting on it there falls through before it is armed, and +note the waiter reads a register the load has not written yet. Mesa NAK gives the rule in +note calc_instr_deps.rs (BlockDelayScheduler::process_instr: an instruction setting rd_bar or +note wr_bar starts at least `bars[bar] + 2` cycles before the first wait on it); nvcc 13.0 sm_80, +note sm_86 and sm_89 builds of my alu, vecadd and reduction probes never wait sooner than 2 +note cycles. alu.s2 waited 1 cycle after LDC.64 R6 and could compute the float output address +note from a stale R6 (RTX 4090, four rentals, drivers 580.126.09 to 615.71.09: 33 to 289 wrong +note words or an address fault 700, 716 or 717, varying run to run; a wait on any of +note instructions 12..14 cured it). +note Every path out of a setter runs through the next instruction, so the check is local: +note a setter must stall at least 1; when it stalls exactly 1, the next instruction must not +note wait on that scoreboard and must stall at least 1 itself. +fn sbchk to void +t = get v VTL +i = ulong 0 +while lt i t +c = cbits i +s = and shr c 1 15 +w = and shr c 6 7 +r = and shr c 9 7 +mk = ulong 0 +if lt w 6 +mk = shl ulong 1 w +end +if lt r 6 +mk = or mk shl ulong 1 r +end +j = add i 16 +if gt mk 0 +if eq s 0 +exit 7 +end +if and eq s 1 lt j t +d = cbits j +if ne and shr d 12 mk 0 +exit 7 +end +if eq and shr d 1 15 0 +exit 7 +end +end +end +i = j +end +end + note the EXIT instructions: the low 12 bits of the first word are 0x94d (2381) fn isexit i ulong to bool w = or ulong get tx i shl ulong get tx add i 1 8 @@ -269,12 +383,19 @@ put ob o 0 p = add o 1 j = ulong 1 st = p -n = get v VNS +nb = get v VNSB +tk = get v VTK for i ulong len tsn c = get tsn i -if lt j n +k = j +on = lt j nb +if eq j 12 +k = tk +on = gt tk 0 +end +if on if eq c 124 -put snm j sub st o +put snm k sub st o if and ge j 7 le j 9 p = nput p end @@ -345,6 +466,52 @@ b4 add o 28 get v VAPI ret add o 32 end +note decimal digits of x (10..999) at p +fn decn p ulong x ulong to ulong +q = p +if ge x 100 +put ob q uchar add 48 div x 100 +q = add q 1 +end +put ob q uchar add 48 rem div x 10 10 +put ob add q 1 uchar add 48 rem x 10 +ret add q 2 +end + +note .note.nv.tkinfo, note type 2000: a 24-byte header (word 0 is 2 as in nvcc 13.0, then 0, +note then the offsets of four strings in the table that follows), the table opening with a 0 +fn tkinfo o ulong to ulong +b4 o 12 +b4 add o 8 2000 +for i ulong len tnv +put ob add add o 12 i get tnv i +end +d = add o 24 +s = add d 24 +b4 d 2 +b4 add d 8 1 +put ob s 0 +p = add s 1 +w = add d 12 +for i ulong len ttk +c = get ttk i +if eq c 124 +put ob p 0 +p = add p 1 +b4 w sub p s +w = add w 4 +else +put ob p c +p = add p 1 +end +end +p = decn p get v VSM +put ob p 0 +e = al add p 1 4 +b4 add o 4 sub e d +ret e +end + fn textc o ulong to ulong n = get v VTL for i ulong n @@ -415,9 +582,12 @@ p = at4 o 55 4 b4 p get v VAPI p = add p 4 if eq get v VNEW 0 +if eq get v VABI 7 b1 p 1 b1 add p 1 53 -p = cbank add p 4 +p = add p 4 +end +p = cbank p p = at3 p 25 get v VPSZ p = kparams p p = at3 p 27 255 @@ -437,7 +607,10 @@ p = exits p p = at3 p 25 get v VPSZ p = cbank p p = at4 p 54 4 -if eq get v VSM 90 +if or eq get v VSM 90 eq get v VSM 100 +b4 p 8 +end +if eq get v VSM 103 b4 p 8 end ret add p 4 @@ -454,10 +627,16 @@ b4 add o 24 527108 if eq get v VSM 120 b4 add o 28 80 end +if eq get v VSM 100 +b4 add o 28 9 +end ret add o 36 end fn wsec k ulong o ulong to ulong +if eq k get v VTK +ret tkinfo o +end if eq k 1 ret shname o end @@ -506,9 +685,17 @@ f = ulong 16777216 if eq get v VNEW 1 f = 16777280 end -sec 6 7 f 0 0 +inf = ulong 0 +if eq get v VNEW 1 +inf = 10 +end +sec 6 7 f get v VTK inf sec2 6 4 0 -sec 7 1 6 3 or shl get v VREG 24 3 +ti = or shl get v VREG 24 3 +if eq get v VNEW 1 +ti = 3 +end +sec 7 1 6 3 ti sec2 7 128 0 sec 8 1 66 0 7 sec2 8 4 0 @@ -518,6 +705,11 @@ sec 10 1879048326 0 0 0 sec2 10 4 0 sec 11 8 3 0 0 sec2 11 1 0 +t = get v VTK +if gt t 0 +sec t 7 33554432 0 0 +sec2 t 4 0 +end end fn build to void @@ -637,6 +829,8 @@ exit 1 end args readin +regchk +sbchk table build ehdr diff --git a/kernels/src/oracle.sh b/kernels/src/oracle.sh new file mode 100755 index 0000000..7dbdde3 --- /dev/null +++ b/kernels/src/oracle.sh @@ -0,0 +1,107 @@ +#!/bin/sh +# kernels/src/oracle.sh -- offline checks of cubins against NVIDIA's own read-only tools, no GPU. +# +# kernels/src/oracle.sh CUBIN... +# +# Each CUBIN must be named NAME_smSS_vA.cubin (SS 80, 86 or 89; A 7 or 8). For each one: +# hdr ELF identification and e_flags. Container v7: EI_OSABI 0x33 (ELFOSABI_CUDA = 51), +# EI_ABIVERSION 7, e_flags SM | 0x500 | SM << 16 (EF_CUDA_SM*, EF_CUDA_TEXMODE_UNIFIED 0x100, +# EF_CUDA_64BIT_ADDRESS 0x400, EF_CUDA_VIRTUAL_SM 0xff0000): LLVM's BinaryFormat/ELF.h. +# Container v8: EI_OSABI 0x41, EI_ABIVERSION 8, e_flags 0x6000000 | SM << 8 | 0x4. LLVM main +# (930a3d47) names ELFABIVERSION_CUDA_V2 = 8 and EF_CUDA_SM_OFFSET = 8 but not the other bits, +# and declares ELFOSABI_CUDA_V2 = 41 in decimal; the byte nvcc 13.0 writes is 0x41, and that +# is the byte the RTX 4090 run RTX_4090-002933 loaded. The v8 values are pinned from those +# observations, not from a specification. +# tkinfo v8 has a .note.nv.tkinfo section, v7 has none. A v8 cubin without it is refused by the +# driver with CUDA_ERROR_INVALID_IMAGE (RTX_4090-002933 vecadd_sm89_v8dNoTk, RTX_5090-005123). +# decode nvdisasm decodes the whole .text without an error. +# regs the register count the driver allocates (cuobjdump -res-usage REG) is at least the highest +# general register the code touches (a .64 operand or a .WIDE/.64 destination counts its +# pair) plus 3: the 2 Volta+ hardware keeps, plus one because registers count from R0. +# alu/ctl with REG 16 writing R14/R15 raised CUDA_ERROR_ILLEGAL_INSTRUCTION (715). +# sb every scoreboard (0..5) set by an instruction is first waited on at least 2 issue cycles +# later, counting stall cycles in program order (Mesa NAK calc_instr_deps.rs: `bars[bar] + 2`). +# alu waiting 1 cycle after LDC.64 R6 read a stale R6 on an RTX 4090. +# Prints one line per check, PASS or FAIL, and exits 0 when all pass, 1 when any fails, 2 when the +# tools are missing (every check NOT_RUN). nvdisasm, cuobjdump (CUDA toolkit) and readelf (binutils) +# are read-only oracles here: they only read cubins this repository built; nothing they print goes +# into a kernel. INTERIM host glue (sh, awk); successor: an Omega cubin reader with the same checks. +set -u +CUDA=${CUDA_HOME:-/usr/local/cuda} +ND=$(command -v nvdisasm || echo "$CUDA/bin/nvdisasm") +CO=$(command -v cuobjdump || echo "$CUDA/bin/cuobjdump") +RE=$(command -v readelf || echo readelf) +for t in "$ND" "$CO" "$RE"; do + if ! command -v "$t" > /dev/null 2>&1; then + echo "NOT_RUN: $t not found (needs nvdisasm and cuobjdump from a CUDA toolkit, and readelf)"; exit 2 + fi +done +echo "oracle: $("$ND" --version | tail -n 1); $("$RE" --version | head -n 1)" +fail=0 +say() { # say CHECK FILE OK DETAIL + if [ "$3" = 1 ]; then echo "PASS $1 $2 $4"; else echo "FAIL $1 $2 $4"; fail=1; fi +} +byte() { # byte FILE OFFSET COUNT -> little-endian unsigned value + od -A n -t u1 -j "$2" -N "$3" "$1" | awk '{ for (i = NF; i >= 1; i--) v = v * 256 + $i } END { print v }' +} +for f in "$@"; do + b=$(basename "$f" .cubin) + sm=$(echo "$b" | sed -n 's/.*_sm\([0-9][0-9]*\)_v\([78]\)[A-Za-z0-9]*$/\1/p') + abi=$(echo "$b" | sed -n 's/.*_sm\([0-9][0-9]*\)_v\([78]\)[A-Za-z0-9]*$/\2/p') + if [ -z "$sm" ] || [ -z "$abi" ]; then echo "FAIL name $f not NAME_smSS_vA.cubin"; fail=1; continue; fi + osabi=$(byte "$f" 7 1) abiv=$(byte "$f" 8 1) flags=$(byte "$f" 48 4) + if [ "$abi" = 7 ]; then wo=51 wf=$((sm | 0x500 | sm << 16)); else wo=65 wf=$((0x6000000 | sm << 8 | 4)); fi + ok=0; [ "$osabi" = "$wo" ] && [ "$abiv" = "$abi" ] && [ "$flags" = "$wf" ] && ok=1 + say hdr "$b" $ok "$(printf 'OSABI 0x%x ABIVERSION %d e_flags 0x%x, want 0x%x %d 0x%x' "$osabi" "$abiv" "$flags" "$wo" "$abi" "$wf")" + # 2>/dev/null: readelf warns that .text's sh_info holds the register count in its top byte + n=$("$RE" -S -W "$f" 2>/dev/null | grep -c '\.note\.nv\.tkinfo') + if [ "$abi" = 8 ]; then ok=0; [ "$n" -ge 1 ] && ok=1; else ok=0; [ "$n" -eq 0 ] && ok=1; fi + say tkinfo "$b" $ok ".note.nv.tkinfo sections: $n" + dis=$("$ND" -hex -c "$f" 2>&1); rc=$? + ok=0; [ $rc -eq 0 ] && ! echo "$dis" | grep -qi 'error' && ok=1 + say decode "$b" $ok "nvdisasm exit $rc" + reg=$("$CO" -res-usage "$f" 2>/dev/null | sed -n 's/.*REG:\([0-9][0-9]*\).*/\1/p' | head -n 1) + top=$(echo "$dis" | awk ' + /\/\*[0-9a-f]+\*\// { + s = $0; sub(/^.*\/\*[0-9a-f]+\*\/[ \t]*/, "", s); sub(/;.*/, "", s) + sub(/^@!?U?P[0-9T][ \t]+/, "", s) + op = s; sub(/[ \t].*/, "", op); rest = s; sub(/^[^ \t]+[ \t]*/, "", rest) + first = 1; t = rest + while (match(t, /(^|[^A-Z_])R[0-9]+(\.64)?/)) { + r = substr(t, RSTART, RLENGTH); t = substr(t, RSTART + RLENGTH) + sub(/^[^R]*R/, "", r); w = (r ~ /\.64$/); sub(/\.64$/, "", r); r = r + 0 + if (first && (op ~ /\.64/ || op ~ /\.WIDE/)) w = 1 + if (op ~ /\.128/ && first) r = r + 3; else if (w) r = r + 1 + if (r > m && r != 255) m = r + first = 0 + } + } + END { print m + 0 }') + ok=0; [ -n "$reg" ] && [ "$reg" -ge $((top + 3)) ] && ok=1 + say regs "$b" $ok "REG ${reg:-?}, highest register R$top, want at least $((top + 3))" + sbr=$(echo "$dis" | awk ' + function hex(s, i, v) { v = 0; for (i = 1; i <= length(s); i++) v = v * 16 + index("0123456789abcdef", substr(s, i, 1)) - 1; return v } + /\/\*[0-9a-f]+\*\// { pc = $0; sub(/^[^\/]*\/\*/, "", pc); sub(/\*\/.*/, "", pc); want = 1; next } + want && /^[ \t]*\/\* 0x[0-9a-f]+ \*\// { + h = $0; sub(/^[ \t]*\/\* 0x/, "", h); sub(/ .*/, "", h) + c = hex(substr(h, 1, 6)); n++ + P[n] = pc; S[n] = int(c / 2) % 16; WB[n] = int(c / 64) % 8; RB[n] = int(c / 512) % 8; WT[n] = int(c / 4096) % 64 + want = 0 + } + END { + min = 99; bad = 0 + for (i = 1; i <= n; i++) for (k = 0; k < 2; k++) { + bar = k ? RB[i] : WB[i]; if (bar > 5) continue + acc = 0 + for (j = i + 1; j <= n; j++) { + acc += S[j - 1] + if (int(WT[j] / 2 ^ bar) % 2) { if (acc < min) min = acc; if (acc < 2) { bad++; where = where " " P[i] "->" P[j] } ; break } + } + } + printf "%d %d %d%s\n", n, min, bad, where + }') + n=${sbr%% *}; r=${sbr#* }; mn=${r%% *}; r=${r#* }; nb=${r%% *}; wh=${r#"$nb"} + ok=0; [ "$n" -gt 0 ] && [ "$nb" -eq 0 ] && ok=1 + say sb "$b" $ok "$n instructions, shortest set-to-wait $mn cycles, $nb shorter than 2${wh:+:$wh}" +done +exit $fail From db20835ddfb40f4fd97df75f581b3f9fe1ff6778 Mon Sep 17 00:00:00 2001 From: aien-spark Date: Tue, 27 Oct 2026 03:13:49 -0500 Subject: [PATCH 2/2] crumbs: compile after 8d4ed36 --- .crumb | 20 ++++++++++---------- kernels/.crumb | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.crumb b/.crumb index cf1f744..43c3ee9 100644 --- a/.crumb +++ b/.crumb @@ -3,8 +3,8 @@ "generated": { "children": [ { - "digest": "71fbdee0d9edf423514e31ae369794db46597a939973e8d20910ccfae735e0f0", - "last_commit": "400ded3", + "digest": "bf763e540e64a5d742aa9362d151b4ec08e0ca89cc8f7a0c1b4bf97d3a350d76", + "last_commit": "8d4ed36", "name": "kernels", "purpose": "six Omega-encoded v7 cubins (vecadd/neg for sm_80/86/89), their sources and the byte-for-byte re" }, @@ -27,15 +27,15 @@ "purpose": "receipt schema, validator, PR gate, board builder, one-off CloudKernels import" } ], - "children_root": "sha256:f56220cfd343cefb6c7566dd30361a36dbe2328c9cbc596cb6b4fb8bbc1a3660", - "compiled_at": "2026-10-27T08:13:31Z", + "children_root": "sha256:f572afda5f4b6ffb716df17aec24f6ce31693a59d6ec3637cb531dde96b191d9", + "compiled_at": "2026-10-27T08:13:45Z", "compiler": "crumb-compile/1", - "digest": "sha256:7b98da2584eb4ef7cf6597e6e3504fabb14a3010fe8832d530ff170ec046f48b", - "evidence_files": 16, - "evidence_root": "sha256:2ca05055761936745894bcf785980f7eab0a2c0edf5d40a7067d653b0e9f5d63", - "files": 49, - "generated_at_commit": "be6e65acafa9f75e705a308100bc5ddec8bfaa66", - "source_tree": "sha256:727346737d8f214fff14debfb89d13d1ea2f3bb3992b1e56bb426b41758e4929" + "digest": "sha256:11aad4987a673f1c0df00ff54a94bb235c6ab670e7a5af0efb75134e4e0e525e", + "evidence_files": 18, + "evidence_root": "sha256:ad860af1d427e08dc17e8bc84e2d2ca74f6e653a8444ec28b4baaf31de37fcda", + "files": 55, + "generated_at_commit": "8d4ed3680a7a77368fb9606fcefe0d9815e9b2d6", + "source_tree": "sha256:1cf76b49a4cf45db105d3b40cf3d873aeedbbbf426bbdd3b21137883c2129014" } }, "name": "omega-gpu-bench", diff --git a/kernels/.crumb b/kernels/.crumb index 3281b8b..691c8e9 100644 --- a/kernels/.crumb +++ b/kernels/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-27T08:13:31Z", + "compiled_at": "2026-10-27T08:13:45Z", "compiler": "crumb-compile/1", - "digest": "sha256:71fbdee0d9edf423514e31ae369794db46597a939973e8d20910ccfae735e0f0", + "digest": "sha256:bf763e540e64a5d742aa9362d151b4ec08e0ca89cc8f7a0c1b4bf97d3a350d76", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 11, - "generated_at_commit": "be6e65acafa9f75e705a308100bc5ddec8bfaa66", - "source_tree": "sha256:db7d2f9eaf031c2d673f6317bee1edbaac3428b788349e2c9d1cf2ee357d0220" + "files": 15, + "generated_at_commit": "8d4ed3680a7a77368fb9606fcefe0d9815e9b2d6", + "source_tree": "sha256:337d5e2da4fb25f3bdc8bf3e0fc8afe99524a0f708afcab49e77c219cb51cb9f" } }, "name": "kernels",