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
CUDApp / compat / nvml / README.md
| 1 | <!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --> |
| 2 | # compat/nvml: CUDA++ libnvidia-ml subset |
| 3 | |
| 4 | Every file here is **generated** from the seeded Omega unit `native/nvml/api.om` |
| 5 | by the omega-bridge cabi-1 C ABI library emitter (omega-bridge#83). Never edit |
| 6 | them; edit `api.om` and regenerate: |
| 7 | |
| 8 | | File | Bridge mode | |
| 9 | | --- | --- | |
| 10 | | `libnvidia-ml.c` | `tools/bridge-seeded lib-c native/nvml/api.om` | |
| 11 | | `nvml.h` | `tools/bridge-seeded lib-h native/nvml/api.om` | |
| 12 | | `libnvidia-ml.map` | `tools/bridge-seeded lib-map native/nvml/api.om` (version script: the 11 exports, `local: *;`) | |
| 13 | |
| 14 | The bridge checkout is `OMEGA_CABI_BRIDGE`; its `src/toc.om` and |
| 15 | `tools/bridge-seeded` are pinned by sha256 in `om/omega-bridge-cabi.lock`. This |
| 16 | second pin is temporary (Manager(Aien) D2, unify under Linear DRA-154) and is |
| 17 | used only for `api.om`; the 53 other units stay on `om/omega-bridge.lock` |
| 18 | through `om/units.sh`. `tests/nvml/gate.om` regenerates all three files and |
| 19 | refuses any byte difference. |
| 20 | |
| 21 | The library answers this subset of NVML (CUDA 13.0 `nvml.h`): |
| 22 | `nvmlInit_v2`, `nvmlShutdown`, `nvmlErrorString`, `nvmlDeviceGetCount_v2`, |
| 23 | `nvmlDeviceGetHandleByIndex_v2`, `nvmlDeviceGetName`, `nvmlDeviceGetUUID`, |
| 24 | `nvmlDeviceGetTemperature`, `nvmlDeviceGetMemoryInfo`, |
| 25 | `nvmlDeviceGetUtilizationRates`, `nvmlDeviceGetComputeRunningProcesses_v3`, |
| 26 | and the unversioned `nvmlInit`/`nvmlDeviceGetCount`/... names through the same |
| 27 | macros NVIDIA's header uses (off with `NVML_NO_UNVERSIONED_FUNC_DEFS`). Types, |
| 28 | values and prototypes follow the CUDA 13.0 header; no NVIDIA text is copied. |
| 29 | |
| 30 | `api.om` owns the protocol loop, the dispatch of each step action to the #281 |
| 31 | transport (`omega2_nvrm_open_file`, `omega2_nvrm_close_file`, |
| 32 | `omega2_nvrm_ioctl`, `native/nvrm/transport.om`), copy bounds, opaque handles, |
| 33 | the error-string cache and the process lock. RM request construction and error |
| 34 | policy stay in `native/nvml/{nvml,query,step,errstr}.om`, imported by `api.om`. |
| 35 | NVIDIA's libnvidia-ml is never linked or loaded. |
| 36 | |
| 37 | ## Build |
| 38 | |
| 39 | ```sh |
| 40 | cc -fPIC -shared -Wl,-soname,libnvidia-ml.so.1 \ |
| 41 | -Wl,--version-script=compat/nvml/libnvidia-ml.map \ |
| 42 | -o libnvidia-ml.so.1 compat/nvml/libnvidia-ml.c |
| 43 | ``` |
| 44 | |
| 45 | The library imports the transport symbols from the process that loads it |
| 46 | (the test caller links `tests/nvml/transport.c`; production links the #281 |
| 47 | transport), so `-Wl,-z,defs` is not used. The gate instead checks the |
| 48 | undefined symbols against an allowlist. |
| 49 | |
| 50 | ## Behaviour changes from the removed handwritten shell |
| 51 | |
| 52 | The handwritten `cudapp_nvml.c` is gone. The generated library is stricter in |
| 53 | four cases, each reachable only if a step returns malformed output: |
| 54 | |
| 55 | - a record output (memory, utilization) must be exactly 0 or the record size; |
| 56 | - process-information bytes must be a multiple of 24 (`nvmlProcessInfo_v2_t`); |
| 57 | - Name/UUID output must be non-empty and end in a NUL; |
| 58 | - a handle slot that was never issued is invalid. |
| 59 | |
| 60 | The 476 checks and 22 mutants observe the same results as before. |
| 61 | |
| 62 | ## Status |
| 63 | |
| 64 | | Tier | Verdict | |
| 65 | | --- | --- | |
| 66 | | Generated `libnvidia-ml.so.1` + C caller over fake RM (`tests/nvml/transport.c`) | HOST_TESTED: 476 checks | |
| 67 | | Seeded Omega model over fake RM | HOST_TESTED: 476 checks; 22/22 mutants with the original failure counts | |
| 68 | | ABI against CUDA 13.0 `nvml.h` | HOST_TESTED: 55 facts; 11 generated prototypes compile against it; a changed type is rejected | |
| 69 | | Exports, soname and imports (ORACLE nm/readelf) | HOST_TESTED: exactly 11 `T` exports, soname `libnvidia-ml.so.1`, allowlisted imports; an object calling `ioctl` is rejected | |
| 70 | | Concurrent callers | NOT_RUN | |
| 71 | | Live resource manager | NOT_RUN: opening `/dev/nvidia*` needs an authorized GPU window | |
| 72 | | Utilization over the #281 transport | NOT_RUN: 55888-byte control vs the e5b32567 devcall bound (aien-dev/omega-mv#1048) | |
| 73 | |
| 74 | Evidence: `evidence/NVML-365-2026-11-07/`. No hardware qualification or |
| 75 | deployment claim. CI on this change is NOT_RUN while aien-dev Actions is |
| 76 | externally blocked. |