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 / cache / templates_test.om

253 lines · 6186 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Independent admitted C exporter fixture, framed as launch4096/cubin32768/observed2048/sizes8LEu64.
3note The driver performs no admission; stdin is verification-only. Runtime caller owns successful admission custody.
4fn kt_sizes frame view uchar 38976 sizes edit ulong 8 to void
5for i ulong 8
6v = ulong 0
7for j ulong 8
8v = or v shl ulong get frame add add 38912 mul i 8 j mul j 8
9end
10put sizes i v
11end
12end
13fn kt_obsmut launch edit uchar 4096 cubin view uchar 32768 obs edit uchar 2048 sizes view ulong 8 off ulong expected long to bool
14old = get obs off
15put obs off xor old 1
16rc = native_templates launch cubin obs sizes
17put obs off old
18ret eq rc expected
19end
20fn kt_cubmut launch view uchar 4096 cubin edit uchar 32768 obs view uchar 2048 sizes view ulong 8 off ulong expected long to bool
21old = get cubin off
22put cubin off xor old 1
23rc = native_templates launch cubin obs sizes
24put cubin off old
25ret eq rc expected
26end
27fn kt_lmut launch edit uchar 4096 cubin view uchar 32768 obs view uchar 2048 sizes view ulong 8 off ulong expected long to bool
28old = get launch off
29put launch off xor old 1
30rc = native_templates launch cubin obs sizes
31put launch off old
32ret eq rc expected
33end
34fn kt_smut launch view uchar 4096 cubin view uchar 32768 obs view uchar 2048 sizes edit ulong 8 off ulong to bool
35old = get sizes off
36put sizes off xor old 1
37rc = native_templates launch cubin obs sizes
38put sizes off old
39ret eq rc -20
40end
41fn kt_resign launch edit uchar 4096 obs view uchar 2048 to int
42buf = new uchar 4096 0
43hash = new uchar 32 0
44for i ulong 768
45put buf i get obs i
46end
47if ne kc_sha buf 768 hash 0
48ret 1
49end
50for i ulong 32
51put launch add mul ulong 23 8 i get hash i
52end
53ret 0
54end
55fn kt_semantic launch edit uchar 4096 cubin view uchar 32768 obs edit uchar 2048 sizes view ulong 8 off ulong to bool
56old = get obs off
57put obs off xor old 1
58if ne kt_resign launch obs 0
59ret false
60end
61rc = native_templates launch cubin obs sizes
62put obs off old
63if ne kt_resign launch obs 0
64ret false
65end
66ret eq rc -25
67end
68fn kt_dupsection launch view uchar 4096 cubin edit uchar 32768 obs view uchar 2048 sizes view ulong 8 to bool
69backup = new uchar 64 0
70sh = kt_u cubin 40 8
71src = add sh mul ulong 8 64
72sh = add sh mul ulong 7 64
73for i ulong 64
74put backup i get cubin add sh i
75put cubin add sh i get cubin add src i
76end
77rc = native_templates launch cubin obs sizes
78for i ulong 64
79put cubin add sh i get backup i
80end
81ret eq rc -22
82end
83fn kt_paramhash launch view uchar 4096 cubin edit uchar 32768 obs view uchar 2048 sizes view ulong 8 off ulong to bool
84old = kt_u cubin off 4
85for i ulong 4
86put cubin add off i uchar and shr ulong 1175552 mul i 8 255
87end
88rc = native_templates launch cubin obs sizes
89for i ulong 4
90put cubin add off i uchar and shr old mul i 8 255
91end
92ret eq rc -26
93end
94fn kt_upperid launch view uchar 4096 cubin view uchar 32768 obs edit uchar 2048 sizes view ulong 8 to bool
95old = get obs 1024
96put obs 1024 65
97rc = native_templates launch cubin obs sizes
98put obs 1024 old
99ret eq rc -24
100end
101fn kt_taildupe launch view uchar 4096 cubin edit uchar 32768 obs view uchar 2048 sizes view ulong 8 off ulong to bool
102old = get cubin off
103put cubin off 55
104rc = native_templates launch cubin obs sizes
105put cubin off old
106ret eq rc -23
107end
108fn kt_cases launch edit uchar 4096 cubin edit uchar 32768 obs edit uchar 2048 sizes edit ulong 8 to int
109if ne native_templates launch cubin obs sizes 0
110ret 1
111end
112if not kt_obsmut launch cubin obs sizes 1024 -24
113ret 2
114end
115if not kt_obsmut launch cubin obs sizes 960 -24
116ret 3
117end
118if not kt_upperid launch cubin obs sizes
119ret 4
120end
121if not kt_obsmut launch cubin obs sizes 900 -20
122ret 5
123end
124if not kt_obsmut launch cubin obs sizes 992 -20
125ret 6
126end
127if not kt_obsmut launch cubin obs sizes 1088 -20
128ret 7
129end
130if not kt_obsmut launch cubin obs sizes 896 -22
131ret 8
132end
133if not kt_smut launch cubin obs sizes 1
134ret 9
135end
136if not kt_smut launch cubin obs sizes 2
137ret 10
138end
139if not kt_smut launch cubin obs sizes 3
140ret 11
141end
142if not kt_smut launch cubin obs sizes 7
143ret 12
144end
145if not kt_lmut launch cubin obs sizes 216 -20
146ret 13
147end
148if not kt_cubmut launch cubin obs sizes 32767 -20
149ret 14
150end
151if not kt_cubmut launch cubin obs sizes 0 -21
152ret 15
153end
154if not kt_cubmut launch cubin obs sizes 47 -21
155ret 16
156end
157if not kt_cubmut launch cubin obs sizes 62 -21
158ret 17
159end
160if not kt_dupsection launch cubin obs sizes
161ret 18
162end
163p = kt_u cubin 40 8
164p = add p mul ulong 8 64
165if not kt_cubmut launch cubin obs sizes add p 44 -22
166ret 19
167end
168p = kt_u cubin add p 24 8
169if not kt_cubmut launch cubin obs sizes p -23
170ret 20
171end
172if not kt_cubmut launch cubin obs sizes add p 4 -23
173ret 21
174end
175if not kt_cubmut launch cubin obs sizes add p 16 -23
176ret 22
177end
178if not kt_cubmut launch cubin obs sizes add p 18 -23
179ret 23
180end
181if not kt_cubmut launch cubin obs sizes add p 26 -23
182ret 24
183end
184if not kt_cubmut launch cubin obs sizes add p 32 -23
185ret 25
186end
187if not kt_cubmut launch cubin obs sizes add p 36 -23
188ret 26
189end
190if not kt_cubmut launch cubin obs sizes add p 45 -23
191ret 27
192end
193if not kt_cubmut launch cubin obs sizes add p 46 -23
194ret 28
195end
196if not kt_cubmut launch cubin obs sizes add p 58 -23
197ret 29
198end
199if not kt_paramhash launch cubin obs sizes add p 20
200ret 30
201end
202if not kt_lmut launch cubin obs sizes 120 -26
203ret 31
204end
205if not kt_obsmut launch cubin obs sizes 768 -27
206ret 32
207end
208if not kt_obsmut launch cubin obs sizes 0 -28
209ret 33
210end
211if not kt_semantic launch cubin obs sizes 540
212ret 34
213end
214if not kt_semantic launch cubin obs sizes 525
215ret 35
216end
217if not kt_semantic launch cubin obs sizes 528
218ret 36
219end
220if not kt_taildupe launch cubin obs sizes add p 49
221ret 38
222end
223if ne native_templates launch cubin obs sizes 0
224ret 37
225end
226ret 0
227end
228fn main to int
229frame = new uchar 38976 0
230pos = ulong 0
231while lt pos 38976 bound 38976
232n = read 0 frame pos sub 38976 pos
233if le n 0
234ret 90
235end
236pos = add pos ulong n
237end
238launch = new uchar 4096 0
239cubin = new uchar 32768 0
240obs = new uchar 2048 0
241sizes = new ulong 8 0
242for i ulong 4096
243put launch i get frame i
244end
245for i ulong 32768
246put cubin i get frame add 4096 i
247end
248for i ulong 2048
249put obs i get frame add 36864 i
250end
251kt_sizes frame sizes
252ret kt_cases launch cubin obs sizes
253end