interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / bridge / shlib / nvml.tsv

131 lines · 5548 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0
2# bridge/shlib/nvml.tsv: libnvidia-ml.so.1 from gpu/nvidia/native/nvml/{nvml,query,step,errstr}.om and
3# bridge/shlib/nvml.om, one object. It needs the transport libomega-nvrm.so.1 (found beside it through $ORIGIN;
4# in the gate the Omega RM fake, nvrmfake.tsv) and the C library (memcpy and the pthread mutex). Every export
5# runs under one mutex. A trap answers NVML_ERROR_UNKNOWN (999), except in nvmlErrorString, whose result is a
6# pointer: it answers NULL (0).
7soname libnvidia-ml.so.1
8needed libomega-nvrm.so.1
9needed libc.so.6
10runpath $ORIGIN
11state NvS 1024
12state NvB 83296
13state NvR 64
14state NvT 2144
15state NvH 128
16state NvLock 64
17lock NvLock pthread_mutex_lock pthread_mutex_unlock
18import omega2_nvrm_ioctl s0 s1 s2 s3 s4 s3+4608 s5
19import omega2_nvrm_open_file s0 s1+4608 s2
20export nvmlInit_v2 999 frame NvS NvB NvR
21export nvmlShutdown 999 frame NvS NvB NvR
22export nvmlErrorString 0 frame NvT
23export nvmlDeviceGetCount_v2 999 frame NvS NvB NvR
24export nvmlDeviceGetHandleByIndex_v2 999 frame NvS NvB NvR NvH
25export nvmlDeviceGetName 999 frame NvS NvB NvR NvH
26export nvmlDeviceGetUUID 999 frame NvS NvB NvR NvH
27export nvmlDeviceGetTemperature 999 frame NvS NvB NvR NvH
28export nvmlDeviceGetMemoryInfo 999 frame NvS NvB NvR NvH
29export nvmlDeviceGetUtilizationRates 999 frame NvS NvB NvR NvH
30export nvmlDeviceGetComputeRunningProcesses_v3 999 frame NvS NvB NvR NvH
31# Against the fake (one GB10). Every EXPECT, bufeq and reteq value below is what CUDApp's C libnvidia-ml.so.1
32# answers and writes for the same calls over the same fake, on the same buffer (every byte 0xA5 at the start);
33# an oracle outside this tree printed them. Each call is followed by the words it changed, the word after each
34# changed run and the two words at each buf+N it was given, so a refused call that writes and a write past an
35# output both fail. The handle at buf+0 is an address and is only passed back (bufword); nvmlErrorString answers
36# an address (any), and its text is compared word by word up to its NUL (reteq). Before init
37# NVML_ERROR_UNINITIALIZED (1); the count, the name "NVIDIA GB10", the UUID, the temperature, the memory and
38# utilization records; the process count (*infoCount 0, then 1: NVML_ERROR_INSUFFICIENT_SIZE, 7, with 2) and the
39# two process records; a name buffer of 4 bytes (7); four error strings; an error code, name lengths and a
40# sensor with their upper 32 bits set (AAPCS64 leaves them unspecified, so they answer as 7, 64, 0 and 4: the
41# last too short, 7) and a device index 0 with them set (0); index 1 and handle 0 (2); after shutdown 1 again.
42call nvmlDeviceGetCount_v2 1 buf+8
43bufeq 8 11936128518282651045
44bufeq 16 11936128518282651045
45call nvmlInit_v2 0
46call nvmlDeviceGetCount_v2 0 buf+8
47bufeq 8 11936128515503554561
48bufeq 16 11936128518282651045
49call nvmlDeviceGetHandleByIndex_v2 0 0 buf
50call nvmlDeviceGetName 0 bufword buf+64 64
51bufeq 64 5125168158881699406
52bufeq 72 11936128515506712898
53bufeq 80 11936128518282651045
54call nvmlDeviceGetName 7 bufword buf+128 4
55bufeq 128 11936128518282651045
56bufeq 136 11936128518282651045
57call nvmlDeviceGetUUID 0 bufword buf+192 96
58bufeq 192 7293687787513270343
59bufeq 200 3472894531834622773
60bufeq 208 7218533775643585847
61bufeq 216 7378131358564364848
62bufeq 224 4122309014660199013
63bufeq 232 11936128518282650880
64bufeq 240 11936128518282651045
65call nvmlDeviceGetTemperature 0 bufword 0 buf+320
66bufeq 320 11936128515503554600
67bufeq 328 11936128518282651045
68call nvmlDeviceGetMemoryInfo 0 bufword buf+384
69bufeq 384 131072000000
70bufeq 392 102400000000
71bufeq 400 28672000000
72bufeq 408 11936128518282651045
73call nvmlDeviceGetUtilizationRates 0 bufword buf+448
74bufeq 448 55834574890
75bufeq 456 11936128518282651045
76bufset 512 0
77call nvmlDeviceGetComputeRunningProcesses_v3 7 bufword buf+512 buf+520
78bufeq 512 2
79bufeq 520 11936128518282651045
80bufeq 528 11936128518282651045
81call nvmlDeviceGetComputeRunningProcesses_v3 0 bufword buf+512 buf+520
82bufeq 520 11936128515503623011
83bufeq 528 351272960
84bufeq 536 18446744073709551615
85bufeq 544 11936128515503558802
86bufeq 552 278003712
87bufeq 560 18446744073709551615
88bufeq 568 11936128518282651045
89bufeq 512 2
90bufset 640 1
91call nvmlDeviceGetComputeRunningProcesses_v3 7 bufword buf+640 buf+648
92bufeq 640 2
93bufeq 648 11936128518282651045
94bufeq 656 11936128518282651045
95call nvmlErrorString any 0
96reteq 0 32496501618079059
97call nvmlErrorString any 7
98reteq 0 7163369272552681033
99reteq 8 8820672744039277929
100reteq 16 101
101call nvmlErrorString any 999
102reteq 0 2336936577129475669
103reteq 8 491496043077
104call nvmlErrorString any 12345
105reteq 0 2336936577129475669
106reteq 8 491496043077
107call nvmlErrorString any 16045481047390945287
108reteq 0 7163369272552681033
109reteq 8 8820672744039277929
110reteq 16 101
111call nvmlDeviceGetName 0 bufword buf+1280 13758215386640154688
112bufeq 1280 5125168158881699406
113bufeq 1288 11936128515506712898
114bufeq 1296 11936128518282651045
115call nvmlDeviceGetTemperature 0 bufword 16045481047390945280 buf+1344
116bufeq 1344 11936128515503554600
117bufeq 1352 11936128518282651045
118call nvmlDeviceGetName 7 bufword buf+1408 13758215386640154628
119bufeq 1408 11936128518282651045
120bufeq 1416 11936128518282651045
121call nvmlDeviceGetHandleByIndex_v2 0 16045481047390945280 buf
122call nvmlDeviceGetHandleByIndex_v2 2 1 buf+1024
123bufeq 1024 11936128518282651045
124bufeq 1032 11936128518282651045
125call nvmlDeviceGetName 2 0 buf+1088 64
126bufeq 1088 11936128518282651045
127bufeq 1096 11936128518282651045
128call nvmlShutdown 0
129call nvmlDeviceGetCount_v2 1 buf+1152
130bufeq 1152 11936128518282651045
131bufeq 1160 11936128518282651045