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 / speculation / vector-checks.om
| 1 | note Shared whole-vector checks, chunked below the seeded dynamic-loop limit. |
| 2 | fn aval i ulong salt ulong to ulong |
| 3 | ret and add mul i 2654435761 salt 4294967295 |
| 4 | end |
| 5 | fn bval i ulong salt ulong to ulong |
| 6 | ret and xor add mul i 2246822519 3266489917 salt 4294967295 |
| 7 | end |
| 8 | fn expect i ulong salt ulong to ulong |
| 9 | ret and add aval i salt bval i salt 4294967295 |
| 10 | end |
| 11 | fn putvec i ulong salt ulong to void |
| 12 | r = mapset get gbmem 5 mul i 4 4 aval i salt |
| 13 | r = mapset get gbmem 6 mul i 4 4 bval i salt |
| 14 | r = mapset get gbmem 7 mul i 4 4 xor expect i salt 4294967295 |
| 15 | end |
| 16 | fn match i ulong salt ulong to bool |
| 17 | ret eq mapget get gbmem 7 mul i 4 4 expect i salt |
| 18 | end |
| 19 | fn prepare n uint salt ulong to void |
| 20 | base = ulong 0 |
| 21 | while lt base ulong n |
| 22 | count = sub ulong n base |
| 23 | if gt count 65536 |
| 24 | count = ulong 65536 |
| 25 | end |
| 26 | for j ulong count |
| 27 | putvec add base j salt |
| 28 | end |
| 29 | base = add base count |
| 30 | end |
| 31 | tail = sub get gbmax 0 n |
| 32 | if gt tail 64 |
| 33 | tail = uint 64 |
| 34 | end |
| 35 | for i ulong ulong tail |
| 36 | r = mapset get gbmem 7 mul add ulong n i 4 4 3735928559 |
| 37 | end |
| 38 | end |
| 39 | fn verify n uint salt ulong wrong bool to void |
| 40 | mism = ulong 0 |
| 41 | base = ulong 0 |
| 42 | while lt base ulong n |
| 43 | count = sub ulong n base |
| 44 | if gt count 65536 |
| 45 | count = ulong 65536 |
| 46 | end |
| 47 | for j ulong count |
| 48 | if not match add base j salt |
| 49 | mism = add mism 1 |
| 50 | end |
| 51 | end |
| 52 | base = add base count |
| 53 | end |
| 54 | if wrong |
| 55 | ck gt mism 0 |
| 56 | else |
| 57 | ck eq mism 0 |
| 58 | end |
| 59 | tail = sub get gbmax 0 n |
| 60 | if gt tail 64 |
| 61 | tail = uint 64 |
| 62 | end |
| 63 | for i ulong ulong tail |
| 64 | ck eq mapget get gbmem 7 mul add ulong n i 4 4 3735928559 |
| 65 | end |
| 66 | end |