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 / om / codegen / cg_pfhost_rl.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Router config cf[0..7]: k,e,t,mutant,warps,passes,chunks,group-bytes. |
| 3 | fn ph_rl_meta cf view ulong 64 meta edit ulong 512 to void |
| 4 | nv = add add 21 get cf 2 get cf 5 |
| 5 | put meta 1 nv |
| 6 | put meta 2 1 |
| 7 | put meta 320 2 |
| 8 | for v ulong nv |
| 9 | sz = ulong 1 |
| 10 | if lt v 3 |
| 11 | sz = ulong 2 |
| 12 | end |
| 13 | if ge v 15 |
| 14 | sz = ulong 4 |
| 15 | if and ge v 17 lt v add 17 get cf 2 |
| 16 | sz = ulong 1 |
| 17 | end |
| 18 | end |
| 19 | put meta add 64 v sz |
| 20 | end |
| 21 | end |
| 22 | fn ph_rl_head ins edit ulong 8192 st edit ulong 16 cf view ulong 64 to void |
| 23 | ph_imm ins st 7 0 856 4 |
| 24 | ph_imm ins st 5 0 896 2 |
| 25 | ph_imm ins st 5 1 904 2 |
| 26 | ph_imm ins st 5 2 912 2 |
| 27 | ph_imm ins st 3 3 33 2 |
| 28 | ph_imm ins st 3 4 37 2 |
| 29 | ph_imm ins st 2 7 1 0 |
| 30 | ph_base st 17 5 3 PHNONE |
| 31 | put st 14 5 |
| 32 | ph_emit ins st 0 |
| 33 | ph_base st 18 6 3 PHNONE |
| 34 | put st 14 31 |
| 35 | ph_emit ins st 0 |
| 36 | ph_imad ins st 8 4 get cf 2 5 |
| 37 | ph_wide ins st 0 8 mul get cf 0 4 0 |
| 38 | ph_wide ins st 0 6 16 0 |
| 39 | ph_imad ins st 9 5 512 PHNONE |
| 40 | ph_imad ins st 9 6 16 9 |
| 41 | ph_wide ins st 1 3 16 1 |
| 42 | ph_imad ins st 10 4 mul get cf 2 get cf 1 3 |
| 43 | ph_wide ins st 2 10 4 2 |
| 44 | for t ulong get cf 2 |
| 45 | ph_imm ins st 2 add 17 t 2147483648 0 |
| 46 | end |
| 47 | ph_load ins st 15 1 0 11 |
| 48 | ph_imm ins st 2 11 get cf 6 0 |
| 49 | end |
| 50 | fn ph_rl_stage ins edit ulong 8192 st edit ulong 16 cf view ulong 64 to void |
| 51 | ph_imm ins st 48 PHNONE 0 0 |
| 52 | for p ulong get cf 5 |
| 53 | d = add add 21 get cf 2 p |
| 54 | off = mul mul mul p get cf 4 get cf 0 4 |
| 55 | kind = ulong 3 |
| 56 | if eq p 0 |
| 57 | kind = ulong 2 |
| 58 | end |
| 59 | ph_load ins st d 0 off kind |
| 60 | end |
| 61 | for p ulong get cf 5 |
| 62 | for q ulong 4 |
| 63 | off = add mul mul p get cf 4 512 mul 4 q |
| 64 | ph_imad ins st 10 7 off 9 |
| 65 | ph_base st 50 PHNONE 10 add add 21 get cf 2 p |
| 66 | put st 15 shl q 32 |
| 67 | ph_emit ins st 5 |
| 68 | end |
| 69 | end |
| 70 | ph_imm ins st 48 PHNONE 0 0 |
| 71 | ph_wide ins st 0 7 512 0 |
| 72 | ph_imm ins st 2 13 0 0 |
| 73 | ph_imm ins st 2 12 16 0 |
| 74 | end |
| 75 | fn ph_rl_math ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 b0 ulong nb ulong rv ulong to void |
| 76 | for i ulong nb |
| 77 | for q ulong 4 |
| 78 | put cf 8 add add 17 b0 i |
| 79 | put cf 9 0 |
| 80 | put cf 10 14 |
| 81 | put cf 11 rv |
| 82 | put cf 12 add add 17 get cf 2 i |
| 83 | put cf 13 q |
| 84 | put cf 14 q |
| 85 | ph_muladd ins st cf |
| 86 | end |
| 87 | end |
| 88 | end |
| 89 | fn ph_rl_compute ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 rv ulong imm ulong to void |
| 90 | b0 = ulong 0 |
| 91 | while lt b0 get cf 2 bound 4 |
| 92 | nb = sub get cf 2 b0 |
| 93 | if gt nb 4 |
| 94 | nb = ulong 4 |
| 95 | end |
| 96 | for i ulong nb |
| 97 | ph_base st 58 add add 17 get cf 2 i 13 PHNONE |
| 98 | put st 14 add mul add b0 i 512 imm |
| 99 | kind = ulong 3 |
| 100 | if eq i 0 |
| 101 | kind = ulong 2 |
| 102 | end |
| 103 | ph_emit ins st kind |
| 104 | end |
| 105 | ph_rl_math ins st cf b0 nb rv |
| 106 | b0 = add b0 4 |
| 107 | end |
| 108 | end |
| 109 | fn ph_rl_iter ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 to void |
| 110 | ph_consume st |
| 111 | ph_load ins st 16 1 get cf 7 11 |
| 112 | ph_rl_compute ins st cf 15 0 |
| 113 | ph_consume st |
| 114 | ph_load ins st 15 1 mul 2 get cf 7 11 |
| 115 | ph_rl_compute ins st cf 16 16 |
| 116 | ph_wide ins st 1 7 mul 2 get cf 7 1 |
| 117 | ph_imad ins st 13 7 32 13 |
| 118 | ph_imad ins st 12 7 4294967295 12 |
| 119 | ph_base st 28 PHNONE 12 7 |
| 120 | ph_emit ins st 1 |
| 121 | end |
| 122 | fn ph_rl_body ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 meta edit ulong 512 to void |
| 123 | ph_rl_head ins st cf |
| 124 | outer = get st 0 |
| 125 | ph_rl_stage ins st cf |
| 126 | inner = get st 0 |
| 127 | ph_rl_iter ins st cf |
| 128 | ph_branch ins st inner |
| 129 | put meta 16 inner |
| 130 | put meta 17 sub get st 0 1 |
| 131 | ph_imad ins st 11 7 4294967295 11 |
| 132 | ph_base st 28 PHNONE 11 7 |
| 133 | ph_emit ins st 1 |
| 134 | ph_branch ins st outer |
| 135 | put meta 18 outer |
| 136 | put meta 19 sub get st 0 1 |
| 137 | put meta 5 2 |
| 138 | ph_consume st |
| 139 | for t ulong get cf 2 |
| 140 | ph_base st 12 PHNONE 2 add 17 t |
| 141 | put st 13 0 |
| 142 | put st 14 mul mul t get cf 1 4 |
| 143 | ph_emit ins st 5 |
| 144 | end |
| 145 | ph_tail ins st |
| 146 | put meta 0 get st 0 |
| 147 | end |