Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/ampere/README.md # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers 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.** 4 No RTX card is attached to the development Spark. Host, emulator, simulated-driver, 5 ELF inspection and nvdisasm results do not change either device status. This plan 6 is for a separate Linux x86_64 machine with an explicitly authorized GPU window. 7 It never stops a serving process, changes clocks, loads a module, or installs a driver. 8 9 ## Prerequisites and exact target 10 11 NVIDIA lists both products at compute capability 8.6: 12 [CUDA GPUs](https://developer.nvidia.com/cuda/gpus.md). 13 The [3090 specifications](https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3090-3090ti/) 14 list 24 GB GDDR6X; [3060 Ti specifications](https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3060-3060ti/) 15 list 8 GB GDDR6/GDDR6X. Do not use system RAM as the discrete allocation budget. 16 17 The 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) 20 supports Linux x86_64 and Turing or later, including these cards. Open-module 21 support is not evidence that CUDA++'s direct RM/UVM path has run on them. 22 Do not bypass a mismatched-driver refusal. A different driver needs its own 23 reviewed header/ABI update before device execution. 24 25 The doctor accepts the requested GA102/GA104 PCI IDs: 2204 (3090), 2486 and 26 2489 (3060 Ti). Other products sold under a 3060 Ti name have distinct PCI IDs; 27 they are not silently treated as GA104. The actual PCI ID must be recorded. 28 The 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 30 one sentence before it opens `/dev/nvidia*`. 31 32 Drake must provide the machine holding each card, its OS, driver version, and SSH 33 access. 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 35 are authorized on the development Spark by this plan. 36 37 ## Build without a GPU 38 39 ```sh 40 make all hello-gpu-build ampere-device-build 41 make test-ampere-plan 42 ``` 43 44 Use the portable generated-from-Omega units. Do not substitute the migration C 45 encoder, AArch64 machine-code trampolines, or a QEMU-AArch64 run for an x86 build. 46 Keep the source commit, converter pin, seeded compiler hash, generated provenance, 47 compiler 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`. 50 It includes an intentionally corrupted encoding negative control that must fail. 51 52 ## Read-only doctor 53 54 ```sh 55 python3 tests/ampere/doctor.py --bdf 0000:01:00.0 56 ``` 57 58 Expected 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; 61 it never opens a GPU. PASS means the preconditions hold, not qualification. 62 A closed module, unknown card, missing node, ambiguous selection, or ABI mismatch 63 must exit 1. A `--root` filesystem fixture is always labeled **SIMULATED**. 64 65 ## Authorized device run and receipts 66 67 Use a **new** evidence directory per card and source revision: 68 69 ```sh 70 python3 tests/ampere/run.py --device --bdf 0000:01:00.0 \ 71 --output evidence/ampere-ga102-first-run --full-math 72 ``` 73 74 Run again on the GA104 machine with its BDF and another new output directory. 75 The runner refuses to overwrite existing receipts. `results.json` starts with 76 all checks `NOT_RUN`; only actually executed checks become PASS or FAIL. It 77 stops on a failure, preserving the failing log and leaving later checks NOT_RUN. 78 Without `--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 93 CUDAPP_GPU_BDF=0000:01:00.0 build/hello_gpu --target=sm_86 94 CUDAPP_GPU_BDF=0000:01:00.0 build/hello_gpu_control --target=sm_86 --bug=short 95 ``` 96 97 The second command **must fail** with exit 1; no out-of-bounds access is involved. 98 Both programs verify every output element, print code/output hashes and synchronize 99 CPU/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 105 CUDAPP_GPU_BDF=0000:01:00.0 build/ampere_math_device --device 106 ``` 107 108 The verifier sweeps every binary32 input bit pattern for each emitted unary MUFU 109 function: reciprocal, reciprocal square root, base-two exponential and logarithm. 110 A bounded batch is uploaded/read back on every iteration; no full-domain buffer 111 is allocated. It checks NaN classification, infinities, signed zero and finite 112 error, against independent host long-double libm. NaN payload identity is not a 113 contract. A shard can be selected with `--start` and `--count`; it prints 114 `SHARD PASS`, never `EXHAUSTIVE PASS`. This is not an exhaustive binary-operand 115 Cartesian product or a claim about correctly rounded software divide/sqrt. 116 117 The intended non-FTZ bounds are NVIDIA PTX ISA 9.4 sections 9.7.3.13, 9.7.3.16, 118 9.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 120 error `2^-22` outside it; exponential 2 ULP. **Raw MUFU equivalence to these 121 PTX-level contracts, especially subnormal handling, is unqualified.** A failure 122 is a defect to fix in normalization/kernel generation, not permission to skip 123 inputs or enlarge a bound. A long-double libm comparison is a test oracle, not 124 a formal correctly-rounded reference proof. 125 126 Symbolic 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 129 Negative control (small, safe shard, still real device work): 130 131 ```sh 132 CUDAPP_GPU_BDF=0000:01:00.0 build/ampere_math_device --device \ 133 --count 65536 --inject-output-error 134 ``` 135 136 It 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 144 CUDAPP_GPU_BDF=0000:01:00.0 build/ampere_memory_refusal --device 145 ``` 146 147 The 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 149 small page. Even a concurrent free cannot turn this into a real allocation. 150 The request must be rejected by D1 **before any RM allocation ioctl**. 151 A link-time ioctl wrapper counts real allocation escapes independently of the 152 return code. A second RM heap query must report identical free and total VRAM. 153 Concurrent GPU users can change free VRAM and make this proof inconclusive/FAIL; 154 reserve an idle window rather than allocating pressure or relaxing the check. 155 Never allocate the card's capacity, exhaust UVM/system memory, or use a real OOM 156 as a refusal test. Host simulated-driver tests are explicitly SIMULATED. 157 158 ## Recording qualification 159 160 Keep complete per-check logs and `results.json` with the exact source revision. 161 A doctor PASS, disassembler PASS, or x86 host PASS must never be copied into a 162 device result. No script modifies the qualified-device table. Only actual real-card 163 results with the required negative controls can support a separate reviewed 164 qualification change. Any failed check leaves the corresponding card unqualified. 165 166 ## Experimental native Omega x86 oracle 167 168 This optional host-only probe does not change the production bridge-C route. 169 Use a checkout of omega-mv draft #923 at 170 ``becf5c817bcb7e0846d12ebfc2be91042d8ad89a``; the probe verifies both that revision 171 and its tracked AArch64 compiler fingerprint before compiling anything. 172 173 ```sh 174 python3 tests/ampere/native_omega_x86.py \ 175 --compiler-tree /path/to/pinned/omega-mv \ 176 --output build/ampere-native-x86 177 ``` 178 179 The probe compiles all four actual units to x86 and executes composed small-unit 180 callers under `qemu-x86_64`, comparing their output with native AArch64 and 181 requiring negative controls to fail. Label these results **EMULATED**, not native 182 x86 or device qualification. The cubin unit's full-size private-ABI buffers do 183 not 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 185 cubin tests exercise the full-size host boundary separately.