Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/om/cmdlist/README.md # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers 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 3 This component stacks on Streams ``daee8b6fc054df8fe40830a04127f10e21ba9184`` 4 (draft #272). It reuses Streams' method encoder, queue selection and pair markers; 5 it does not introduce another GPU launcher. Omega owns the policy, CUDApp owns 6 allocation, 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 20 A program describes every user-data access as `{va, bytes, READ|WRITE}`. Address 21 intervals, not buffer identities, determine aliasing. All outstanding launches 22 since the most recent drain are compared; comparing only adjacent launches is 23 incorrect. RAW, WAR and WAW require a drain; read/read overlap does not. Empty 24 access sets mean **known empty**. Legacy records mean **unknown**, conservatively 25 conflicting with every other record. Descriptors are copied and validated. 26 For multiple virtual mappings of the same storage, the producer must normalize 27 effects to one canonical interval namespace. Distinct raw VAs do not prove 28 physical independence. If that normalization is unavailable, retain unknown 29 effects and their conservative drains. 30 31 The first launch retains an admission WFI and full shader-cache invalidation. 32 Hazards retain that same pair. Independent launches omit both. Completion release 33 and its flush remain unchanged. Optional timestamps add a final explicit WFI; 34 independent-launch timestamps are front-end positions, not completion times. 35 `ProgramPlan.waits` counts explicit WFI methods, including admission and that 36 optional final timestamp WFI; it does not count the unchanged completion release. 37 38 A program either fits one submission including the platform's published prefix, 39 or is refused before queue commit. It is never silently split. Empty programs 40 produce zero submissions. Experimental barrier suppression, skipped launches, 41 first-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 45 Pinned method source: 46 [NVIDIA/open-gpu-doc@`9fdf5c4062007929d9f4e6cbad9c9771fe61b880`, 47 classes/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 63 These definitions justify which methods are preserved and the range proof 64 justifies each omitted drain. They are not a chip ordering qualification. Host 65 simulation cannot prove GPU cache behavior; chip ordering and latency are NOT_RUN. 66 The C encoding oracle is retained for differential checking, not as a new trusted 67 implementation. Numeric conversion used in the QMD port was checked with Wolfram: 68 `WolframLanguageEvaluator: FromDigits["`04b44808`",16] -> `78923784``. 69 70 ## Host acceptance 71 72 Every host test, simulator, mutant and differential runs in a device-free 73 namespace, 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 77 export OMEGA_OMC=$HOME/work/cudastack/omega-mv/seed/out/omc 78 export OMEGA_BRIDGE=$HOME/work/cudastack/omega-bridge 79 export OMEGA_BRIDGE_DIR=$OMEGA_BRIDGE 80 export OMEGA_MV=$HOME/work/cudastack/omega-mv 81 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-om-cmdlist test-runtime-api 82 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-om-cmdlist-mutants 83 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh om/units.sh --check 84 crumb compile . 85 crumb verify . 86 ``` 87 88 The independent C oracle checks 12,000 randomized programs, aliased ranges, 89 RAW/WAR/WAW/read-read, nonadjacent dependencies, empty/one/full/capacity+1 programs, 90 exact ring bounds and 1,000 launch records against the pre-existing C bank/QMD 91 builders. The shell differential additionally exercises public record/plan APIs 92 and 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 96 barrier-delimited epoch, then checks every buffer against serialized execution 97 under both warp orders. This adversarial schedule makes a missing required drain 98 observable as wrong **data**, not merely a different barrier counter. 99 100 Five separately compiled Omega mutants must fail behavior: omitted hazard drain 101 (simulator data mismatch), capacity off-by-one, wrong RAW classification, 102 adjacent-only dependency tracking and incorrect pushbuffer sizing. A compile 103 failure 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 109 workload from `tests/gpu_launch_cost_test.c` and the five-kernel decode glue sequence 110 from `tests/gpu_cmdlist_test.c`. The historical 289-launch token is also shown 111 with **unknown** effects: it deliberately receives no invented wait reduction. 112 These are source-derived count models, not captured production traces or latency 113 measurements. Complete graph-producer annotations are required before claiming a 114 whole-token reduction. ROADMAP remains PARTIAL. 115 116 Observed 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 128 The old command-list implementation already used one submission for these 129 programs. The change removes only provably redundant inter-launch WFIs and 130 refuses oversized whole programs instead of splitting. The per-kernel column 131 is a different execution strategy, not a claimed reduction over old lists. 132 133 Chip qualification requires Drake's current exclusive-window authorization and 134 the existing operator gate; a free lock is not authorization. No chip command was 135 run in this lane. Preserve the historical 136 `evidence/OWN30B-LAUNCH-COST-20261014T0120Z/` receipt; create a new dated receipt. 137 Keep the OWN30B method: fixed `n=16384`, `k=2048`, splits `1,2,4,8,16`, same weights 138 and bytes, one selected FP8 kernel, 20 repetitions, poisoned outputs checked 139 bit-for-bit against serialized one-launch references on every repetition, GPU 140 stamp span and host elapsed reported separately. Run WFI baseline before and 141 after the candidate as drift controls. Do not infer candidate latency from host 142 counts. Required negatives: dropped launch must name the missing semaphore; 143 missing hazard drain must be data-red in the host simulator before any chip run. 144 145 Build the existing chip executable on the host (this does not open a GPU): 146 147 ```sh 148 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 build/gpu_launch_cost_test 149 ``` 150 151 Only inside the authorized exclusive window, through the operator's current 152 hardware gate, and after explicit authorization to expose the device for chip 153 testing (the host namespace rule is not implicitly waived), run these commands 154 in this order and preserve stdout plus receipts: 155 156 ```sh 157 build/gpu_launch_cost_test --reps 20 --n 16384 --k 2048 --out baseline-before.json 158 build/gpu_launch_cost_test --program --reps 20 --n 16384 --k 2048 --out program.json 159 build/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 163 recorded launch and calls the new one-submission API. Shared input is read-only; 164 weight, scale and output slices do not alias other launches' writes. Its first 165 intermediate stamp can precede completion, so only endpoint span and host elapsed 166 are comparable to the old cost method. Receipt metadata labels these front-end 167 stamps. The old dropped-launch negative remains a legacy-oracle check. Candidate 168 chip 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. 174 It reuses `nvsend` and the existing sleeping `nvwait`; it does not open a second 175 channel. 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. 179 The conservative stream drains and invalidates shader caches between bodies. 180 It preserves dependencies; it does not claim independent dispatch overlap. 181 182 The count limit is 512, the packet limit is `1048576` bytes. Any bad append poisons 183 the entire recording. Nothing is sent until the exact declared count fits. 184 One launch retains the old packet bytes. Larger batches carry one WFI release 185 seal per launch and one final C3 completion tail. A failed wait names the first 186 missing zero-based index in `gbst[4]` and caller id in `gbst[5]`; index=count means 187 the final tail failed after every launch seal. It is completion attribution, 188 not a GPU exception decoder. All packet, QMD, bank, code and data allocations 189 remain pinned until completion. Timeout latches `nvfault`; never reuse or free 190 these buffers before the existing context teardown has quiesced the channel. 191 192 Host acceptance is `OMEGA_COMPILER= sh tests/host-trace/run-host-trace.sh`. 193 The chip probe is `tests/host-trace/batch-chip.om`, compiled with the real context; 194 it measures a synthetic VECTOR_1D step, not model inference. Hardware remains NOT_RUN.