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 / tests / ampere / README.md

185 lines · 9601 bytes Raw Blame History Rendered
1# Ampere device qualification plan
2
3**RTX 3090 (GA102): NOT_RUN. RTX 3060 Ti (GA104): NOT_RUN.**
4No RTX card is attached to the development Spark. Host, emulator, simulated-driver,
5ELF inspection and nvdisasm results do not change either device status. This plan
6is for a separate Linux x86_64 machine with an explicitly authorized GPU window.
7It never stops a serving process, changes clocks, loads a module, or installs a driver.
8
9## Prerequisites and exact target
10
11NVIDIA lists both products at compute capability 8.6:
12[CUDA GPUs](https://developer.nvidia.com/cuda/gpus.md).
13The [3090 specifications](https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3090-3090ti/)
14list 24 GB GDDR6X; [3060 Ti specifications](https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3060-3060ti/)
15list 8 GB GDDR6/GDDR6X. Do not use system RAM as the discrete allocation budget.
16
17The initial direct-driver ABI is pinned to NVIDIA **580.173.02**, matching
18`third_party/nvidia-open-580.173.02`. The
19[pinned open-module README](https://github.com/NVIDIA/open-gpu-kernel-modules/blob/580.173.02/README.md)
20supports Linux x86_64 and Turing or later, including these cards. Open-module
21support is not evidence that CUDA++'s direct RM/UVM path has run on them.
22Do not bypass a mismatched-driver refusal. A different driver needs its own
23reviewed header/ABI update before device execution.
24
25The doctor accepts the requested GA102/GA104 PCI IDs: 2204 (3090), 2486 and
262489 (3060 Ti). Other products sold under a 3060 Ti name have distinct PCI IDs;
27they are not silently treated as GA104. The actual PCI ID must be recorded.
28The library admits the same three IDs as sm_86 at device open
29(`om/admission/chip_admit.om`); `nvrm_open` refuses any other NVIDIA GPU with
30one sentence before it opens `/dev/nvidia*`.
31
32Drake must provide the machine holding each card, its OS, driver version, and SSH
33access. On that machine, obtain its PCI BDF with the read-only doctor or `lspci`.
34`CUDAPP_GPU_BDF` selects that same exact device in the runtime. No device tests
35are authorized on the development Spark by this plan.
36
37## Build without a GPU
38
39```sh
40make all hello-gpu-build ampere-device-build
41make test-ampere-plan
42```
43
44Use the portable generated-from-Omega units. Do not substitute the migration C
45encoder, AArch64 machine-code trampolines, or a QEMU-AArch64 run for an x86 build.
46Keep the source commit, converter pin, seeded compiler hash, generated provenance,
47compiler version and full build/test logs with the run. The normal host suite is
48`make test`; the Ampere-specific nvdisasm gate is:
49`make OUT_DIR=build-ampere-oracle CUDAPP_AMPERE_CORPUS=1 test-ampere-encoder-oracle`.
50It includes an intentionally corrupted encoding negative control that must fail.
51
52## Read-only doctor
53
54```sh
55python3 tests/ampere/doctor.py --bdf 0000:01:00.0
56```
57
58Expected JSON: `preflight: PASS`, `machine: x86_64`, `open_module: true`, driver
59`580.173.02`, exactly the selected GA102/GA104 GPU with `target: sm_86`, and
60`device_execution: NOT_RUN`. It reads `/proc`, `/sys`, and node access bits only;
61it never opens a GPU. PASS means the preconditions hold, not qualification.
62A closed module, unknown card, missing node, ambiguous selection, or ABI mismatch
63must exit 1. A `--root` filesystem fixture is always labeled **SIMULATED**.
64
65## Authorized device run and receipts
66
67Use a **new** evidence directory per card and source revision:
68
69```sh
70python3 tests/ampere/run.py --device --bdf 0000:01:00.0 \
71 --output evidence/ampere-ga102-first-run --full-math
72```
73
74Run again on the GA104 machine with its BDF and another new output directory.
75The runner refuses to overwrite existing receipts. `results.json` starts with
76all checks `NOT_RUN`; only actually executed checks become PASS or FAIL. It
77stops on a failure, preserving the failing log and leaving later checks NOT_RUN.
78Without `--full-math`, `math-exhaustive` remains NOT_RUN even if smoke tests pass.
79
80| Check | Expected output / criterion | GA102 | GA104 |
81|---|---|---|---|
82| doctor | Exact GPU, open module, pinned ABI; preflight PASS | NOT_RUN | NOT_RUN |
83| hello | `checked 1048576 of 1048576 elements: 0 wrong, 0 never written`, exit 0 | NOT_RUN | NOT_RUN |
84| hello negative control | One deliberately unwritten result, `1 wrong, 1 never written`, exit 1 | NOT_RUN | NOT_RUN |
85| safe reserve refusal | `AMPERE MEMORY REFUSAL PASS`; no new RM allocation ioctl; free VRAM unchanged | NOT_RUN | NOT_RUN |
86| math smoke | Four `SHARD PASS` lines; not exhaustive evidence | NOT_RUN | NOT_RUN |
87| math negative control | Deliberately sign-corrupted first reciprocal result is caught, exit 1 | NOT_RUN | NOT_RUN |
88| math exhaustive | Four `EXHAUSTIVE PASS` lines over all binary32 bit patterns, exit 0 | NOT_RUN | NOT_RUN |
89
90### Vector add
91
92```sh
93CUDAPP_GPU_BDF=0000:01:00.0 build/hello_gpu --target=sm_86
94CUDAPP_GPU_BDF=0000:01:00.0 build/hello_gpu_control --target=sm_86 --bug=short
95```
96
97The second command **must fail** with exit 1; no out-of-bounds access is involved.
98Both programs verify every output element, print code/output hashes and synchronize
99CPU/device visibility explicitly. Ampere output must not reuse GB10 bandwidth claims.
100`--sim --target=sm_86` is an IR **SIMULATED** result, not SASS or device evidence.
101
102### Exhaustive numerical checks
103
104```sh
105CUDAPP_GPU_BDF=0000:01:00.0 build/ampere_math_device --device
106```
107
108The verifier sweeps every binary32 input bit pattern for each emitted unary MUFU
109function: reciprocal, reciprocal square root, base-two exponential and logarithm.
110A bounded batch is uploaded/read back on every iteration; no full-domain buffer
111is allocated. It checks NaN classification, infinities, signed zero and finite
112error, against independent host long-double libm. NaN payload identity is not a
113contract. A shard can be selected with `--start` and `--count`; it prints
114`SHARD PASS`, never `EXHAUSTIVE PASS`. This is not an exhaustive binary-operand
115Cartesian product or a claim about correctly rounded software divide/sqrt.
116
117The intended non-FTZ bounds are NVIDIA PTX ISA 9.4 sections 9.7.3.13, 9.7.3.16,
1189.7.3.20 and 9.7.3.21: reciprocal 1 ULP; reciprocal square root relative error
119`2^-22.9`; logarithm absolute error `2^-22` for input in `(0.5,2)` and relative
120error `2^-22` outside it; exponential 2 ULP. **Raw MUFU equivalence to these
121PTX-level contracts, especially subnormal handling, is unqualified.** A failure
122is a defect to fix in normalization/kernel generation, not permission to skip
123inputs or enlarge a bound. A long-double libm comparison is a test oracle, not
124a formal correctly-rounded reference proof.
125
126Symbolic formula check used while writing this verifier:
127`WolframLanguageEvaluator: {FullSimplify[1/Sqrt[x] == x^(-1/2), Assumptions->x>0], FullSimplify[Log[x]/Log[2] == Log[2,x], Assumptions->x>0], 2^(-22)} -> {True, True, 1/4194304}`.
128
129Negative control (small, safe shard, still real device work):
130
131```sh
132CUDAPP_GPU_BDF=0000:01:00.0 build/ampere_math_device --device \
133 --count 65536 --inject-output-error
134```
135
136It corrupts only the CPU-side readback after the GPU finishes. Expected:
137`AMPERE MATH FAIL op=rcp input=00000000`, exit 1.
138`--self-test` checks the host oracle's special-value/refusal controls without a GPU;
139`--emit-only` emits all four kernels without opening a GPU.
140
141### Safe memory refusal, not an OOM test
142
143```sh
144CUDAPP_GPU_BDF=0000:01:00.0 build/ampere_memory_refusal --device
145```
146
147The session opens first, then the test queries actual free and total VRAM, sets
148`CUDAPP_GPU_MIN_FREE_BYTES` above total (therefore above free), and requests only a
149small page. Even a concurrent free cannot turn this into a real allocation.
150The request must be rejected by D1 **before any RM allocation ioctl**.
151A link-time ioctl wrapper counts real allocation escapes independently of the
152return code. A second RM heap query must report identical free and total VRAM.
153Concurrent GPU users can change free VRAM and make this proof inconclusive/FAIL;
154reserve an idle window rather than allocating pressure or relaxing the check.
155Never allocate the card's capacity, exhaust UVM/system memory, or use a real OOM
156as a refusal test. Host simulated-driver tests are explicitly SIMULATED.
157
158## Recording qualification
159
160Keep complete per-check logs and `results.json` with the exact source revision.
161A doctor PASS, disassembler PASS, or x86 host PASS must never be copied into a
162device result. No script modifies the qualified-device table. Only actual real-card
163results with the required negative controls can support a separate reviewed
164qualification change. Any failed check leaves the corresponding card unqualified.
165
166## Experimental native Omega x86 oracle
167
168This optional host-only probe does not change the production bridge-C route.
169Use a checkout of omega-mv draft #923 at
170`becf5c817bcb7e0846d12ebfc2be91042d8ad89a`; the probe verifies both that revision
171and its tracked AArch64 compiler fingerprint before compiling anything.
172
173```sh
174python3 tests/ampere/native_omega_x86.py \
175 --compiler-tree /path/to/pinned/omega-mv \
176 --output build/ampere-native-x86
177```
178
179The probe compiles all four actual units to x86 and executes composed small-unit
180callers under `qemu-x86_64`, comparing their output with native AArch64 and
181requiring negative controls to fail. Label these results **EMULATED**, not native
182x86 or device qualification. The cubin unit's full-size private-ABI buffers do
183not fit Omega's local-array/stack limits; its native private-ABI execution remains
184**NOT_RUN**, not a reduced-signature or fake-buffer PASS. The generated bridge-C
185cubin tests exercise the full-size host boundary separately.