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 / cmdlist / README.md

194 lines · 11612 bytes Raw Blame History Rendered
1# Seeded whole-program command lists
2
3This component stacks on Streams `daee8b6fc054df8fe40830a04127f10e21ba9184`
4(draft #272). It reuses Streams' method encoder, queue selection and pair markers;
5it does not introduce another GPU launcher. Omega owns the policy, CUDApp owns
6allocation, copying, synchronization, queue submission and observation.
7
8## Default implementation
9
10- `record.om`: bank template, arguments, launch admission and QMD1/QMD0 encoding.
11- `layout.om`: allocation sizes, legacy chunk capacity, chunk bounds and inline patches.
12- `plan.om`: whole-program validation, aliased byte-range hazards, exact ring budget
13 and one-submission plan. `access.om` exports its single-descriptor validator.
14- `src/omega_gpu_cmdlist.c`: memory/effect shell; the former C record and sizing
15 implementation is an opt-in oracle, `CUDAPP_MIGRATION_PENDING_CMDLIST=1`.
16- Generated portable C is checked in and regenerated only through `om/units.sh`.
17 Compiler pin: `omega-mv@e5b32567`, omc SHA-256
18 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`.
19
20A program describes every user-data access as `{va, bytes, READ|WRITE}`. Address
21intervals, not buffer identities, determine aliasing. All outstanding launches
22since the most recent drain are compared; comparing only adjacent launches is
23incorrect. RAW, WAR and WAW require a drain; read/read overlap does not. Empty
24access sets mean **known empty**. Legacy records mean **unknown**, conservatively
25conflicting with every other record. Descriptors are copied and validated.
26For multiple virtual mappings of the same storage, the producer must normalize
27effects to one canonical interval namespace. Distinct raw VAs do not prove
28physical independence. If that normalization is unavailable, retain unknown
29effects and their conservative drains.
30
31The first launch retains an admission WFI and full shader-cache invalidation.
32Hazards retain that same pair. Independent launches omit both. Completion release
33and its flush remain unchanged. Optional timestamps add a final explicit WFI;
34independent-launch timestamps are front-end positions, not completion times.
35`ProgramPlan.waits` counts explicit WFI methods, including admission and that
36optional final timestamp WFI; it does not count the unchanged completion release.
37
38A program either fits one submission including the platform's published prefix,
39or is refused before queue commit. It is never silently split. Empty programs
40produce zero submissions. Experimental barrier suppression, skipped launches,
41first-barrier suppression and cross-list waits are refused on this path.
42
43## Why the omitted waits are not dispatches or required cache publication
44
45Pinned method source:
46[NVIDIA/open-gpu-doc@9fdf5c4062007929d9f4e6cbad9c9771fe61b880,
47classes/compute/clcec0.h](https://github.com/NVIDIA/open-gpu-doc/blob/9fdf5c4062007929d9f4e6cbad9c9771fe61b880/classes/compute/clcec0.h).
48
49- `clcec0.h:49-50`: `WAIT_FOR_IDLE` is a separate method. Omitting a redundant
50 wait does not omit the launch.
51- `clcec0.h:262-277`: shader-cache invalidation has distinct instruction, data,
52 constant and flush-data fields. Every CPU-written bank/QMD is unique per launch
53 and immutable until completion; the retained leading invalidate admits these
54 records. For an independent launch no earlier dispatch writes anything it
55 reads or writes, or reads anything it overwrites. There is no inter-dispatch
56 data publication requiring another shader-cache invalidation.
57- `clcec0.h:363-364,378-383`: every PCAS launch still sends its QMD address and
58 `INVALIDATE_COPY_SCHEDULE` action. QMD copy/invalidation and scheduling are not
59 dropped along with the idle wait. INLINE retains both complete QMD payloads.
60- `clcec0.h:666-680`: NVIDIA also defines a distinct `NO_WFI` invalidate method.
61 This planner does **not** replace dependency drains with that weaker operation.
62
63These definitions justify which methods are preserved and the range proof
64justifies each omitted drain. They are not a chip ordering qualification. Host
65simulation cannot prove GPU cache behavior; chip ordering and latency are NOT_RUN.
66The C encoding oracle is retained for differential checking, not as a new trusted
67implementation. Numeric conversion used in the QMD port was checked with Wolfram:
68`WolframLanguageEvaluator: FromDigits["04b44808",16] -> 78923784`.
69
70## Host acceptance
71
72Every host test, simulator, mutant and differential runs in a device-free
73namespace, as required by Main's 2026-11-06 safety rule. It exposes a minimal
74`/dev`, without NVIDIA, CUSE or VFIO nodes, plus the assigned CPU affinity:
75
76```sh
77export OMEGA_OMC=$HOME/work/cudastack/omega-mv/seed/out/omc
78export OMEGA_BRIDGE=$HOME/work/cudastack/omega-bridge
79export OMEGA_BRIDGE_DIR=$OMEGA_BRIDGE
80export OMEGA_MV=$HOME/work/cudastack/omega-mv
81bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-om-cmdlist test-runtime-api
82bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-om-cmdlist-mutants
83bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh om/units.sh --check
84crumb compile .
85crumb verify .
86```
87
88The independent C oracle checks 12,000 randomized programs, aliased ranges,
89RAW/WAR/WAW/read-read, nonadjacent dependencies, empty/one/full/capacity+1 programs,
90exact ring bounds and 1,000 launch records against the pre-existing C bank/QMD
91builders. The shell differential additionally exercises public record/plan APIs
92and checks complete emitted pushbuffers against Streams' C method oracle.
93
94`cmdlist_sim_test.c` executes real copy-plus-one instructions in the existing
95`bw_warp_sim.h` simulator. A queue harness reverses dispatch order inside each
96barrier-delimited epoch, then checks every buffer against serialized execution
97under both warp orders. This adversarial schedule makes a missing required drain
98observable as wrong **data**, not merely a different barrier counter.
99
100Five separately compiled Omega mutants must fail behavior: omitted hazard drain
101(simulator data mismatch), capacity off-by-one, wrong RAW classification,
102adjacent-only dependency tracking and incorrect pushbuffer sizing. A compile
103failure is not a killed mutant. Build/run receipts are retained under
104`build/om-cmdlist/mutants/` (or the configured `OUT_DIR`).
105
106## Count model and chip runbook
107
108`build/om-cmdlist/cost` reports integer counts only, for the split FP8 decode
109workload from `tests/gpu_launch_cost_test.c` and the five-kernel decode glue sequence
110from `tests/gpu_cmdlist_test.c`. The historical 289-launch token is also shown
111with **unknown** effects: it deliberately receives no invented wait reduction.
112These are source-derived count models, not captured production traces or latency
113measurements. Complete graph-producer annotations are required before claiming a
114whole-token reduction. ROADMAP remains PARTIAL.
115
116Observed host count output (PCAS; split FP8 uses timestamps, glue/token do not):
117
118| Program | Launches | Old per-kernel submissions | Old list submissions / WFIs | New submissions / WFIs | New words |
119| --- | --- | --- | --- | --- | --- |
120| FP8 split 1 | 1 | 1 | 1 / 2 | 1 / 2 | 57 |
121| FP8 split 2 | 2 | 2 | 1 / 3 | 1 / 2 | 67 |
122| FP8 split 4 | 4 | 4 | 1 / 5 | 1 / 2 | 87 |
123| FP8 split 8 | 8 | 8 | 1 / 9 | 1 / 2 | 127 |
124| FP8 split 16 | 16 | 16 | 1 / 17 | 1 / 2 | 207 |
125| Decode glue | 5 | 5 | 1 / 5 | 1 / 3 | 67 |
126| Historical token, unknown effects | 289 | 289 | 1 / 289 | 1 / 289 | 2347 |
127
128The old command-list implementation already used one submission for these
129programs. The change removes only provably redundant inter-launch WFIs and
130refuses oversized whole programs instead of splitting. The per-kernel column
131is a different execution strategy, not a claimed reduction over old lists.
132
133Chip qualification requires Drake's current exclusive-window authorization and
134the existing operator gate; a free lock is not authorization. No chip command was
135run in this lane. Preserve the historical
136`evidence/OWN30B-LAUNCH-COST-20261014T0120Z/` receipt; create a new dated receipt.
137Keep the OWN30B method: fixed `n=16384`, `k=2048`, splits `1,2,4,8,16`, same weights
138and bytes, one selected FP8 kernel, 20 repetitions, poisoned outputs checked
139bit-for-bit against serialized one-launch references on every repetition, GPU
140stamp span and host elapsed reported separately. Run WFI baseline before and
141after the candidate as drift controls. Do not infer candidate latency from host
142counts. Required negatives: dropped launch must name the missing semaphore;
143missing hazard drain must be data-red in the host simulator before any chip run.
144
145Build the existing chip executable on the host (this does not open a GPU):
146
147```sh
148bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 build/gpu_launch_cost_test
149```
150
151Only inside the authorized exclusive window, through the operator's current
152hardware gate, and after explicit authorization to expose the device for chip
153testing (the host namespace rule is not implicitly waived), run these commands
154in this order and preserve stdout plus receipts:
155
156```sh
157build/gpu_launch_cost_test --reps 20 --n 16384 --k 2048 --out baseline-before.json
158build/gpu_launch_cost_test --program --reps 20 --n 16384 --k 2048 --out program.json
159build/gpu_launch_cost_test --reps 20 --n 16384 --k 2048 --out baseline-after.json
160```
161
162`--program` attaches the complete table/input/weight/scale/output ranges to each
163recorded launch and calls the new one-submission API. Shared input is read-only;
164weight, scale and output slices do not alias other launches' writes. Its first
165intermediate stamp can precede completion, so only endpoint span and host elapsed
166are comparable to the old cost method. Receipt metadata labels these front-end
167stamps. The old dropped-launch negative remains a legacy-oracle check. Candidate
168chip data parity, cache ordering, drift and timing are all NOT_RUN here.
169
170## Native seeded callers
171
172`native/blackwell/batch.om` is the native counterpart for callers that compose
173`native/nvrm/context.om` and `native/blackwell/launch.om`, rather than the C ABI.
174It reuses `nvsend` and the existing sleeping `nvwait`; it does not open a second
175channel. Call `gbbopen` once, `gbbegin count`, then build a body with `gbbody n`
176(or the caller's QMD/inline-DMA builder without its tail) and call
177`gbappend kernel_id dependency` for every launch. Finally call `gbbsubmit budget_ns`.
178`dependency` is zero or an already-recorded producer's zero-based index plus one.
179The conservative stream drains and invalidates shader caches between bodies.
180It preserves dependencies; it does not claim independent dispatch overlap.
181
182The count limit is 512, the packet limit is 1048576 bytes. Any bad append poisons
183the entire recording. Nothing is sent until the exact declared count fits.
184One launch retains the old packet bytes. Larger batches carry one WFI release
185seal per launch and one final C3 completion tail. A failed wait names the first
186missing zero-based index in `gbst[4]` and caller id in `gbst[5]`; index=count means
187the final tail failed after every launch seal. It is completion attribution,
188not a GPU exception decoder. All packet, QMD, bank, code and data allocations
189remain pinned until completion. Timeout latches `nvfault`; never reuse or free
190these buffers before the existing context teardown has quiesced the channel.
191
192Host acceptance is `OMEGA_COMPILER=<pinned omc> sh tests/host-trace/run-host-trace.sh`.
193The chip probe is `tests/host-trace/batch-chip.om`, compiled with the real context;
194it measures a synthetic VECTOR_1D step, not model inference. Hardware remains NOT_RUN.