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 / capacity-unit.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Concatenate allocator,effect,check,project,rowpipe,staged,compose,then this host-only caller. |
| 3 | note Refused emissions must not patch/control a nonexistent slot before their capacity error reaches the caller. |
| 4 | fn cu_slots to int |
| 5 | ins = new ulong 8192 99 |
| 6 | s = new ulong 64 0 |
| 7 | m = new ulong 2048 0 |
| 8 | args = new ulong 4 0 |
| 9 | put s 0 1024 |
| 10 | at = bc_branch ins s 0 false |
| 11 | if or ne at 1024 ne get s 3 1 |
| 12 | ret 70 |
| 13 | end |
| 14 | bc_patch ins at 0 |
| 15 | bc_tail ins at |
| 16 | for j ulong 8192 |
| 17 | if ne get ins j 99 |
| 18 | ret 71 |
| 19 | end |
| 20 | end |
| 21 | note Check both final valid slot and very large rejected indices before multiplication. |
| 22 | bc_patch ins 18446744073709551615 0 |
| 23 | bc_tail ins 18446744073709551615 |
| 24 | bc_patch ins 1023 1023 |
| 25 | if ne and get ins 8190 4294967295 0 |
| 26 | ret 72 |
| 27 | end |
| 28 | bc_tail ins 1023 |
| 29 | if ne get ins 8190 shl ulong 1032192 32 |
| 30 | ret 73 |
| 31 | end |
| 32 | for j ulong 4 |
| 33 | put args j j |
| 34 | put m j 4 |
| 35 | end |
| 36 | put m 2 2 |
| 37 | for j ulong 3 |
| 38 | put s 0 add j 1022 |
| 39 | if eq bc_mma ins s m args 0 |
| 40 | ret 74 |
| 41 | end |
| 42 | if ne get s 0 add j 1022 |
| 43 | ret 75 |
| 44 | end |
| 45 | end |
| 46 | put s 0 1021 |
| 47 | put s 1 0 |
| 48 | put s 3 0 |
| 49 | if ne bc_mma ins s m args 0 |
| 50 | ret 76 |
| 51 | end |
| 52 | if ne get s 0 1024 |
| 53 | ret 77 |
| 54 | end |
| 55 | ret 0 |
| 56 | end |
| 57 | fn cu_case cfg view ulong 16 expected uint to int |
| 58 | ins = new ulong 8192 0 |
| 59 | meta = new ulong 2048 0 |
| 60 | phys = new ulong 288 0 |
| 61 | actual = new ulong 8 99 |
| 62 | rc = bc_compose cfg ins meta phys actual |
| 63 | if ne rc expected |
| 64 | ret 65 |
| 65 | end |
| 66 | if ne rc 0 |
| 67 | for j ulong 8 |
| 68 | if ne get actual j 0 |
| 69 | ret 66 |
| 70 | end |
| 71 | end |
| 72 | end |
| 73 | ret 0 |
| 74 | end |
| 75 | fn main to int |
| 76 | rc = cu_slots |
| 77 | if ne rc 0 |
| 78 | ret rc |
| 79 | end |
| 80 | cfg = new ulong 16 0 |
| 81 | put cfg 0 3 |
| 82 | put cfg 1 1536 |
| 83 | put cfg 2 16 |
| 84 | put cfg 3 8 |
| 85 | put cfg 4 16 |
| 86 | note This legal U3 shape previously trapped103 during branch patching at saturated instruction capacity. |
| 87 | rc = cu_case cfg 2 |
| 88 | if ne rc 0 |
| 89 | ret rc |
| 90 | end |
| 91 | note A legal nearby U2 shape must remain realizable with unchanged instruction effects. |
| 92 | put cfg 1 2048 |
| 93 | rc = cu_case cfg 0 |
| 94 | if ne rc 0 |
| 95 | ret rc |
| 96 | end |
| 97 | put cfg 0 1 |
| 98 | put cfg 1 256 |
| 99 | put cfg 2 8 |
| 100 | put cfg 3 1 |
| 101 | put cfg 4 4 |
| 102 | rc = cu_case cfg 0 |
| 103 | if ne rc 0 |
| 104 | ret rc |
| 105 | end |
| 106 | put cfg 0 2 |
| 107 | ret cu_case cfg 0 |
| 108 | end |