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 / om / components / api_bf_plan.om

129 lines · 1625 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2fn api_bf_plan mode ulong a edit ulong 16 to ulong
3if eq mode 0
4k = get a 0
5ks = div k 256
6w = ulong 16
7d = ks
8if ne d 0
9while or gt d 16 ne rem ks d 0 bound 65536
10d = sub d 1
11end
12end
13if or ne rem k mul 32 w 0 gt k mul 512 w
14w = 32
15end
16put a 8 ulong 1
17put a 9 w
18put a 10 d
19put a 11 ulong 96
20for i ulong 4
21if ne get a add i 1 0
22put a add i 8 get a add i 1
23end
24end
25ret 0
26end
27if eq mode 1
28n = get a 0
29rows = get a 1
30warps = get a 2
31ctas = get a 3
32if or eq rows 0 eq warps 0
33ret 3
34end
35if ne rem n rows 0
36ret 3
37end
38gx = div and add div n rows sub warps 1 4294967295 warps
39if gt gx ctas
40gx = ctas
41end
42if eq gx 0
43gx = 1
44end
45put a 8 gx
46put a 9 div n rows
47ret 0
48end
49if eq mode 2
50rec = ne get a 0 0
51xr = get a 1
52xb = get a 2
53if and ne xr 0 or not rec gt xr 65535
54ret 1
55end
56if ne get a 4 0
57if or not rec ne xr 0
58ret 1
59end
60if or gt xb 1 eq get a 5 0
61ret 1
62end
63end
64if gt xb 1
65if or not rec ne xr 0
66ret 1
67end
68if or gt xb 4 lt get a 3 get a 6
69ret 1
70end
71end
72ret 0
73end
74if eq mode 3
75if gt get a 0 1
76if or gt get a 0 4 eq get a 1 0
77ret 1
78end
79end
80put a 8 ulong 0
81if le get a 0 1
82put a 8 ulong 1
83end
84ret 0
85end
86if eq mode 4
87if gt mul mul ulong 32 get a 0 get a 1 65536
88ret 2
89end
90ret 0
91end
92if eq mode 5
93if eq get a 0 0
94ret 1
95end
96put a 8 ulong 0
97if eq get a 0 1
98put a 8 ulong 1
99end
100ret 0
101end
102if eq mode 6
103r = get a 5
104s = ulong 0
105xb = ulong 0
106gy = ulong 1
107nr = ulong 1
108if ne get a 0 0
109s = get a 4
110gy = get a 0
111nr = gy
112end
113if ne get a 3 0
114r = 1
115end
116if gt get a 1 1
117xb = get a 1
118s = get a 2
119nr = xb
120end
121put a 8 r
122put a 9 s
123put a 10 xb
124put a 11 gy
125put a 12 mul get a 4 nr
126ret 0
127end
128ret 1
129end