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_effect.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_effect.om` 207 lines · 4269 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Concatenate after bw_alloc.om. No second IR: st16..23 is one existing8cell instruction. 3 note st0 count,1pending,2held,3error,4nv,5nu; st8..15 temporary component args. 4 fn bc_node s edit ulong 64 op ulong d ulong a ulong b ulong c ulong to void 5 put s 16 op 6 put s 17 d 7 put s 18 a 8 put s 19 b 9 put s 20 c 10 put s 21 BCNONE 11 put s 22 0 12 put s 23 0 13 end 14 fn bc_vreg s edit ulong 64 m edit ulong 2048 width ulong uniform bool to ulong 15 k = ulong 4 16 base = ulong 0 17 cap = ulong 256 18 if uniform 19 k = 5 20 base = 256 21 cap = 32 22 end 23 v = get s k 24 if ge v cap 25 put s 3 1 26 ret BCNONE 27 end 28 put s k add v 1 29 put m add base v width 30 ret v 31 end 32 fn bc_control stall ulong wb ulong rbar ulong wait ulong yield bool to ulong 33 v = or or shl stall 9 shl wb 14 or shl rbar 17 shl wait 20 34 if yield 35 v = or v 8192 36 end 37 ret v 38 end 39 fn bc_append ins edit ulong 8192 s edit ulong 64 to void 40 for k ulong 8 41 put ins add mul get s 0 8 k get s add k 16 42 end 43 put s 0 add get s 0 1 44 end 45 fn bc_emit ins edit ulong 8192 s edit ulong 64 kind ulong to void 46 if ge get s 0 1024 47 put s 3 1 48 ret 49 end 50 wait = get s 1 51 stall = ulong 6 52 wb = ulong 7 53 rbar = ulong 7 54 yld = false 55 next = ulong 0 56 if eq kind 1 57 stall = 14 58 end 59 if or eq kind 2 eq kind 3 60 stall = 4 61 wb = 0 62 rbar = 1 63 yld = true 64 next = 3 65 if eq kind 3 66 wait = and wait 2 67 end 68 end 69 if eq kind 4 70 stall = 4 71 wb = 2 72 yld = true 73 next = 4 74 end 75 if eq kind 5 76 stall = 4 77 rbar = 1 78 yld = true 79 next = 2 80 end 81 if or eq kind 7 eq kind 8 82 stall = 5 83 if ne and get s 23 2 0 84 next = wait 85 end 86 end 87 if eq kind 9 88 stall = 1 89 yld = true 90 end 91 if eq kind 10 92 stall = 5 93 yld = true 94 end 95 note kind11/12 SB_B prefetch,13 first takeover; pending never carries SB_B. 96 if or eq kind 11 eq kind 12 97 stall = 4 98 wb = 3 99 rbar = 1 100 yld = true 101 next = 2 102 put s 2 or get s 2 8 103 if eq kind 12 104 wait = and wait 2 105 end 106 end 107 if eq kind 13 108 if eq and get s 2 8 0 109 put s 3 1 110 ret 111 end 112 wait = or wait 8 113 put s 2 xor get s 2 8 114 end 115 if gt kind 13 116 put s 3 1 117 ret 118 end 119 stall = bc_control stall wb rbar wait yld 120 put s 22 or and get s 22 `4294967295` shl stall 32 121 put s 1 next 122 bc_append ins s 123 end 124 fn bc_inst ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong imm ulong to void 125 bc_node s op d a BCNONE BCNONE 126 put s 22 imm 127 bc_emit ins s 0 128 end 129 fn bc_imad ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong c ulong to void 130 bc_node s op d a BCNONE c 131 put s 22 get s 8 132 put s 23 shl get s 9 24 133 bc_emit ins s 0 134 end 135 fn bc_mem ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong kind ulong to void 136 bc_node s op d a BCNONE BCNONE 137 put s 21 0 138 put s 22 get s 8 139 bc_emit ins s kind 140 end 141 fn bc_ffma ins edit ulong 8192 s edit ulong 64 d ulong a ulong b ulong c ulong to void 142 bc_node s 33 d a b c 143 put s 23 shl get s 9 32 144 bc_emit ins s 0 145 end 146 fn bc_pred ins edit ulong 8192 s edit ulong 64 a ulong b ulong to void 147 bc_node s 28 BCNONE a b BCNONE 148 bc_emit ins s 1 149 end 150 fn bc_branch ins edit ulong 8192 s edit ulong 64 target ulong ispred bool to ulong 151 at = get s 0 152 bc_node s 46 BCNONE BCNONE BCNONE BCNONE 153 put s 22 and sub target at `4294967295` 154 if ispred 155 put s 23 2 156 end 157 bc_emit ins s 8 158 ret at 159 end 160 fn bc_patch ins edit ulong 8192 at ulong target ulong to void 161 note A refused emission can leave branchsite=count=1024; never patch an unallocated slot. 162 if ge at 1024 163 ret 164 end 165 k = add mul at 8 6 166 put ins k or shl shr get ins k 32 32 and sub target at `4294967295` 167 end 168 fn bc_tail ins edit ulong 8192 at ulong to void 169 if ge at 1024 170 ret 171 end 172 put ins add mul at 8 6 shl ulong `1032192` 32 173 end 174 note Typed HMMA component: BF16 A quad,B pair,C/D quads; no raw solved bytes. 175 note Component includes existing hmma_wait15+nop14 spacing before any external reader. 176 fn bc_mma ins edit ulong 8192 s edit ulong 64 m view ulong 2048 args view ulong 4 to uint 177 for j ulong 4 178 if ge get args j 256 179 ret 1 180 end 181 end 182 if or ne get m get args 0 4 ne get m get args 1 4 183 ret 1 184 end 185 if or ne get m get args 2 2 ne get m get args 3 4 186 ret 1 187 end 188 if gt get s 0 1021 189 ret 1 190 end 191 bc_node s 16 get args 0 get args 1 get args 2 get args 3 192 put s 22 shl bc_control 8 7 7 get s 1 false 32 193 put s 1 0 194 if ge get s 0 1024 195 ret 1 196 end 197 for j ulong 8 198 put ins add mul get s 0 8 j get s add j 16 199 end 200 put s 0 add get s 0 1 201 for k ulong 2 202 bc_node s 0 BCNONE BCNONE BCNONE BCNONE 203 bc_emit ins s 0 204 put ins add mul sub get s 0 1 8 6 shl bc_control sub ulong 15 k 7 7 0 false 32 205 end 206 ret 0 207 end