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 / pipeline / graph-caller.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Reuses exact Composer+Quant fixture. Synthetic identities do not qualify code. |
| 3 | fn pl_hword h view uchar 32 i ulong to ulong |
| 4 | v = ulong 0 |
| 5 | for j ulong 8 |
| 6 | v = or v shl ulong get h add mul i 8 j mul j 8 |
| 7 | end |
| 8 | ret v |
| 9 | end |
| 10 | fn pl_zero out view ulong 32 to bool |
| 11 | for j ulong 32 |
| 12 | if ne get out j 0 |
| 13 | ret false |
| 14 | end |
| 15 | end |
| 16 | ret true |
| 17 | end |
| 18 | fn pl_bind q edit ulong 64 a edit ulong 1024 real view uchar 4096 to int |
| 19 | h = new uchar 32 0 |
| 20 | if ne kc_sha real 1152 h 0 |
| 21 | ret 1 |
| 22 | end |
| 23 | put a 0 compose_word real 19 |
| 24 | put a 12 compose_word real 22 |
| 25 | put a 13 compose_word real 21 |
| 26 | put a 14 compose_word real 25 |
| 27 | put a 15 compose_word real 3 |
| 28 | for i ulong 4 |
| 29 | v = pl_hword h i |
| 30 | put a add 21 i v |
| 31 | put a add 49 i v |
| 32 | put q add 30 i v |
| 33 | put a add 57 i compose_word real add 84 i |
| 34 | put a add 25 i compose_word real add 88 i |
| 35 | end |
| 36 | ret 0 |
| 37 | end |
| 38 | fn pl_make want edit uchar 4096 real edit uchar 4096 to int |
| 39 | launch = new ulong 32 0 |
| 40 | if ne compose_fixture want launch 0 |
| 41 | ret 1 |
| 42 | end |
| 43 | for j ulong 4096 |
| 44 | put real j get want j |
| 45 | end |
| 46 | ret int compose_launch real launch |
| 47 | end |
| 48 | fn pl_resident q edit ulong 64 a edit ulong 1024 p edit ulong 528 real view uchar 4096 to int |
| 49 | req = new ulong 16 0 |
| 50 | pl_fixture q a |
| 51 | put q 1 1 |
| 52 | put q 10 256 |
| 53 | put q 11 0 |
| 54 | if ne pl_bind q a real 0 |
| 55 | ret 3 |
| 56 | end |
| 57 | if ne kc_init p 1 1 128 1 0 |
| 58 | ret 4 |
| 59 | end |
| 60 | put req 0 1 |
| 61 | put req 1 1 |
| 62 | put req 2 1 |
| 63 | put req 7 1 |
| 64 | for j ulong 4 |
| 65 | put req add 3 j get a add 21 j |
| 66 | end |
| 67 | if ne kc_prepare p req 1 |
| 68 | ret 5 |
| 69 | end |
| 70 | ret kc_commit p 0 1 1 |
| 71 | end |
| 72 | fn main to int |
| 73 | q = new ulong 64 0 |
| 74 | a = new ulong 1024 0 |
| 75 | p = new ulong 528 0 |
| 76 | want = new uchar 4096 0 |
| 77 | real = new uchar 4096 0 |
| 78 | out = new ulong 32 0 |
| 79 | if ne pl_make want real 0 |
| 80 | ret 1 |
| 81 | end |
| 82 | if ne pl_resident q a p real 0 |
| 83 | ret 2 |
| 84 | end |
| 85 | if ne pl_graph q a p want real out 0 |
| 86 | ret 7 |
| 87 | end |
| 88 | if ne get out 16 1 |
| 89 | ret 8 |
| 90 | end |
| 91 | if ne kc_unpin p get out 17 get out 18 get out 19 0 |
| 92 | ret 9 |
| 93 | end |
| 94 | note Target, shape, tail, alias and pin mutations cannot reuse original artifact. |
| 95 | old = get real 16 |
| 96 | put real 16 xor old uchar 1 |
| 97 | if ne pl_graph q a p want real out 69 |
| 98 | ret 10 |
| 99 | end |
| 100 | if not pl_zero out |
| 101 | ret 11 |
| 102 | end |
| 103 | put real 16 old |
| 104 | old = get real 32 |
| 105 | put real 32 xor old uchar 1 |
| 106 | if ne pl_graph q a p want real out 69 |
| 107 | ret 10 |
| 108 | end |
| 109 | if not pl_zero out |
| 110 | ret 11 |
| 111 | end |
| 112 | put real 32 old |
| 113 | old = get real 96 |
| 114 | put real 96 xor old uchar 1 |
| 115 | if ne pl_graph q a p want real out 69 |
| 116 | ret 10 |
| 117 | end |
| 118 | if not pl_zero out |
| 119 | ret 11 |
| 120 | end |
| 121 | put real 96 old |
| 122 | old = get real 104 |
| 123 | put real 104 xor old uchar 1 |
| 124 | if ne pl_graph q a p want real out 69 |
| 125 | ret 10 |
| 126 | end |
| 127 | if not pl_zero out |
| 128 | ret 11 |
| 129 | end |
| 130 | put real 104 old |
| 131 | old = get real 544 |
| 132 | put real 544 xor old uchar 1 |
| 133 | if ne pl_graph q a p want real out 69 |
| 134 | ret 10 |
| 135 | end |
| 136 | if not pl_zero out |
| 137 | ret 11 |
| 138 | end |
| 139 | put real 544 old |
| 140 | note Resource declarations must match exact canonical metadata, not only fit ceiling. |
| 141 | put a 12 1 |
| 142 | if ne pl_graph q a p want real out 69 |
| 143 | ret 12 |
| 144 | end |
| 145 | put a 12 compose_word real 22 |
| 146 | note Missing native staged composer is an explicit refusal, never shape-based inference. |
| 147 | compose_put real 19 3 |
| 148 | if ne pl_graph q a p want real out 69 |
| 149 | ret 13 |
| 150 | end |
| 151 | ret 0 |
| 152 | end |