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
CUDApp / om / codegen / GDN.md
| 1 | # Seeded Omega GDN builders |
| 2 | |
| 3 | The default implementation of `src/omega_blackwell_codegen_gdn.c` is seeded Omega. |
| 4 | `CUDAPP_MIGRATION_PENDING_C_CODEGEN_GDN=1` selects the retained C differential |
| 5 | oracle. The switch is private to the C file. The public header and API are unchanged. |
| 6 | |
| 7 | ## Units and host boundary |
| 8 | |
| 9 | - `cg_gdn_shape.om`: `omega_gdn_shape` (ratio 0 means 3, ratios 1..3, the |
| 10 | parameter, tail and state sizes, bf16 halving). Shared by both units. |
| 11 | - `cg_gdn_common.om`: the eight-word record emitter, control words, the held |
| 12 | scoreboard prefetch bookkeeping, branch/region/loop records and the operand |
| 13 | helpers (`omega_gd_*`). |
| 14 | - `cg_gdn.om`: entry `cg_gdn k a c d b m`. Kind 0 decode, 1 multi-token decode, |
| 15 | 2 state copy/zero, 3 prefill prep, 4 prefill scan, 5 prefill post. `a` is the |
| 16 | mutant selector, `c` the copy mode, `d` the ratio with `state_bf16 != 0` in bit 32. |
| 17 | Every refusal the C builders make is made here (unknown kind, copy with a mutant |
| 18 | or an unknown mode, a GDN kernel with a copy mode, mutant outside 0..4, an |
| 19 | unsupported ratio). Multi sets the GPR limit 246 through metadata word 6. |
| 20 | - `cg_gdn_policy.om`: entry `cg_gdn_policy q ra bf`, the public shape queries. |
| 21 | |
| 22 | The C shell keeps API/null handling and the three stats accessors; the stats |
| 23 | accessors are shared by the oracle and the default build. Register allocation, |
| 24 | loop-interval checks and record replay use `omega_gpu_om_ir_replay`; no replay op |
| 25 | or metadata word was added. |
| 26 | |
| 27 | Vreg ids live in a flat state view (`s`, 512 words). A slot is a name only; the |
| 28 | allocation order is the C order, phase by phase. Phase functions are split where |
| 29 | the seeded compiler's live-name/register bound requires it (`pr1`/`pr1b`, |
| 30 | `pr2`/`pr2b`/`pr2c`), and argument expressions deeper than one operation are |
| 31 | first assigned to `h1..h4`. Neither changes the emitted order. |
| 32 | |
| 33 | ## Verification |
| 34 | |
| 35 | Run every gate in the device-free namespace. A missing device node is a host-path |
| 36 | defect to fix, not permission to rerun without the wrapper. |
| 37 | |
| 38 | ```sh |
| 39 | export OMEGA_OMC=/path/to/omega-mv/seed/out/omc |
| 40 | export OMEGA_BRIDGE=/path/to/omega-bridge OMEGA_BRIDGE_DIR=/path/to/omega-bridge |
| 41 | export OMEGA_MV=/path/to/omega-mv |
| 42 | W="bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10" |
| 43 | $W sh om/units.sh --check |
| 44 | $W make -j3 test-codegen-gdn-diff |
| 45 | $W make -j3 test-codegen-gdn-mutants |
| 46 | $W make -j3 test-codegen-gdn-sim |
| 47 | ``` |
| 48 | |
| 49 | `test-codegen-gdn-diff` links the C oracle into the test translation unit and |
| 50 | enumerates mutant -1..5, copy -1..3, ratio {0,1,2,3,4,UINT32_MAX} and |
| 51 | state_bf16 {0,1,2,UINT32_MAX} for all six builders. It compares refusals, IR |
| 52 | instructions, register allocation, encoded bytes, the shape policy (including |
| 53 | untouched output on refusal) and all stats accessors, checks NULL handling, and |
| 54 | ends with a negative control: one flipped bit in an emitted Omega record must |
| 55 | show up as an IR difference. |
| 56 | |
| 57 | `gdn_mutants.py` changes one unique site in the Omega sources, regenerates every |
| 58 | unit that contains it through `tools/bridge-seeded`, rebuilds the differential and |
| 59 | requires it to fail with `GDN DIFF` or `GDN SHAPE DIFF`. Temporary sources, C and |
| 60 | binaries are deleted. Python and the retained C are verification tools only. |
| 61 | |
| 62 | `test-codegen-gdn-sim` runs the existing `gpu_gdn_test --host-only`, `--sim` and |
| 63 | `gpu_gdn_multi_test --sim` batteries against `libomega_gpu.a`, which now contains |
| 64 | the Omega builders. |
| 65 | |
| 66 | ## Qualification boundary (chip tier NOT_RUN) |
| 67 | |
| 68 | Host byte equality and warp-simulator parity are not GB10 qualification. No GPU |
| 69 | window was granted to this lane. In a separately authorized exclusive window: |
| 70 | |
| 71 | 1. Run the integrated host and simulator gates above on the exact revision. |
| 72 | 2. Build `build/gpu_gdn_test` and `build/gpu_gdn_multi_test` from that revision and |
| 73 | record the CUDApp revision and binary SHA-256 values. |
| 74 | 3. Run `build/gpu_gdn_test` (default mode is the chip battery: chained steps against |
| 75 | the double oracle, rerun bit-identity, mutants 1-4 caught, record path), then |
| 76 | `build/gpu_gdn_test --bf16`, then `build/gpu_gdn_multi_test` without `--sim`. |
| 77 | 4. Keep each final verdict line and the `--out` receipt as the chip receipt. |
| 78 | |
| 79 | Do not change live services, chip locks, driver state or boot configuration as |
| 80 | part of host work. |