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 / docs / PORT-AMPERE.md

191 lines · 18036 bytes Raw Blame History Rendered
1# RTX 3090 / RTX 3060 Ti Ampere port
2
3**RTX 3090 (GA102): device NOT_RUN. RTX 3060 Ti (GA104): device NOT_RUN.**
4This is host preparation, not a supported-hardware announcement. No RTX card is
5attached to the development Spark, and this work must not submit to its GB10 or
6interrupt its resident model. DONE below means the implementation or audit item
7exists; exercised checks are recorded separately. A simulator, disassembler or
8x86 emulator cannot qualify either GPU.
9
10## Authoritative target and driver references
11
12NVIDIA's [CUDA GPU table](https://developer.nvidia.com/cuda/gpus.md) places both
13GeForce RTX 3090 and RTX 3060 Ti at compute capability **8.6 (sm_86)**. They are
14not GB10/sm_121 and must not reuse its target tag. NVIDIA lists the
15[3090](https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3090-3090ti/)
16as Ampere with **24 GB GDDR6X**, and the
17[3060 Ti](https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3060-3060ti/)
18as Ampere with **8 GB GDDR6/GDDR6X**, depending on the model. Physical capacity
19is not an allocation budget: use the selected device's measured free VRAM.
20
21NVIDIA's [580.173.02 open-module README](https://github.com/NVIDIA/open-gpu-kernel-modules/blob/580.173.02/README.md)
22supports Linux x86_64/aarch64 and Turing-or-newer GPUs, and lists these RTX 30
23products. Thus “Ampere requires a closed kernel module” is false. That support
24does **not** qualify CUDA++'s direct RM/UVM client. The client remains pinned to
25vendored `third_party/nvidia-open-580.173.02`; another driver version is a
26refusal, not an invitation to bypass the ABI check.
27
28The local NVIDIA open-gpu-doc reference is revision
29`9fdf5c4062007929d9f4e6cbad9c9771fe61b880`. Its
30[`clc6c0.h:24-32`](https://github.com/NVIDIA/open-gpu-doc/blob/9fdf5c4062007929d9f4e6cbad9c9771fe61b880/classes/compute/clc6c0.h#L24-L32)
31defines **AMPERE_COMPUTE_A = 0xc6c0**, whereas
32[`clc7c0.h:24-32`](https://github.com/NVIDIA/open-gpu-doc/blob/9fdf5c4062007929d9f4e6cbad9c9771fe61b880/classes/compute/clc7c0.h#L24-L32)
33defines **AMPERE_COMPUTE_B = 0xc7c0**. GA10x/sm_86 needs the latter, not the
34GA100 COMPUTE_A class. Names and QMD layouts must not be inferred from a nearby
35Blackwell header.
36
37## Audit and implementation inventory
38
39| Item | State | Implementation / boundary and source references |
40|---|---|---|
41| Explicit target selection | DONE | `src/omega_ampere_codegen.c:7` accepts exactly sm_86 or sm_121. Existing `omega_bw_encode_program` remains the explicit Blackwell API. `examples/hello_gpu/hello_gpu.c` accepts `--target=sm_86`; the session compares `OmegaGpuLaunch.target_sm` against the selected GPU before submission (`src/omega_gpu_session.c:536`). Zero retains the historical sm_121 contract; it is not silent cross-target selection. |
42| Ampere instruction encoding | DONE | First-party implementation is `om/encoder/ampere_enc_sm86.om`, not a hand-written C fallback. Ampere argument constants start at 0x160 instead of Blackwell's 0x380. Target-specific differences include uniform constant loads, global-memory descriptor/address fields and atomic encodings. The portable binding is `src/cudapp_om_ampere_enc_sm86.c`; host marshaling is `src/omega_ampere_codegen.c`. |
43| Offline instruction oracle | DONE | `mk/ampere-encoder.mk` captures emitted host-suite kernels, disassembles their sm_86 bytes with pinned nvdisasm 13.0.85, and checks decoded instructions/operands. Its corrupted-encoding negative control must fail. The build-only math kernels participate via `tests/ampere/math_device.c --emit-only`. CI uses a separate corpus output directory so baseline and instrumented objects cannot be mixed. |
44| Blackwell-only instruction semantics | BLOCKED | Blackwell FP8 conversion / QMMA forms have no same-semantics sm_86 encoding. The sm_86 encoder refuses them rather than inventing bytes or silently executing a different operation. Existing Blackwell-specialized model/tensor paths are not made Ampere-capable by changing an ELF flag. A real Ampere algorithm lowering is required before those paths are enabled. |
45| Cubin/ELF target | DONE | `om/cubin/cubin_elf.om:26` selects the parameter base; `:269` selects CUDA ELF OSABI/ABI and e_version; `:286` sets the sm_86 flags. `omega_cubin_pack_target` is the target-explicit host boundary in `src/omega_cubin.c`. The old sm_121 entry remains explicit/default-compatible. `mk/ampere-cubin.mk` checks ELF fields and parameter metadata, differential behavior, and offline nvdisasm loading. |
46| Capability-mercury sections | DONE | The sm_86 writer emits no `.nv.capmerc.*` / `.nv.merc.*` sections. The Blackwell driver-loader requirement observed for sm_121 must not be generalized to Ampere. Successful offline ELF decoding is not evidence of successful `cuModuleLoadData` or direct RM launch; both RTX loader/device paths remain NOT_RUN. |
47| Compute/FIFO classes and QMD | DONE | `src/omega_ampere_qmd.h:5` records C6C0 versus C7C0 and Ampere FIFO constants. `om/encoder/amp_runtime.om` implements target admission, QMD3.0 layout and bounded command admission. `src/omega_gpu_session.c:562` emits the Ampere QMD and `:599` its PCAS launch instead of Blackwell QMD5/inline packets. `nvrm/nvrm.c:71` requires the queried class list to contain the selected target's classes. sm_121 is admitted for the GR SM-version field 12_01, or for 10_04 (0xa04, what the GB10 reports at driver 580.173.02; `ctrl2080gr.h` keeps 10_04 until its 12_* names replace it) only when the PCI identity is 0x10de:0x2e12, and always with the complete Blackwell-B class set; `tests/test_ampere_runtime.c` refuses 10_04 with another vendor or device id. Raw Blackwell packets on an Ampere device are refused before ring submission (`nvrm/nvrm.c:1059`). |
48| Discrete allocation and copies | DONE | `nvrm/nvrm.c:634` selects local framebuffer memory on sm_86, RM maps it into GPU VA and maps its CPU BAR alias through real RM_MAP_MEMORY/mmap. Queue and host-polled completion storage remain system memory. `nvrm/nvrm.c:739` / `:748` provide live-identity/bounds-checked CPU→BAR and BAR→CPU transfers with ordering fences. The session may write/read that uncached BAR view directly; platform sync (`src/omega_gpu_platform_linux.c:358`) orders visibility rather than pretending to copy coherent host RAM. No copy engine is claimed. |
49| Cached local mappings / large BAR availability | BLOCKED | Cached Ampere mappings are explicitly refused until their cache-maintenance contract is implemented. CPU BAR mapping availability and large-allocation behavior need the real driver/card configuration; failure is surfaced, not replaced by a fake host allocation. First-run tests use bounded allocations. |
50| VRAM-aware D1 reserve | DONE | `nvrm/nvrm.c:640` queries the selected framebuffer heap. `src/omega_gpu_platform_linux.c:233` reads reserve policy and `:248` uses free VRAM, never host MemAvailable, for local allocations. `CUDAPP_GPU_MIN_FREE_BYTES` supports a precise safe refusal; the default MiB reserve remains documented by the runtime. The refusal precedes the driver allocation call. |
51| Safe reserve refusal proof | DONE | `tests/ampere/memory_refusal.c:39` sets reserve above total VRAM (therefore above free VRAM even if other processes release memory), then requests only a small allocation. It requires refusal, zero intervening RM allocation ioctls and unchanged free VRAM. Simulated-driver coverage is separate from this real-device test. It never pressure-allocates VRAM. |
52| Open-module and device selection doctor | DONE | `tests/ampere/doctor.py:79` verifies Linux x86_64, the exact pinned open module, requested PCI IDs, device nodes and an unambiguous BDF. `CUDAPP_GPU_BDF` selects that exact GPU in the driver client. `test_doctor.py` uses a fake filesystem and is always SIMULATED. No driver is opened by the doctor. |
53| Portable Omega build provenance | IMPLEMENTED | `om/units.sh` covers all canonical hosted roots plus Ampere encoding/runtime and the separate revision/epoch/f16 freestanding profile. Checked portable generated translation units replace executable-code trampolines. `om/omega-bridge.lock`, per-unit identities and generated declarations retain exact composed-source SHA → C SHA provenance. Missing/mismatched converter, profile or seed refuses before installation. Final host acceptance is recorded separately below. |
54| Native x86_64 host build | EXERCISED; host only | Source `592cee255eaba4b86c5a823ed071c2773a3d4f13` passed [native consumer run 40762515409](https://github.com/aien-dev/CUDApp/actions/runs/40762515409), executing PR merge `6a2b759333ce791663d0107949659c7a3cd887bb`: 58 host targets, 40 regenerated portable roots and the 2169-kernel offline oracle. The earlier `__truncsfhf2` link failure is repaired by import-free integer Omega conversion, not by weakening the gate or linking libgcc. `.github/workflows/ampere-x86.yml` separates EMULATED pinned ARM provenance from genuinely native x86 compiled-C consumers and offline oracles. This is not native x86 Omega compiler acceptance or RTX device qualification. |
55| Device test plan / runner | DONE | `tests/ampere/README.md`, `doctor.py`, `run.py`, `math_device.c`, and `memory_refusal.c` cover doctor, complete vector-add output, intentionally failing vector-add, exhaustive unary math, a numerical negative control and safe memory refusal. The runner starts each result at NOT_RUN, records real outputs and stops on failure. |
56| GA102 / GA104 execution and qualification | BLOCKED | No RTX device is attached or authorized here. Both device states remain NOT_RUN. Need the actual host, OS, driver version, SSH access and a GPU window before any real execution. |
57
58## Evidence and limits
59
60The acceptance commands and status belong with the draft PR and its observed
61logs. Merely adding a CI job does not mean it passed. `make test-ampere-plan`
62contains only host/simulated checks; `make ampere-device-build` builds device
63programs without executing them. The instruction oracle command is:
64
65```sh
66make OUT_DIR=build-ampere-oracle CUDAPP_AMPERE_CORPUS=1 test-ampere-encoder-oracle
67```
68
69Recovery host acceptance at `dbb1b5002fd7d96ff4695b2da4dcb3238db226c2`
70used bridge `cb492a76348546dc1ffe5857492e0796cfcec232`, after preserving
71the interrupted index at `3e4145d3` and integrating canonical `c6977b49`
72plus the accepted capacity-refusal source/tests through `ca441c5a`.
73`make -j2 OUT_DIR=build-ampere-final all test test-native-artifact
74zero-cuda-gate ampere-device-build` exited zero on the AArch64 host:
75`CUDA++ HOST TESTS PASS (57 targets)`. This includes byte-identical
76regeneration of all 39 roots, real compose-capacity refusal, import-free
77scalar linkage/allowlist controls, Ampere simulated ordering and VRAM
78admission, numeric/cubin checks, and existing encoder/cubin differentials.
79The five compiler/converter/frontend mutation controls each refused with
80exit 3 and installed no output ([pin receipt](../evidence/CUDAPP-AMPERE/recovery-portable-pins.json)).
81These are host results, not RTX execution or a native x86 compiler result.
82
83The fresh instrumented producer run captured 773 SM121 kernels and emitted
84the Ampere math corpus. Its 600-second make deadline expired during decoding;
85the completed standalone comparison then exited zero: 2169 SM86 kernels,
86every opcode and operand matched, 73 native-FP8 refusals. Register operand,
87uniform destination, EF-versus-MMIO.GPU policy, subtraction sign, branch,
88reconvergence join/barrier and carry-output mutants were refused.
89See [exact oracle receipt](../evidence/CUDAPP-AMPERE/recovery-exact-oracle.json).
90The legacy SM121 MMIO repair remains separate in issue171/draft172;
91its unchanged 773-kernel and four-artifact impact receipts are not hardware
92qualification and are not silently folded into Ampere's expected semantics.
93
94The [device plan](../tests/ampere/README.md) keeps separate NOT_RUN entries for
95every check on each card. Exhaustive math uses the intended NVIDIA PTX bounds,
96not an invented tolerance or a claim that raw MUFU matches PTX normalization.
97A failing subnormal case needs a real fix, not a weakened gate.
98
99The runtime API minor version changes to 0.7 because appending the explicit
100launch target grows `OmegaGpuLaunch`; rebuild callers against the new headers.
101The ABI manifest and semver gate must agree. The existing sm_121 default, driver
102pin and negative controls are not weakened for the port.
103
104The portable converter is the pending
105[omega-bridge draft #36](https://github.com/aien-dev/omega-bridge/pull/36);
106the exact source commit is recorded in `om/omega-bridge.lock`. Its explicitly
107selected seeded frontend uses omega e5b32567 compiler SHA-256
108`2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`.
109The original 191b776 frontend gate remains unchanged and required. The expanded
110route supports bounded canonical compositions and internal binary32 quant
111operations; a separately checked scalar profile supplies import-free revision,
112epoch and binary32-to-binary16 RNE conversion without hosted trap machinery.
113Generated identities pin each converter, frontend and compiler, not a moving branch name.
114
115The disposable x86 CI runner uses Ubuntu's verification-only
116`qemu-user-static` package `8.2.2+ds-0ubuntu1.19`, amd64 package SHA256
117`ec80ee896fe8f57f7420f4d4076164cb0fa613df6848568cdf5d1a2dbe2347cb`,
118and AArch64 interpreter SHA256
119`1152646a17920a81c618d62574ee8ae8b63243349957095d40212c2245f20aab`.
120An ARM runner source-bootstraps baseline compiler
121`191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`;
122the x86 job checks that artifact and the seeded compiler before use.
123Only their AArch64 ELF execution is registered, with exact magic, mask and
124interpreter checks and unconditional removal of this run's handler afterward.
125No Spark binfmt configuration is changed. These executions are EMULATED
126provenance, not a native compiler result. Native x86 ELF consumers are built
127with the runner's C compiler, checked with `readelf`, then exercised by the
128unchanged acceptance targets. QEMU is neither linked into production nor an
129implementation dependency; its intended Omega replacement is the separate
130native x86 compiler, which still fails and is not assumed usable.
131The native x86 consumer acceptance for source
132`592cee255eaba4b86c5a823ed071c2773a3d4f13` completed successfully in
133[run 40762515409](https://github.com/aien-dev/CUDApp/actions/runs/40762515409),
134which checked out PR merge `6a2b759333ce791663d0107949659c7a3cd887bb`.
135It reported 58 host targets, byte-identical regeneration of all 40 portable
136roots, half-conversion boundary/sweep/mutant controls, the unchanged
137freestanding import allowlist, and the 2169-kernel offline SM86 oracle.
138The compiler/converter provenance executions remain EMULATED; the three
139consumer ELF headers were checked as x86-64. Physical RTX execution remains
140NOT_RUN. A separate CodeQL finding in the offline cubin fixture writer is
141repaired by explicitly creating new output files with mode 0600, independent
142of the caller's umask; this does not change the cubin bytes or production code.
143
144
145`om/numeric/f16.om` implements the freestanding conversion; the C caller
146only bitcasts the input and calls its checked scalar ABI. The hosted
147`_Float16` cast remains the independent verification oracle, not production
148freestanding code. `make test-ampere-f16-host` checks signed zero,
149subnormals, ties-to-even, overflow, infinities and NaNs, rejects six
150conversion mutants and compares a stepped raw-input sweep with that
151native cast. The full host suite requires this target. The generated
152unit compiles with no undefined symbols; the unchanged aggregate
153freestanding allowlist continues to refuse unexpected runtime helpers.
154
155Experimental native x86 compiler work (#923) remains a distinct failing route,
156not a build, generation or acceptance prerequisite here. Portable C is generated
157by the seeded AArch64 compiler and compiled normally for the selected host.
158
159The x86 numeric source/header divergence from Omega's retained CPU oracles is
160intentional. Main authorized four explicit cutover blob pins, with their
161rationale, in `tools/extract/drift-baseline.tsv:289`; no wildcard exclusion is
162used. `tools/extract/drift.sh:127` mutates each retained source/header and
163requires a named drift failure, preserving future change detection.
164
165The Ampere oracle also exposed the historical sm_121 `BW_IR_LDG_MMIO` mismatch:
166its header promises MMIO.GPU but its old encoder emits EF
167([issue #171](https://github.com/aien-dev/CUDApp/issues/171)).
168The sm_86 expectation enforces the IR's MMIO.GPU contract, retaining every
169operand and rejecting an EF mutant; it does not equate the cache policies.
170The sm_121 correction is isolated in a separate PR and is not part of this
171port. No disassembly result establishes cache coherence or device behavior.
172
173SM86 `BRA` uses a byte-displacement field rather than SM121's split field.
174The corpus oracle retains exact branch/join destinations and barrier registers;
175wrong-target and wrong-barrier controls must fail. SM86 BSSY/BSYNC omit SM121's
176printed `.RECONVERGENT` qualifier, not its reconvergence semantics.
177Signed-field arithmetic is recorded with its Wolfram query and result in
178`evidence/CUDAPP-AMPERE/wolfram-branch.txt`. FSUB's source negate bit is also
179checked independently; FADD cannot satisfy the subtraction contract.
180IADD3's discarded `PT` carry outputs are explicit on SM121 and implicit on
181SM86. Only those two discarded outputs are omitted from the target-specific
182expectation; an unexpected carry predicate must still fail the oracle.
183
184## First real run: operator-provided access
185
186Provide, for **each card**: which machine holds it, the machine's OS/distribution
187and architecture, its exact NVIDIA driver version and open-module status, and
188SSH host/account/access. Then select the actual PCI BDF and authorize the GPU
189window on that machine. If a different driver is installed, stop at the doctor
190and update/review the ABI pin; do not install or replace a driver implicitly.
191Nothing in this preparation authorizes touching the Spark's live model.