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 / rowpipe-caller.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Host-only caller. stdin exactly64 bytes: eight LE64 spec words. |
| 3 | note Concatenate bw_alloc,bw_effect,bw_project,rowpipe,bw_enc_sm121,bw_spec_sm121,this. |
| 4 | note bw_spec_sm121 contributes only the prefix before its standalone fn main. |
| 5 | note stdout same shared caller frame:stats4,peakGPR,peakUGPR,width+phys per GPR/UGPR, |
| 6 | note all used eight-cell instructions,then unpadded instruction bytes. |
| 7 | note Exit66 is a clean refusal with zero outputs;69 means refusal leaked output. |
| 8 | fn rp_word v ulong to bool |
| 9 | b = new uchar 8 0 |
| 10 | for j ulong 8 |
| 11 | put b j uchar and shr v mul j 8 255 |
| 12 | end |
| 13 | n = ulong 0 |
| 14 | while lt n 8 bound 8 |
| 15 | k = write 1 b n sub ulong 8 n |
| 16 | if le k 0 |
| 17 | ret false |
| 18 | end |
| 19 | n = add n ulong k |
| 20 | end |
| 21 | ret true |
| 22 | end |
| 23 | fn rp_bytes b view uchar 16384 n ulong to int |
| 24 | sent = ulong 0 |
| 25 | while lt sent n bound 16384 |
| 26 | k = write 1 b sent sub n sent |
| 27 | if le k 0 |
| 28 | ret 74 |
| 29 | end |
| 30 | sent = add sent ulong k |
| 31 | end |
| 32 | ret 0 |
| 33 | end |
| 34 | fn rp_admit ins view ulong 8192 phys view ulong 288 n ulong to uint |
| 35 | state = new ulong 3001 0 |
| 36 | o = new ulong 16 0 |
| 37 | w = new ulong 4 0 |
| 38 | for j ulong n |
| 39 | opnds ins j phys o |
| 40 | if ne sp_enc state o w 0 |
| 41 | ret 1 |
| 42 | end |
| 43 | end |
| 44 | ret 0 |
| 45 | end |
| 46 | fn rp_input spec edit ulong 8 to int |
| 47 | b = new uchar 64 0 |
| 48 | n = ulong 0 |
| 49 | while lt n 64 bound 64 |
| 50 | k = read 0 b n sub ulong 64 n |
| 51 | if le k 0 |
| 52 | ret 65 |
| 53 | end |
| 54 | n = add n ulong k |
| 55 | end |
| 56 | extra = read 0 b 0 1 |
| 57 | if ne extra 0 |
| 58 | ret 65 |
| 59 | end |
| 60 | for j ulong 8 |
| 61 | v = ulong 0 |
| 62 | for k ulong 8 |
| 63 | v = or v shl ulong get b add mul j 8 k mul k 8 |
| 64 | end |
| 65 | put spec j v |
| 66 | end |
| 67 | ret 0 |
| 68 | end |
| 69 | fn rp_irout ins view ulong 8192 m view ulong 2048 phys view ulong 288 stats view ulong 4 astats view ulong 4 to int |
| 70 | for j ulong 4 |
| 71 | if not rp_word get stats j |
| 72 | ret 74 |
| 73 | end |
| 74 | end |
| 75 | if not rp_word get astats 1 |
| 76 | ret 74 |
| 77 | end |
| 78 | if not rp_word get astats 2 |
| 79 | ret 74 |
| 80 | end |
| 81 | for j ulong get stats 1 |
| 82 | if not rp_word get m j |
| 83 | ret 74 |
| 84 | end |
| 85 | if not rp_word get phys j |
| 86 | ret 74 |
| 87 | end |
| 88 | end |
| 89 | for j ulong get stats 2 |
| 90 | if not rp_word get m add j 256 |
| 91 | ret 74 |
| 92 | end |
| 93 | if not rp_word get phys add j 256 |
| 94 | ret 74 |
| 95 | end |
| 96 | end |
| 97 | for j ulong mul get stats 0 8 |
| 98 | if not rp_word get ins j |
| 99 | ret 74 |
| 100 | end |
| 101 | end |
| 102 | ret 0 |
| 103 | end |
| 104 | fn main to int |
| 105 | spec = new ulong 8 0 |
| 106 | ins = new ulong 8192 1 |
| 107 | m = new ulong 2048 1 |
| 108 | stats = new ulong 4 1 |
| 109 | astats = new ulong 4 0 |
| 110 | phys = new ulong 288 0 |
| 111 | code = new uchar 16384 0 |
| 112 | if ne rp_input spec 0 |
| 113 | ret 65 |
| 114 | end |
| 115 | rc = bc_rowpipe spec ins m stats |
| 116 | if ne rc 0 |
| 117 | for j ulong 8192 |
| 118 | if ne get ins j 0 |
| 119 | ret 69 |
| 120 | end |
| 121 | end |
| 122 | for j ulong 2048 |
| 123 | if ne get m j 0 |
| 124 | ret 69 |
| 125 | end |
| 126 | end |
| 127 | for j ulong 4 |
| 128 | if ne get stats j 0 |
| 129 | ret 69 |
| 130 | end |
| 131 | end |
| 132 | ret 66 |
| 133 | end |
| 134 | if ne bc_regalloc ins get stats 0 m phys astats 128 0 |
| 135 | ret 67 |
| 136 | end |
| 137 | if ne rp_admit ins phys get stats 0 0 |
| 138 | ret 68 |
| 139 | end |
| 140 | size = bw_enc_sm121 ins phys get stats 0 0 code |
| 141 | if eq size 0 |
| 142 | ret 68 |
| 143 | end |
| 144 | if ne rp_irout ins m phys stats astats 0 |
| 145 | ret 74 |
| 146 | end |
| 147 | ret rp_bytes code size |
| 148 | end |