interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / tools / sm121dis / README.md

137 lines · 10626 bytes Raw Blame History Rendered
1# sm121dis: Omega's own GB10 disassembler
2
3A disassembler turns the GPU's machine code back into readable instructions. Omega used to borrow NVIDIA's
4`nvdisasm` for that, in every check that reads a kernel back. `sm121dis` is my own (row C6 of `docs/OMEGA.md`):
5the decoder is seeded Omega, `om/disasm/sm121_dis.om`, lowered by the pinned omega-bridge into
6`src/cudapp_om_sm121_dis.c` (`om/units.sh`, byte for byte); `src/omega_sm121_disasm.c` only moves the bytes and copies
7the text. The hand-written C decoder that came first stays in that file behind `CUDAPP_MIGRATION_PENDING_C_DISASM`, as
8the differential oracle (`make CUDAPP_DISASM=om|c|diff`; CUDA++ C6, DRA-475). This folder holds the command line and
9the comparison with NVIDIA's tool.
10
11## What it proves
12
13- Every kernel the library builds without the chip (each GPU test in its host-only and simulator modes, and every
14 kernel the hazard checker's sweep builds) is collected and compared word by word with `nvdisasm`, text and spacing
15 included. On 2026-11-07 (CUDA++ C6, DRA-475, host, Omega decoder): all 3,191 kernels (1,237,248 instruction words)
16 agree, 0 differ (`evidence/C6-DISASM-OM/`). `corpus.sh` writes `MANIFEST.tsv` (every kernel's SHA-256, size, words
17 and first producer; that day's manifest has SHA-256 `0939127a973c165f163694a3fa4b4cb3ae398d9e80b8d8560c427eb073e2c4ce`)
18 and `PRODUCERS.tsv` (new kernels per producer run: 789 from the GPU tests, 2,402 from the hazard sweep).
19- Older counts: 331 kernels (59,152 words) on 2026-10-24 and 402 kernels (74,096 words) on 2026-10-25 are the receipts
20 in `evidence/C6-DISASM/`, from before the hazard sweep joined the corpus; 2,980 kernels (1,218,992 words) on
21 2026-10-30 is the first count with the sweep (7919aada). The 3,191 of 2026-11-07 is the same corpus after later
22 producers and generators (gpu_mathlibs_test, 36 kernels, joined on 2026-11-04 in 679fd24f); it equals the encoder
23 corpus count of `evidence/ldg-offset-20261107`.
24- A copy of the decoder with one planted fault (the C oracle with `SM121DIS_MUTANT`, first source register off by one
25 bit) must fail that comparison with a verdict. Three one-line mutants of the `.om` decoder, each regenerated by the
26 pinned compiler and bridge, must each change the corpus text (`make test-sm121dis-om-mutants`).
27- The `.om` decoder and the C oracle are run on every word of the corpus (the `CUDAPP_DISASM=diff` build aborts on any
28 difference in status, text or EXIT flag); the same build with one bit flipped on the C side must abort.
29- Flipped-bit control (`negctl.sh`): flipping bit 16 of word 0 in each kernel must change our text and break parity in
30 exactly that word.
31- A kernel that could not be saved whole (a full disk) fails the collection; it is never compared cut short.
32- IMAD.WIDE.U32's 32-bit immediate prints signed, as nvdisasm 13.0.85 prints it (`-0x2daee0ad` for the Philox
33 multiplier 0xd2511f53). Until 2026-11-10 both decoders printed it unsigned; the gpu_mathlibs_test Philox kernels
34 of the #280 integration were the first to reach bit 31, and 81 of their kernels failed the comparison.
35- A word the decoder does not know is printed as `?? <hex>` and fails the check. It is never guessed. That includes a
36 special register nvdisasm names but this decoder does not (96 of 256 values; an S2R sweep, `sr-sweep.sh`).
37- BlackwellIR ops 64..79, the numbers the #280 integration moved (ATOMG.E.MIN.64 stays at 64; its conversions and
38 binary64 forms are 65..79, `evidence/INTEG-280-20261110/numbering.txt`): `make test-sm121dis-opmove` encodes one row
39 of each with the seeded encoder (`om/disasm/opmove_test.om`), and my decoder must know every word with the op's
40 mnemonic while nvdisasm 13.0.85 prints the same text. The rows numbered as before the move must fail. Before the
41 2026-11-10 rows were added, 14 of those 16 words printed `??`; the C oracle got the same rows, so `diff` still
42 agrees.
43- `ATOMG.E.EXCH.STRONG.SYS` (BlackwellIR op 27, the resident kernel's grid barrier) was added on 2026-11-12 to both
44 decoders. Until then the two exchange words of that kernel printed `??`, and no check saw it because the resident
45 kernel was in no corpus: `bw_hazard_test` now builds it (4 kernels), so `make test-bw-hazard-nvdisasm` reads those
46 words. The text was compared with nvdisasm 13.0.85 on that kernel's own bytes. Row constants, WolframLanguageEvaluator
47 `{FromDigits["80000000000079a8",16], FromDigits["0c1f5100",16], FromDigits[Reverse[#],256]& /@ Partition[PadRight[Append[ToCharacterCode[text],0],56],8]}`
48 -> `{9223372036854806952, 203378944, {3334121982912320577, 5932458067399759941, 2329303646074261071,
49 2318338018805306448, 6720256143407670628, 3196768717813917019, 6432032}}`.
50
51## How to run it
52
53 make test-sm121dis # collect, compare with nvdisasm, then the red check
54 make test-sm121dis-opmove # BlackwellIR ops 64..79 against nvdisasm 13.0.85, with three red checks
55 make test-sm121dis-om-mutants # three .om decoder mutants must each change the corpus text
56 make test-om-disasm # no NVIDIA tool: 11 golden words and .om vs C on every row, with two red checks
57 make test-om-disasm-mutants # four .om decoder mutants must each fail the .om vs C differential
58 make test-disasm-words # word assembly and EXIT padding (src/cudapp_om_words.c) against its C oracle
59
60`test-sm121dis-om-mutants`, `test-om-disasm-mutants` and `test-disasm-words` need the pinned `OMEGA_OMC` and
61`OMEGA_BRIDGE`, like `om/units.sh`; `test-sm121dis-om-mutants` reads the corpus `test-sm121dis` collected.
62`test-sm121dis-opmove` needs the pinned `OMEGA_OMC` and refuses any nvdisasm other than 13.0.85.
63
64`nvdisasm` is used only here, as the reference to compare against. Nothing it prints goes into a kernel.
65
66## Who uses it
67
68The checks that used to call `nvdisasm` now call mine:
69
70- the listing checks inside `tests/gpu_elementwise_test.c`, `gpu_fp8_api_test.c`, `gpu_reconv_test.c`,
71 `gpu_attention_test.c` and `bench/prime_race/tests/gb10_sieve_host_test.c` (linked in, `omega_sm121_listing`);
72- `tools/divsqrt_nvdisasm_check.sh`, `tools/ldst_nvdisasm_check.sh` and `make test-numeric-reduce-nvdisasm`
73 (the `build/sm121dis` command);
74- the hazard checker's register cross-check, `tests/bw_hazard_test.c --disasm` (`make test-bw-hazard-nvdisasm`,
75 linked in, `omega_sm121_disasm`), over every kernel its sweep builds. Those kernels are in the comparison corpus.
76- `tests/device-trace/run-emitter-checks.sh` (`make test-device-trace-emitter`, with its red decoder; the device-side
77 trace emitter's 40 words; nvdisasm only when `NVDISASM` is set, as an oracle that must print the same text) and
78 `tools/artifact_smoke.sh` (each artifact's kernel text).
79 Every remaining nvdisasm call site, with its class, is in `evidence/C6-DISASM-OM/NVDISASM-CALL-SITES.md`.
80
81The script and target names are kept so older receipts still line up. `make test-zero-nvdisasm` proves that none
82of these checks runs `nvdisasm`.
83
84## Files
85
86| File | Job |
87|---|---|
88| `sm121dis.c` | command line: a listing, `-b SM121` (called like nvdisasm), `--pairs` (for the comparison), `--version` |
89| `corpus.sh` | runs every GPU test with `OMEGA_KERNEL_DUMP_DIR` set, so each kernel the library encodes is saved |
90| `check.sh` | compares my 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 |
91| `oracle_pairs.sh` | turns nvdisasm's listing into the same one-line-per-word form |
92| `negctl.sh` | ORACLE harness: the flipped-bit negative control of the comparison |
93| `om_mutants.sh` | three `.om` decoder mutants through the pinned compiler and bridge; each must change the corpus text |
94| `om_vs_c.sh` | the `.om` decoder (default build) against the C decoder (`CUDAPP_DISASM=c` build) on a folder of kernels, `--pairs` text byte for byte; no make target calls it yet |
95| `oracle-allow.tsv` | the declared oracle lines the ZERO-NVDISASM static check accepts, each with its reason |
96
97## Exact MMIO semantic contract (issue #171)
98
99`BW_IR_LDG_MMIO` promises `LDG.E.MMIO.GPU`, not the historical encoder's EF
100cache policy. `make test-sm121-mmio OMEGA_MV=/path/to/pinned/omega` concatenates
101the production encoder with `om/encoder/mmio_test.om`. The Omega fixture emits
102one instruction and checks NVIDIA nvdisasm 13.0.85's exact mnemonic and register,
103descriptor and address operands. It then emits an otherwise identical EF
104mutant; the same Omega expectation must refuse it with exit status 4.
105The seeded compiler SHA-256 remains pinned; the oracle's version and binary
106SHA-256 are recorded. Neither decoder output nor mutant bytes enter production.
107
108This tests an IR semantic promise, unlike a decoder-only comparison that can
109agree about the wrong instruction. Existing golden receipts are not rewritten.
110Before/after corpus identities record any emitted-kernel byte impact separately.
111GB10 cache behavior and device execution remain **NOT_RUN**; no live model is
112rebuilt, replaced, or deployed by this check.
113
114The recorded pre/post comparison at base `e84326dca9f1ef9afbeaf249fb3e46ae0a2517f7`
115has **773 identical existing SASS kernels and four identical captured cubins**
116(including a copied bundle used for manifest-tampering controls).
117The complete before/after SHA-256 maps and empty changed-kernel/artifact lists
118are in `evidence/CUDAPP-SM121-MMIO/corpus-impact.json`, bound to exact source,
119generated binding and NVIDIA oracle identities. The existing producer corpus
120does not exercise op21; the new single-op fixture does. The generated encoder
121and host library bytes change as expected, but no deployed artifact is rebuilt
122or loaded. Corpus equality is not cache-behavior or device qualification.
123
124The final canonical replay uses baseline
125`c6977b4906229fe83f41103b7eff65b64a0986d6` and corrected implementation
126`3c163287d27b6e5a5f5b90c15b61ac83d8f26e2d`. Its complete inventories,
127commands, logs, source identities and review are under
128`evidence/CUDAPP-SM121-MMIO/c697-final-host/`.
129All 773 existing SASS kernels and all four captured cubins remain byte-identical.
130Both artifact captures pass all 47 checks. Exact-op and wrong-EF controls,
131canonical-baseline refusal, binding regeneration, golden encoder parity and
132specification checks pass with the canonical bridge pin
133`0c4cb9ff980af278890b231b994eaede4dc7621c`.
134The original `corpus-impact.json` remains immutable historical evidence, not
135the canonical replay. The complete host suite and device execution are not
136claimed by this targeted replay. The review is a source review, not independent
137hardware qualification.