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
omega-mv / bridge / shlib / nvml.tsv
| 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). |
| 7 | soname libnvidia-ml.so.1 |
| 8 | needed libomega-nvrm.so.1 |
| 9 | needed libc.so.6 |
| 10 | runpath $ORIGIN |
| 11 | state NvS 1024 |
| 12 | state NvB 83296 |
| 13 | state NvR 64 |
| 14 | state NvT 2144 |
| 15 | state NvH 128 |
| 16 | state NvLock 64 |
| 17 | lock NvLock pthread_mutex_lock pthread_mutex_unlock |
| 18 | import omega2_nvrm_ioctl s0 s1 s2 s3 s4 s3+4608 s5 |
| 19 | import omega2_nvrm_open_file s0 s1+4608 s2 |
| 20 | export nvmlInit_v2 999 frame NvS NvB NvR |
| 21 | export nvmlShutdown 999 frame NvS NvB NvR |
| 22 | export nvmlErrorString 0 frame NvT |
| 23 | export nvmlDeviceGetCount_v2 999 frame NvS NvB NvR |
| 24 | export nvmlDeviceGetHandleByIndex_v2 999 frame NvS NvB NvR NvH |
| 25 | export nvmlDeviceGetName 999 frame NvS NvB NvR NvH |
| 26 | export nvmlDeviceGetUUID 999 frame NvS NvB NvR NvH |
| 27 | export nvmlDeviceGetTemperature 999 frame NvS NvB NvR NvH |
| 28 | export nvmlDeviceGetMemoryInfo 999 frame NvS NvB NvR NvH |
| 29 | export nvmlDeviceGetUtilizationRates 999 frame NvS NvB NvR NvH |
| 30 | export 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. |
| 42 | call nvmlDeviceGetCount_v2 1 buf+8 |
| 43 | bufeq 8 11936128518282651045 |
| 44 | bufeq 16 11936128518282651045 |
| 45 | call nvmlInit_v2 0 |
| 46 | call nvmlDeviceGetCount_v2 0 buf+8 |
| 47 | bufeq 8 11936128515503554561 |
| 48 | bufeq 16 11936128518282651045 |
| 49 | call nvmlDeviceGetHandleByIndex_v2 0 0 buf |
| 50 | call nvmlDeviceGetName 0 bufword buf+64 64 |
| 51 | bufeq 64 5125168158881699406 |
| 52 | bufeq 72 11936128515506712898 |
| 53 | bufeq 80 11936128518282651045 |
| 54 | call nvmlDeviceGetName 7 bufword buf+128 4 |
| 55 | bufeq 128 11936128518282651045 |
| 56 | bufeq 136 11936128518282651045 |
| 57 | call nvmlDeviceGetUUID 0 bufword buf+192 96 |
| 58 | bufeq 192 7293687787513270343 |
| 59 | bufeq 200 3472894531834622773 |
| 60 | bufeq 208 7218533775643585847 |
| 61 | bufeq 216 7378131358564364848 |
| 62 | bufeq 224 4122309014660199013 |
| 63 | bufeq 232 11936128518282650880 |
| 64 | bufeq 240 11936128518282651045 |
| 65 | call nvmlDeviceGetTemperature 0 bufword 0 buf+320 |
| 66 | bufeq 320 11936128515503554600 |
| 67 | bufeq 328 11936128518282651045 |
| 68 | call nvmlDeviceGetMemoryInfo 0 bufword buf+384 |
| 69 | bufeq 384 131072000000 |
| 70 | bufeq 392 102400000000 |
| 71 | bufeq 400 28672000000 |
| 72 | bufeq 408 11936128518282651045 |
| 73 | call nvmlDeviceGetUtilizationRates 0 bufword buf+448 |
| 74 | bufeq 448 55834574890 |
| 75 | bufeq 456 11936128518282651045 |
| 76 | bufset 512 0 |
| 77 | call nvmlDeviceGetComputeRunningProcesses_v3 7 bufword buf+512 buf+520 |
| 78 | bufeq 512 2 |
| 79 | bufeq 520 11936128518282651045 |
| 80 | bufeq 528 11936128518282651045 |
| 81 | call nvmlDeviceGetComputeRunningProcesses_v3 0 bufword buf+512 buf+520 |
| 82 | bufeq 520 11936128515503623011 |
| 83 | bufeq 528 351272960 |
| 84 | bufeq 536 18446744073709551615 |
| 85 | bufeq 544 11936128515503558802 |
| 86 | bufeq 552 278003712 |
| 87 | bufeq 560 18446744073709551615 |
| 88 | bufeq 568 11936128518282651045 |
| 89 | bufeq 512 2 |
| 90 | bufset 640 1 |
| 91 | call nvmlDeviceGetComputeRunningProcesses_v3 7 bufword buf+640 buf+648 |
| 92 | bufeq 640 2 |
| 93 | bufeq 648 11936128518282651045 |
| 94 | bufeq 656 11936128518282651045 |
| 95 | call nvmlErrorString any 0 |
| 96 | reteq 0 32496501618079059 |
| 97 | call nvmlErrorString any 7 |
| 98 | reteq 0 7163369272552681033 |
| 99 | reteq 8 8820672744039277929 |
| 100 | reteq 16 101 |
| 101 | call nvmlErrorString any 999 |
| 102 | reteq 0 2336936577129475669 |
| 103 | reteq 8 491496043077 |
| 104 | call nvmlErrorString any 12345 |
| 105 | reteq 0 2336936577129475669 |
| 106 | reteq 8 491496043077 |
| 107 | call nvmlErrorString any 16045481047390945287 |
| 108 | reteq 0 7163369272552681033 |
| 109 | reteq 8 8820672744039277929 |
| 110 | reteq 16 101 |
| 111 | call nvmlDeviceGetName 0 bufword buf+1280 13758215386640154688 |
| 112 | bufeq 1280 5125168158881699406 |
| 113 | bufeq 1288 11936128515506712898 |
| 114 | bufeq 1296 11936128518282651045 |
| 115 | call nvmlDeviceGetTemperature 0 bufword 16045481047390945280 buf+1344 |
| 116 | bufeq 1344 11936128515503554600 |
| 117 | bufeq 1352 11936128518282651045 |
| 118 | call nvmlDeviceGetName 7 bufword buf+1408 13758215386640154628 |
| 119 | bufeq 1408 11936128518282651045 |
| 120 | bufeq 1416 11936128518282651045 |
| 121 | call nvmlDeviceGetHandleByIndex_v2 0 16045481047390945280 buf |
| 122 | call nvmlDeviceGetHandleByIndex_v2 2 1 buf+1024 |
| 123 | bufeq 1024 11936128518282651045 |
| 124 | bufeq 1032 11936128518282651045 |
| 125 | call nvmlDeviceGetName 2 0 buf+1088 64 |
| 126 | bufeq 1088 11936128518282651045 |
| 127 | bufeq 1096 11936128518282651045 |
| 128 | call nvmlShutdown 0 |
| 129 | call nvmlDeviceGetCount_v2 1 buf+1152 |
| 130 | bufeq 1152 11936128518282651045 |
| 131 | bufeq 1160 11936128518282651045 |