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 / component-unit.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Concatenate allocator,effect,check,project,then this host-only unit caller. |
| 3 | fn ut_ir ins edit ulong 8192 meta edit ulong 2048 n ulong to int |
| 4 | old = get ins 0 |
| 5 | put ins 0 999 |
| 6 | if eq bc_ircheck ins n meta 0 |
| 7 | ret 5 |
| 8 | end |
| 9 | put ins 0 old |
| 10 | for i ulong n |
| 11 | base = mul i 8 |
| 12 | op = get ins base |
| 13 | if eq op 56 |
| 14 | slot = add base 6 |
| 15 | old = get ins slot |
| 16 | put ins slot and old 4294967295 |
| 17 | if eq bc_ircheck ins n meta 0 |
| 18 | ret 6 |
| 19 | end |
| 20 | put ins slot old |
| 21 | reg = get ins add base 1 |
| 22 | width = get meta reg |
| 23 | put meta reg 1 |
| 24 | if eq bc_ircheck ins n meta 0 |
| 25 | ret 7 |
| 26 | end |
| 27 | put meta reg width |
| 28 | end |
| 29 | if eq op 54 |
| 30 | slot = add base 6 |
| 31 | old = get ins slot |
| 32 | put ins slot or shl shr old 32 32 2147483647 |
| 33 | if eq bc_ircheck ins n meta 0 |
| 34 | ret 8 |
| 35 | end |
| 36 | put ins slot old |
| 37 | end |
| 38 | end |
| 39 | ret 0 |
| 40 | end |
| 41 | fn ut_mma to int |
| 42 | ins = new ulong 8192 0 |
| 43 | meta = new ulong 2048 0 |
| 44 | s = new ulong 64 0 |
| 45 | args = new ulong 4 0 |
| 46 | bc_node s 1 0 1 BCNONE BCNONE |
| 47 | bc_emit ins s 13 |
| 48 | if eq get s 3 0 |
| 49 | ret 11 |
| 50 | end |
| 51 | for j ulong 64 |
| 52 | put s j 0 |
| 53 | end |
| 54 | for j ulong 4 |
| 55 | put args j j |
| 56 | put meta j 4 |
| 57 | end |
| 58 | put meta 2 2 |
| 59 | if ne bc_mma ins s meta args 0 |
| 60 | ret 12 |
| 61 | end |
| 62 | if ne get s 0 3 |
| 63 | ret 13 |
| 64 | end |
| 65 | if ne shr get ins 6 32 bc_control 8 7 7 0 false |
| 66 | ret 14 |
| 67 | end |
| 68 | if ne shr get ins 14 32 bc_control 15 7 7 0 false |
| 69 | ret 15 |
| 70 | end |
| 71 | if ne shr get ins 22 32 bc_control 14 7 7 0 false |
| 72 | ret 16 |
| 73 | end |
| 74 | put meta 2 1 |
| 75 | if eq bc_mma ins s meta args 0 |
| 76 | ret 17 |
| 77 | end |
| 78 | ret 0 |
| 79 | end |
| 80 | fn main to int |
| 81 | spec = new ulong 8 0 |
| 82 | ins = new ulong 8192 0 |
| 83 | meta = new ulong 2048 0 |
| 84 | phys = new ulong 288 0 |
| 85 | st = new ulong 4 0 |
| 86 | rs = new ulong 4 0 |
| 87 | put spec 0 256 |
| 88 | put spec 1 8 |
| 89 | put spec 2 1 |
| 90 | put spec 3 4 |
| 91 | if ne bc_project spec ins meta st 0 |
| 92 | ret 1 |
| 93 | end |
| 94 | if ne bc_ircheck ins get st 0 meta 0 |
| 95 | ret 2 |
| 96 | end |
| 97 | if ne bc_regalloc ins get st 0 meta phys rs 128 0 |
| 98 | ret 3 |
| 99 | end |
| 100 | if eq bc_regalloc ins get st 0 meta phys rs 3 0 |
| 101 | ret 4 |
| 102 | end |
| 103 | rc = ut_ir ins meta get st 0 |
| 104 | if ne rc 0 |
| 105 | ret rc |
| 106 | end |
| 107 | put spec 4 2 |
| 108 | if eq bc_project spec ins meta st 0 |
| 109 | ret 9 |
| 110 | end |
| 111 | put spec 4 0 |
| 112 | put spec 5 1 |
| 113 | if eq bc_project spec ins meta st 0 |
| 114 | ret 10 |
| 115 | end |
| 116 | ret ut_mma |
| 117 | end |