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 / om / codegen-tc / README.md

159 lines · 8803 bytes Raw Blame History Rendered
1# Seeded Omega tensor-core builders
2
3`../codegen/cg_tc.om` owns the instruction selection, HMMA spacing, held-scoreboard
4transitions, staging, branch fixups and epilogues for the builders formerly
5implemented 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
8records through `omega_gpu_om_ir_replay`. The existing public headers, CPU data
9conversions and shape-query functions are unchanged. `omega_bw_em.h` remains
10available to unrelated C builders.
11
12The default is Omega. Set `CUDAPP_MIGRATION_PENDING_C_CODEGEN_TC=1` only to select
13the old C differential oracle. This is not a compatibility implementation or a
14second production record format. The independent renamed C objects in the test
15are always built with the oracle switch enabled.
16
17## Source layout
18
19The exported function is `omega_cg_tc`. Kinds select probe (0), peak (1), read
20bandwidth (2), grouped GEMM (3), or grouped GEMM v2 (4). The v2 selector carries
21both F32 and SwiGLU epilogues and the direct-output flag. Scalar inputs are packed
22by the unchanged public C entry points; the record ABI is common to the other
23codegen migrations.
24
25The phase functions preserve the original builder's order. `note r[index] name`
26marks builder-local values. Lexical scratch slots are reused after scope exit;
27these are host-side builder scratch values, not GPU registers. Pending explicit
28instruction structs have their own scratch slots so intervening helper emission
29cannot overwrite them. Pure expression helpers bound the seeded compiler's live
30value count. All functions obey the function-mode argument limit.
31
32Metadata slots 7 and 8 are emitter-private held-scoreboard and loop-start state;
33the generic replay consumes only its documented metadata slots. Packing masks
34immediates to their original uint32 width. The instruction-count and virtual
35register caps match the pre-existing C builder caps. Regalloc failures are
36compared as refusals, not reported as successful programs.
37
38## Reproducible host gates
39
40Use the pinned seeded compiler `omega-mv@e5b32567` (omc SHA-256
41`2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`),
42with 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
46sh om/units.sh
47sh om/units.sh --check
48taskset -c 10-14 nice -n 10 make -j3 test-codegen-tc
49taskset -c 10-14 nice -n 10 make -j3 test-codegen-tc-mutants
50taskset -c 10-14 nice -n 10 make -j3 test-codegen-tc-sim
51taskset -c 10-14 nice -n 10 make -j3 test
52```
53
54The last three focused targets are registered in `HOST_TESTS`. The mutant gate
55requires the compiler and bridge environment variables; missing tools or a
56compile failure fail the gate rather than counting as a killed mutant.
57
58### Configuration coverage
59
60The differential compares every instruction field, the complete solved register
61allocation, and successfully encoded instruction bytes. Neither two encoding
62failures 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
85N endpoints follow the original strict 23-bit output-offset guard:
86`Floor[(2^23-1)/(64 rt (16 warps))] (16 warps)`.
87WolframLanguageEvaluator query
88`Table[{rt,w,Floor[(2^23-1)/(64 rt (16 w))] (16 w)},{rt,{2,4,8}},{w,{4,8,16}}]`
89returned
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
92The record negative control flips one generated control word and requires the
93same comparator to reject it. The separate source-mutant gate recompiles Omega
94with changes to probe/peak HMMA spacing, bandwidth folding, GEMM FP8 decoding,
95and v2 accumulator rescaling (exercised with both epilogues). Each mutant must
96compile and link successfully, then fail the IR differential.
97
98### Simulator and chip distinction
99
100The simulator target executes the emitted probe, both bandwidth address modes,
101peak HMMA chains, grouped GEMM, and both v2 epilogues/direct modes. It reuses the
102existing tensor-core simulator and its built-in arithmetic mutants. It does not
103model scoreboard timing, physical hardware scheduling or chip throughput.
104
105Chip tier is **NOT_RUN**: no GPU window is authorized. During a separately
106approved 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
108revision, with the existing session/lock and hardware gates intact. Record device,
109compiler/unit identities, launch shapes, expected/observed values, timing policy
110and built-in mutant outcomes in a new receipt. Host or simulator PASS does not
111qualify the hardware path. No merge or deployment is authorized by this lane.
112
113Chip runbook (instructions only; **not executed** by this lane):
114
1151. 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.
1182. 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.
1213. 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
1324. 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
139The pre-relocation exhaustive/factored differential at `3bdfcfa` passed 180466
140encoded programs with 52240 matching allocator refusals and killed the record
141flip negative control. The six Omega source mutants and all simulator targets
142passed as well. The full host suite reached the 3600-second shared-core deadline;
143its tier is **INCONCLUSIVE**, not PASS. `full-timeout.log` preserves the command,
144deadline result and the absence of a final suite marker. Per Main's explicit
145full-suite policy, this lane does not retry the full run; Integrator owns the
146unbounded integrated host gate.
147
148The successor sources were then relocated without content changes into
149`om/codegen/` at CodegenA's request. Documentation and receipts remain here;
150Main/Integrator owns the shared `om/codegen/.crumb` and merged registration.
151The post-relocation regeneration and focused receipts are in `validation.json`.
152
153Post-relocation focused command chain exited 0. The strict differential printed
154`CODEGEN TC DIFF PASS (180517 cases, 52380 matching refusals)` and caught the
155record negative. Every successful program encoded successfully on both sides;
156matching encoding failures are not accepted. All six source mutants were killed,
157all simulator targets passed, regeneration was byte-identical, and crumb verify
158reported current. The one absolute home path in `focused-host.log` was replaced
159with `~`; numerical/test output is unchanged.