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
| 1 | # Start here: run and verify CUDA++ |
| 2 | |
| 3 | This is the shortest route for someone who has not worked on AIEN. The repository is named `CUDApp`; the project is called **CUDA++**. It is a research-stage GPU machine-code toolchain and runtime, not yet a drop-in replacement for all of CUDA. Read [the roadmap](../ROADMAP.md) for the tested, partial, and missing components. |
| 4 | |
| 5 | ## 1. Know what is supported |
| 6 | |
| 7 | | Path | What it establishes | Current boundary | |
| 8 | | --- | --- | --- | |
| 9 | | Build and host tests | Compiles the library and checks host references, simulators, negative controls and API contracts. | Linux with gcc. `make test` is the portable suite on x86-64 and on AArch64. It needs no NVIDIA tool and no sibling checkout. Target-only checks name their requirement (`docs/OMEGA_HOST_TESTS.md`, [#15](https://github.com/aien-dev/CUDApp/issues/15)). | |
| 10 | | `build/hello_gpu --sim` | Runs the example through the **host simulator** and checks its answers. | No GPU is opened; this is **not** hardware qualification or a performance result. | |
| 11 | | `make doctor` | Reports whether the current Linux host matches the supported native GPU path. | Read-only diagnostic; a non-GB10 host is expected to report NOT READY. | |
| 12 | | `make hello-gpu` | Runs the vector-add example on the actual GPU and checks output against the CPU. | Qualified target: NVIDIA GB10 (DGX Spark, sm_121), Linux, kernel driver 580.173.02. Requires safe, authorized GPU access. | |
| 13 | |
| 14 | The current runtime bypasses NVIDIA's **user-space** CUDA toolkit and `libcuda` API. It still relies on NVIDIA's **kernel module** and signed GPU firmware. This is not a CUDA-compatibility guarantee for unmodified CUDA applications or for arbitrary NVIDIA/AMD/Intel GPUs. See [the compatibility roadmap](../ROADMAP.md) and [portability contract](runtime/PORTABILITY.md). |
| 15 | |
| 16 | ## 2. Clone and run host-only checks |
| 17 | |
| 18 | On a Linux host with `git`, GNU `make`, `gcc`, and `python3` for the optional figure check: |
| 19 | |
| 20 | ```sh |
| 21 | git clone https://github.com/aien-dev/CUDApp.git |
| 22 | cd CUDApp |
| 23 | git rev-parse HEAD |
| 24 | uname -s -m |
| 25 | |
| 26 | make -j4 |
| 27 | make test |
| 28 | make test-native-artifact |
| 29 | make zero-cuda-gate |
| 30 | build/hello_gpu --sim |
| 31 | ``` |
| 32 | |
| 33 | `make test` is the host-only suite. Its success marker is `CUDA++ HOST TESTS PASS (<count> targets)`; `<count>` is computed from the current `HOST_TESTS` manifest in `Makefile`, not a fixed historical count. The suite contains intentional failure/mutation cases: judge the **exit code and final result**, not the presence of the words FAIL/ERROR in intermediate logs. It can take several minutes. `make zero-cuda-gate` inspects ELF metadata and runs its own negative control; it is **not** a proof that kernel drivers or firmware have disappeared. |
| 34 | |
| 35 | The code-allocation source scan inside `make test` expands only existing source files and refuses an empty readset, a missing/unreadable input, or any scanner error. Its negative controls also require the intended refusal diagnostic, so a setup failure cannot count as detecting forbidden allocation sizing. A clean scan is only a check of the selected source idioms, not GPU execution evidence. |
| 36 | |
| 37 | On x86-64, `make test-gpu-native-runtime` is outside `make test` and exits 2. |
| 38 | On AArch64 it extends the existing session-platform fixture |
| 39 | with generated native Quant, Composer, encoder, residency and selector calls, |
| 40 | then the actual FP8 cache and command-list integration. Platform handles are |
| 41 | synthetic host fixtures, not live GPU handles. Recorded/inflight references |
| 42 | remain pinned on timeout; only observed completion or confirmed session |
| 43 | teardown permits their retirement. This does not qualify or activate native |
| 44 | candidates: production graph state remains absent until the existing |
| 45 | independent receipt/admission path accepts exact artifacts. |
| 46 | |
| 47 | The same host fixture executes the actual graph recording and incumbent |
| 48 | nonempty-submit adapters. It checks that successful command-list ordinals are |
| 49 | not mistaken for error status. Paired submission has independent per-buffer |
| 50 | QMD-publication controls: omission for either queue must refuse. No synthetic |
| 51 | completion or handle is hardware or full-model evidence. |
| 52 | |
| 53 | `make test-portable-receipts` is part of `make test` on AArch64 and needs full Git |
| 54 | history, `OMEGA_OMC`, and `OMEGA_BRIDGE`. Public derived receipts substitute |
| 55 | `$AIEN_RECEIPT_HOME` for the producer's HOME prefix. Their metadata states the |
| 56 | original Git blob, original SHA-256, exact substitution rule, and scrubbed |
| 57 | payload SHA-256. The scrubbed hash domain is the document with exactly its |
| 58 | inserted metadata line removed; `tests/portable_receipts.tsv` also pins the |
| 59 | complete derived-file SHA-256. The `.om` checker reconstructs original bytes |
| 60 | from each derivative and compares both hashes and the immutable original Git |
| 61 | blob, with refusal controls. Originals and historical commits are unchanged. |
| 62 | On x86-64 the same target is outside `make test` and exits 2, because the |
| 63 | pinned compiler is not part of the portable suite. |
| 64 | |
| 65 | Canonical consumer integration is meant to use one single-commit `cudapp.lock` |
| 66 | in Omega, not a second artifact or qualification registry. That lock does not |
| 67 | exist on omega-mv main yet: `cudapp.lock`, the `check-cudapp` make target and |
| 68 | `tools/cudapp-stage.sh` are proposed in the open draft |
| 69 | [omega-mv#924](https://github.com/aien-dev/omega-mv/pull/924). That isolated |
| 70 | Omega consumer cutover builds an authenticated committed source archive and |
| 71 | links its actual callers to that canonical library; with #924 checked out: |
| 72 | |
| 73 | ```sh |
| 74 | OMEGA_OMC=/absolute/path/to/pinned/omc \ |
| 75 | OMEGA_BRIDGE=/absolute/path/to/pinned/omega-bridge \ |
| 76 | make -C /absolute/path/to/Omega check-cudapp \ |
| 77 | CUDAPP_DIR=/absolute/path/to/committed/CUDApp |
| 78 | ``` |
| 79 | |
| 80 | `tools/cudapp-stage.sh` verifies the exact lock, exports committed source, |
| 81 | requires native-unit regeneration agreement, and builds the canonical archive. |
| 82 | Fresh compiled Omega guards authenticate the staged source and emit its |
| 83 | source/archive/library provenance. Working checkout edits are not archived. |
| 84 | Consumer headers resolve from `stage/source`; the library is |
| 85 | `stage/build/libcudapp.a`, linked after the Omega CPU/evidence adapter companion. |
| 86 | Wrong/missing pins and changed staged source refuse; `LOCK_CHECK` is not a |
| 87 | bypass. No merge, deployment, live serving consumption, chip qualification or |
| 88 | default native activation follows from this development cutover. |
| 89 | |
| 90 | The acceptance boundaries remain [#5](https://github.com/aien-dev/CUDApp/issues/5) |
| 91 | and [#106](https://github.com/aien-dev/CUDApp/issues/106). Historical extraction |
| 92 | maps and receipts remain unchanged. The obsolete |
| 93 | [consumer PR #618](https://github.com/aien-dev/omega-mv/pull/618) used an older |
| 94 | pin and different source-check contract; it is not the canonical cutover base. |
| 95 | |
| 96 | On x86-64, `make test` is the portable host suite. Production `dsb sy` stays on AArch64 (`nvrm/cpu_barrier.h`). The x86-64 publication barrier is a real sequentially consistent fence. A target-only check that names its requirement and exits 2 is not a pass of that check. The two lists are in [docs/OMEGA_HOST_TESTS.md](OMEGA_HOST_TESTS.md) ([#15](https://github.com/aien-dev/CUDApp/issues/15)). The x86-64 device path returns `ENOTSUP` and the text `requires AArch64 Linux`. That path is not a supported GPU run. |
| 97 | |
| 98 | `python3 tools/figures/make_figures.py --check` verifies that the README diagrams, including `docs/img/stack.svg`, match `tools/figures/make_figures.py`. It must print `figures current:` and exit 0. Pull requests run that check. When the generator changes, commit the regenerated SVG in the same change. A diagram that disagrees with the generator fails the check. |
| 99 | |
| 100 | Pull requests also run `make -j4`, `make test-native-artifact`, `make zero-cuda-gate`, `build/hello_gpu --sim` and read-only `make doctor` on `ubuntu-24.04-arm`. `make test` runs as the `host-tests` job. None of those jobs open a GPU. What a green check means is [docs/CI_ACCEPTANCE.md](CI_ACCEPTANCE.md). |
| 101 | |
| 102 | ## 3. Diagnose a native GPU machine |
| 103 | |
| 104 | ```sh |
| 105 | make doctor |
| 106 | ``` |
| 107 | |
| 108 | The doctor inspects the host and reports compatibility. It does not open a GPU device. **NOT READY is an expected result** on unsupported chips, absent driver/device nodes, or mismatched driver releases. Do not bypass its refusal to try hardware. |
| 109 | |
| 110 | The doctor is a wrapper-only preflight, also run by `make hello-gpu`. Direct |
| 111 | binaries and applications linking the library get no driver-version check; since |
| 112 | runtime API 0.14.0 the library refuses an unknown or unqualified GPU (by PCI id) |
| 113 | before it opens any `/dev/nvidia` node. READY means the diagnostic checks matched, |
| 114 | not that this commit is chip-qualified. The imported M16 summary lacks its |
| 115 | referenced raw logs; see the README evidence limitation. Current native |
| 116 | qualification is NOT_RUN. |
| 117 | |
| 118 | Only when the machine is a qualified GB10 and you are authorized to use it without interrupting a serving workload: |
| 119 | |
| 120 | ```sh |
| 121 | make hello-gpu |
| 122 | ``` |
| 123 | |
| 124 | The example adds one million floats and checks its answer against the CPU. Exit 0 and PASS describe that run, on that machine and commit. Do not run chip tests on a shared DGX Spark without a coordinated quiet window. |
| 125 | |
| 126 | ## 4. How to evaluate the evidence |
| 127 | |
| 128 | - The primary implementation is under [`src/`](../src/), with the driver client in [`nvrm/`](../nvrm/) and [`m16/`](../m16/). The hello-world implementation is [`examples/hello_gpu/hello_gpu.c`](../examples/hello_gpu/hello_gpu.c). |
| 129 | - Read [the actual runtime API](runtime/API.md) and [driver explanation](DRIVER.md), then inspect the code and [provenance audit](AUDIT.md). The third-party licenses are described in [THIRD_PARTY.md](../THIRD_PARTY.md). |
| 130 | - Published results and numbers apply to the exact documented workload, commit, hardware and driver. A host simulator PASS does not prove machine-byte correctness on another GPU; a GB10 receipt does not establish general GPU support or performance superiority. |
| 131 | - `evidence/` contains experimental receipts. A dated or historical receipt does not prove an unrelated later commit passed the same gate. Preserve existing receipts; create a new folder for new evidence. |
| 132 | - Current runtime implementation is primarily C. Migration toward an exclusively first-party `.om` implementation is **planned, not complete** ([#79](https://github.com/aien-dev/CUDApp/issues/79)). Do not present a future compiler or driver as already shipped. |
| 133 | |
| 134 | To help, follow [CONTRIBUTING.md](../CONTRIBUTING.md) and use an existing issue template. If you find a vulnerability, follow [SECURITY.md](../SECURITY.md) instead of posting exploit details publicly. |
| 135 | |
| 136 | ## 5. What to attach to an independent review |
| 137 | |
| 138 | Report the full source commit (`git rev-parse HEAD`), OS and architecture (`uname -s -m`), compiler (`gcc --version`), commands with exit codes, and the relevant output. For a permitted GB10 test, include chip/driver identity and the immutable evidence path. Clearly mark each gate **PASS**, **FAIL** or **NOT RUN**; a skipped hardware gate is never PASS. |
| 139 | |
| 140 | For the first public release bar and feature gaps, use [ROADMAP.md](../ROADMAP.md), [host reproducibility #15](https://github.com/aien-dev/CUDApp/issues/15), and [native `.om` migration #79](https://github.com/aien-dev/CUDApp/issues/79). |