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 / cmdlist / plan.om

153 lines · 2680 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2const CLBAD ulong 18446744073709551615
3note Descriptor: count then sixteen VA/length/flags triples; count17 means unknown.
4fn clvalid p view ulong 200704 i ulong to ulong
5b = mul i 49
6n = get p b
7if gt n 17
8ret 0
9end
10if eq n 17
11ret 1
12end
13for j ulong n
14k = add add b 1 mul j 3
15if eq get p add k 1 0
16ret 0
17end
18if eq get p add k 2 0
19ret 0
20end
21if gt get p add k 2 3
22ret 0
23end
24if gt get p k sub CLBAD get p add k 1
25ret 0
26end
27end
28ret 1
29end
30
31fn clrange p view ulong 200704 a ulong b ulong to ulong
32if ge get p a add get p b get p add b 1
33ret 0
34end
35if ge get p b add get p a get p add a 1
36ret 0
37end
38x = get p add a 2
39y = get p add b 2
40h = ulong 0
41if and ne and y 2 0 ne and x 1 0
42h = or h 1
43end
44if and ne and y 1 0 ne and x 2 0
45h = or h 2
46end
47if and ne and y 2 0 ne and x 2 0
48h = or h 4
49end
50ret h
51end
52
53fn clrow p view ulong 200704 a ulong y ulong to ulong
54h = ulong 0
55for j ulong get p y
56b = add add y 1 mul j 3
57h = or h clrange p a b
58end
59ret h
60end
61
62fn clpair p view ulong 200704 x ulong y ulong to ulong
63if or eq get p x 17 eq get p y 17
64ret 7
65end
66h = ulong 0
67for i ulong get p x
68a = add add x 1 mul i 3
69h = or h clrow p a y
70end
71ret h
72end
73
74fn clhazards p view ulong 200704 i ulong start ulong to ulong
75h = ulong 0
76for j ulong sub i start
77h = or h clpair p mul i 49 mul add start j 49
78end
79if eq i 0
80h = ulong 8
81end
82ret h
83end
84
85fn clstep p view ulong 200704 barriers edit ulong 4096 o edit ulong 16 i ulong mode ulong stamps ulong to ulong
86h = clhazards p i get o 3
87put barriers i h
88if ne h 0
89put o 1 add get o 1 1
90put o 3 i
91put o 0 add get o 0 4
92end
93if eq mode 0
94put o 0 add get o 0 4
95else
96put o 0 add get o 0 198
97end
98if ne stamps 0
99put o 0 add get o 0 6
100end
101ret 0
102end
103
104note Whole-program planning: count capacity mode stamps ring_words prefix_words.
105note Output: exact words, WFI methods (excluding tail release), submissions, epoch start.
106note RAW1 WAR2 WAW4 admission8. Compare ALL outstanding launches since the last drain.
107note No splitting: ring overflow is refused before the shell can submit anything.
108fn cmdlist_plan a view ulong 16 p view ulong 200704 barriers edit ulong 4096 o edit ulong 16 to ulong
109if gt get a 0 4096
110ret 1
111end
112if gt get a 0 get a 1
113ret 1
114end
115if gt get a 1 4096
116ret 1
117end
118if or gt get a 2 1 gt get a 3 1
119ret 1
120end
121for i ulong 4
122if ne get a add 6 i 0
123ret 1
124end
125end
126for i ulong get a 0
127if eq clvalid p i 0
128ret 2
129end
130end
131for i ulong 16
132put o i 0
133end
134if eq get a 0 0
135ret 0
136end
137put o 0 35
138if ne get a 3 0
139put o 0 add get o 0 8
140put o 1 1
141end
142for i ulong get a 0
143r = clstep p barriers o i get a 2 get a 3
144end
145if gt get a 5 get a 4
146ret 3
147end
148if gt get o 0 sub get a 4 get a 5
149ret 3
150end
151put o 2 1
152ret 0
153end