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 / compat / nvml / README.md

76 lines · 3963 bytes Raw Blame History Rendered
1<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
2# compat/nvml: CUDA++ libnvidia-ml subset
3
4Every file here is **generated** from the seeded Omega unit `native/nvml/api.om`
5by the omega-bridge cabi-1 C ABI library emitter (omega-bridge#83). Never edit
6them; 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
14The 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
16second pin is temporary (Manager(Aien) D2, unify under Linear DRA-154) and is
17used only for `api.om`; the 53 other units stay on `om/omega-bridge.lock`
18through `om/units.sh`. `tests/nvml/gate.om` regenerates all three files and
19refuses any byte difference.
20
21The 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`,
26and the unversioned `nvmlInit`/`nvmlDeviceGetCount`/... names through the same
27macros NVIDIA's header uses (off with `NVML_NO_UNVERSIONED_FUNC_DEFS`). Types,
28values 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
31transport (`omega2_nvrm_open_file`, `omega2_nvrm_close_file`,
32`omega2_nvrm_ioctl`, `native/nvrm/transport.om`), copy bounds, opaque handles,
33the error-string cache and the process lock. RM request construction and error
34policy stay in `native/nvml/{nvml,query,step,errstr}.om`, imported by `api.om`.
35NVIDIA's libnvidia-ml is never linked or loaded.
36
37## Build
38
39```sh
40cc -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
45The library imports the transport symbols from the process that loads it
46(the test caller links `tests/nvml/transport.c`; production links the #281
47transport), so `-Wl,-z,defs` is not used. The gate instead checks the
48undefined symbols against an allowlist.
49
50## Behaviour changes from the removed handwritten shell
51
52The handwritten `cudapp_nvml.c` is gone. The generated library is stricter in
53four 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
60The 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
74Evidence: `evidence/NVML-365-2026-11-07/`. No hardware qualification or
75deployment claim. CI on this change is NOT_RUN while aien-dev Actions is
76externally blocked.