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 / dnn-layers / README.md
| 1 | # Seeded Omega DNN layers |
| 2 | |
| 3 | The integration branch is `feat/dnn-layers-om`, stacked on attention #282, |
| 4 | any-shape GEMM #283 (`04f16fe8`) and C1's append-only unsigned-conversion |
| 5 | foundation (`3bf3ac4`). No GPU execution is authorized by this work. |
| 6 | |
| 7 | ## Operator coverage and limits |
| 8 | |
| 9 | | Operator | Seeded source and contract | CPU-only entry | Input/output | |
| 10 | | --- | --- | --- | --- | |
| 11 | | Rectangular online-softmax attention | [`attn-any`](../attn-any/README.md): sequences 1..65535, head dimension 1..256, GQA, top-left causal or non-causal, finite scale including zero/negative | `omega_gpu_attn_any_codegen` | f32/bf16/f16 Q/K/V, f32 output | |
| 12 | | Row softmax, layernorm, rmsnorm | [`dnn-rows`](../dnn-rows/README.md): rows/length 1..65535, bounded total elements; pure norms with positive finite normal f32 epsilon | `omega_gpu_dnn_rows_codegen` | shared f32/bf16/f16 input, f32 output | |
| 13 | | ReLU, erf-GELU, tanh-GELU, SiLU | [`dnn-activations`](../dnn-activations/README.md): contiguous counts 1..UINT32_MAX, finite inputs, tail exits and stable saturation | `omega_gpu_dnn_activations_codegen` | shared f32/bf16/f16 input, f32 output | |
| 14 | | Strict implicit-GEMM conv2d | [`conv2d`](../conv2d/README.md): NCHW/NHWC, OIHW filters, groups/depthwise, stride, independent zero padding and dilation | `omega_gpu_conv2d_plan`, `omega_gpu_conv2d_codegen` | shared f32/bf16/f16 image/filter, f32 output | |
| 15 | |
| 16 | These are experimental bounded APIs, not complete cuDNN coverage or |
| 17 | performance replacements for the unchanged tuned model kernels. Public |
| 18 | signatures, distinct refusal codes and caller buffer/finite-arithmetic |
| 19 | preconditions are in `docs/runtime/API.md` sections 12 and 13 and the |
| 20 | individual headers. Shape admission, addressing, tails, tiling and kernel |
| 21 | arithmetic are seeded Omega. Execution C is allocation, upload/download, |
| 22 | pointer stepping and session/launch lifetime handling, not a host math kernel. |
| 23 | |
| 24 | Convolution does not materialize a global im2col tensor. Its virtual image |
| 25 | addresses feed `gs_dot` in `om/gemm-any/gemm_ir.om`, the same reduction used |
| 26 | by default scalar f32 dense GEMM. The former C scalar generator is retained |
| 27 | only behind default-OFF `CUDAPP_MIGRATION_PENDING_C_GEMM_BUILDER`; the |
| 28 | existing tensor GEMM configuration/API is unchanged. |
| 29 | |
| 30 | Independent double host references use libm only as verification oracles. |
| 31 | Each operator guide records its exact Wolfram query/result and **MODELED** |
| 32 | numerical test envelope. Simulator comparisons exercise the emitted IR; |
| 33 | neither the model nor simulated MUFU behavior proves chip accuracy. |
| 34 | |
| 35 | ## Device-free host acceptance |
| 36 | |
| 37 | Set `OMEGA_OMC` and `OMEGA_BRIDGE` to the pinned paths below. After writers |
| 38 | finish, the integration owner runs focused checks inside the device-free |
| 39 | namespace: |
| 40 | |
| 41 | ```sh |
| 42 | export OMEGA_OMC="$HOME/work/cudastack/omega-mv/seed/out/omc" |
| 43 | export OMEGA_BRIDGE="$HOME/work/cudastack/omega-bridge" |
| 44 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh om/units.sh --check |
| 45 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 \ |
| 46 | test-dnn-half test-dnn-half-mutants test-om-ir-boundary \ |
| 47 | test-gpu-attn-any test-gpu-attn-any-mutants \ |
| 48 | test-gpu-dnn-rows test-gpu-dnn-rows-mutants \ |
| 49 | test-gpu-dnn-activations test-gpu-dnn-activations-mutants \ |
| 50 | test-gpu-conv2d test-gpu-conv2d-mutants test-gpu-conv2d-gemm-f32 \ |
| 51 | test-runtime-api test-runtime-api-semver test-omega-binding-portable |
| 52 | ``` |
| 53 | |
| 54 | During the multi-lane integration wave, **Integrator alone** runs the single |
| 55 | full-suite attempt, after all candidate commits land: |
| 56 | |
| 57 | ```sh |
| 58 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test |
| 59 | ``` |
| 60 | |
| 61 | No retry, no `pkill`/`killall`, and no stopping another lane's processes. |
| 62 | Judge full-suite success by both rc 0 and the final |
| 63 | `CUDA++ HOST TESTS PASS (<n> targets)` line; interruption is INCONCLUSIVE, |
| 64 | not PASS. These templates do not retroactively claim that historical checks |
| 65 | preceding the device-free policy ran inside a namespace. |
| 66 | |
| 67 | The DNN and attention host/mutant links additionally wrap session |
| 68 | open/lock/unlock/free/allocation. Every wrapped entry aborts under `--sim` |
| 69 | or `--quick`; an explicit direct-open source mutant must die at that guard. |
| 70 | Separate `--shell-contract` mode has a fake backend solely to test NULL |
| 71 | versus non-NULL session pointer handling, and never forwards to a device. |
| 72 | The namespace remains mandatory even with those guards. |
| 73 | |
| 74 | ### Safety correction |
| 75 | |
| 76 | The initial row epsilon-admission mutant, before wrappers were installed, |
| 77 | had a source-proven path from `--sim` refusal testing to `session_open` and |
| 78 | the Linux nvrm client. That path could attempt `/dev/nvidiactl`, |
| 79 | `/dev/nvidia-uvm` and the driver-reported `/dev/nvidia%u`; source reachability |
| 80 | does not establish a successful historical device open or launch. |
| 81 | `om/dnn-rows/README.md` preserves the original command and correction. |
| 82 | The inverted session-pointer checks were fixed, abort guards and direct-open |
| 83 | negative controls were added to all DNN slices and attention, and all new |
| 84 | host/simulator/mutant commands use the mandatory device-free namespace. |
| 85 | |
| 86 | ## Source and generation pins |
| 87 | |
| 88 | Native seam: `9be13fb2595f1b3668288b36c4d17ef976bcb3a7`. |
| 89 | Seeded compiler: omega-mv `e5b32567`, omc SHA-256 |
| 90 | `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. |
| 91 | Bridge checkout: `29d9cff72676bcef41a067bdcf4d8b0711042bcd`; |
| 92 | `om/units.sh` enforces `om/omega-bridge.lock` and generates the committed |
| 93 | hosted/freestanding C and declarations. Generated identities are never |
| 94 | hand-edited to resolve a stacked-branch conflict. |
| 95 | |
| 96 | ## Native scalar half seam |
| 97 | |
| 98 | `BW_IR_F16_TO_F32` is opcode 67 and `BW_IR_F32_TO_F16` is 68. Existing opcodes |
| 99 | 0..64 retain main's values. The #280 merge moved the unpublished integ |
| 100 | conversion and binary64 IDs from 64..78 to 65..79, preserving main op 64. |
| 101 | Generic replay admits `BW_IR_LAST` and refuses |
| 102 | `BW_IR_LAST+1`; the replay-boundary regression also kills a compiled source |
| 103 | mutant restoring the former bound of 63. |
| 104 | |
| 105 | The sm_121 encoding authority is the already recorded E1_CVT golden words in |
| 106 | `src/omega_numeric.c`: `HADD2.F32 R9, -RZ, R2.H0_H0` has words |
| 107 | `ff097230 20000002 00004100`; `F2F.F16.F32 R9, R2` has |
| 108 | `00097304 00000002 00200800`. Widening uses HADD2, not an invented scalar |
| 109 | F2F widening instruction. The source is the low half of the input register; |
| 110 | narrowing is round-to-nearest-even and clears the upper half. Widening is |
| 111 | fixed latency; narrowing uses a dependency barrier before consuming its result. |
| 112 | The seeded encoder and migration-pending C differential encoder use the same |
| 113 | recorded forms; allocation and instruction selection remain separate. |
| 114 | |
| 115 | WolframLanguageEvaluator query: |
| 116 | |
| 117 | ```wolfram |
| 118 | FromDigits[#,16]& /@ {"ff007230","20000000","4100","7304", |
| 119 | "00200800","010fca00","010e2800"} |
| 120 | ``` |
| 121 | |
| 122 | Result: `{4278219312,536870912,16640,29444,2099200,17811968,17704960}`. |
| 123 | These are encoding integers, not measured performance or accuracy claims. |
| 124 | |
| 125 | `tests/gpu_dnn_half_test.c` checks all binary16 bit patterns against the |
| 126 | independent integer E1 reference, all finite half round trips, and a deterministic |
| 127 | binary32 narrowing sweep. NaNs are compared by class, not payload. It separately |
| 128 | checks native words across registers and all three IR guard modes, plus an |
| 129 | unknown-opcode refusal. The simulator uses the host `_Float16` conversion, |
| 130 | not the integer reference. No tolerance is applied to finite conversion bits. |
| 131 | Both simulator headers run the same native conversion reference and guarded |
| 132 | warp-scheduler regression. Default/scalar instructions execute only for the |
| 133 | predicate-selected lanes. SHFL writes only those lanes but may read a source |
| 134 | register from a guard-inactive lane; an entirely guard-inactive SHFL does |
| 135 | nothing. Active SHFL retains the simulator's split/exited-lane refusals. |
| 136 | The scalar simulator repair follows C1 commit `7de6da63`; the pre-existing |
| 137 | dynamic simulator repair is carried by attention #282. |
| 138 | |
| 139 | |
| 140 | Host-only commands: |
| 141 | |
| 142 | ```sh |
| 143 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-dnn-half test-om-ir-boundary |
| 144 | mkdir -p build/dnn-half-bins |
| 145 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 build/dnn_half_test build/dnn-half-bins/half.bin |
| 146 | # Compare the generated words with the seeded disassembler and offline nvdisasm: |
| 147 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 env SM121DIS_JOBS=3 tools/sm121dis/check.sh /path/to/sm121dis \ |
| 148 | build/dnn-half-bins build/dnn-half-oracle |
| 149 | ``` |
| 150 | |
| 151 | Every host, simulator, source-mutant or offline-oracle command runs inside |
| 152 | that device-free namespace. Native encoding/disassembly does not require a |
| 153 | GPU node; an attempted session/device open during those paths is a defect. |
| 154 | |
| 155 | The disassembler is a read-only verification oracle, not a production dependency. |
| 156 | Its exact source revision and the exercised commands belong in the dated receipt. |
| 157 | Listings and raw instruction binaries stay under ignored build directories. |
| 158 | |
| 159 | Chip execution and qualification are **NOT_RUN**. A passing simulator or offline |
| 160 | disassembler check is not a chip receipt. The ROADMAP status is not upgraded. |
| 161 | |
| 162 | Integrated implementation and host receipts are in |
| 163 | [`evidence/DNN-LAYERS-2026-11-06/REPORT.md`](../../evidence/DNN-LAYERS-2026-11-06/REPORT.md). |
| 164 | Draft [#307](https://github.com/aien-dev/CUDApp/pull/307) is stacked on attention |
| 165 | draft #282. The final full-suite gate belongs to Integrator2, not to these private |
| 166 | operator slices. |