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-tc / README.md
| 1 | # Seeded Omega tensor-core builders |
| 2 | |
| 3 | `../codegen/cg_tc.om` owns the instruction selection, HMMA spacing, held-scoreboard |
| 4 | transitions, staging, branch fixups and epilogues for the builders formerly |
| 5 | implemented in `omega_blackwell_codegen_tc.c` and `omega_blackwell_codegen_tc2.c`. |
| 6 | `../codegen/cg_tc_emit.om` emits the shared eight-word record format defined by |
| 7 | `omega_gpu_om_ir.h`. The C entry points marshal scalar arguments and replay those |
| 8 | records through `omega_gpu_om_ir_replay`. The existing public headers, CPU data |
| 9 | conversions and shape-query functions are unchanged. `omega_bw_em.h` remains |
| 10 | available to unrelated C builders. |
| 11 | |
| 12 | The default is Omega. Set `CUDAPP_MIGRATION_PENDING_C_CODEGEN_TC=1` only to select |
| 13 | the old C differential oracle. This is not a compatibility implementation or a |
| 14 | second production record format. The independent renamed C objects in the test |
| 15 | are always built with the oracle switch enabled. |
| 16 | |
| 17 | ## Source layout |
| 18 | |
| 19 | The exported function is `omega_cg_tc`. Kinds select probe (0), peak (1), read |
| 20 | bandwidth (2), grouped GEMM (3), or grouped GEMM v2 (4). The v2 selector carries |
| 21 | both F32 and SwiGLU epilogues and the direct-output flag. Scalar inputs are packed |
| 22 | by the unchanged public C entry points; the record ABI is common to the other |
| 23 | codegen migrations. |
| 24 | |
| 25 | The phase functions preserve the original builder's order. `note r[index] name` |
| 26 | marks builder-local values. Lexical scratch slots are reused after scope exit; |
| 27 | these are host-side builder scratch values, not GPU registers. Pending explicit |
| 28 | instruction structs have their own scratch slots so intervening helper emission |
| 29 | cannot overwrite them. Pure expression helpers bound the seeded compiler's live |
| 30 | value count. All functions obey the function-mode argument limit. |
| 31 | |
| 32 | Metadata slots 7 and 8 are emitter-private held-scoreboard and loop-start state; |
| 33 | the generic replay consumes only its documented metadata slots. Packing masks |
| 34 | immediates to their original uint32 width. The instruction-count and virtual |
| 35 | register caps match the pre-existing C builder caps. Regalloc failures are |
| 36 | compared as refusals, not reported as successful programs. |
| 37 | |
| 38 | ## Reproducible host gates |
| 39 | |
| 40 | Use the pinned seeded compiler `omega-mv@e5b32567` (omc SHA-256 |
| 41 | `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`), |
| 42 | with the repository's pinned `om/omega-bridge.lock`. Set `OMEGA_OMC`, |
| 43 | `OMEGA_BRIDGE`, `OMEGA_MV` and `OMEGA_BRIDGE_DIR` to their local checkouts. |
| 44 | |
| 45 | ```sh |
| 46 | sh om/units.sh |
| 47 | sh om/units.sh --check |
| 48 | taskset -c 10-14 nice -n 10 make -j3 test-codegen-tc |
| 49 | taskset -c 10-14 nice -n 10 make -j3 test-codegen-tc-mutants |
| 50 | taskset -c 10-14 nice -n 10 make -j3 test-codegen-tc-sim |
| 51 | taskset -c 10-14 nice -n 10 make -j3 test |
| 52 | ``` |
| 53 | |
| 54 | The last three focused targets are registered in `HOST_TESTS`. The mutant gate |
| 55 | requires the compiler and bridge environment variables; missing tools or a |
| 56 | compile failure fail the gate rather than counting as a killed mutant. |
| 57 | |
| 58 | ### Configuration coverage |
| 59 | |
| 60 | The differential compares every instruction field, the complete solved register |
| 61 | allocation, and successfully encoded instruction bytes. Neither two encoding |
| 62 | failures nor two partially built programs count as byte-equality success. |
| 63 | |
| 64 | * Probe: both accepted accumulator modes, invalid mutants and null output. |
| 65 | * Peak: every chain count, stall value and accepted thread count. Iteration count |
| 66 | is an immediate only: representative interior values and uint32 boundary |
| 67 | values cover that independent dimension. Zero iterations and invalid shape |
| 68 | boundaries are checked as refusals. |
| 69 | * Bandwidth: every accepted thread count and both control-flow classes of |
| 70 | `groups` (one/shared and greater-than-one/distinct), plus zero and uint32 |
| 71 | boundary values. Iteration count enters only the count immediate and the |
| 72 | uint32 region-size product; 1, 2, an interior value and UINT32_MAX cover their |
| 73 | boundary behavior. The runtime loop is not unrolled by the builder. |
| 74 | * Grouped GEMM: every K, row tile, column tile, warp count and accepted built-in |
| 75 | mutant. Shapes refused by the existing register allocator must still refuse. |
| 76 | * Grouped GEMM v2: every K, row tile, warp count, A-fragment count, epilogue, |
| 77 | direct-output mode and built-in mutant. At K=128 every accepted N is tested; |
| 78 | at every other K both accepted N endpoints are tested. This is a complete |
| 79 | factored boundary set, not an exhaustive Cartesian product: N affects only |
| 80 | affine output offsets, independently of K, while K changes the loop count and |
| 81 | input offsets. Shape validation, all nonlinear instruction decisions and all |
| 82 | epilogue/direct decisions are enumerated. Invalid scalar-field boundaries and |
| 83 | null specs/output are checked separately. |
| 84 | |
| 85 | N endpoints follow the original strict 23-bit output-offset guard: |
| 86 | `Floor[(2^23-1)/(64 rt (16 warps))] (16 warps)`. |
| 87 | WolframLanguageEvaluator query |
| 88 | `Table[{rt,w,Floor[(2^23-1)/(64 rt (16 w))] (16 w)},{rt,{2,4,8}},{w,{4,8,16}}]` |
| 89 | returned |
| 90 | `{{{2,4,65472},{2,8,65408},{2,16,65280}},{{4,4,32704},{4,8,32640},{4,16,32512}},{{8,4,16320},{8,8,16256},{8,16,16128}}}`. |
| 91 | |
| 92 | The record negative control flips one generated control word and requires the |
| 93 | same comparator to reject it. The separate source-mutant gate recompiles Omega |
| 94 | with changes to probe/peak HMMA spacing, bandwidth folding, GEMM FP8 decoding, |
| 95 | and v2 accumulator rescaling (exercised with both epilogues). Each mutant must |
| 96 | compile and link successfully, then fail the IR differential. |
| 97 | |
| 98 | ### Simulator and chip distinction |
| 99 | |
| 100 | The simulator target executes the emitted probe, both bandwidth address modes, |
| 101 | peak HMMA chains, grouped GEMM, and both v2 epilogues/direct modes. It reuses the |
| 102 | existing tensor-core simulator and its built-in arithmetic mutants. It does not |
| 103 | model scoreboard timing, physical hardware scheduling or chip throughput. |
| 104 | |
| 105 | Chip tier is **NOT_RUN**: no GPU window is authorized. During a separately |
| 106 | approved exclusive window, use the existing `gpu_tc_probe_test`, |
| 107 | `gpu_tc_peak_test`, `gpu_tcgemm_test` and `gpu_pfgemm_test` chip runbooks at this |
| 108 | revision, with the existing session/lock and hardware gates intact. Record device, |
| 109 | compiler/unit identities, launch shapes, expected/observed values, timing policy |
| 110 | and built-in mutant outcomes in a new receipt. Host or simulator PASS does not |
| 111 | qualify the hardware path. No merge or deployment is authorized by this lane. |
| 112 | |
| 113 | Chip runbook (instructions only; **not executed** by this lane): |
| 114 | |
| 115 | 1. Obtain Drake's current exclusive-window authorization and satisfy the current |
| 116 | GPU ownership, memory, watchdog and service-preservation procedure. The lock |
| 117 | file alone is not authorization. Do not weaken any gate. |
| 118 | 2. Build the four existing chip-test binaries on the same revision using the |
| 119 | pinned compiler/generated units. Do not substitute a host-only flag for chip |
| 120 | evidence. |
| 121 | 3. Inside that authorized window, execute the binaries below without `--sim` or |
| 122 | `--host-only`. They use the existing session lock and launch path. Preserve |
| 123 | each exit status and complete output. |
| 124 | |
| 125 | ```sh |
| 126 | ./build/gpu_tc_probe_test |
| 127 | ./build/gpu_tc_peak_test |
| 128 | ./build/gpu_tcgemm_test |
| 129 | ./build/gpu_pfgemm_test |
| 130 | ``` |
| 131 | |
| 132 | 4. Require the existing arithmetic comparison and mutant gates. Preserve device |
| 133 | and source identities with the new chip receipt; do not reinterpret host |
| 134 | differential results as chip timing evidence. Follow the authorized window's |
| 135 | restoration procedure and report service/device state. |
| 136 | |
| 137 | ## Lane receipt |
| 138 | |
| 139 | The pre-relocation exhaustive/factored differential at `3bdfcfa` passed 180466 |
| 140 | encoded programs with 52240 matching allocator refusals and killed the record |
| 141 | flip negative control. The six Omega source mutants and all simulator targets |
| 142 | passed as well. The full host suite reached the 3600-second shared-core deadline; |
| 143 | its tier is **INCONCLUSIVE**, not PASS. `full-timeout.log` preserves the command, |
| 144 | deadline result and the absence of a final suite marker. Per Main's explicit |
| 145 | full-suite policy, this lane does not retry the full run; Integrator owns the |
| 146 | unbounded integrated host gate. |
| 147 | |
| 148 | The successor sources were then relocated without content changes into |
| 149 | `om/codegen/` at CodegenA's request. Documentation and receipts remain here; |
| 150 | Main/Integrator owns the shared `om/codegen/.crumb` and merged registration. |
| 151 | The post-relocation regeneration and focused receipts are in `validation.json`. |
| 152 | |
| 153 | Post-relocation focused command chain exited 0. The strict differential printed |
| 154 | `CODEGEN TC DIFF PASS (180517 cases, 52380 matching refusals)` and caught the |
| 155 | record negative. Every successful program encoded successfully on both sides; |
| 156 | matching encoding failures are not accepted. All six source mutants were killed, |
| 157 | all simulator targets passed, regeneration was byte-identical, and crumb verify |
| 158 | reported current. The one absolute home path in `focused-host.log` was replaced |
| 159 | with `~`; numerical/test output is unchanged. |