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 / learn53 / moe-observe-unit.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note HOST_ONLY SYNTHETIC; no device qualification or owner-snapshot authentication. |
| 3 | text mo_ok "MOE-OBSERVE HOST_ONLY PASS\n" |
| 4 | fn mo_launchtest to bool |
| 5 | m = new ulong 32 0 |
| 6 | s = new ulong 16 0 |
| 7 | bank = new uchar 1024 17 |
| 8 | qmd = new uchar 1024 34 |
| 9 | h = new uchar 32 0 |
| 10 | g = new uchar 32 0 |
| 11 | mo_launch edit m edit s |
| 12 | mo_qmd m edit qmd |
| 13 | if ne mc_launch m bank qmd s edit h 0 |
| 14 | ret false |
| 15 | end |
| 16 | for i ulong 32 |
| 17 | put m i xor get m i 1 |
| 18 | st = ulong mc_launch m bank qmd s edit g |
| 19 | if eq st 0 |
| 20 | if mo_equal h g |
| 21 | ret false |
| 22 | end |
| 23 | else |
| 24 | if not mo_zero g |
| 25 | ret false |
| 26 | end |
| 27 | end |
| 28 | put m i xor get m i 1 |
| 29 | end |
| 30 | for i ulong 16 |
| 31 | put s i xor get s i 1 |
| 32 | st = ulong mc_launch m bank qmd s edit g |
| 33 | if eq st 0 |
| 34 | if mo_equal h g |
| 35 | ret false |
| 36 | end |
| 37 | else |
| 38 | if not mo_zero g |
| 39 | ret false |
| 40 | end |
| 41 | end |
| 42 | put s i xor get s i 1 |
| 43 | end |
| 44 | for i ulong add 896 mul get m 4 4 |
| 45 | mo_flip edit bank i |
| 46 | if ne mc_launch m bank qmd s edit g 0 |
| 47 | ret false |
| 48 | end |
| 49 | if mo_equal h g |
| 50 | ret false |
| 51 | end |
| 52 | mo_flip edit bank i |
| 53 | end |
| 54 | for i ulong 1024 |
| 55 | mo_flip edit qmd i |
| 56 | st = ulong mc_launch m bank qmd s edit g |
| 57 | if or lt i 384 and ge i 512 lt i 896 |
| 58 | if eq st 0 |
| 59 | if mo_equal h g |
| 60 | ret false |
| 61 | end |
| 62 | else |
| 63 | if not mo_zero g |
| 64 | ret false |
| 65 | end |
| 66 | end |
| 67 | else |
| 68 | if or ne st 0 not mo_equal h g |
| 69 | ret false |
| 70 | end |
| 71 | end |
| 72 | mo_flip edit qmd i |
| 73 | end |
| 74 | note Padding outside the driver and active arguments is not consumed by this identity. |
| 75 | for i ulong 104 |
| 76 | st = add ulong 920 i |
| 77 | mo_flip edit bank st |
| 78 | if ne mc_launch m bank qmd s edit g 0 |
| 79 | ret false |
| 80 | end |
| 81 | if not mo_equal h g |
| 82 | ret false |
| 83 | end |
| 84 | mo_flip edit bank st |
| 85 | end |
| 86 | ret true |
| 87 | end |
| 88 | fn mo_dirtest to bool |
| 89 | m = new ulong 8 0 |
| 90 | r = new ulong 1024 0 |
| 91 | h = new uchar 32 0 |
| 92 | g = new uchar 32 0 |
| 93 | mo_dir edit m edit r |
| 94 | if ne mc_dir m r edit h 0 |
| 95 | ret false |
| 96 | end |
| 97 | for i ulong 8 |
| 98 | put m i xor get m i 1 |
| 99 | st = mc_dir m r edit g |
| 100 | if eq st 0 |
| 101 | if mo_equal h g |
| 102 | ret false |
| 103 | end |
| 104 | else |
| 105 | if not mo_zero g |
| 106 | ret false |
| 107 | end |
| 108 | end |
| 109 | put m i xor get m i 1 |
| 110 | end |
| 111 | for i ulong 1024 |
| 112 | put r i xor get r i 8 |
| 113 | st = mc_dir m r edit g |
| 114 | if lt i 514 |
| 115 | if or ne st 0 mo_equal h g |
| 116 | ret false |
| 117 | end |
| 118 | else |
| 119 | if or ne st 1 not mo_zero g |
| 120 | ret false |
| 121 | end |
| 122 | end |
| 123 | put r i xor get r i 8 |
| 124 | end |
| 125 | put r 513 0 |
| 126 | if or ne mc_dir m r edit g 3 not mo_zero g |
| 127 | ret false |
| 128 | end |
| 129 | ret true |
| 130 | end |
| 131 | fn mo_alloctest to bool |
| 132 | m = new ulong 8 0 |
| 133 | r = new ulong 1024 0 |
| 134 | h = new uchar 32 0 |
| 135 | g = new uchar 32 0 |
| 136 | mo_alloc edit m edit r |
| 137 | if ne mc_alloc m r edit h 0 |
| 138 | ret false |
| 139 | end |
| 140 | for i ulong 8 |
| 141 | put m i xor get m i 1 |
| 142 | st = mc_alloc m r edit g |
| 143 | if eq st 0 |
| 144 | if mo_equal h g |
| 145 | ret false |
| 146 | end |
| 147 | else |
| 148 | if not mo_zero g |
| 149 | ret false |
| 150 | end |
| 151 | end |
| 152 | put m i xor get m i 1 |
| 153 | end |
| 154 | for i ulong 1024 |
| 155 | put r i xor get r i 1 |
| 156 | st = mc_alloc m r edit g |
| 157 | if eq st 0 |
| 158 | if mo_equal h g |
| 159 | ret false |
| 160 | end |
| 161 | else |
| 162 | if not mo_zero g |
| 163 | ret false |
| 164 | end |
| 165 | end |
| 166 | put r i xor get r i 1 |
| 167 | end |
| 168 | note Same buffer index cannot simultaneously name conflicting generations or backing allocations. |
| 169 | put r 18 2 |
| 170 | if or ne mc_alloc m r edit g 3 not mo_zero g |
| 171 | ret false |
| 172 | end |
| 173 | put r 18 1 |
| 174 | put r 21 8192 |
| 175 | if or ne mc_alloc m r edit g 3 not mo_zero g |
| 176 | ret false |
| 177 | end |
| 178 | ret true |
| 179 | end |
| 180 | fn mo_codetest to bool |
| 181 | code = new uchar 16384 51 |
| 182 | h = new uchar 32 0 |
| 183 | g = new uchar 32 0 |
| 184 | if ne mc_code code 16 edit h 0 |
| 185 | ret false |
| 186 | end |
| 187 | for i ulong 16 |
| 188 | put code i xor get code i 1 |
| 189 | if or ne mc_code code 16 edit g 0 mo_equal h g |
| 190 | ret false |
| 191 | end |
| 192 | put code i xor get code i 1 |
| 193 | end |
| 194 | put code 16 0 |
| 195 | if or ne mc_code code 16 edit g 0 not mo_equal h g |
| 196 | ret false |
| 197 | end |
| 198 | if or ne mc_code code 0 edit g 1 not mo_zero g |
| 199 | ret false |
| 200 | end |
| 201 | if or ne mc_code code 17 edit g 1 not mo_zero g |
| 202 | ret false |
| 203 | end |
| 204 | if or ne mc_code code 16385 edit g 1 not mo_zero g |
| 205 | ret false |
| 206 | end |
| 207 | ret true |
| 208 | end |
| 209 | fn main to int |
| 210 | if not mo_launchtest |
| 211 | ret 31 |
| 212 | end |
| 213 | if not mo_dirtest |
| 214 | ret 32 |
| 215 | end |
| 216 | if not mo_alloctest |
| 217 | ret 33 |
| 218 | end |
| 219 | if not mo_codetest |
| 220 | ret 34 |
| 221 | end |
| 222 | wrote = write 1 mo_ok 0 len mo_ok |
| 223 | if ne wrote long len mo_ok |
| 224 | ret 74 |
| 225 | end |
| 226 | ret 0 |
| 227 | end |