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 / omega / slices / open_plan.osc

60 lines · 1801 bytes Raw Blame History
1// slice-entry: open_plan class_pick
2// CUDA++ NVRM open sequence, in Omega. These are the classes and sizes nvrm_open
3// asks the driver for, in that order. The calls themselves are still the C file:
4// the compiler refuses the syscall word. Slot values are the header constants,
5// not guesses. class_pick is the loop that accepts a device only when it exposes
6// Blackwell compute (0xCEC0), Blackwell GPFIFO (0xC96F) and Hopper usermode (0xC661).
7// slice-run: open_plan cells:16 -> 0 cells=3472883713,65,128,0,8320,112,562949953421311,52928,51567,50785,65536,144,37105,4096,562949869535232,72
8// slice-run: class_pick cells:4=3,52928,51567,50785 -> 7
9// slice-run: class_pick cells:4=2,52928,51567,0 -> 3
10// slice-run: class_pick cells:4=0,0,0,0 -> 0
11// slice-run: class_pick cells:4=5,0,0,0 -> 18446744073709551615
12
13fn open_plan(st: cells) -> u64 {
14 if st.len < 16 {
15 return 18446744073709551615;
16 }
17 st[0] = 3472883713;
18 st[1] = 65;
19 st[2] = 128;
20 st[3] = 0;
21 st[4] = 8320;
22 st[5] = 112;
23 st[6] = 562949953421311;
24 st[7] = 52928;
25 st[8] = 51567;
26 st[9] = 50785;
27 st[10] = 65536;
28 st[11] = 144;
29 st[12] = 37105;
30 st[13] = 4096;
31 st[14] = 562949869535232;
32 st[15] = 72;
33 return 0;
34}
35
36fn class_pick(cls: cells) -> u64 {
37 if cls.len < 1 {
38 return 18446744073709551615;
39 }
40 let n: u64 = cls[0];
41 if n > cls.len - 1 {
42 return 18446744073709551615;
43 }
44 let mut found: u64 = 0;
45 let mut i: u64 = 0;
46 while i < n bound 512 {
47 let id: u64 = cls[1 + i];
48 if id == 52928 {
49 found = found | 1;
50 }
51 if id == 51567 {
52 found = found | 2;
53 }
54 if id == 50785 {
55 found = found | 4;
56 }
57 i = i + 1;
58 }
59 return found;
60}