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 / evidence / NVRM-STRUCT-OM / README.md

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