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

8d52a3a Declare offline reference and no-CUDA control paths in decoder gate Drake Stapleton committed 2026-11-16
..
README.md10626
check.sh4407
check_selftest.sh1944
corpus.sh4461
corpus_selftest.sh1728
negctl.sh4299
om_mutants.sh2655
om_vs_c.sh1341
oracle-allow.tsv4101
oracle_pairs.sh874
sm121dis.c2983
zero_nvdisasm.sh5487

README.md

sm121dis: Omega's own GB10 disassembler

A disassembler turns the GPU's machine code back into readable instructions. Omega used to borrow NVIDIA's nvdisasm for that, in every check that reads a kernel back. sm121dis is my own (row C6 of docs/OMEGA.md): the decoder is seeded Omega, om/disasm/sm121_dis.om, lowered by the pinned omega-bridge into src/cudapp_om_sm121_dis.c (om/units.sh, byte for byte); src/omega_sm121_disasm.c only moves the bytes and copies the text. The hand-written C decoder that came first stays in that file behind CUDAPP_MIGRATION_PENDING_C_DISASM, as the differential oracle (make CUDAPP_DISASM=om|c|diff; CUDA++ C6, DRA-475). This folder holds the command line and the comparison with NVIDIA's tool.

What it proves

  • Every kernel the library builds without the chip (each GPU test in its host-only and simulator modes, and every kernel the hazard checker's sweep builds) is collected and compared word by word with nvdisasm, text and spacing included. On 2026-11-07 (CUDA++ C6, DRA-475, host, Omega decoder): all 3,191 kernels (1,237,248 instruction words) agree, 0 differ (evidence/C6-DISASM-OM/). corpus.sh writes MANIFEST.tsv (every kernel's SHA-256, size, words and first producer; that day's manifest has SHA-256 0939127a973c165f163694a3fa4b4cb3ae398d9e80b8d8560c427eb073e2c4ce) and PRODUCERS.tsv (new kernels per producer run: 789 from the GPU tests, 2,402 from the hazard sweep).
  • Older counts: 331 kernels (59,152 words) on 2026-10-24 and 402 kernels (74,096 words) on 2026-10-25 are the receipts in evidence/C6-DISASM/, from before the hazard sweep joined the corpus; 2,980 kernels (1,218,992 words) on 2026-10-30 is the first count with the sweep (7919aada). The 3,191 of 2026-11-07 is the same corpus after later producers and generators (gpu_mathlibs_test, 36 kernels, joined on 2026-11-04 in 679fd24f); it equals the encoder corpus count of evidence/ldg-offset-20261107.
  • A copy of the decoder with one planted fault (the C oracle with SM121DIS_MUTANT, first source register off by one bit) must fail that comparison with a verdict. Three one-line mutants of the .om decoder, each regenerated by the pinned compiler and bridge, must each change the corpus text (make test-sm121dis-om-mutants).
  • The .om decoder and the C oracle are run on every word of the corpus (the CUDAPP_DISASM=diff build aborts on any difference in status, text or EXIT flag); the same build with one bit flipped on the C side must abort.
  • Flipped-bit control (negctl.sh): flipping bit 16 of word 0 in each kernel must change our text and break parity in exactly that word.
  • A kernel that could not be saved whole (a full disk) fails the collection; it is never compared cut short.
  • IMAD.WIDE.U32's 32-bit immediate prints signed, as nvdisasm 13.0.85 prints it (-0x2daee0ad for the Philox multiplier 0xd2511f53). Until 2026-11-10 both decoders printed it unsigned; the gpu_mathlibs_test Philox kernels of the #280 integration were the first to reach bit 31, and 81 of their kernels failed the comparison.
  • A word the decoder does not know is printed as ?? <hex> and fails the check. It is never guessed. That includes a special register nvdisasm names but this decoder does not (96 of 256 values; an S2R sweep, sr-sweep.sh).
  • BlackwellIR ops 64..79, the numbers the #280 integration moved (ATOMG.E.MIN.64 stays at 64; its conversions and binary64 forms are 65..79, evidence/INTEG-280-20261110/numbering.txt): make test-sm121dis-opmove encodes one row of each with the seeded encoder (om/disasm/opmove_test.om), and my decoder must know every word with the op's mnemonic while nvdisasm 13.0.85 prints the same text. The rows numbered as before the move must fail. Before the 2026-11-10 rows were added, 14 of those 16 words printed ??; the C oracle got the same rows, so diff still agrees.
  • ATOMG.E.EXCH.STRONG.SYS (BlackwellIR op 27, the resident kernel's grid barrier) was added on 2026-11-12 to both decoders. Until then the two exchange words of that kernel printed ??, and no check saw it because the resident kernel was in no corpus: bw_hazard_test now builds it (4 kernels), so make test-bw-hazard-nvdisasm reads those words. The text was compared with nvdisasm 13.0.85 on that kernel's own bytes. Row constants, WolframLanguageEvaluator {FromDigits["80000000000079a8",16], FromDigits["0c1f5100",16], FromDigits[Reverse[#],256]& /@ Partition[PadRight[Append[ToCharacterCode[text],0],56],8]} -> `{9223372036854806952, 203378944, {3334121982912320577, 5932458067399759941, 2329303646074261071, 2318338018805306448, 6720256143407670628, 3196768717813917019, 6432032}}`.

How to run it

make test-sm121dis            # collect, compare with nvdisasm, then the red check
make test-sm121dis-opmove     # BlackwellIR ops 64..79 against nvdisasm 13.0.85, with three red checks
make test-sm121dis-om-mutants # three .om decoder mutants must each change the corpus text
make test-om-disasm           # no NVIDIA tool: 11 golden words and .om vs C on every row, with two red checks
make test-om-disasm-mutants   # four .om decoder mutants must each fail the .om vs C differential
make test-disasm-words        # word assembly and EXIT padding (src/cudapp_om_words.c) against its C oracle

test-sm121dis-om-mutants, test-om-disasm-mutants and test-disasm-words need the pinned OMEGA_OMC and OMEGA_BRIDGE, like om/units.sh; test-sm121dis-om-mutants reads the corpus test-sm121dis collected. test-sm121dis-opmove needs the pinned OMEGA_OMC and refuses any nvdisasm other than 13.0.85.

nvdisasm is used only here, as the reference to compare against. Nothing it prints goes into a kernel.

Who uses it

The checks that used to call nvdisasm now call mine:

  • the listing checks inside tests/gpu_elementwise_test.c, gpu_fp8_api_test.c, gpu_reconv_test.c, gpu_attention_test.c and bench/prime_race/tests/gb10_sieve_host_test.c (linked in, omega_sm121_listing);
  • tools/divsqrt_nvdisasm_check.sh, tools/ldst_nvdisasm_check.sh and make test-numeric-reduce-nvdisasm (the build/sm121dis command);
  • the hazard checker's register cross-check, tests/bw_hazard_test.c --disasm (make test-bw-hazard-nvdisasm, linked in, omega_sm121_disasm), over every kernel its sweep builds. Those kernels are in the comparison corpus.
  • tests/device-trace/run-emitter-checks.sh (make test-device-trace-emitter, with its red decoder; the device-side trace emitter's 40 words; nvdisasm only when NVDISASM is set, as an oracle that must print the same text) and tools/artifact_smoke.sh (each artifact's kernel text). Every remaining nvdisasm call site, with its class, is in evidence/C6-DISASM-OM/NVDISASM-CALL-SITES.md.

The script and target names are kept so older receipts still line up. make test-zero-nvdisasm proves that none of these checks runs nvdisasm.

Files

FileJob
sm121dis.ccommand line: a listing, -b SM121 (called like nvdisasm), --pairs (for the comparison), --version
corpus.shruns every GPU test with OMEGA_KERNEL_DUMP_DIR set, so each kernel the library encodes is saved
check.shcompares 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
oracle_pairs.shturns nvdisasm's listing into the same one-line-per-word form
negctl.shORACLE harness: the flipped-bit negative control of the comparison
om_mutants.shthree .om decoder mutants through the pinned compiler and bridge; each must change the corpus text
om_vs_c.shthe .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
oracle-allow.tsvthe declared oracle lines the ZERO-NVDISASM static check accepts, each with its reason

Exact MMIO semantic contract (issue #171)

BW_IR_LDG_MMIO promises LDG.E.MMIO.GPU, not the historical encoder's EF cache policy. make test-sm121-mmio OMEGA_MV=/path/to/pinned/omega concatenates the production encoder with om/encoder/mmio_test.om. The Omega fixture emits one instruction and checks NVIDIA nvdisasm 13.0.85's exact mnemonic and register, descriptor and address operands. It then emits an otherwise identical EF mutant; the same Omega expectation must refuse it with exit status 4. The seeded compiler SHA-256 remains pinned; the oracle's version and binary SHA-256 are recorded. Neither decoder output nor mutant bytes enter production.

This tests an IR semantic promise, unlike a decoder-only comparison that can agree about the wrong instruction. Existing golden receipts are not rewritten. Before/after corpus identities record any emitted-kernel byte impact separately. GB10 cache behavior and device execution remain NOT_RUN; no live model is rebuilt, replaced, or deployed by this check.

The recorded pre/post comparison at base e84326dca9f1ef9afbeaf249fb3e46ae0a2517f7 has 773 identical existing SASS kernels and four identical captured cubins (including a copied bundle used for manifest-tampering controls). The complete before/after SHA-256 maps and empty changed-kernel/artifact lists are in evidence/CUDAPP-SM121-MMIO/corpus-impact.json, bound to exact source, generated binding and NVIDIA oracle identities. The existing producer corpus does not exercise op21; the new single-op fixture does. The generated encoder and host library bytes change as expected, but no deployed artifact is rebuilt or loaded. Corpus equality is not cache-behavior or device qualification.

The final canonical replay uses baseline c6977b4906229fe83f41103b7eff65b64a0986d6 and corrected implementation 3c163287d27b6e5a5f5b90c15b61ac83d8f26e2d. Its complete inventories, commands, logs, source identities and review are under evidence/CUDAPP-SM121-MMIO/c697-final-host/. All 773 existing SASS kernels and all four captured cubins remain byte-identical. Both artifact captures pass all 47 checks. Exact-op and wrong-EF controls, canonical-baseline refusal, binding regeneration, golden encoder parity and specification checks pass with the canonical bridge pin 0c4cb9ff980af278890b231b994eaede4dc7621c. The original corpus-impact.json remains immutable historical evidence, not the canonical replay. The complete host suite and device execution are not claimed by this targeted replay. The review is a source review, not independent hardware qualification.