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 / native / smi / README.md

127 lines · 6702 bytes Raw Blame History Rendered
1<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
2# cudapp-smi
3
4`cudapp-smi` is the CUDA++ successor of `nvidia-smi`: a read-only GPU status
5reporter written in seeded Omega (`.om`). It is a program-mode executable, not
6a libcudapp unit: it uses omc's bounded `devcall` words, which the bridge
7cannot import into libcudapp today (omega-bridge#29).
8
9**Compiler dependency.** The utilization control
10(`native/smi/util.om`) passes 55888 bytes of params to `devcall`. omc at
11omega-mv `e5b32567` (sha256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`)
12traps 3 above 16383 bytes (omc.om L5585-5588), so this tree builds with the
13dedicated omc of aien-dev/omega-mv#1048 (issue #1042), landed through #1050.
14The pin is `e9b635875e6d43314aedc9d85f25c8f65636ac3d`, omc sha256
15`390629fd22590aaefca852045f8b0ace86c62cefb3b1bc203ce400773c8abc2f`, bound
161048576 bytes. `CUDAPP_SMI_OMC` must name this compiler for `make test-smi`;
17otherwise that target is NOT_RUN (exit 2). CUDApp's general `OMEGA_OMC` pin
18remains `e5b32567`; no live resource-manager qualification is implied.
19
20## Build and test
21
22```sh
23cat native/smi/smi.om native/nvrm/context.om native/smi/util.om native/smi/rm.om | "$CUDAPP_SMI_OMC" > cudapp-smi
24make test-smi CUDAPP_OMC_HOST=1 CUDAPP_SMI_OMC=... OMEGA_OMC=... # host tier
25sh tests/smi/run.sh "$CUDAPP_SMI_OMC" "$OMEGA_OMC" # the same runner, directly
26sh tests/smi/live.sh "$CUDAPP_SMI_OMC" OUTDIR # live read-only comparison against nvidia-smi
27```
28
29`tests/smi/run.sh` covers the fixture tier (`tests/smi/fixtures/gb10`, an
30optional-absent tree, a no-GPU tree, 16 malformed-input refusals and usage
31errors), the `--rm` tier against a host fake of the resource manager
32(`tests/smi/rmfake.om`: one default report, one unsupported-pstate report,
33three utilization `[N/A]` reports, 12 faults, handle teardown counts and the
34one-GPU rule), a guard negative control (an unrewritten `context.om` is
35refused, so no fake build can reach a device; `util.om` must hold exactly one
36device word), the devcall bound probe (`tests/smi/capprobe.om`: a 55888-byte
37control on `/dev/null`, which is not a GPU device, must return ENOTTY under
38the dedicated compiler and trap 3, exit 103, under the `e5b32567` omc given as the
39second argument), a checker negative control and 22 source mutants. Last
40line: `CUDAPP-SMI HOST PASS`.
41
42`tests/smi/live.sh` never passes `--rm`. It compares every field
43`cudapp-smi` reads from `/proc` and `/sys` with `nvidia-smi --query-gpu`,
44`--query-compute-apps` and `-q`, and runs a comparator negative control. Last
45line: `CUDAPP-SMI LIVE PASS (<n> fields)`.
46
47## Data sources
48
49Without `--rm` the program opens only files under `ROOT/proc` and `ROOT/sys`
50read-only and reads the `ROOT/proc/<pid>/fd` links. It opens no device.
51
52| Source | Fields |
53| --- | --- |
54| `/proc/driver/nvidia/version` | `driver_version` |
55| `/proc/driver/nvidia/gpus/<bus>/information` | `uuid`, `pci.bus_id`, `minor_number`, `vbios_version`, `gsp_firmware_version` |
56| `/sys/bus/pci/devices/<bus>/` | `pci.device_id`, `pci.sub_device_id`, `pci.base_classcode`, `pci.sub_classcode`, `pcie.link.*` |
57| `/proc/<pid>/fd`, `/proc/<pid>/cmdline` | `holder.k.pid`, `holder.k.process_name` (every process with an open `/dev/nvidia*` node) |
58
59With `--rm` it also opens `/dev/nvidiactl` and `/dev/nvidia0` through
60`native/nvrm/context.om` (`nvstart`/`nvstop`) and issues read-only subdevice
61controls only: no memory allocation, channel or mapping. Layouts come from
62NVIDIA open-gpu-kernel-modules tag `580.173.02` (commit
63`20e4e6e19cc26ba47b5cbe23130a396be100c427`),
64`src/common/sdk/nvidia/inc/ctrl/ctrl2080/`:
65
66| Control | Header line | Params | Fields |
67| --- | --- | --- | --- |
68| `NV2080_CTRL_CMD_GPU_GET_NAME_STRING` 0x20800110 | ctrl2080gpu.h:318 | 132 B | `name` |
69| `NV2080_CTRL_CMD_THERMAL_SYSTEM_EXECUTE_V2` 0x20800513 | ctrl2080thermal.h:135 | 1432 B | `temperature.gpu` |
70| `NV2080_CTRL_CMD_PERF_GET_CURRENT_PSTATE` 0x20802068 | ctrl2080perf.h:885 | 4 B | `pstate` |
71| `NV2080_CTRL_CMD_PERF_GET_GPUMON_PERFMON_UTIL_SAMPLES_V2` 0x20802096 | ctrl2080perf.h:550 | 55888 B | `utilization.gpu`, `utilization.memory` |
72| `NV2080_CTRL_CMD_GPU_GET_PIDS` 0x2080018d | ctrl2080gpu.h:3521 | 3812 B | `compute_app.k.pid` |
73| `NV2080_CTRL_CMD_GPU_GET_PID_INFO` 0x2080018e | ctrl2080gpu.h:3663 | 14408 B | `compute_app.k.used_memory[_bytes]` |
74
75Utilization reads the newest sample of the 72-entry ring, the entry before
76`tracker` (ctrl2080perf.h:580-588); each sample is 776 bytes (8-byte
77timestamp, then six 128-byte engine samples; ctrl2080perf.h:447-514).
78`utilization.gpu` is `gr.util / 100` and `utilization.memory` is
79`fb.util / 100` (both pct × 100). An empty ring (count 0, or a zero timestamp
80in the newest sample) prints `[N/A]`; a count above 72, a tracker at or above
8172 or a util above 10000 is a malformed reply (exit 32). nvidia-smi may
82average over its sample period; this field is the newest sample only
83[INFERENCE: the averaging rule of nvidia-smi is not public].
84
85`NV_ERR_NOT_SUPPORTED` (0x56, nvstatuscodes.h:115) from the name, temperature,
86pstate or utilization control prints `[N/A]` where the header allows it; other
87statuses, such as `NV_ERR_INSUFFICIENT_PERMISSIONS` (0x1b, nvstatuscodes.h:56),
88refuse with exit 31.
89
90## Fields not reported
91
92| nvidia-smi field | Why | Gate |
93| --- | --- | --- |
94| `clocks.*` | ctrl2080clk.h in the 580.173.02 SDK defines no `NV2080_CTRL_CMD_` control | no public control |
95| `power.draw` | ctrl2080pmgr.h defines only `PMGR_GET_MODULE_INFO` 0x20802609; no power reading control | no public control |
96| `memory.total/used` | GB10 has no dedicated framebuffer; nvidia-smi itself prints `N/A` | none |
97
98## Exit codes
99
100| Code | Meaning |
101| --- | --- |
102| 0 | report written |
103| 2 | usage |
104| 3 | I/O error, or stdout write failed |
105| 4 | no NVIDIA driver (`proc/driver/nvidia/version` absent) |
106| 10 | malformed version file |
107| 11 | information file lacks GPU UUID, Bus Location or Device Minor |
108| 12 | malformed GPU entry |
109| 13 | PCI vendor is not 0x10de |
110| 14 | malformed sysfs number |
111| 15 | unknown PCIe link speed |
112| 19 | capacity exceeded |
113| 30 | resource-manager open failed |
114| 31 | a resource-manager control failed |
115| 32 | malformed control reply |
116| 33 | teardown failed |
117| 34 | `--rm` needs exactly one GPU |
118
119A refusal writes one `SMI REFUSE <reason>` line to stderr and nothing to
120stdout. Runtime traps exit 100 + trap code.
121
122## Status
123
124Host fixture and fake-RM tiers: PASS. Live read-only tier without `--rm`:
125PASS (`evidence/SMI-2026-11-05/`). Live `--rm` (name, temperature, pstate,
126utilization, per-process memory): NOT_RUN; it opens the GPU device nodes and
127needs an authorized spark-window.