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 / learn53 / moe-unit.om

294 lines · 5557 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note HOST_ONLY synthetic controls; this does not execute a GPU/evaluator/candidate.
3text mf_ok "MOE-CLOSURE HOST_ONLY PASS\n"
4fn mf_zero h view uchar 32 to bool
5for i ulong 32
6if ne get h i 0
7ret false
8end
9end
10ret true
11end
12fn mf_copy a view uchar 16384 b edit uchar 16384 to void
13for i ulong 16384
14put b i get a i
15end
16end
17fn mf_mutant a view uchar 16384 b edit uchar 16384 h edit uchar 32 pos ulong to bool
18mf_copy a edit b
19put b pos xor get b pos 1
20s = mc_bind a b 11264 edit h
21if eq s 0
22ret false
23end
24ret mf_zero h
25end
26fn mf_scalars a view uchar 16384 b edit uchar 16384 h edit uchar 32 to bool
27note Every scalar, semantic/order field, address, extent, stride, generation and length.
28for i ulong 128
29if not mf_mutant a edit b edit h mul i 8
30ret false
31end
32end
33ret true
34end
35fn mf_digests a view uchar 16384 b edit uchar 16384 h edit uchar 32 to bool
36note All64 roles: GU/DN pairing, code/launch/manifest/ABI/QMD/quant, source/context.
37for i ulong 64
38if not mf_mutant a edit b edit h add 1024 mul i 32
39ret false
40end
41end
42ret true
43end
44fn mf_table a view uchar 16384 b edit uchar 16384 h edit uchar 32 to bool
45note All table cells, including unused rows, plus capacity tail canonicality.
46for i ulong 1024
47if not mf_mutant a edit b edit h add 3072 mul i 8
48ret false
49end
50end
51ret mf_mutant a edit b edit h 16383
52end
53fn mf_contexts a view uchar 16384 to bool
54q = new ulong 64 0
55row = new ulong 64 0
56mf_context a edit q edit row
57if ne mc_context a q row 0 0
58ret false
59end
60for i ulong 24
61v = get q add 14 i
62put q add 14 i xor v 1
63if ne mc_context a q row 0 5
64ret false
65end
66put q add 14 i v
67v = get row add 33 i
68put row add 33 i xor v 1
69if ne mc_context a q row 0 5
70ret false
71end
72put row add 33 i v
73end
74for i ulong 4
75v = get q add i 3
76put q add i 3 xor v 1
77if ne mc_context a q row 0 5
78ret false
79end
80put q add i 3 v
81end
82note A DN row cannot consume the GU half, even with matching joint subject.
83if ne mc_context a q row 1 5
84ret false
85end
86for i ulong 8
87v = mc_limb a add 53 div i 4 rem i 4
88put q add 30 i v
89put row add 49 i v
90end
91for i ulong 4
92put row add 21 i mc_limb a 30 i
93put row add 25 i mc_limb a 32 i
94put row add 57 i mc_limb a 31 i
95end
96if ne mc_context a q row 1 0
97ret false
98end
99note Distinct paired artifacts cannot be interchanged after the role is fixed.
100put row 21 mc_limb a 22 0
101if ne mc_context a q row 1 5
102ret false
103end
104ret true
105end
106fn mf_custody a view uchar 16384 h view uchar 32 to bool
107ctx = new ulong 32 0
108got = new ulong 32 0
109mf_cust a h edit ctx
110for i ulong 32
111put got i get ctx i
112end
113if ne mc_custody a h ctx got 0
114ret false
115end
116for i ulong 32
117v = get got i
118put got i xor v 1
119if ne mc_custody a h ctx got 5
120ret false
121end
122put got i v
123end
124note Even mutually matching synthetic inputs cannot request device evidence class.
125put ctx 1 2
126put got 1 2
127if ne mc_custody a h ctx got 5
128ret false
129end
130ret true
131end
132fn mf_pack a view uchar 16384 b edit uchar 16384 to bool
133s = new ulong 128 0
134h = new uchar 2048 0
135w = new ulong 1024 0
136for i ulong 128
137put s i mc_word a i
138end
139for i ulong 2048
140put h i get a add 1024 i
141end
142for i ulong 1024
143put w i mc_word a add 384 i
144end
145if ne mc_pack s h w edit b 0
146ret false
147end
148for i ulong 16384
149if ne get a i get b i
150ret false
151end
152end
153put s 13 8
154if ne mc_pack s h w edit b 2
155ret false
156end
157for i ulong 16384
158if ne get b i 0
159ret false
160end
161end
162ret true
163end
164fn mf_boundroot a view uchar 16384 to bool
165b = new uchar 16384 0
166q = new ulong 64 0
167row = new ulong 64 0
168h = new uchar 32 0
169mf_copy a edit b
170mf_context a edit q edit row
171if ne mc_bindctx a b q row 0 edit h 0
172ret false
173end
174if mf_zero h
175ret false
176end
177put row 21 xor get row 21 1
178if ne mc_bindctx a b q row 0 edit h 5
179ret false
180end
181ret mf_zero h
182end
183fn mf_payload a view uchar 16384 to bool
184c = new uchar 4096 0
185code = new uchar 16384 0
186l = new uchar 256 0
187if ne mc_blob a c code 16 l 2 1
188ret false
189end
190compose_put edit c 19 3
191note Correct role cannot bypass the existing canonical family3 admission refusal.
192if ne mc_blob a c code 16 l 0 6
193ret false
194end
195if ne mc_blob a c code 16 l 1 6
196ret false
197end
198ret true
199end
200fn main to int
201a = new uchar 16384 0
202b = new uchar 16384 0
203h = new uchar 32 0
204mf_fill edit a
205if ne mc_valid a 11264 0
206ret 10
207end
208if not mf_boundroot a
209ret 23
210end
211if not mf_payload a
212ret 24
213end
214mf_copy a edit b
215if ne mc_bind a b 11264 edit h 0
216ret 11
217end
218if mf_zero h
219ret 12
220end
221if not mf_custody a h
222ret 13
223end
224if not mf_contexts a
225ret 14
226end
227if not mf_scalars a edit b edit h
228ret 15
229end
230if not mf_digests a edit b edit h
231ret 16
232end
233if not mf_table a edit b edit h
234ret 17
235end
236if not mf_pack a edit b
237ret 18
238end
239note Version1 direct-leaf wires are never accepted by the Version2 consumer.
240mc_put edit a 0 1
241mf_copy a edit b
242put h 0 255
243if ne mc_bind a b 11264 edit h 1
244ret 27
245end
246if not mf_zero h
247ret 28
248end
249mf_fill edit a
250note Equally malformed expected+observed must refuse, not compare equal and succeed.
251mc_put edit a 13 8
252mf_copy a edit b
253if ne mc_bind a b 11264 edit h 2
254ret 19
255end
256if not mf_zero h
257ret 20
258end
259mf_fill edit a
260mf_copy a edit b
261if ne mc_bind a b 11263 edit h 1
262ret 21
263end
264if not mf_zero h
265ret 22
266end
267mf_fifteen edit a
268if ne mc_valid a 11264 0
269ret 25
270end
271if not mf_boundroot a
272ret 26
273end
274if not mf_table a edit b edit h
275ret 27
276end
277note Explicit ordered table reorder, duplicate and global-map base shift controls.
278mf_copy a edit b
279mc_put edit b 384 14
280mc_put edit b 392 0
281if ne mc_bind a b 11264 edit h 2
282ret 28
283end
284mf_copy a edit b
285mc_put edit b 112 2
286if ne mc_bind a b 11264 edit h 2
287ret 29
288end
289wrote = write 1 mf_ok 0 len mf_ok
290if ne wrote long len mf_ok
291ret 74
292end
293ret 0
294end