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 / native / speculation / report.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note One homogeneous held-out fixture/context/cold-or-warm group per report. |
| 3 | note All attempts retained, invalid attempts poison the group; never retry until green. |
| 4 | global pconfig ulong 5 |
| 5 | global pbind ulong 39 |
| 6 | global parmids ulong 128 |
| 7 | global pinned ulong 128 |
| 8 | global pobs ulong 56 |
| 9 | global praw ulong 14336 |
| 10 | global pslots ulong 128 |
| 11 | global pstate ulong 4 |
| 12 | global ratios ulong 32 |
| 13 | global times ulong 32 |
| 14 | global firsts ulong 32 |
| 15 | global summary ulong 12 |
| 16 | fn pstart n ulong to int |
| 17 | put pstate 3 0 |
| 18 | if lt n 5 |
| 19 | ret 65 |
| 20 | end |
| 21 | if gt n 32 |
| 22 | ret 65 |
| 23 | end |
| 24 | if ne get pconfig 0 1024 |
| 25 | if ne get pconfig 0 32768 |
| 26 | ret 77 |
| 27 | end |
| 28 | end |
| 29 | if gt get pconfig 1 1 |
| 30 | ret 65 |
| 31 | end |
| 32 | if eq get pconfig 2 0 |
| 33 | ret 65 |
| 34 | end |
| 35 | if eq get pconfig 3 0 |
| 36 | ret 65 |
| 37 | end |
| 38 | if gt get pconfig 3 256 |
| 39 | ret 65 |
| 40 | end |
| 41 | if gt get pconfig 4 1 |
| 42 | ret 65 |
| 43 | end |
| 44 | v = svalid |
| 45 | if ne v 0 |
| 46 | ret v |
| 47 | end |
| 48 | v = pids |
| 49 | if ne v 0 |
| 50 | ret v |
| 51 | end |
| 52 | if eq get pconfig 4 1 |
| 53 | if ne get sprofile 4 2 |
| 54 | ret 69 |
| 55 | end |
| 56 | end |
| 57 | for i ulong 32 |
| 58 | put pbind i get sid i |
| 59 | end |
| 60 | put pbind 32 get sprofile 1 |
| 61 | put pbind 33 get sprofile 4 |
| 62 | for i ulong 5 |
| 63 | put pbind add i 34 get pconfig i |
| 64 | end |
| 65 | for i ulong 128 |
| 66 | put pinned i get parmids i |
| 67 | end |
| 68 | for i ulong 128 |
| 69 | put pslots i 0 |
| 70 | end |
| 71 | for i ulong 4 |
| 72 | put pstate i 0 |
| 73 | end |
| 74 | put pstate 3 n |
| 75 | ret 0 |
| 76 | end |
| 77 | fn pids to int |
| 78 | note Same model/tokenizer/numerics/protocol in all arms. Base build may differ. |
| 79 | for a ulong 4 |
| 80 | note A different base build still needs an identity; unused components bind a named absent identity. |
| 81 | for d ulong 8 |
| 82 | nonzero = ulong 0 |
| 83 | for j ulong 4 |
| 84 | nonzero = or nonzero get parmids add add mul a 32 mul d 4 j |
| 85 | end |
| 86 | if eq nonzero 0 |
| 87 | ret 69 |
| 88 | end |
| 89 | end |
| 90 | for i ulong 32 |
| 91 | required = false |
| 92 | if lt i 12 |
| 93 | required = true |
| 94 | end |
| 95 | if ge i 28 |
| 96 | required = true |
| 97 | end |
| 98 | if gt a 0 |
| 99 | if lt i 20 |
| 100 | required = true |
| 101 | end |
| 102 | end |
| 103 | if ge a 2 |
| 104 | required = true |
| 105 | end |
| 106 | if required |
| 107 | if ne get parmids add mul a 32 i get sid i |
| 108 | ret 69 |
| 109 | end |
| 110 | end |
| 111 | end |
| 112 | end |
| 113 | ret 0 |
| 114 | end |
| 115 | fn pvalid to int |
| 116 | if eq get pstate 3 0 |
| 117 | ret 75 |
| 118 | end |
| 119 | for i ulong 5 |
| 120 | if ne get pbind add i 34 get pconfig i |
| 121 | ret 69 |
| 122 | end |
| 123 | end |
| 124 | for i ulong 32 |
| 125 | if ne get pbind i get sid i |
| 126 | ret 69 |
| 127 | end |
| 128 | if ne get sid i get sid add i 32 |
| 129 | ret 69 |
| 130 | end |
| 131 | end |
| 132 | if ne get pbind 32 get sprofile 1 |
| 133 | ret 69 |
| 134 | end |
| 135 | if ne get pbind 33 get sprofile 4 |
| 136 | ret 69 |
| 137 | end |
| 138 | ord = get pstate 0 |
| 139 | if ge ord mul get pstate 3 4 |
| 140 | ret 65 |
| 141 | end |
| 142 | if ne get pobs 22 ord |
| 143 | ret 65 |
| 144 | end |
| 145 | pair = div ord 4 |
| 146 | if ne get pobs 0 pair |
| 147 | ret 65 |
| 148 | end |
| 149 | if ne get pobs 1 rem add ord pair 4 |
| 150 | ret 65 |
| 151 | end |
| 152 | for i ulong 32 |
| 153 | expected = get pinned add mul get pobs 1 32 i |
| 154 | if ne get pobs add i 24 expected |
| 155 | ret 69 |
| 156 | end |
| 157 | end |
| 158 | if ne get pobs 2 get pconfig 2 |
| 159 | ret 69 |
| 160 | end |
| 161 | if ne get pobs 23 get pconfig 0 |
| 162 | ret 69 |
| 163 | end |
| 164 | if ne get pobs 20 get pbind 32 |
| 165 | ret 69 |
| 166 | end |
| 167 | if ne get pobs 21 get pconfig 1 |
| 168 | ret 69 |
| 169 | end |
| 170 | for d ulong 2 |
| 171 | v = ulong 0 |
| 172 | for j ulong 4 |
| 173 | v = or v get pobs add add 3 mul d 4 j |
| 174 | end |
| 175 | if eq v 0 |
| 176 | ret 69 |
| 177 | end |
| 178 | end |
| 179 | if eq get pobs 11 0 |
| 180 | ret 65 |
| 181 | end |
| 182 | if gt get pobs 11 256 |
| 183 | ret 65 |
| 184 | end |
| 185 | if lt get pobs 13 get pobs 12 |
| 186 | ret 65 |
| 187 | end |
| 188 | if lt get pobs 14 get pobs 13 |
| 189 | ret 65 |
| 190 | end |
| 191 | elapsed = sub get pobs 14 get pobs 12 |
| 192 | if eq elapsed 0 |
| 193 | ret 65 |
| 194 | end |
| 195 | if gt elapsed 1000000000 |
| 196 | ret 65 |
| 197 | end |
| 198 | if eq get pobs 15 0 |
| 199 | ret 65 |
| 200 | end |
| 201 | if lt get pobs 16 1 |
| 202 | ret 65 |
| 203 | end |
| 204 | if gt get pobs 16 2 |
| 205 | ret 65 |
| 206 | end |
| 207 | if eq get pobs 16 2 |
| 208 | if ne get pobs 11 256 |
| 209 | ret 65 |
| 210 | end |
| 211 | end |
| 212 | if ne get pobs 17 1 |
| 213 | ret 69 |
| 214 | end |
| 215 | if ne get pobs 18 1 |
| 216 | ret 75 |
| 217 | end |
| 218 | if ne get pobs 19 0 |
| 219 | ret 75 |
| 220 | end |
| 221 | ret 0 |
| 222 | end |
| 223 | fn padd to int |
| 224 | n = get pstate 0 |
| 225 | if ge n 256 |
| 226 | ret 77 |
| 227 | end |
| 228 | status = pvalid |
| 229 | for i ulong 56 |
| 230 | put praw add mul n 56 i get pobs i |
| 231 | end |
| 232 | put pstate 0 add n 1 |
| 233 | if ne status 0 |
| 234 | put pstate 1 add get pstate 1 1 |
| 235 | ret status |
| 236 | end |
| 237 | slot = add mul get pobs 0 4 get pobs 1 |
| 238 | if ne get pslots slot 0 |
| 239 | put pstate 1 add get pstate 1 1 |
| 240 | ret 65 |
| 241 | end |
| 242 | put pslots slot add n 1 |
| 243 | if lt get pobs 11 get pconfig 3 |
| 244 | put pstate 2 1 |
| 245 | end |
| 246 | ret 0 |
| 247 | end |
| 248 | fn prow pair ulong arm ulong to ulong |
| 249 | ret mul sub get pslots add mul pair 4 arm 1 56 |
| 250 | end |
| 251 | fn pfinish to int |
| 252 | if eq get pstate 3 0 |
| 253 | ret 75 |
| 254 | end |
| 255 | for i ulong 5 |
| 256 | if ne get pbind add i 34 get pconfig i |
| 257 | ret 69 |
| 258 | end |
| 259 | end |
| 260 | if ne get pstate 1 0 |
| 261 | ret 75 |
| 262 | end |
| 263 | if ne get pstate 0 mul get pstate 3 4 |
| 264 | ret 75 |
| 265 | end |
| 266 | for i ulong 32 |
| 267 | if ne get pbind i get sid i |
| 268 | ret 69 |
| 269 | end |
| 270 | if ne get sid i get sid add i 32 |
| 271 | ret 69 |
| 272 | end |
| 273 | end |
| 274 | if ne get pbind 32 get sprofile 1 |
| 275 | ret 69 |
| 276 | end |
| 277 | if ne get pbind 33 get sprofile 4 |
| 278 | ret 69 |
| 279 | end |
| 280 | for p ulong get pstate 3 |
| 281 | for a ulong 4 |
| 282 | if eq get pslots add mul p 4 a 0 |
| 283 | ret 75 |
| 284 | end |
| 285 | end |
| 286 | base = prow p 0 |
| 287 | if not pprompt base prow 0 0 |
| 288 | ret 69 |
| 289 | end |
| 290 | for a ulong 4 |
| 291 | row = prow p a |
| 292 | if not pequal base row |
| 293 | ret 69 |
| 294 | end |
| 295 | end |
| 296 | end |
| 297 | ret 0 |
| 298 | end |
| 299 | fn pprompt a ulong b ulong to bool |
| 300 | for i ulong 4 |
| 301 | left = get praw add add a 3 i |
| 302 | right = get praw add add b 3 i |
| 303 | if ne left right |
| 304 | ret false |
| 305 | end |
| 306 | end |
| 307 | ret true |
| 308 | end |
| 309 | fn pequal base ulong row ulong to bool |
| 310 | note Exact greedy output digest and length must agree before speed is interpreted. |
| 311 | for i ulong 9 |
| 312 | left = get praw add add base 3 i |
| 313 | right = get praw add add row 3 i |
| 314 | if ne left right |
| 315 | ret false |
| 316 | end |
| 317 | end |
| 318 | if ne get praw add base 16 get praw add row 16 |
| 319 | ret false |
| 320 | end |
| 321 | ret true |
| 322 | end |
| 323 | fn psort n ulong to void |
| 324 | for i ulong n |
| 325 | for j ulong sub n 1 |
| 326 | if gt get ratios j get ratios add j 1 |
| 327 | t = get ratios j |
| 328 | put ratios j get ratios add j 1 |
| 329 | put ratios add j 1 t |
| 330 | end |
| 331 | if gt get times j get times add j 1 |
| 332 | t = get times j |
| 333 | put times j get times add j 1 |
| 334 | put times add j 1 t |
| 335 | end |
| 336 | if gt get firsts j get firsts add j 1 |
| 337 | t = get firsts j |
| 338 | put firsts j get firsts add j 1 |
| 339 | put firsts add j 1 t |
| 340 | end |
| 341 | end |
| 342 | end |
| 343 | end |
| 344 | fn prank n ulong to ulong |
| 345 | note Exact two-sided 95% distribution-free interval for median paired ratio. |
| 346 | note P[Binomial(n,1/2) < k] <= 1/40. n <=32 keeps every product in uint64. |
| 347 | choose = ulong 1 |
| 348 | sum = ulong 0 |
| 349 | k = ulong 0 |
| 350 | for i ulong add div n 2 1 |
| 351 | sum = add sum choose |
| 352 | if le mul sum 40 shl 1 n |
| 353 | k = add i 1 |
| 354 | end |
| 355 | choose = div mul choose sub n i add i 1 |
| 356 | end |
| 357 | ret k |
| 358 | end |
| 359 | fn pmeasure pair ulong arm ulong to void |
| 360 | a = prow pair 3 |
| 361 | b = prow pair arm |
| 362 | ta = sub get praw add a 14 get praw add a 12 |
| 363 | tb = sub get praw add b 14 get praw add b 12 |
| 364 | put ratios pair div mul tb 1000000 ta |
| 365 | put times pair ta |
| 366 | put firsts pair sub get praw add a 13 get praw add a 12 |
| 367 | if gt get praw add a 15 get summary 9 |
| 368 | put summary 9 get praw add a 15 |
| 369 | end |
| 370 | end |
| 371 | fn preport arm ulong to int |
| 372 | if gt arm 2 |
| 373 | ret 65 |
| 374 | end |
| 375 | for i ulong 12 |
| 376 | put summary i 0 |
| 377 | end |
| 378 | status = pfinish |
| 379 | if ne status 0 |
| 380 | ret status |
| 381 | end |
| 382 | n = get pstate 3 |
| 383 | for p ulong n |
| 384 | pmeasure p arm |
| 385 | end |
| 386 | psort n |
| 387 | mid = div n 2 |
| 388 | put summary 0 n |
| 389 | put summary 1 arm |
| 390 | put summary 2 get ratios mid |
| 391 | put summary 5 get times mid |
| 392 | put summary 7 get firsts mid |
| 393 | if eq rem n 2 0 |
| 394 | put summary 2 div add get ratios mid get ratios sub mid 1 2 |
| 395 | put summary 5 div add get times mid get times sub mid 1 2 |
| 396 | put summary 7 div add get firsts mid get firsts sub mid 1 2 |
| 397 | end |
| 398 | p95 = sub div add mul n 95 99 100 1 |
| 399 | put summary 6 get times p95 |
| 400 | put summary 8 get firsts p95 |
| 401 | rank = prank n |
| 402 | put summary 11 get pbind 33 |
| 403 | if eq rank 0 |
| 404 | put summary 4 18446744073709551615 |
| 405 | ret 0 |
| 406 | end |
| 407 | put summary 3 get ratios sub rank 1 |
| 408 | put summary 4 get ratios sub n rank |
| 409 | if eq get pstate 2 1 |
| 410 | ret 0 |
| 411 | end |
| 412 | if gt get summary 3 1000000 |
| 413 | put summary 10 1 |
| 414 | end |
| 415 | if lt get summary 4 1000000 |
| 416 | put summary 10 3 |
| 417 | end |
| 418 | if eq get summary 3 1000000 |
| 419 | if eq get summary 4 1000000 |
| 420 | put summary 10 2 |
| 421 | end |
| 422 | end |
| 423 | ret 0 |
| 424 | end |