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 / components / record-unit.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Verification entry: stdin is independent original-C staged frame; argv is K LB MT W rowmap. |
| 3 | note Conductor compares complete native/C frames and disassembles all code before this test. |
| 4 | text RUOk "PASS staged canonical/launch/cfg/out8 controls and independent C statistics\n" |
| 5 | fn ru_word h view uchar 56 k ulong to ulong |
| 6 | v = ulong 0 |
| 7 | for j ulong 8 |
| 8 | v = or v shl ulong get h add mul k 8 j mul j 8 |
| 9 | end |
| 10 | ret v |
| 11 | end |
| 12 | fn ru_arg k ulong to ulong |
| 13 | a = new uchar 8 0 |
| 14 | n = argread k a 0 8 |
| 15 | if or le n 0 gt n 5 |
| 16 | ret 0 |
| 17 | end |
| 18 | v = ulong 0 |
| 19 | for j ulong ulong n |
| 20 | c = get a j |
| 21 | if or lt c 48 gt c 57 |
| 22 | ret 0 |
| 23 | end |
| 24 | v = add mul v 10 sub ulong c 48 |
| 25 | end |
| 26 | if gt v 16384 |
| 27 | ret 0 |
| 28 | end |
| 29 | ret v |
| 30 | end |
| 31 | fn ru_bad b edit uchar 4096 field ulong value ulong to bool |
| 32 | old = compose_word b field |
| 33 | compose_put b field value |
| 34 | rc = compose_check b 1152 |
| 35 | compose_put b field old |
| 36 | ret ne rc 0 |
| 37 | end |
| 38 | fn ru_input cfg edit ulong 16 out edit ulong 8 to int |
| 39 | h = new uchar 56 0 |
| 40 | pos = ulong 0 |
| 41 | while lt pos 56 bound 56 |
| 42 | n = read 0 h pos sub ulong 56 pos |
| 43 | if le n 0 |
| 44 | ret 11 |
| 45 | end |
| 46 | pos = add pos ulong n |
| 47 | end |
| 48 | if ne ru_word h 0 0 |
| 49 | ret 12 |
| 50 | end |
| 51 | put cfg 0 3 |
| 52 | for j ulong 5 |
| 53 | put cfg add j 1 ru_arg add j 1 |
| 54 | end |
| 55 | put out 0 ru_word h 1 |
| 56 | put out 1 ru_word h 5 |
| 57 | put out 2 ru_word h 6 |
| 58 | put out 3 ru_word h 4 |
| 59 | put out 4 ru_word h 2 |
| 60 | put out 5 ru_word h 3 |
| 61 | ret 0 |
| 62 | end |
| 63 | fn ru_build cfg view ulong 16 b edit uchar 4096 l edit ulong 32 out edit ulong 8 to int |
| 64 | ins = new ulong 8192 0 |
| 65 | meta = new ulong 2048 0 |
| 66 | phys = new ulong 288 0 |
| 67 | fresh = new ulong 8 0 |
| 68 | if ne bc_compose cfg ins meta phys fresh 0 |
| 69 | ret 13 |
| 70 | end |
| 71 | for j ulong 8 |
| 72 | if ne get fresh j get out j |
| 73 | ret 14 |
| 74 | end |
| 75 | put out j get fresh j |
| 76 | end |
| 77 | ret ru_fill cfg b l out |
| 78 | end |
| 79 | fn ru_fill cfg view ulong 16 b edit uchar 4096 l edit ulong 32 out view ulong 8 to int |
| 80 | if ne compose_fixture b l 0 |
| 81 | ret 17 |
| 82 | end |
| 83 | compose_put b 4 64 |
| 84 | compose_put b 6 get cfg 1 |
| 85 | compose_put b 14 get cfg 3 |
| 86 | compose_put b 16 mul get cfg 2 32 |
| 87 | compose_put b 17 get cfg 4 |
| 88 | ks = div get cfg 1 mul get cfg 2 32 |
| 89 | u = ks |
| 90 | if eq rem ks 2 0 |
| 91 | u = 2 |
| 92 | end |
| 93 | compose_put b 18 u |
| 94 | compose_put b 19 3 |
| 95 | compose_put b 21 get out 3 |
| 96 | note Exact original-C omega_bw_gpr_declared expression, not a new launch policy. |
| 97 | decl = add get out 1 2 |
| 98 | decl = add decl 7 |
| 99 | decl = div decl 8 |
| 100 | decl = mul decl 8 |
| 101 | compose_put b 22 decl |
| 102 | compose_put b 25 mul get cfg 4 32 |
| 103 | put l 4 mul get cfg 4 32 |
| 104 | put l 7 get out 3 |
| 105 | put l 8 decl |
| 106 | put l 12 add ulong 8 mul get cfg 5 4 |
| 107 | ret 0 |
| 108 | end |
| 109 | fn ru_checks cfg edit ulong 16 b edit uchar 4096 l edit ulong 32 out edit ulong 8 to int |
| 110 | if ne bc_record cfg b l out 0 |
| 111 | ret 18 |
| 112 | end |
| 113 | decl = compose_word b 22 |
| 114 | peak = get out 1 |
| 115 | u = compose_word b 18 |
| 116 | note A removed +2 guard must be caught even when declaration remains eight-aligned. |
| 117 | put out 1 sub decl 1 |
| 118 | if eq bc_record cfg b l out 0 |
| 119 | ret 70 |
| 120 | end |
| 121 | put out 1 peak |
| 122 | if not ru_bad b 14 3 |
| 123 | ret 20 |
| 124 | end |
| 125 | if not ru_bad b 15 2 |
| 126 | ret 21 |
| 127 | end |
| 128 | if not ru_bad b 16 128 |
| 129 | ret 22 |
| 130 | end |
| 131 | if not ru_bad b 17 3 |
| 132 | ret 23 |
| 133 | end |
| 134 | if not ru_bad b 18 add u 1 |
| 135 | ret 24 |
| 136 | end |
| 137 | if not ru_bad b 21 sub get out 3 128 |
| 138 | ret 25 |
| 139 | end |
| 140 | if not ru_bad b 22 add decl 1 |
| 141 | ret 26 |
| 142 | end |
| 143 | if not ru_bad b 23 7 |
| 144 | ret 27 |
| 145 | end |
| 146 | if not ru_bad b 24 0 |
| 147 | ret 28 |
| 148 | end |
| 149 | if not ru_bad b 28 2 |
| 150 | ret 29 |
| 151 | end |
| 152 | put l 11 904 |
| 153 | if eq compose_launch b l 0 |
| 154 | ret 30 |
| 155 | end |
| 156 | put l 11 896 |
| 157 | put l 12 10 |
| 158 | if eq compose_launch b l 0 |
| 159 | ret 31 |
| 160 | end |
| 161 | put l 12 add ulong 8 mul get cfg 5 4 |
| 162 | put cfg 5 sub ulong 1 get cfg 5 |
| 163 | if eq bc_record cfg b l out 0 |
| 164 | ret 32 |
| 165 | end |
| 166 | put cfg 5 sub ulong 1 get cfg 5 |
| 167 | put cfg 6 1 |
| 168 | if eq bc_record cfg b l out 0 |
| 169 | ret 33 |
| 170 | end |
| 171 | put cfg 6 0 |
| 172 | put out 6 1 |
| 173 | if eq bc_record cfg b l out 0 |
| 174 | ret 34 |
| 175 | end |
| 176 | put out 6 0 |
| 177 | if lt get out 3 16384 |
| 178 | compose_put b 21 add get out 3 128 |
| 179 | put l 7 add get out 3 128 |
| 180 | if ne bc_record cfg b l out 0 |
| 181 | ret 35 |
| 182 | end |
| 183 | compose_put b 21 get out 3 |
| 184 | put l 7 get out 3 |
| 185 | end |
| 186 | if le mul get l 4 add decl 8 65536 |
| 187 | compose_put b 22 add decl 8 |
| 188 | put l 8 add decl 8 |
| 189 | if ne bc_record cfg b l out 0 |
| 190 | ret 36 |
| 191 | end |
| 192 | end |
| 193 | ret 0 |
| 194 | end |
| 195 | fn main to int |
| 196 | if ne argcnt 6 |
| 197 | ret 10 |
| 198 | end |
| 199 | cfg = new ulong 16 0 |
| 200 | b = new uchar 4096 0 |
| 201 | l = new ulong 32 0 |
| 202 | out = new ulong 8 0 |
| 203 | rc = ru_input cfg out |
| 204 | if ne rc 0 |
| 205 | ret rc |
| 206 | end |
| 207 | rc = ru_build cfg b l out |
| 208 | if ne rc 0 |
| 209 | ret rc |
| 210 | end |
| 211 | rc = ru_checks cfg b l out |
| 212 | if ne rc 0 |
| 213 | ret rc |
| 214 | end |
| 215 | z = write 1 RUOk 0 len RUOk |
| 216 | ret 0 |
| 217 | end |