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 / host-trace / recorder-test.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Host checks for native/trace/htrec.om. Synthetic events only; no device is opened. |
| 3 | note Prints one line per failed check and HOSTTRACE_RECORDER_PASS <checks> or _FAIL <failures>. |
| 4 | global tally ulong 2 |
| 5 | global digits uchar 32 |
| 6 | global back uchar 262144 |
| 7 | text passmsg "HOSTTRACE_RECORDER_PASS " |
| 8 | text failmsg "HOSTTRACE_RECORDER_FAIL " |
| 9 | text nlaunch "kernel.launch:VECTOR_1D" |
| 10 | text nspace "bad name" |
| 11 | text nlong "a123456789a123456789a123456789a123456789a123456789a123456789abcd" |
| 12 | fn number n ulong to void |
| 13 | if ge n 10 |
| 14 | number div n 10 |
| 15 | end |
| 16 | put digits 0 uchar add 48 rem n 10 |
| 17 | w = write 1 digits 0 1 |
| 18 | end |
| 19 | fn ck yes bool to void |
| 20 | put tally 0 add get tally 0 1 |
| 21 | if not yes |
| 22 | put tally 1 add get tally 1 1 |
| 23 | number get tally 0 |
| 24 | put digits 0 10 |
| 25 | w = write 1 digits 0 1 |
| 26 | end |
| 27 | end |
| 28 | fn regl id uint to bool |
| 29 | if not htnbeg id |
| 30 | ret false |
| 31 | end |
| 32 | for i ulong len nlaunch |
| 33 | b = htnbyte get nlaunch i |
| 34 | end |
| 35 | ret htnend |
| 36 | end |
| 37 | fn regsp id uint to bool |
| 38 | if not htnbeg id |
| 39 | ret false |
| 40 | end |
| 41 | for i ulong len nspace |
| 42 | b = htnbyte get nspace i |
| 43 | end |
| 44 | ret htnend |
| 45 | end |
| 46 | fn reglong id uint to bool |
| 47 | if not htnbeg id |
| 48 | ret false |
| 49 | end |
| 50 | for i ulong len nlong |
| 51 | b = htnbyte get nlong i |
| 52 | end |
| 53 | ret htnend |
| 54 | end |
| 55 | fn rd at ulong k ulong to ulong |
| 56 | v = ulong 0 |
| 57 | for i ulong k |
| 58 | v = or v shl ulong get back add at i mul i 8 |
| 59 | end |
| 60 | ret v |
| 61 | end |
| 62 | fn offchecks to void |
| 63 | ck not htlive |
| 64 | ck eq htbeg 4 1 0 |
| 65 | ck not htmark 2 1 0 0 0 |
| 66 | ck eq get htst 1 0 |
| 67 | ck eq get htst 3 0 |
| 68 | end |
| 69 | fn namechecks to void |
| 70 | ck regl 1 |
| 71 | ck not regl 1 |
| 72 | ck not regl 0 |
| 73 | ck not regsp 2 |
| 74 | ck not reglong 3 |
| 75 | ck not htnbyte 65 |
| 76 | ck htnbeg 4 |
| 77 | ck not htnend |
| 78 | ck eq get htst 6 1 |
| 79 | ck eq get htst 3 6 |
| 80 | ck htnbeg 5 |
| 81 | ck not htnbeg 6 |
| 82 | ck eq get htst 3 7 |
| 83 | end |
| 84 | fn spanchecks to void |
| 85 | ck htinit |
| 86 | ck htlive |
| 87 | s = htbeg 4 1 |
| 88 | ck eq s 1 |
| 89 | ck eq get htst 7 1 |
| 90 | ck htend s 1024 43 0 |
| 91 | ck eq get htst 7 0 |
| 92 | ck not htend s 1 1 1 |
| 93 | ck not htend 99 1 1 1 |
| 94 | ck eq htbeg 2 1 0 |
| 95 | ck not htmark 4 1 0 0 0 |
| 96 | ck eq htbeg 0 1 0 |
| 97 | ck eq htbeg 12 1 0 |
| 98 | ck eq htbeg 4 77 0 |
| 99 | ck not htmark 8 77 3 0 0 |
| 100 | ck eq get htst 3 8 |
| 101 | ck htmark 8 1 3 12 -22 |
| 102 | ck eq get htst 1 2 |
| 103 | ck eq get htkind 1 8 |
| 104 | ck eq get hta0 1 3 |
| 105 | ck eq get htrc 1 -22 |
| 106 | end |
| 107 | fn dumpchecks to void |
| 108 | fd = memfd nlaunch 0 len nlaunch 1 |
| 109 | ck ge fd 0 |
| 110 | r = htdump int fd |
| 111 | ck eq ulong r htbytes |
| 112 | ck eq r 189 |
| 113 | p = fseek int fd 0 0 |
| 114 | k = read int fd back 0 len back |
| 115 | ck eq k r |
| 116 | ck eq rd 0 4 827479119 |
| 117 | ck eq rd 4 2 1 |
| 118 | ck eq rd 6 2 48 |
| 119 | ck eq rd 8 4 2 |
| 120 | ck eq rd 16 4 8 |
| 121 | ck eq rd 20 4 1 |
| 122 | ck eq rd 44 4 1 |
| 123 | ck eq rd 64 2 4 |
| 124 | ck eq rd 66 2 1 |
| 125 | ck eq rd 68 4 1 |
| 126 | ck ge rd 80 8 rd 72 8 |
| 127 | ck eq rd 88 8 1024 |
| 128 | ck eq rd 96 8 43 |
| 129 | ck eq rd 112 2 8 |
| 130 | ck eq rd 152 8 18446744073709551594 |
| 131 | ck eq rd 160 4 1 |
| 132 | ck eq rd 164 2 len nlaunch |
| 133 | ck eq rd 166 1 107 |
| 134 | c = fclose int fd |
| 135 | end |
| 136 | fn capchecks to void |
| 137 | n = get htst 1 |
| 138 | for i ulong sub HTCAP n |
| 139 | b = htmark 10 1 i 0 0 |
| 140 | end |
| 141 | ck eq get htst 1 HTCAP |
| 142 | ck eq get htst 2 0 |
| 143 | ck not htmark 10 1 0 0 0 |
| 144 | ck eq htbeg 9 1 0 |
| 145 | ck eq get htst 2 2 |
| 146 | htstop |
| 147 | ck not htlive |
| 148 | ck eq htbeg 9 1 0 |
| 149 | ck eq get htst 2 2 |
| 150 | end |
| 151 | fn main to int |
| 152 | offchecks |
| 153 | namechecks |
| 154 | spanchecks |
| 155 | dumpchecks |
| 156 | capchecks |
| 157 | if ne get tally 1 0 |
| 158 | w = write 1 failmsg 0 len failmsg |
| 159 | number get tally 1 |
| 160 | put digits 0 10 |
| 161 | w = write 1 digits 0 1 |
| 162 | ret 1 |
| 163 | end |
| 164 | w = write 1 passmsg 0 len passmsg |
| 165 | number get tally 0 |
| 166 | put digits 0 10 |
| 167 | w = write 1 digits 0 1 |
| 168 | ret 0 |
| 169 | end |