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 / evidence / LEARN53-L777-CONTINUATION / author / catalog-export.om

456 lines · 5692 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note CUL1 public domain adapter. See docs/learn53/CONTRACT.md.
3note Caller owns/pins kt; only ko contains candidate observations. No code execution.
4global kt uchar 4096
5global ko uchar 1032
6fn kw i ulong to ulong
7v = ulong 0
8for j ulong 4
9v = or v shl ulong get kt add mul i 4 j mul j 8
10end
11ret v
12end
13fn kc i ulong to ulong
14v = ulong 0
15for j ulong 4
16v = or v shl ulong get ko add mul i 4 j mul j 8
17end
18ret v
19end
20fn kshape to ulong
21op = kw 2
22m = kw 5
23n = kw 6
24k = kw 7
25if eq op 3
26if eq m 2
27if eq n 3
28if eq k 2
29ret 301
30end
31end
32end
33if eq m 3
34if eq n 2
35if eq k 3
36ret 302
37end
38end
39end
40ret 0
41end
42if ne n 1
43ret 0
44end
45if ne k 1
46ret 0
47end
48base = mul op 100
49if eq m 3
50ret add base 1
51end
52if eq m 8
53ret add base 2
54end
55if eq m 17
56ret add base 3
57end
58ret 0
59end
60fn kextent rows ulong cols ulong stride ulong to ulong
61ret add mul sub rows 1 stride cols
62end
63fn kstrides to int
64op = kw 2
65m = kw 5
66if eq op 3
67if lt kw 8 kw 7
68ret 65
69end
70if lt kw 9 kw 6
71ret 65
72end
73if lt kw 10 kw 6
74ret 65
75end
76if ne kw 11 kextent m kw 7 kw 8
77ret 65
78end
79if ne kw 12 kextent kw 7 kw 6 kw 9
80ret 65
81end
82if ne kw 13 kextent m kw 6 kw 10
83ret 65
84end
85ret 0
86end
87if eq kw 8 0
88ret 65
89end
90if ne kw 11 kextent m 1 kw 8
91ret 65
92end
93if eq op 2
94if ne kw 9 0
95ret 65
96end
97if ne kw 12 0
98ret 65
99end
100if ne kw 10 1
101ret 65
102end
103if ne kw 13 1
104ret 65
105end
106ret 0
107end
108if eq kw 9 0
109ret 65
110end
111if eq kw 10 0
112ret 65
113end
114if ne kw 12 kextent m 1 kw 9
115ret 65
116end
117if ne kw 13 kextent m 1 kw 10
118ret 65
119end
120ret 0
121end
122fn kvalid n ulong to int
123note All variable reads follow size/count validation. Bounds precede arithmetic.
124if lt n 96
125ret 65
126end
127if gt n 4096
128ret 65
129end
130if ne kw 0 827086147
131ret 65
132end
133if ne kw 1 1
134ret 69
135end
136if gt kw 11 256
137ret 65
138end
139if gt kw 12 256
140ret 65
141end
142if eq kw 13 0
143ret 65
144end
145if gt kw 13 256
146ret 65
147end
148if ne n add 96 mul 4 add kw 11 kw 12
149ret 65
150end
151if ne kw 23 0
152ret 65
153end
154if eq kw 16 0
155ret 65
156end
157if ne kw 21 0
158ret 65
159end
160if ne kw 22 0
161ret 65
162end
163if lt kw 2 1
164ret 69
165end
166if gt kw 2 3
167ret 69
168end
169if ne kw 3 1
170ret 69
171end
172if ne kw 4 0
173ret 69
174end
175if ne kw 17 1
176ret 69
177end
178if ne kw 18 0
179ret 69
180end
181if ne kw 19 1
182ret 69
183end
184if ne kw 20 1
185ret 69
186end
187if eq kw 14 0
188ret 65
189end
190if gt kw 14 3
191ret 65
192end
193if ne kw 14 1
194ret 77
195end
196family = kshape
197if eq family 0
198ret 69
199end
200if ne kw 15 family
201ret 65
202end
203for i ulong 3
204if gt kw add i 8 32
205ret 65
206end
207end
208ret kstrides
209end
210fn ksum to ulong
211v = ulong 0
212for i ulong kw 5
213v = and add v kw add 24 mul i kw 8 4294967295
214end
215ret v
216end
217fn kdot row ulong col ulong to ulong
218v = ulong 0
219for i ulong kw 7
220a = kw add 24 add mul row kw 8 i
221b = kw add add 24 kw 11 add mul i kw 9 col
222v = and add v mul a b 4294967295
223end
224ret v
225end
226fn kexpect pos ulong to ulong
227op = kw 2
228if eq op 2
229ret ksum
230end
231stride = kw 10
232row = div pos stride
233col = rem pos stride
234if eq op 3
235if ge col kw 6
236ret 2779096485
237end
238ret kdot row col
239end
240if ne col 0
241ret 2779096485
242end
243a = kw add 24 mul row kw 8
244b = kw add add 24 kw 11 mul row kw 9
245ret and add a b 4294967295
246end
247fn keval n ulong c ulong to int
248status = kvalid n
249if ne status 0
250ret status
251end
252note Candidate result length is not trusted. No caller-supplied PASS or tolerance.
253if ne c mul 4 add kw 13 2
254ret 65
255end
256if ne kc 0 2779096485
257ret 1
258end
259if ne kc add kw 13 1 2779096485
260ret 1
261end
262for i ulong kw 13
263if ne kc add i 1 kexpect i
264ret 1
265end
266end
267ret 0
268end
269note SPDX-License-Identifier: AGPL-3.0-only
270note Eight fixed public development tasks. Not a sealed pool or a process runner.
271fn kput p ulong v ulong to void
272for i ulong 4
273put kt add mul p 4 i uchar and shr v mul i 8 255
274end
275end
276fn kbase id ulong to void
277for i ulong 4096
278put kt i 0
279end
280kput 0 827086147
281kput 1 1
282kput 3 1
283kput 5 3
284kput 6 1
285kput 7 1
286kput 8 2
287kput 9 2
288kput 10 2
289kput 11 5
290kput 12 5
291kput 13 5
292kput 14 1
293kput 16 id
294kput 17 1
295kput 19 1
296kput 20 1
297end
298fn klinear id ulong to void
299if eq id 1
300kput 2 1
301kput 15 101
302kput 24 4294967295
303kput 25 111
304kput 26 7
305kput 27 222
306kput 28 9
307kput 29 1
308kput 30 333
309kput 31 4
310kput 32 444
311kput 33 6
312ret
313end
314if eq id 4
315kput 2 2
316kput 15 201
317kput 9 0
318kput 10 1
319kput 12 0
320kput 13 1
321kput 24 4294967295
322kput 25 111
323kput 26 2
324kput 27 222
325kput 28 3
326ret
327end
328n = ulong 8
329if or eq id 3 eq id 6
330n = 17
331end
332kput 5 n
333kput 8 1
334kput 10 1
335kput 11 n
336if le id 3
337kput 2 1
338kput 9 1
339kput 12 n
340kput 13 n
341kput 15 add 100 id
342a = ulong 7
343b = ulong 9
344if eq id 3
345a = 4294967295
346b = 3
347end
348for i ulong n
349kput add 24 i a
350kput add add 24 n i b
351end
352else
353kput 2 2
354kput 9 0
355kput 12 0
356kput 13 1
357kput 15 add 197 id
358for i ulong n
359kput add 24 i 4294967295
360end
361end
362end
363fn kmatrix id ulong to void
364kput 2 3
365if eq id 7
366kput 5 2
367kput 6 3
368kput 7 2
369kput 8 3
370kput 9 4
371kput 10 4
372kput 11 5
373kput 12 7
374kput 13 7
375kput 15 301
376kput 24 1
377kput 25 2
378kput 26 999
379kput 27 3
380kput 28 4
381kput 29 5
382kput 30 6
383kput 31 7
384kput 32 999
385kput 33 8
386kput 34 9
387kput 35 10
388else
389kput 5 3
390kput 6 2
391kput 7 3
392kput 8 3
393kput 9 2
394kput 10 2
395kput 11 9
396kput 12 6
397kput 13 6
398kput 15 302
399for i ulong 9
400kput add 24 i add i 1
401end
402for i ulong 6
403kput add 33 i add i 1
404end
405end
406end
407fn kload id ulong to ulong
408note Reject before modifying either caller buffer. Valid loads never touch ko.
409if or eq id 0 gt id 8
410ret 0
411end
412kbase id
413if le id 6
414klinear id
415else
416kmatrix id
417end
418ret add 96 mul 4 add kw 11 kw 12
419end
420note SPDX-License-Identifier: AGPL-3.0-only
421note Development fixture emitter: exactly one input byte, public catalog ID1..8.
422global CIn uchar 2
423fn main to int
424pos = ulong 0
425done = false
426while eq done false bound 3
427r = read 0 CIn pos sub 2 pos
428if lt r 0
429ret 74
430end
431if eq r 0
432done = true
433else
434pos = add pos ulong r
435if eq pos 2
436ret 65
437end
438end
439end
440if ne pos 1
441ret 65
442end
443n = kload ulong get CIn 0
444if eq n 0
445ret 77
446end
447pos = 0
448while lt pos n bound 257
449w = write 1 kt pos sub n pos
450if le w 0
451ret 74
452end
453pos = add pos ulong w
454end
455ret 0
456end