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 / evidence / NVRM-STRUCT-OM / README.md
| 1 | # NVRM struct codecs: host evidence |
| 2 | |
| 3 | ## State and scope |
| 4 | |
| 5 | IMPLEMENTED and EXERCISED on AArch64 Linux. HOST_ONLY PASS. Chip, live-RM, |
| 6 | VFIO and deployment are NOT_RUN. This is not hardware qualification. |
| 7 | |
| 8 | Base: CUDApp #324, `feat/nvrm-m16-rest-om`, |
| 9 | `196e84eeb753089cf0c92340a21788ea83f4eebb`; initial WIP `932e48fe`. |
| 10 | The first completion commit, `df36ab94f834`, registers the unit before the C |
| 11 | cutover. This receipt accompanies the subsequent implementation commit. |
| 12 | |
| 13 | The default (`CUDAPP_MIGRATION_PENDING_C_NVRM_STRUCT=0`) calls the Omega |
| 14 | parameter encoder/decoder. Setting the flag to 1 compiles the old C parameter |
| 15 | fills as the migration oracle. The existing independent envelope/transport flag |
| 16 | is unchanged. Raw ioctls, allocation ownership and pointer acquisition stay C. |
| 17 | |
| 18 | ## Measured layouts |
| 19 | |
| 20 | `tests/nvrm_struct_layout.c` is a host `sizeof`/`offsetof`/field-width probe; |
| 21 | `tests/nvrm_struct_layout.txt` is its actual stdout, not a hand-entered table. |
| 22 | The gate recompiles it against the read-only vendor source |
| 23 | `~/workspace/_ext/open-gpu-kernel-modules-580.173.02`, runs it, and compares |
| 24 | its entire output with the committed measurement. Includes are the vendor |
| 25 | SDK, common, UVM and nvalloc/unix header directories. Compile command: |
| 26 | |
| 27 | ```sh |
| 28 | cc -std=gnu11 -Wall -Wextra -Werror \ |
| 29 | -I"$V/src/common/sdk/nvidia/inc" -I"$V/kernel-open/common/inc" \ |
| 30 | -I"$V/kernel-open/nvidia-uvm" \ |
| 31 | -I"$V/src/nvidia/arch/nvalloc/unix/include" \ |
| 32 | tests/nvrm_struct_layout.c -o "$TMP/probe" |
| 33 | ``` |
| 34 | |
| 35 | The source/output cover RM request and reply fields, card fields, channel, |
| 36 | context share and scheduling, VASPACE, GID and every UVM parameter block used |
| 37 | by this client. The differential independently derives its schema with vendor |
| 38 | `offsetof` and `sizeof(field)` and compares that schema to Omega modes 2–5. |
| 39 | Examples directly from the probe: VASPACE size 56, `vaBase` at 40; GPU info V2 |
| 40 | size 564 with its list at 4; GR info is a distinct 8-byte structure; GID size |
| 41 | 268, length at 8 and byte data at 12. The card table contains 64 measured |
| 42 | 72-byte records. Channel entries have their measured field width, not a width |
| 43 | inferred from the next offset. |
| 44 | |
| 45 | The codec projects 26 layouts: ID, device, subdevice, virtual allocation, |
| 46 | GPU info V2, GR-get, classlist, VASPACE, GID, memory, channel, channel group, |
| 47 | context share, submit token, schedule, cards, GR info, and the UVM initialize, |
| 48 | MM initialize, range/free, register GPU, UUID-only unregister, register VASPACE, |
| 49 | register channel, unregister channel and external-map blocks. |
| 50 | |
| 51 | ## Independent controls and partitions |
| 52 | |
| 53 | `tests/nvrm_struct_test.c` uses vendor field descriptors as a C byte oracle. |
| 54 | For every projected field of every layout it varies zero, one, the field's |
| 55 | maximum, maximum minus one, the high bit and a mixed-bit value. The oracle |
| 56 | masks to the actual vendor field width. It compares every byte of the whole |
| 57 | block, including zeroed reserved fields and padding, then decodes the field. |
| 58 | A combined nonzero-fields case catches overlap. Every GID data byte is a |
| 59 | separate field. Every card field is decoded at all 64 indexes, and both GPU |
| 60 | list fields at all 70 indexes; one-past-end indexes and short buffers are |
| 61 | refused. UVM command sizes/status and heap status/total/free have independent |
| 62 | checks. The red control corrupts the C expected block and must fail the byte |
| 63 | comparison. |
| 64 | |
| 65 | `tests/nvrm_struct_check.py` changes real Omega semantic sites, regenerates |
| 66 | and compiles each mutant, and requires the independent oracle to reject it. |
| 67 | Compile failure does not count as a kill. All 12 were killed: GPU block size, |
| 68 | card table size, device mode offset, VASPACE base offset, GID data offset, |
| 69 | memory limit offset, channel engine offset, reversed card bound, GID byte |
| 70 | width, zero fill, UVM status width and heap free offset. Existing wire and |
| 71 | policy red controls and the six existing policy mutants also passed. |
| 72 | |
| 73 | ## Toolchain and shared implementation |
| 74 | |
| 75 | Seeded omc SHA-256: |
| 76 | `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. |
| 77 | Bridge source used: draft omega-bridge #76, |
| 78 | `741c1ebb2b0fbae311a77ad2118b13d5ec7a17ee`. |
| 79 | Portable converter SHA-256: |
| 80 | `d84fd6ebd258170a023ed5235880cd3e1ca8664703a2542542a7f8d103120538`; |
| 81 | portable frontend: |
| 82 | `a3a455bd77381e132215924295763e8728889d7d578278ae376de78324be8629`. |
| 83 | The bridge is draft / host-EXERCISED, not QUALIFIED. This evidence does not |
| 84 | claim its native-v2 path, hardware behavior or unrelated lowering is qualified. |
| 85 | |
| 86 | `om/units.sh` applies `bridge-seeded --runtime-views c|h` only to these |
| 87 | composites; ordinary units share the single portable converter pin: |
| 88 | |
| 89 | - `nvrm_struct=native/nvrm/uvm_fields.om,native/nvrm/struct.om` |
| 90 | - `nvrm_uvm_wire=native/nvrm/uvm_fields.om,native/nvrm/uvm_wire.om` |
| 91 | - `nvrm_uvm_map_wire=native/nvrm/uvm_fields.om,native/nvrm/uvm_map_wire.om` |
| 92 | |
| 93 | `uvm_fields.om` holds the existing UVM byte bodies shared by both callers. |
| 94 | The older fixed-size exports keep their ABI; the struct entry passes exact-size |
| 95 | runtime views. No parallel UVM encoder is retained. Existing envelope and heap |
| 96 | encoders remain the implementation for their existing requests. Generated C |
| 97 | is converter output, not a handwritten substitute for the Omega computation. |
| 98 | Host build dependency: GCC `13.3.0` (Ubuntu `13.3.0-6ubuntu2~24.04.1`). |
| 99 | Host call/runtime dependency: glibc `2.39`. These existing dependencies compile |
| 100 | and call the bridge-generated C. Their Omega replacement belongs to the seeded |
| 101 | compiler/native-linker work; no host-runtime replacement is claimed here. |
| 102 | |
| 103 | ## Reproduction and observed results |
| 104 | |
| 105 | Every probe execution, test, mutant, differential and unit check ran with the |
| 106 | following isolation prefix. It hides host GPU devices; no live ioctl was made. |
| 107 | Build parallelism was at most `-j3`. The full `make test` was not run. |
| 108 | |
| 109 | ```sh |
| 110 | export OMEGA_OMC="$HOME/work/cudastack/omega-mv/seed/out/omc" |
| 111 | export OMEGA_SEED="$HOME/work/cudastack/omega-bridge/build/bootstrap/omc" |
| 112 | export OMEGA_BRIDGE=/tmp/bridge-pin-merge # checkout at the exact revision above |
| 113 | bwrap --dev-bind / / --dev /dev --proc /proc -- \ |
| 114 | taskset -c 10-14 nice -n 10 \ |
| 115 | make -j3 test-nvrm-struct test-nvrm-wire test-nvrm-native \ |
| 116 | test-nvrm-differential test-nvrm-boundary test-nvrm-policy test-streams-submit |
| 117 | bwrap --dev-bind / / --dev /dev --proc /proc -- \ |
| 118 | taskset -c 10-14 nice -n 10 sh om/units.sh --check |
| 119 | ``` |
| 120 | |
| 121 | - `host.log`: exit 0; all named targets PASS; struct red killed, 12 struct |
| 122 | mutants killed, existing policy six-mutant gate PASS, native fake-RM request |
| 123 | bytes/replies PASS, C/Omega lifecycle output equal, submit image equal. |
| 124 | - `units-check.log`: exit 0, generated units regenerate byte for byte. |
| 125 | - `crumb.log`: compile and verify results for this change. |
| 126 | |
| 127 | Home-directory prefixes in logs are replaced with `~` for publication; no |
| 128 | semantic output is changed. Initial compilation caught an invalid bare return |
| 129 | in the new close error path; it was fixed to retain fault state while continuing |
| 130 | cleanup before the successful host run recorded here. |
| 131 | |
| 132 | ## Chip runbook — NOT_RUN |
| 133 | |
| 134 | Only the operator may authorize the exclusive GPU window. This document does |
| 135 | not grant permission to open devices, alter a driver, touch the serving model, |
| 136 | claim the GPU lock or run live checks. Do not run a live command under the host |
| 137 | sandbox and misreport the inevitable refusal as chip evidence. |
| 138 | |
| 139 | In an authorized window, first pin this PR and bridge revisions and rerun the |
| 140 | isolated host gates above. Record kernel/open-module version and device IDs; |
| 141 | require the 580.173.02 interface and the documented chip admission procedure. |
| 142 | Then use the repository's documented `make hello-gpu` entrypoint (which invokes |
| 143 | its doctor) with bounded build parallelism. Record allocation, channel creation, |
| 144 | GPU UUID/SM decoding, launch result and teardown, process exit and fresh driver |
| 145 | fault diagnostics. Follow the maintainer's existing exclusive-window runbook; |
| 146 | do not modify the lock/watchdog/service policy. A C-oracle live comparison |
| 147 | requires separate explicit authorization and an isolated output directory. |
| 148 | |
| 149 | Expected: correct hello output and clean teardown on the intended chip, with no |
| 150 | new driver fault. A failed admission or unavailable GPU is NOT_RUN, not PASS. |
| 151 | Preserve actual logs and negative-control results in a new chip receipt; never |
| 152 | edit this host receipt into a chip qualification. No chip step was executed here. |
| 153 | |
| 154 | Harness guide changes are tracked by `aien-dev/omega-harness#194`, consolidated |
| 155 | by Integrator4 because that repository is outside this lane's write scope. |