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 / graph / README.md
| 1 | # Seeded model graph recording |
| 2 | |
| 3 | The default graph recorders use seeded Omega plans for scalar decode, Qwen3.6, Qwen3.8, batched Q36 heads, prefill mixer/expert ordering, MoE grouping/window bindings, output heads, allocation region offsets/sizes, standalone residual/SwiGLU glue, debug-copy launch records, and prefill launch/copy planning. `CUDAPP_MIGRATION_PENDING_C_GRAPHS=1` selects the retained C differential oracle in the four migrated translation units. It is not enabled by default. |
| 4 | |
| 5 | `om/units.sh` composes the units and commits their portable C ABI bindings. The compiler is omega-mv e5b32567, omc SHA-256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. The final entry function of each composition is the bridge export. Plans use fixed-size ulong descriptor views; the shell copies packed uint argument words and calls existing CUDApp recorder APIs. It does not add an execution backend or GPU launcher. |
| 6 | |
| 7 | The C shell retains tensor object observation, allocation/lifetime, recorder dispatch, statistics, errors, queue execution, and existing closure/admission API calls. Slice 8 moves the remaining Q38 dimensional defaults and derived widths, model scalar configuration/shape checks, layer classification and counters, rotary/FP8 gather tables, decode barrier normalization and timeline admission, prefill register-budget admission and allocation rounding into seeded Omega. Pure allocation layout and debug-copy/standalone glue descriptors are Omega units. Pointer/null/lifetime checks around host objects remain C; this is not a claim that every line in the four C files has been replaced. |
| 8 | |
| 9 | ## Host checks |
| 10 | |
| 11 | Run inside the device-free namespace, never against live devices: |
| 12 | |
| 13 | ``` |
| 14 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 CUDAPP_OMC_HOST=1 OMEGA_OMC=../omega-mv/seed/out/omc OMEGA_BRIDGE=../omega-bridge test-model-graphs-om |
| 15 | ``` |
| 16 | |
| 17 | The wire test compares seven argument-bank formats with an independent C oracle. The command-list differential compiles the actual graph translation units with old/new selection, compares complete command-list argument banks, QMD slots, launch code, waits, independence and graph state. Nested GDN, attention, GEMM and router recorders are deterministic ABI adapters: their complete input arguments become launches in the real command list. This isolates the migrated graph decisions, but is **not** end-to-end parity of actual nested kernel recordings or real model weights. |
| 18 | |
| 19 | Fixtures cover boundaries and generated sequence positions/configurations, scalar/batched heads, GDN/attention, Q38 BF16/split-down shapes and exact-head records, prefill multi-token paths, native MoE windows, combine, grouping and standalone glue. Independent layout/copy/transfer/launch checks compare generated descriptors with C expressions. Record flips are rejected. `mutants.py` recompiles five semantic wire changes; compilation errors are not mutant kills. Fake-platform submission probes exercise one complete token's layer/final plans without device access. |
| 20 | |
| 21 | `make test-model-graphs-warp` interprets the actual GATHER glue program with Omega-packed arguments in both warp orders, and rejects its source-index mutant. This is simulator evidence, not hardware qualification. |
| 22 | |
| 23 | `make test-model-graphs-nested` independently compiles old/new graph objects and invokes unwrapped production GDN, attention, FP8/BF16 GEMV, native GEMM and router recorders with synthetic resource observations and fake platform/RM. It compares every bank/QMD and submitted word, requires one submission per complete word, and kills a changed real plan descriptor. Q36 native MoE windows use actual seeded staged artifacts, temporary cubin export/snapshot admission and real leases; these device-free host paths are exercised. Weight/state contents are not kernel-executed. This complements, rather than replaces, the larger ABI-adapter randomized differential. Hardware qualification and the integrated full suite remain NOT_RUN. See `CHIP.md` and the dated receipt. |
| 24 | |
| 25 | ## Slice 8: graph residue and hello |
| 26 | |
| 27 | `residue.om` exports scalar metadata decisions over fixed descriptors; |
| 28 | `table.om` produces rotary/gather permutation words. The independent scalar |
| 29 | oracle is selected only with default-OFF |
| 30 | `CUDAPP_MIGRATION_PENDING_GRAPH_RESIDUE=1`. Existing #310 C graph oracles remain |
| 31 | separately selectable. `hello.om` and `hello-plan.om` cover hello input/output |
| 32 | checking and host plans; see [the hello runbook](../../examples/hello_gpu/README.md). |
| 33 | |
| 34 | `test-graph-residue` compares deterministic output against the C oracle, with a |
| 35 | deliberately corrupted result as a red check. Cases follow constructor branches: |
| 36 | dimension defaults, divisibility and capacity limits; vocabulary and layer/head |
| 37 | limits; mask bits and both layer classes; all legal gather layouts; barrier |
| 38 | values; timeline empty/full/overflow; explicit/default register budgets; full, |
| 39 | short, poisoned and bit-flipped output; all launch chunks and both bug modes. |
| 40 | Dimension and scalar rejection cases include 0, UINT32_MAX and adjacent source |
| 41 | boundaries. Non-NaN float output is compared bit-exact with contraction disabled. |
| 42 | |
| 43 | `test-graph-residue-mutants` compiles seven changed Omega units and requires |
| 44 | behavioral disagreement: poison, input period, checker add/sub, dimension cap, |
| 45 | timeline capacity, gather stride and load scoreboard. A compiler refusal is a |
| 46 | failed gate, never a mutant kill. |
| 47 | |
| 48 | `test-graph-residue-coverage` instruments the C oracle at O0 and runs the actual |
| 49 | hello oracle simulator plus both fault controls. The scalar header has every |
| 50 | executable line and branch reached. Its untaken `!in` branch is unreachable |
| 51 | after zero selects the nonzero default. ABI-status/abort branches in the glue |
| 52 | are deliberately not invoked with forged pointers or lengths. The hello oracle's |
| 53 | remaining uncovered branches are the device-only main path and device error |
| 54 | cleanup (NOT_RUN: no GPU window), allocation/IR-append failure handling (not |
| 55 | injected), CLI usage/invalid-option I/O, alternate diagnostic opcode strings and |
| 56 | nearest-buffer ties/ranges not generated by the vecadd fault. These are retained |
| 57 | host/device glue, not untested alternate C computation selected in production. |
| 58 | The differential separately exercises bandwidth target/positive-time branches |
| 59 | and wrong-answer checking that the normal/past-end/short simulator does not. |
| 60 | Warp-simulator opcode/MUFU branches unused by vecadd belong to the simulator's |
| 61 | own tests; coverage here does not qualify them. |
| 62 | |
| 63 | Q36 formerly silently truncated a full timeline; Q38 could copy past its fixed |
| 64 | stamp array. Both now reject a batch that cannot fit before copying any stamps. |
| 65 | The shared capacity regression checks the last fitting batch and the first |
| 66 | overflow, including UINT32_MAX count. Failure leaves the output index unchanged. |
| 67 | |
| 68 | ### Runtime table view pin (pending upstream) |
| 69 | |
| 70 | The converter/frontend pins in `om/units.sh` select omega-bridge #73 |
| 71 | `79e8c3613a6f`, stacked on unmerged #71. This CUDApp change is pending both PRs. |
| 72 | Only `model_graph_table` selects `bridge-seeded --runtime-views`. Its numeric |
| 73 | `edit uint 24576` is a capacity: the actual allocation length is passed to the |
| 74 | checked entry, so Omega writes packed uint32 values directly. The old fixed-512 |
| 75 | scratch buffer, widening/narrowing copy and C chunk loop are removed. All legal |
| 76 | Q/KV layouts are compared up to the maximum extent, including q=kv=24; admission |
| 77 | controls cover empty/null, over-capacity, nonempty-null and result/view overlap. |
| 78 | WolframLanguageEvaluator: `(24+24)*512` -> `24576`. |
| 79 | |
| 80 | This is the hosted checked converter profile, not native/freestanding. The |
| 81 | existing freestanding units and pins retain their original path. Build the |
| 82 | bridge generator with its existing pinned bootstrap seed using `tools/build.sh`; |
| 83 | set `OMEGA_SEED` to that baseline executable when a separate bridge worktree |
| 84 | does not contain `build/bootstrap/omc`. The seeded source validator remains |
| 85 | e5b32567 through `OMEGA_OMC`. Re-run `om/units.sh --check` with the same bridge, |
| 86 | seed and validator. Every hosted generated file/identity is refreshed because |
| 87 | the converter pin changes; integration must regenerate the union of lane units. |