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 / gpu / nvidia / native / smi / util.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note util.om: the one cudapp-smi control whose params exceed native/nvrm/context.om's 16384-byte nvpar. |
| 3 | note Appended after context.om and before rm.om. The control header goes through context.om's nvhdr; |
| 4 | note the params live in smbig. Layout: open-gpu-kernel-modules 580.173.02 (commit 20e4e6e1), |
| 5 | note src/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080perf.h:447-592 and ctrl2080gpumon.h:40. |
| 6 | note 545267862 NV2080_CTRL_CMD_PERF_GET_GPUMON_PERFMON_UTIL_SAMPLES_V2 0x20802096, 55888-byte params: |
| 7 | note type u8 @0, bufSize u32 @4, count u32 @8, tracker u32 @12, 72 samples of 776 bytes @16. |
| 8 | note devcall with 55888 bytes needs the devcall bound of aien-dev/omega-mv#1042 (draft PR #1048): |
| 9 | note omc e5b32567 traps 3 above 16383 bytes, so this unit is pinned to the #1048 candidate compiler. |
| 10 | |
| 11 | global smbig uchar 55888 |
| 12 | |
| 13 | fn sbzero to void |
| 14 | for i ulong len smbig |
| 15 | put smbig i 0 |
| 16 | end |
| 17 | end |
| 18 | |
| 19 | fn sbput off ulong v uint to void |
| 20 | for i ulong 4 |
| 21 | put smbig add off i uchar and shr v mul i 8 255 |
| 22 | end |
| 23 | end |
| 24 | |
| 25 | fn sbget off ulong to uint |
| 26 | v = uint 0 |
| 27 | for i ulong 4 |
| 28 | v = or v shl uint get smbig add off i mul i 8 |
| 29 | end |
| 30 | ret v |
| 31 | end |
| 32 | |
| 33 | fn sbg64 off ulong to ulong |
| 34 | v = ulong 0 |
| 35 | for i ulong 8 |
| 36 | v = or v shl ulong get smbig add off i mul i 8 |
| 37 | end |
| 38 | ret v |
| 39 | end |
| 40 | |
| 41 | note Subdevice control with smbig as params; result as nvctrl (false: nverr or the status at header 28). |
| 42 | fn nvbig cmd uint n ulong to bool |
| 43 | nhzero |
| 44 | nhput 0 get nvobj 0 |
| 45 | nhput 4 get nvobj 2 |
| 46 | nhput 8 cmd |
| 47 | r = devcall get nvfd 0 uint 3223340586 nvhdr 0 32 smbig 0 n |
| 48 | ret nvos r nhget 28 |
| 49 | end |