interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / sm121 / README.md

117 lines · 8599 bytes Raw Blame History Rendered
1# seed/sm121/: rung 6, GPU words from the same chain
2
3The ladder in `seed/` (see `seed/README.md`) grows a toolchain from a few hundred hand-written bytes. Rung 2 is
4`asm2`, a small assembler: it reads a plain-text table of instructions, then a program written with those names,
5and writes machine words. Until now it only knew the main processor (Arm). This rung teaches the same `asm2`,
6unchanged, the instructions of the GB10's graphics chip (NVIDIA calls this generation sm_121), by giving it a
7second table. Nothing new was compiled to do it: the new part is text.
8
9## What is here
10
11- `sm121.tbl`: the GPU instruction table, plain text, same format as `rung2/table.s2`. A GPU instruction is
12 128 bits long, four times an Arm instruction, and `asm2` writes 32 bits per line, so each GPU instruction is
13 four lines, one per quarter. For example `ldg.0 2 2` / `ldg.1 4` / `ldg.2` / `ldg.3` is
14 "load from memory into register 2, address in register 2, memory descriptor in uniform register 4".
15 Every line says which line of my own C code generator (`src/omega_blackwell_codegen.c`) it was read from.
16- `vecadd.s2`: the GB10 vector add (`out[i] = a[i] + b[i]`), the kernel the existing launcher has run on the
17 chip since the first GPU cut, written by hand with the table's names. `vecadd.bin` is what `asm2` makes of it.
18- `gate6.sh`: the checks (below). `names.tsv`: the name my C code gives each instruction form, for the
19 disassembler check.
20- `sm121list.c`: a reference tool. It is built from my C code generators and is only a referee: for every GPU
21 program those generators can make, it writes the program as a text listing in `asm2`'s language and, next
22 to it, the bytes the C code made. It never writes a byte under `seed/`.
23
24## Build
25
26`gate6.sh` needs the reference tool at `build/seed/r6/sm121list`. Build it from the repository root, then run
27the gate:
28
29```sh
30mkdir -p build/seed/r6
31gcc -O1 -Isrc -o build/seed/r6/sm121list seed/sm121/sm121list.c src/omega_blackwell_codegen*.c \
32 src/omega_blackwell_matmul.c src/omega_blackwell_encoder.c src/omega_gpu_fmt.c src/omega_om_units.c -lm
33sh seed/sm121/gate6.sh
34```
35
36The gate writes its result files to `build/seed/r6/evidence/`. The recorded receipt `evidence/SEED-0/sm121/`
37is only read: the gate's last line before the verdict says whether each result file equals its recorded copy
38(`seed/check/receipt.sh`); a rerun never rewrites it.
39
40## How the checks work
41
42The C code generator is the referee, never an input to the table: I read its source and wrote the table by
43hand; the gate then compares.
44
451. Every program my C generators make today, over a sweep of their settings (sizes, warp counts, depths,
46 and the deliberately broken "mutant" versions the tests use), is written out as a listing; `asm2` with the
47 new table turns each listing into words; the words must equal the C code's words, bit for bit.
482. Every instruction form, with registers and numbers at the edges of their fields, the same way.
493. The hand-written vector add must equal, byte for byte, the words the existing launcher runs.
504. Controls: a wrong register, a wrong offset, an out-of-range register, a wrong bit in the table and a field
51 in the wrong place must each be caught.
525. Reference only: NVIDIA's disassembler (`nvdisasm -b SM121`) reads every instruction form back, and its
53 name is compared with the name my C code gives it. Every difference is listed.
546. On the chip: the seed-made vector add runs on the GB10 through the existing launcher (no CUDA library),
55 with a receipt.
56
57Results: `build/seed/r6/evidence/`; recorded receipt: `evidence/SEED-0/sm121/`.
58
59## Limits, said plainly
60
61- Numbers in a listing are written the way the bits hold them. For example a constant-bank offset of 0x380
62 bytes is written 224 (0x380 / 4) for `LDC` and 112 (0x380 / 8) for `LDCU`, and a branch distance is written
63 as its two pieces (low 6 bits, the rest), because the instruction stores it split. The listing writer does
64 that arithmetic, as a person would; `asm2` itself has no GPU-specific code.
65- There are no GPU labels: `asm2`'s label arithmetic counts 32-bit words from the line it is on, while GPU
66 branches count 128-bit instructions from the next instruction. Branch distances are written as numbers.
67- The scheduling word (the fourth quarter: stall counts and waits) is part of the program, like in NVIDIA's
68 own listings. The table holds the C code's default for each instruction; any other value is written out
69 with `ctl`.
70- The kernel sweep covers the settings ranges each generator documents; settings a generator refuses are
71 skipped. Four small programs are built inside other files' private functions (attention, elementwise,
72 command list, resident runtime) and are not reachable without changing those files; they use the same
73 encoder, so the edge-case check covers their instruction forms, but not those exact programs. (The listing
74 tool can reach the elementwise ones when it is built together with the GPU library; this run did not.)
75
76## Results (gate run 2026-10-20 03:04 UTC, after merging seed/birth, `evidence/SEED-0/sm121/gate6.log`)
77
78- **Every program matches.** The C generators make 6,091 different GPU programs over the sweep (2,398,274
79 instructions, 2,419,440 counting the padding at the end of each program). `asm2` with `sm121.tbl` turned
80 every listing into exactly the C code's words, bit for bit. Zero differences between the table and the C code.
81- **Every instruction form at the edges matches**: 65,352 cases, bit for bit.
82- **The vector add**: the hand-written listing becomes 512 bytes identical to the launcher's vector add, and
83 the same twice in a row.
84- **The controls work**: a wrong register, a wrong offset, a register number too large, one wrong bit in the
85 table and a field moved by one bit are each caught.
86- **On the chip** (2026-10-20 03:02 UTC, `evidence/SEED-0/sm121/chip/`): the vector add `asm2` made ran on the
87 GB10 through the bytes tool and my own launcher, no CUDA library: 1,048,576 additions, 0 wrong. The
88 control (the same program with one word changed) got all 1,048,576 wrong and failed, as it must. The run
89 record says `dirty=3`: those are the bytes tool copied in from its own branch (ledger L098, not part of
90 this branch) and the chip folder being written; the program bytes are `seed/sm121/vecadd.bin` as committed
91 (fingerprint 39f3dfdf...). Receipt: `chip/receipt.json`.
92
93### What the check found in my C code (not in the table)
94
951. **A crash in the tensor-core matrix multiply generator.** It accepts "4 row tiles, 1 warp", then writes 16
96 entries into lists that hold 8 and overwrites memory. The 48 settings that do this are skipped here and
97 named in `notes-summary.tsv`; a fixer agent is repairing the generator (ledger L149).
982. **Two labels swapped in the header.** The instruction listed as "uncached load" is really the evict-first
99 load, and the one listed as "evict-first store" is really the uncached store. The encoder's own comments
100 and NVIDIA's disassembler agree on what the bits mean, so programs behave as the encoder intends; only the
101 labels in `src/omega_blackwell_codegen.h` are wrong.
1023. **A compare that is unsigned where the name suggests signed.** The register-against-uniform form of
103 "greater or equal" compares as unsigned numbers. No program uses that form today, so nothing is affected yet.
1044. **Some numbers are taken raw, unchecked.** For shared-memory loads and stores the number is the size field
105 itself, and for the floating-point compare it is the whole condition word. The C code accepts any value,
106 including ones that are no real size or condition (the disassembler shows them as other sizes or refuses
107 them). Real programs only use valid values (32-bit and 128-bit shared-memory accesses).
1085. **Two instructions ignore a requested schedule.** For IADD3 and EXIT the C code always writes its own
109 scheduling bits, whatever the program asked for (`notes-summary.tsv`); the table does the same.
110
111### The disassembler check (reference only)
112
113NVIDIA's disassembler (`nvdisasm` 13.0, used only to read my bits back, never to make any) read 45,024 of the
11465,352 edge cases. It refused 20,328: 20,104 of them have the scheduling word set to all ones on purpose, and
115224 are the floating-point compare with a made-up condition word (item 4). Of 68 instruction forms, 59 got the
116same name from the disassembler as from my C code; the 9 others are the items above plus naming detail
117(for example `IMAD.MOV` is how the disassembler shows a multiply-add whose inputs make it a plain copy).