Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/om/components/bw_project.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / om / components / bw_project.om` 304 lines · 7729 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Port of existing nondeep OmegaFp8GemvSpec sched0 coal0 at `b759afc3`. 3 note spec8:K,laneBytes,rows,warps,load-order component(0X-first/1W-first),reserved0. 4 note Mutants are never accepted production specs. No solved bytes or second IR. 5 fn bc_log v ulong to ulong 6 for i ulong 32 7 if eq shl ulong 1 i v 8 ret i 9 end 10 end 11 ret BCNONE 12 end 13 fn bc_imm ins edit ulong 8192 s edit ulong 64 d ulong a ulong c ulong imm ulong to void 14 put s 8 imm 15 put s 9 0 16 bc_imad ins s 8 d a c 17 end 18 fn bc_wide ins edit ulong 8192 s edit ulong 64 d ulong a ulong c ulong imm ulong to void 19 put s 8 imm 20 put s 9 0 21 bc_imad ins s 9 d a c 22 end 23 fn bc_shift ins edit ulong 8192 s edit ulong 64 d ulong a ulong subreg ulong amount ulong to void 24 bc_node s 17 d a BCNONE BCNONE 25 put s 22 amount 26 put s 23 shl subreg 24 27 bc_emit ins s 0 28 end 29 fn bc_mask ins edit ulong 8192 s edit ulong 64 d ulong a ulong subreg ulong mask ulong to void 30 bc_node s 18 d a BCNONE BCNONE 31 put s 22 mask 32 put s 23 shl subreg 24 33 bc_emit ins s 0 34 end 35 fn bc_initregs m edit ulong 2048 s edit ulong 64 r edit ulong 64 to void 36 uv = bc_vreg s m 2 true 37 for k ulong 31 38 width = ulong 1 39 if or lt k 3 and ge k 14 le k 16 40 width = 2 41 end 42 if or and ge k 18 le k 20 and ge k 24 le k 28 43 width = 2 44 end 45 put r k bc_vreg s m width false 46 end 47 for row ulong get s 34 48 put r add 32 mul row 2 bc_vreg s m 1 false 49 put r add 33 mul row 2 bc_vreg s m div get s 33 4 false 50 end 51 for word ulong get s 38 52 put r add word 48 bc_vreg s m 4 false 53 end 54 put r 52 bc_vreg s m 1 false 55 put r 53 bc_vreg s m 2 false 56 for k ulong 6 57 put r add k 54 bc_vreg s m 1 false 58 end 59 end 60 fn bc_prologue ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 61 bc_node s 7 0 BCNONE BCNONE BCNONE 62 put s 22 856 63 put s 23 1 64 bc_emit ins s 4 65 for k ulong 7 66 op = ulong 4 67 if lt k 3 68 op = 5 69 end 70 bc_node s op get r k BCNONE BCNONE BCNONE 71 put s 22 add ulong 896 mul k 8 72 if ge k 3 73 put s 22 add ulong 920 mul sub k 3 4 74 end 75 bc_emit ins s 2 76 end 77 for k ulong 3 78 bc_node s 3 get r add k 7 BCNONE BCNONE BCNONE 79 put s 22 33 80 if eq k 1 81 put s 22 37 82 end 83 if eq k 2 84 put s 22 38 85 end 86 bc_emit ins s 2 87 end 88 bc_inst ins s 2 get r 12 BCNONE 1 89 bc_shift ins s get r 10 get r 7 0 5 90 bc_mask ins s get r 11 get r 7 0 31 91 bc_imm ins s get r 13 get r 9 BCNONE 1 92 bc_wide ins s get r 14 get r 13 get r 0 16 93 put s 8 0 94 bc_mem ins s 56 get r 15 get r 14 2 95 put s 8 8 96 bc_mem ins s 56 get r 16 get r 14 3 97 bc_node s 8 get r 17 get r 9 get r 4 BCNONE 98 bc_emit ins s 0 99 bc_wide ins s get r 18 get r 17 get r 1 1 100 bc_node s 8 get r 17 get r 9 get r 5 BCNONE 101 bc_emit ins s 0 102 bc_wide ins s get r 19 get r 17 get r 2 1 103 bc_wide ins s get r 20 get r 11 get r 18 mul get s 33 4 104 bc_imm ins s get r 21 get r 11 BCNONE get s 33 105 bc_shift ins s get r 22 get r 11 0 get s 39 106 bc_imm ins s get r 22 get r 22 BCNONE 4 107 bc_imm ins s get r 23 get r 8 get r 10 get s 35 108 end 109 fn bc_decode ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 110 wq = get s 11 111 word = get s 12 112 byteidx = get s 13 113 if lt byteidx 3 114 put s 8 shl ulong 1 sub ulong 20 mul byteidx 8 115 put s 9 word 116 bc_imad ins s 8 get r 55 wq BCNONE 117 else 118 bc_shift ins s get r 55 wq word 4 119 end 120 bc_mask ins s get r 56 get r 55 0 shl ulong 127 20 121 bc_mask ins s get r 57 wq word shl ulong 128 mul byteidx 8 122 put s 8 1 123 if lt byteidx 3 124 put s 8 shl ulong 1 sub ulong 24 mul byteidx 8 125 end 126 put s 9 0 127 bc_imad ins s 8 get r 58 get r 57 get r 56 128 end 129 fn bc_xloads ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 130 for q ulong get s 38 131 put s 8 mul q 16 132 bc_mem ins s 57 get r add q 48 get r 26 get s 10 133 put s 10 3 134 end 135 end 136 fn bc_loads ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 137 put s 10 2 138 if eq get s 36 0 139 bc_xloads ins s r 140 end 141 bc_wide ins s get r 53 get r 12 get r 25 0 142 for row ulong get s 34 143 put s 8 mul row get s 32 144 op = ulong 56 145 if eq get s 33 16 146 op = 57 147 end 148 dst = get r add 33 mul row 2 149 bc_mem ins s op dst get r 24 get s 10 150 put s 10 3 151 end 152 put s 8 0 153 bc_mem ins s 11 get r 52 get r 53 3 154 if eq get s 36 1 155 bc_xloads ins s r 156 end 157 end 158 fn bc_dotword ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 159 for byteidx ulong 4 160 put s 13 byteidx 161 bc_decode ins s r 162 put s 9 byteidx 163 bc_ffma ins s get r 54 get r 58 get r add get s 12 48 get r 54 164 end 165 end 166 fn bc_accum ins edit ulong 8192 s edit ulong 64 r view ulong 64 row ulong to void 167 put s 9 0 168 acc = get r add 32 mul row 2 169 bc_ffma ins s acc get r 54 get r 52 acc 170 end 171 fn bc_dot ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 172 for row ulong get s 34 173 bc_inst ins s 1 get r 54 BCNONE 0 174 put s 11 get r add 33 mul row 2 175 for word ulong get s 38 176 put s 12 word 177 bc_dotword ins s r 178 end 179 bc_accum ins s r row 180 end 181 end 182 fn bc_reduce ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 183 for row ulong get s 34 184 acc = get r add 32 mul row 2 185 for q ulong 5 186 bc_node s 42 get r 59 acc BCNONE BCNONE 187 put s 22 shr ulong 16 q 188 bc_emit ins s 2 189 bc_node s 30 acc acc get r 59 BCNONE 190 bc_emit ins s 0 191 end 192 end 193 end 194 fn bc_epilogue ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 195 bc_reduce ins s r 196 bc_wide ins s get r 27 get r 23 get r 19 mul get s 34 4 197 bc_pred ins s get r 11 get r 12 198 put s 13 get s 0 199 bc_node s 54 BCNONE BCNONE BCNONE BCNONE 200 put s 22 2 201 bc_emit ins s 9 202 put s 14 bc_branch ins s add get s 0 1 true 203 for row ulong get s 34 204 bc_wide ins s get r 28 get r 12 get r 27 mul row 4 205 bc_node s 12 BCNONE get r 28 get r add 32 mul row 2 BCNONE 206 put s 21 0 207 bc_emit ins s 5 208 end 209 put s 15 get s 0 210 bc_node s 55 BCNONE BCNONE BCNONE BCNONE 211 bc_emit ins s 10 212 bc_patch ins get s 14 get s 15 213 bc_patch ins get s 13 add get s 15 1 214 end 215 fn bc_prcheck spec view ulong 8 to uint 216 if or eq get spec 0 0 gt get spec 0 32768 217 ret 1 218 end 219 if and ne get spec 1 8 ne get spec 1 16 220 ret 1 221 end 222 if and ne get spec 2 1 and ne get spec 2 2 and ne get spec 2 4 ne get spec 2 8 223 ret 1 224 end 225 if or eq get spec 3 0 gt get spec 3 32 226 ret 1 227 end 228 if ne rem get spec 0 mul get spec 1 32 0 229 ret 1 230 end 231 if gt get spec 4 1 232 ret 1 233 end 234 for k ulong 3 235 if ne get spec add k 5 0 236 ret 1 237 end 238 end 239 ret 0 240 end 241 fn bc_prbody ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void 242 bc_prologue ins s r 243 put s 41 get s 0 244 bc_pred ins s get r 23 get r 3 245 put s 42 bc_branch ins s add get s 0 1 true 246 bc_wide ins s get r 24 get r 23 get r 15 mul get s 34 get s 32 247 bc_wide ins s get r 24 get r 21 get r 24 1 248 bc_shift ins s get r 29 get r 23 0 get s 40 249 bc_wide ins s get r 25 get r 29 get r 16 div get s 32 32 250 bc_wide ins s get r 25 get r 22 get r 25 1 251 bc_wide ins s get r 26 get r 12 get r 20 0 252 for row ulong get s 34 253 bc_inst ins s 1 get r add 32 mul row 2 BCNONE 0 254 end 255 bc_inst ins s 2 get r 30 BCNONE get s 37 256 put s 43 get s 0 257 bc_loads ins s r 258 bc_dot ins s r 259 bc_wide ins s get r 24 get r 12 get r 24 mul get s 33 32 260 bc_wide ins s get r 26 get r 12 get r 26 mul get s 33 128 261 bc_wide ins s get r 25 get r 12 get r 25 get s 33 262 bc_imm ins s get r 30 get r 12 get r 30 `4294967295` 263 bc_pred ins s get r 30 get r 12 264 at = bc_branch ins s get s 43 true 265 bc_epilogue ins s r 266 bc_imm ins s get r 23 get r 6 get r 23 1 267 at = bc_branch ins s get s 41 false 268 bc_patch ins get s 42 get s 0 269 bc_node s 45 BCNONE BCNONE BCNONE BCNONE 270 bc_emit ins s 7 271 at = bc_branch ins s get s 0 false 272 note Historical tail BRA has exact fixed control independent of scheduler pending. 273 bc_tail ins at 274 end 275 fn bc_project spec view ulong 8 ins edit ulong 8192 m edit ulong 2048 stats edit ulong 4 to uint 276 if ne bc_prcheck spec 0 277 ret 1 278 end 279 s = new ulong 64 0 280 r = new ulong 64 0 281 for k ulong 2048 282 put m k 0 283 end 284 for k ulong 8192 285 put ins k 0 286 end 287 for k ulong 5 288 put s add k 32 get spec k 289 end 290 put s 37 div get spec 0 mul get spec 1 32 291 put s 38 div get spec 1 4 292 put s 39 bc_log div ulong 128 get spec 1 293 put s 40 bc_log div ulong 128 get spec 2 294 bc_initregs m s r 295 bc_prbody ins s r 296 if ne get s 3 0 297 ret 2 298 end 299 put stats 0 get s 0 300 put stats 1 get s 4 301 put stats 2 get s 5 302 put stats 3 0 303 ret 0 304 end