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
CUDApp / native / nvrm / transport.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Linux AArch64 RM580.173.02 transport. No GPU is opened by generation or host tests. |
| 3 | note Encoded requests match context.om and the vendored headers; request184 F74: WolframLanguageEvaluator BitOr[BitShiftLeft[3,30],BitShiftLeft[184,16],BitShiftLeft[70,8],74] -> 3233302090. |
| 4 | om2 |
| 5 | export fn nvrm_open_file path view uchar * to long |
| 6 | ret fopen path 0 len path 524290 0 |
| 7 | end |
| 8 | export fn nvrm_close_file fd long to long |
| 9 | ret fclose int fd |
| 10 | end |
| 11 | export fn nvrm_ioctl fd long nr ulong h edit uchar * p edit uchar * to long |
| 12 | if eq nr 43 |
| 13 | if ne len h 32 |
| 14 | ret neg long 22 |
| 15 | end |
| 16 | for i ulong 8 |
| 17 | put h add 16 i 0 |
| 18 | end |
| 19 | ret devcall int fd uint 3223340587 h 0 32 p 0 len p |
| 20 | end |
| 21 | if eq nr 42 |
| 22 | if ne len h 32 |
| 23 | ret neg long 22 |
| 24 | end |
| 25 | for i ulong 8 |
| 26 | put h add 16 i 0 |
| 27 | end |
| 28 | ret devcall int fd uint 3223340586 h 0 32 p 0 len p |
| 29 | end |
| 30 | if and eq nr 41 eq len h 16 |
| 31 | ret devctl int fd uint 3222292009 h 0 16 |
| 32 | end |
| 33 | if and eq nr 78 eq len h 56 |
| 34 | ret devctl int fd uint 3224913486 h 0 56 |
| 35 | end |
| 36 | if and eq nr 87 eq len h 64 |
| 37 | ret devctl int fd uint 3225437783 h 0 64 |
| 38 | end |
| 39 | if and eq nr 88 eq len h 48 |
| 40 | ret devctl int fd uint 3224389208 h 0 48 |
| 41 | end |
| 42 | if and eq nr 201 eq len h 4 |
| 43 | ret devctl int fd uint 3221505737 h 0 4 |
| 44 | end |
| 45 | if and eq nr 200 eq len h 4608 |
| 46 | ret devctl int fd uint 3523233480 h 0 4608 |
| 47 | end |
| 48 | if and eq nr 74 eq len h 184 |
| 49 | ret devctl int fd uint 3233302090 h 0 184 |
| 50 | end |
| 51 | ret neg long 22 |
| 52 | end |
| 53 | export fn nvrm_uvm fd long cmd ulong b edit uchar * to long |
| 54 | if and eq cmd 805306369 eq len b 16 |
| 55 | ret uvmctl int fd uint 805306369 b 0 16 |
| 56 | end |
| 57 | if and eq cmd 75 eq len b 8 |
| 58 | ret uvmctl int fd uint 75 b 0 8 |
| 59 | end |
| 60 | if and eq cmd 37 eq len b 40 |
| 61 | ret uvmctl int fd uint 37 b 0 40 |
| 62 | end |
| 63 | if and eq cmd 38 eq len b 20 |
| 64 | ret uvmctl int fd uint 38 b 0 20 |
| 65 | end |
| 66 | if and eq cmd 25 eq len b 32 |
| 67 | ret uvmctl int fd uint 25 b 0 32 |
| 68 | end |
| 69 | if and eq cmd 26 eq len b 20 |
| 70 | ret uvmctl int fd uint 26 b 0 20 |
| 71 | end |
| 72 | if and eq cmd 27 eq len b 56 |
| 73 | ret uvmctl int fd uint 27 b 0 56 |
| 74 | end |
| 75 | if and eq cmd 28 eq len b 28 |
| 76 | ret uvmctl int fd uint 28 b 0 28 |
| 77 | end |
| 78 | if and eq cmd 33 eq len b 9264 |
| 79 | ret uvmctl int fd uint 33 b 0 9264 |
| 80 | end |
| 81 | if and eq cmd 34 eq len b 24 |
| 82 | ret uvmctl int fd uint 34 b 0 24 |
| 83 | end |
| 84 | if and eq cmd 73 eq len b 24 |
| 85 | ret uvmctl int fd uint 73 b 0 24 |
| 86 | end |
| 87 | ret neg long 22 |
| 88 | end |
| 89 | export fn nvrm_reserve address ulong size ulong to long |
| 90 | note Explicit client envelope refusal is -EFBIG27; never fall back to C or trap for oversized input. |
| 91 | if gt size 68719476736 |
| 92 | ret neg long 27 |
| 93 | end |
| 94 | if ge address 1099511627776 |
| 95 | ret neg long 27 |
| 96 | end |
| 97 | if gt size sub 1099511627776 address |
| 98 | ret neg long 27 |
| 99 | end |
| 100 | if or eq size 0 lt address 65536 |
| 101 | ret neg long 22 |
| 102 | end |
| 103 | ret maphold address size |
| 104 | end |
| 105 | export fn nvrm_bind token long fd long to long |
| 106 | ret mapbind token int fd 0 3 |
| 107 | end |
| 108 | export fn nvrm_map_file fd long size ulong to long |
| 109 | if gt size 68719476736 |
| 110 | ret neg long 27 |
| 111 | end |
| 112 | if eq size 0 |
| 113 | ret neg long 22 |
| 114 | end |
| 115 | ret mapnew int fd 0 size 3 1 |
| 116 | end |
| 117 | export fn nvrm_map_address token long to ulong |
| 118 | ret mapaddr token |
| 119 | end |
| 120 | export fn nvrm_drop token long to long |
| 121 | ret mapdrop token |
| 122 | end |