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 / tilelab_host_fault.om

223 lines · 4495 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Concatenate after tools/tilelab_process.om. Args: HOST_FAULT_DRIVER REPLAY NEW_SCRATCH_DIR
3note All GEMMs are CPU fault injection in an explicitly separate compile-time driver build.
4text ttwords "--shapes\n2,2,2\n--rounds\n1\n--out\n--fault\nmutant_error\nwarm_error\ntimed_error\nmutant_good\n--host-only\n--cfg\nbad\"name\\arm\t:2,4,2,4,8\n\"red_mutants_caught\":3\n\"arm\":\"bad\\\"name\\\\arm\\u0009\"\n\"fails\":0\n/dev/full\n/bin/false\n/nonexistent/tilelab-driver\nx:2,4,2,4,8\n\"red_mutants_caught\":0\n\"cells\":[]\n\"arm\"\ncafé € 😀:2,4,2,4,8\n\"arm\":\"café € 😀\"\n"
5text ttsuffix "/receipt.json"
6text ttshape "2,2,2"
7text ttbad "garbage"
8text ttpass "TILELAB_HOST_FAULT PASS (synthetic CPU only; GPU NOT_RUN)\n"
9global tf uchar 65536
10global tfn ulong 1
11fn tt_check good bool to void
12if not good
13exit 1
14end
15end
16fn tt_addword idx ulong to void
17tl_word idx
18tl_add
19end
20fn tt_path to void
21tl_arg 3
22n = get tn 0
23tt_check le add n len ttsuffix 4095
24for i ulong len ttsuffix
25put tb add n i get ttsuffix i
26end
27put tn 0 add n len ttsuffix
28end
29fn tt_base to void
30tl_clear
31tl_arg 1
32tl_add
33tt_addword 0
34tt_addword 1
35tt_addword 2
36tt_addword 3
37end
38fn tt_out to void
39tt_addword 4
40tt_path
41tl_add
42end
43fn tt_read to void
44fd = fopen tb 0 get tn 0 0 0
45tt_check ge fd 0
46n = ulong 0
47while lt n len tf bound 65536
48r = read int fd tf n sub len tf n
49tt_check ge r 0
50if eq r 0
51break
52end
53n = add n ulong r
54end
55tt_check lt n len tf
56put tfn 0 n
57tt_check eq fclose int fd 0
58end
59fn tt_match p ulong n ulong to bool
60for i ulong n
61if ne get tf add p i get tb i
62ret false
63end
64end
65ret true
66end
67fn tt_count word ulong to ulong
68tl_word word
69count = ulong 0
70n = get tn 0
71if gt n get tfn 0
72ret 0
73end
74for p ulong add sub get tfn 0 n 1
75if tt_match p n
76count = add count 1
77end
78end
79ret count
80end
81fn tt_receipt to void
82tt_path
83tt_read
84end
85fn tt_fault word ulong want int to void
86tt_base
87tt_out
88tt_addword 5
89tt_addword word
90tt_check eq tl_run want
91tt_receipt
92end
93fn tt_shapes count ulong bad bool to void
94tl_clear
95tl_arg 1
96tl_add
97tt_addword 10
98tt_addword 0
99p = ulong 0
100for i ulong count
101if ne i 0
102put tb p 59
103p = add p 1
104end
105for j ulong len ttshape
106put tb p get ttshape j
107p = add p 1
108end
109end
110if bad
111put tb p 59
112p = add p 1
113for i ulong len ttbad
114put tb p get ttbad i
115p = add p 1
116end
117end
118put tn 0 p
119tl_add
120end
121fn tt_replay driver ulong count ulong want int to void
122tl_clear
123tl_arg 2
124tl_add
125if eq driver 0
126tl_arg 1
127else
128tl_word driver
129end
130tl_add
131tt_path
132tl_add
133tt_addword 1
134tt_addword 3
135for i ulong count
136tt_addword 19
137end
138tt_check eq tl_run want
139end
140fn tt_chunk digit uchar arms ulong to void
141tt_path
142p = get tn 0
143put tb p 46
144put tb add p 1 digit
145put tb add p 2 46
146put tb add p 3 106
147put tb add p 4 115
148put tb add p 5 111
149put tb add p 6 110
150put tn 0 add p 7
151tt_read
152tt_check eq tt_count 22 arms
153tt_check eq tt_count 15 1
154end
155fn tt_invalid to void
156tt_base
157tt_addword 11
158tl_word 19
159note A standalone non-UTF8 byte in an otherwise valid configuration must be refused.
160put tb 0 255
161tl_add
162tt_check eq tl_run 2
163end
164fn main to int
165tt_check eq argcnt 4
166for i ulong len ttwords
167put tw i get ttwords i
168end
169tl_arg 3
170tt_check eq makedir tb 0 get tn 0 448 0
171tt_shapes 16 false
172tt_check eq tl_run 0
173tt_shapes 17 false
174tt_check eq tl_run 2
175tt_shapes 16 true
176tt_check eq tl_run 2
177tt_shapes 0 true
178tt_check eq tl_run 2
179note Baseline successful synthetic executions must catch real wrong-result mutants.
180tt_base
181tt_out
182tt_addword 11
183tt_addword 12
184tt_check eq tl_run 0
185tt_receipt
186tt_check eq tt_count 13 1
187tt_check eq tt_count 14 1
188tt_check eq tt_count 15 1
189note Multibyte identifiers preserve their UTF8 bytes, unlike bytewise Unicode escaping.
190tt_base
191tt_out
192tt_addword 11
193tt_addword 23
194tt_check eq tl_run 0
195tt_receipt
196tt_check eq tt_count 24 1
197tt_invalid
198note Runtime errors are not oracle catches. Failed warmup/timed work has no successful cell.
199tt_fault 6 1
200tt_check eq tt_count 20 1
201tt_fault 7 1
202tt_check eq tt_count 21 1
203tt_fault 8 1
204tt_check eq tt_count 21 1
205note Negative control: successfully executed mutants with correct results must fail.
206tt_fault 9 1
207tt_check eq tt_count 20 1
208note Opening succeeds but buffered receipt writes fail.
209tt_base
210tt_addword 4
211tt_addword 16
212tt_check eq tl_run 2
213note Replay propagates child failure and exec failure, and chunks 31 cfgs across three children.
214tt_replay 17 0 1
215tt_replay 18 0 127
216tt_replay 0 31 0
217tt_chunk 48 16
218tt_chunk 49 16
219tt_chunk 50 2
220r = write 1 ttpass 0 len ttpass
221tt_check eq r long len ttpass
222ret 0
223end