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 Source

cudapp-smi

cudapp-smi is the CUDA++ successor of nvidia-smi: a read-only GPU status reporter written in seeded Omega (.om). It is a program-mode executable, not a libcudapp unit: it uses omc's bounded devcall words, which the bridge cannot import into libcudapp today (omega-bridge#29).

Compiler dependency. The utilization control (native/smi/util.om) passes 55888 bytes of params to devcall. omc at omega-mv e5b32567 (sha256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f) traps 3 above 16383 bytes (omc.om L5585-5588), so this tree builds with the dedicated omc of aien-dev/omega-mv#1048 (issue #1042), landed through #1050. The pin is e9b635875e6d43314aedc9d85f25c8f65636ac3d, omc sha256 390629fd22590aaefca852045f8b0ace86c62cefb3b1bc203ce400773c8abc2f, bound 1048576 bytes. CUDAPP_SMI_OMC must name this compiler for make test-smi; otherwise that target is NOT_RUN (exit 2). CUDApp's general OMEGA_OMC pin remains e5b32567; no live resource-manager qualification is implied.

Build and test

cat native/smi/smi.om native/nvrm/context.om native/smi/util.om native/smi/rm.om | "$CUDAPP_SMI_OMC" > cudapp-smi
make test-smi CUDAPP_OMC_HOST=1 CUDAPP_SMI_OMC=... OMEGA_OMC=...  # host tier
sh tests/smi/run.sh "$CUDAPP_SMI_OMC" "$OMEGA_OMC"   # the same runner, directly
sh tests/smi/live.sh "$CUDAPP_SMI_OMC" OUTDIR       # live read-only comparison against nvidia-smi

tests/smi/run.sh covers the fixture tier (tests/smi/fixtures/gb10, an optional-absent tree, a no-GPU tree, 16 malformed-input refusals and usage errors), the --rm tier against a host fake of the resource manager (tests/smi/rmfake.om: one default report, one unsupported-pstate report, three utilization [N/A] reports, 12 faults, handle teardown counts and the one-GPU rule), a guard negative control (an unrewritten context.om is refused, so no fake build can reach a device; util.om must hold exactly one device word), the devcall bound probe (tests/smi/capprobe.om: a 55888-byte control on /dev/null, which is not a GPU device, must return ENOTTY under the dedicated compiler and trap 3, exit 103, under the e5b32567 omc given as the second argument), a checker negative control and 22 source mutants. Last line: CUDAPP-SMI HOST PASS.

tests/smi/live.sh never passes --rm. It compares every field cudapp-smi reads from /proc and /sys with nvidia-smi --query-gpu, --query-compute-apps and -q, and runs a comparator negative control. Last line: CUDAPP-SMI LIVE PASS (<n> fields).

Data sources

Without --rm the program opens only files under ROOT/proc and ROOT/sys read-only and reads the ROOT/proc/<pid>/fd links. It opens no device.

SourceFields
/proc/driver/nvidia/versiondriver_version
/proc/driver/nvidia/gpus/<bus>/informationuuid, pci.bus_id, minor_number, vbios_version, gsp_firmware_version
/sys/bus/pci/devices/<bus>/pci.device_id, pci.sub_device_id, pci.base_classcode, pci.sub_classcode, pcie.link.*
/proc/<pid>/fd, /proc/<pid>/cmdlineholder.k.pid, holder.k.process_name (every process with an open /dev/nvidia* node)

With --rm it also opens /dev/nvidiactl and /dev/nvidia0 through native/nvrm/context.om (nvstart/nvstop) and issues read-only subdevice controls only: no memory allocation, channel or mapping. Layouts come from NVIDIA open-gpu-kernel-modules tag 580.173.02 (commit 20e4e6e19cc26ba47b5cbe23130a396be100c427), src/common/sdk/nvidia/inc/ctrl/ctrl2080/:

ControlHeader lineParamsFields
NV2080_CTRL_CMD_GPU_GET_NAME_STRING 0x20800110ctrl2080gpu.h:318132 Bname
NV2080_CTRL_CMD_THERMAL_SYSTEM_EXECUTE_V2 0x20800513ctrl2080thermal.h:1351432 Btemperature.gpu
NV2080_CTRL_CMD_PERF_GET_CURRENT_PSTATE 0x20802068ctrl2080perf.h:8854 Bpstate
NV2080_CTRL_CMD_PERF_GET_GPUMON_PERFMON_UTIL_SAMPLES_V2 0x20802096ctrl2080perf.h:55055888 Butilization.gpu, utilization.memory
NV2080_CTRL_CMD_GPU_GET_PIDS 0x2080018dctrl2080gpu.h:35213812 Bcompute_app.k.pid
NV2080_CTRL_CMD_GPU_GET_PID_INFO 0x2080018ectrl2080gpu.h:366314408 Bcompute_app.k.used_memory[_bytes]

Utilization reads the newest sample of the 72-entry ring, the entry before tracker (ctrl2080perf.h:580-588); each sample is 776 bytes (8-byte timestamp, then six 128-byte engine samples; ctrl2080perf.h:447-514). utilization.gpu is gr.util / 100 and utilization.memory is fb.util / 100 (both pct × 100). An empty ring (count 0, or a zero timestamp in the newest sample) prints [N/A]; a count above 72, a tracker at or above 72 or a util above 10000 is a malformed reply (exit 32). nvidia-smi may average over its sample period; this field is the newest sample only [INFERENCE: the averaging rule of nvidia-smi is not public].

NV_ERR_NOT_SUPPORTED (0x56, nvstatuscodes.h:115) from the name, temperature, pstate or utilization control prints [N/A] where the header allows it; other statuses, such as NV_ERR_INSUFFICIENT_PERMISSIONS (0x1b, nvstatuscodes.h:56), refuse with exit 31.

Fields not reported

nvidia-smi fieldWhyGate
clocks.*ctrl2080clk.h in the 580.173.02 SDK defines no NV2080_CTRL_CMD_ controlno public control
power.drawctrl2080pmgr.h defines only PMGR_GET_MODULE_INFO 0x20802609; no power reading controlno public control
memory.total/usedGB10 has no dedicated framebuffer; nvidia-smi itself prints N/Anone

Exit codes

CodeMeaning
0report written
2usage
3I/O error, or stdout write failed
4no NVIDIA driver (proc/driver/nvidia/version absent)
10malformed version file
11information file lacks GPU UUID, Bus Location or Device Minor
12malformed GPU entry
13PCI vendor is not 0x10de
14malformed sysfs number
15unknown PCIe link speed
19capacity exceeded
30resource-manager open failed
31a resource-manager control failed
32malformed control reply
33teardown failed
34--rm needs exactly one GPU

A refusal writes one SMI REFUSE <reason> line to stderr and nothing to stdout. Runtime traps exit 100 + trap code.

Status

Host fixture and fake-RM tiers: PASS. Live read-only tier without --rm: PASS (evidence/SMI-2026-11-05/). Live --rm (name, temperature, pstate, utilization, per-process memory): NOT_RUN; it opens the GPU device nodes and needs an authorized spark-window.