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 / nvrm / transport.om

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