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