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 / graph / layout.om

271 lines · 4335 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note c model,heads,layers,ctas,H,I,groups,qkv,attn,mix,ab,attmix,mout,routerbytes,segbytes,span,maxheads,pad,copyrow,tokenstride,cap.
3fn gl_dec c view ulong 32 p ulong to ulong
4if or or eq p 0 eq p 1 or eq p 4 or eq p 8 eq p 14
5ret mul get c 4 4
6end
7if eq p 2
8ret mul get c 7 4
9end
10if or eq p 3 eq p 16
11ret mul get c 8 4
12end
13if eq p 5
14ret mul mul mul get c 6 2 get c 5 4
15end
16if eq p 6
17ret mul mul get c 6 get c 5 4
18end
19if eq p 7
20ret mul mul get c 6 get c 4 4
21end
22if eq p 9
23ret mul mul get c 3 get c 15 4
24end
25if or eq p 10 eq p 11
26ret mul get c 15 4
27end
28if eq p 12
29ret 16
30end
31if eq p 13
32ret mul mul get c 2 get c 4 4
33end
34if eq p 15
35ret mul get c 2 32
36end
37ret mul get c 4 4
38end
39fn gl_dense c view ulong 32 p ulong to ulong
40if or or eq p 0 eq p 2 or eq p 8 or eq p 13 eq p 17
41ret mul get c 4 4
42end
43if eq p 1
44ret mul get c 10 4
45end
46if eq p 3
47ret mul mul get c 3 get c 15 4
48end
49if or eq p 4 eq p 5
50ret mul get c 15 4
51end
52if eq p 6
53ret 16
54end
55if eq p 7
56ret mul mul mul get c 2 2 get c 4 4
57end
58if eq p 9
59ret add mul get c 2 64 16
60end
61if or eq p 10 eq p 15
62ret mul get c 11 4
63end
64if eq p 11
65ret mul get c 18 4
66end
67if or eq p 12 eq p 18
68ret mul mul 2 get c 5 4
69end
70if eq p 14
71ret mul get c 9 4
72end
73if eq p 16
74ret mul get c 12 4
75end
76ret mul get c 5 4
77end
78fn gl_q36 c view ulong 32 p ulong to ulong
79if or or eq p 0 eq p 2 eq p 15
80ret mul mul get c 4 4 get c 1
81end
82if eq p 1
83ret mul get c 10 4
84end
85if eq p 3
86ret mul mul mul get c 3 get c 15 4 get c 1
87end
88if or eq p 4 eq p 5
89ret mul get c 15 4
90end
91if eq p 6
92ret mul get c 19 get c 1
93end
94if eq p 7
95ret mul mul get c 2 get c 4 4
96end
97if eq p 8
98ret mul get c 4 4
99end
100if eq p 9
101ret add mul get c 2 64 16
102end
103if or eq p 10 eq p 17
104ret mul get c 11 4
105end
106if eq p 11
107ret mul get c 18 4
108end
109if or eq p 12 eq p 22
110ret mul mul get c 6 get c 4 4
111end
112if eq p 13
113ret mul mul get c 2 2 get c 14
114end
115if eq p 14
116ret mul add add get c 4 get c 12 get c 5 4
117end
118if eq p 16
119ret mul get c 9 4
120end
121if eq p 18
122ret mul get c 12 4
123end
124if eq p 19
125ret mul get c 4 4
126end
127if eq p 20
128ret mul mul mul get c 6 2 get c 5 4
129end
130if eq p 21
131ret mul mul get c 6 get c 5 4
132end
133if or eq p 23 eq p 35
134ret mul mul get c 16 get c 4 4
135end
136if eq p 24
137ret mul mul get c 1 get c 9 4
138end
139if eq p 25
140ret mul mul get c 1 get c 10 4
141end
142if eq p 26
143ret mul mul get c 1 get c 11 4
144end
145if eq p 27
146ret mul mul get c 1 get c 12 4
147end
148if eq p 28
149ret mul mul get c 16 get c 12 4
150end
151if eq p 29
152ret mul mul get c 1 get c 4 4
153end
154if eq p 30
155ret mul get c 1 graph_align get c 13
156end
157if or eq p 31 eq p 32
158ret mul mul get c 1 get c 6 get c 14
159end
160if or eq p 33 eq p 34
161ret mul add mul get c 1 get c 6 get c 17 4
162end
163if eq p 36
164ret mul mul mul mul get c 1 get c 6 2 get c 5 4
165end
166if or eq p 37 eq p 38
167ret mul mul mul get c 1 get c 6 get c 5 4
168end
169ret mul mul mul get c 1 get c 6 get c 4 4
170end
171fn gl_pf c view ulong 32 p ulong to ulong
172if or eq p 0 or eq p 10 eq p 17
173ret mul mul get c 20 get c 4 4
174end
175if eq p 1
176ret mul get c 20 get c 13
177end
178if or eq p 2 eq p 3
179ret mul 256 get c 14
180end
181if or eq p 4 eq p 5
182ret get c 14
183end
184if or eq p 6 eq p 7
185ret mul add mul get c 20 get c 6 get c 17 4
186end
187if or eq p 8 eq p 9
188ret mul add get c 20 get c 17 4
189end
190if or eq p 11 eq p 18
191ret mul mul add get c 20 get c 17 get c 4 4
192end
193if eq p 12
194ret mul mul get c 20 get c 9 4
195end
196if eq p 13
197ret mul mul get c 20 get c 10 4
198end
199if eq p 14
200ret mul mul get c 20 get c 11 4
201end
202if eq p 15
203ret mul mul get c 20 get c 12 4
204end
205if eq p 16
206ret mul mul add get c 20 get c 17 get c 12 4
207end
208if eq p 19
209ret mul mul mul mul get c 20 get c 6 2 get c 5 4
210end
211if eq p 20
212ret mul mul mul get c 20 get c 6 get c 5 4
213end
214if eq p 21
215ret mul mul add mul get c 20 get c 6 get c 17 get c 5 4
216end
217ret mul mul mul get c 20 get c 6 get c 4 4
218end
219fn mg_layout c view ulong 32 d edit ulong 64 to ulong
220for i ulong 64
221put d i 0
222end
223n = ulong 18
224if eq get c 0 1
225n = 40
226end
227if eq get c 0 2
228n = 20
229end
230if eq get c 0 3
231n = 23
232end
233o = ulong 0
234for p ulong n
235if eq get c 0 1
236if eq p 15
237put d 60 o
238end
239end
240if eq get c 0 2
241if eq p 13
242put d 60 o
243end
244end
245if eq get c 0 3
246if eq p 10
247put d 61 o
248o = 0
249end
250end
251put d p o
252b = gl_dec c p
253if eq get c 0 1
254b = gl_q36 c p
255end
256if eq get c 0 2
257b = gl_dense c p
258end
259if eq get c 0 3
260b = gl_pf c p
261end
262o = graph_align add o b
263end
264if eq get c 0 3
265put d 63 o
266else
267put d 61 o
268end
269put d 62 graph_align get c 13
270ret 1
271end