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 / pipeline / test_mccover.om

266 lines · 4607 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note HOST_ONLY SYNTHETIC policy controls, no receipt, admission, device or GPU.
3fn test_cover to long
4c = new ulong 16 0
5roles = new ulong 4096 8
6counts = new ulong 8 1
7owner = new ulong 4 0
8put c 0 1
9put c 1 159
10put c 2 6
11put c 3 1
12put c 4 1
13put c 5 64
14put c 6 1
15put c 8 8
16put c 9 7
17put c 10 16
18put owner 0 8
19put owner 1 7
20put owner 2 32
21put roles 0 1
22put roles 1 0
23put roles 2 2
24put roles 3 6
25put roles 4 3
26put roles 5 4
27put roles 6 7
28put roles 7 5
29if ne mcc_cover c roles counts owner 0
30ret 1
31end
32note A missing successful-add record cannot be replaced by an expected role.
33put roles 3 8
34if eq mcc_cover c roles counts owner 0
35ret 2
36end
37put roles 3 6
38put counts 6 0
39if eq mcc_cover c roles counts owner 0
40ret 3
41end
42put counts 6 1
43note Same role set with the wrong actual order is refused.
44put roles 3 3
45put roles 4 6
46if eq mcc_cover c roles counts owner 0
47ret 4
48end
49put roles 3 6
50put roles 4 3
51put c 9 6
52if eq mcc_cover c roles counts owner 0
53ret 5
54end
55put c 9 7
56put owner 0 7
57if eq mcc_cover c roles counts owner 0
58ret 6
59end
60put owner 0 8
61put roles 8 5
62if eq mcc_cover c roles counts owner 0
63ret 7
64end
65put roles 8 8
66put c 4 2
67if eq mcc_cover c roles counts owner 0
68ret 8
69end
70put c 4 1
71if ne mcc_cover c roles counts owner 0
72ret 9
73end
74ret 0
75end
76fn test_qword qmd edit uchar 1024 off ulong v ulong to void
77for i ulong 4
78put qmd add off i uchar and shr v mul i 8 255
79end
80end
81fn test_intent to long
82m = new ulong 32 0
83bank = new uchar 1024 0
84qmd = new uchar 1024 0
85s = new ulong 16 0
86seal = new uchar 32 0
87put m 0 1
88put m 1 159
89put m 2 1
90put m 3 6
91put m 4 1
92put m 5 16
93put m 7 7
94put m 10 4096
95put m 11 8192
96note Expected VA declared independently before writing the synthetic QMD.
97put qmd 129 1
98put s 0 1
99put s 1 159
100put s 2 4
101put s 3 7
102put s 6 1
103put s 11 8
104if ne mcc_seal bank qmd get m 4 edit seal 0
105ret 18
106end
107if ne native_mcintent m bank qmd s seal 0
108ret 10
109end
110put m 10 8192
111if eq native_mcintent m bank qmd s seal 0
112ret 11
113end
114put m 10 4096
115put m 3 7
116if ne native_mcintent m bank qmd s seal 0
117ret 12
118end
119put s 3 6
120if eq native_mcintent m bank qmd s seal 0
121ret 13
122end
123put s 3 7
124put m 6 8
125if eq native_mcintent m bank qmd s seal 0
126ret 14
127end
128put m 6 0
129note Mutations of driver prefix, actual argument, QMD1 and QMD0 each refuse.
130put bank 0 1
131if eq native_mcintent m bank qmd s seal 0
132ret 19
133end
134put bank 0 0
135put bank 896 1
136if eq native_mcintent m bank qmd s seal 0
137ret 20
138end
139put bank 896 0
140put qmd 0 1
141if eq native_mcintent m bank qmd s seal 0
142ret 21
143end
144put qmd 0 0
145put qmd 512 1
146if eq native_mcintent m bank qmd s seal 0
147ret 22
148end
149put qmd 512 0
150note Inactive bank tail/QMD gap are deliberately outside the seal.
151put bank 900 1
152put qmd 384 1
153if ne native_mcintent m bank qmd s seal 0
154ret 23
155end
156put bank 900 0
157put qmd 384 0
158note Exact PCAS to INLINE to PCAS reuse preserves seal, not unchecked modefields.
159test_qword edit qmd 40 1638400
160want = and shr add get m 11 512 8 4294967295
161test_qword edit qmd 48 want
162put s 4 1
163if ne native_mcintent m bank qmd s seal 0
164ret 24
165end
166put qmd 40 1
167if eq native_mcintent m bank qmd s seal 0
168ret 25
169end
170test_qword edit qmd 40 1638400
171put m 11 8448
172if eq native_mcintent m bank qmd s seal 0
173ret 26
174end
175put m 11 8192
176test_qword edit qmd 40 0
177test_qword edit qmd 48 0
178put s 4 0
179if ne native_mcintent m bank qmd s seal 0
180ret 27
181end
182put seal 0 xor get seal 0 1
183if eq native_mcintent m bank qmd s seal 0
184ret 28
185end
186if eq mcc_seal bank qmd 0 edit seal 0
187ret 29
188end
189for i ulong 32
190if ne get seal i 0
191ret 30
192end
193end
194ret 0
195end
196fn test_nwin n ulong to ulong
197ret div add n sub div ulong 128 9 1 div ulong 128 9
198end
199fn test_windows to long
200c = new ulong 16 0
201roles = new ulong 4096 8
202counts = new ulong 8 0
203owner = new ulong 4 0
204seq = new ulong 6 0
205put seq 1 2
206put seq 2 6
207put seq 3 3
208put seq 4 4
209put seq 5 7
210put c 0 1
211put c 1 159
212put c 2 6
213put c 3 128
214put c 4 test_nwin get c 3
215put c 5 64
216put c 9 77
217put c 10 16
218for i ulong 8
219put counts i get c 4
220end
221put counts 1 div add get c 3 63 64
222put counts 5 get c 3
223off = ulong 0
224for i ulong get counts 1
225put roles off 1
226off = add off 1
227end
228for w ulong get c 4
229for j ulong 6
230put roles off get seq j
231off = add off 1
232end
233end
234for i ulong get counts 5
235put roles off 5
236off = add off 1
237end
238put c 8 off
239put owner 0 off
240put owner 1 get c 9
241put owner 2 4096
242if ne mcc_cover c roles counts owner 0
243ret 15
244end
245put c 3 129
246if eq mcc_cover c roles counts owner 0
247ret 16
248end
249put c 3 128
250put roles sub off 1 8
251if eq mcc_cover c roles counts owner 0
252ret 17
253end
254ret 0
255end
256fn main to int
257r = test_cover
258if ne r 0
259ret int r
260end
261r = test_windows
262if ne r 0
263ret int r
264end
265ret int test_intent
266end