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 / tests / shader-pilot / core-test.om

138 lines · 3230 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Tests bind the pilot boundary, not GPU execution or source authentication.
3global sptally ulong 2
4text spok "SHADER_PILOT_CORE_PASS\n"
5text spbad "SHADER_PILOT_CORE_FAIL\n"
6fn sptest yes bool to void
7put sptally 0 add get sptally 0 1
8if not yes
9put sptally 1 add get sptally 1 1
10end
11end
12fn spcopy id ulong to ulong
13n = kload id
14for i ulong n
15put sptask i get kt i
16end
17gbvec
18for i ulong 512
19put spcode i get gbcode i
20end
21ret n
22end
23fn spow p ulong v ulong to void
24for j ulong 4
25put ko add mul p 4 j uchar and shr v mul j 8 255
26end
27end
28fn spobs n ulong value ulong to void
29note Independent expected literals: Wolfram Mod[7+9,2^32]=16 and Mod[2^32-1+3,2^32]=2.
30for i ulong add n 2
31v = value
32if or eq i 0 eq i add n 1
33v = 2779096485
34end
35spow i v
36end
37end
38fn spcase id ulong tn ulong n ulong value ulong on ulong to void
39sptest eq spload id tn
40sptest eq get gblen 0 512
41sptest eq kw 5 n
42sptest eq kw 2 1
43spobs n value
44sptest eq keval tn on 0
45note Wrong result/skipped write must fail the existing independent evaluator.
46put ko 4 xor get ko 4 1
47sptest eq keval tn on 1
48spobs n value
49put ko sub on 1 0
50sptest eq keval tn on 1
51t = spcopy id
52sptest eq t tn
53sptest eq spmatch id tn 512 0
54note Every candidate byte matters. Omitted scan bytes make these tests fail.
55for i ulong tn
56v = get sptask i
57put sptask i xor v 1
58sptest eq spmatch id tn 512 1
59sptest eq get sptask i xor v 1
60put sptask i v
61end
62for i ulong 512
63v = get spcode i
64put spcode i xor v 1
65sptest eq spmatch id tn 512 1
66sptest eq get spcode i xor v 1
67put spcode i v
68end
69sptest eq spmatch id tn 512 0
70sptest eq spmatch id sub tn 1 512 65
71sptest eq spmatch id add tn 1 512 65
72sptest eq spmatch id tn 511 65
73sptest eq spmatch id tn 513 65
74sptest eq spmatch id 18446744073709551615 512 65
75sptest eq spmatch id tn 18446744073709551615 65
76note Stale or poisoned trusted scratch cannot redefine the expected bytes.
77put kt 0 0
78put gbcode 0 0
79put gblen 0 0
80sptest eq spmatch id tn 512 0
81end
82fn spprofs to void
83n = kload 2
84sptest spprofile 2 n
85note This remains valid CUL1 add8 but stride2 is not supported by gbvec.
86kput 8 2
87kput 9 2
88kput 10 2
89kput 11 15
90kput 12 15
91kput 13 15
92sptest eq kvalid 216 0
93sptest not spprofile 2 216
94n = kload 3
95sptest not spprofile 2 n
96sptest spprofile 3 n
97note A valid CUL1 operation is not necessarily a supported vector operation.
98n = kload 5
99sptest eq kvalid n 0
100sptest not spprofile 2 n
101n = kload 1
102sptest not spprofile 1 n
103n = kload 2
104kput 3 2
105sptest not spprofile 2 n
106end
107fn main to int
108spprofs
109spcase 2 160 8 16 40
110spcase 3 232 17 2 76
111note Same emitted code does not make task2 an acceptable task3 receipt.
112t = spcopy 2
113sptest eq spmatch 3 t 512 65
114sptest eq spmatch 3 232 512 1
115note Unsupported catalog IDs and modes do not mutate a previous specimen.
116n = spload 3
117a = get kt 0
118b = get gbcode 0
119for id ulong 10
120if and ne id 2 ne id 3
121sptest eq spload id 0
122sptest eq spmatch id 232 512 77
123sptest eq get kt 0 a
124sptest eq get gbcode 0 b
125sptest eq get gblen 0 512
126end
127end
128sptest eq spload 18446744073709551615 0
129sptest eq spmatch 18446744073709551615 232 512 77
130if ne get sptally 1 0
131r = write 2 spbad 0 len spbad
132ret 1
133end
134if ne write 1 spok 0 len spok long len spok
135ret 74
136end
137ret 0
138end