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

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