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/codegen/cg_rest_emit.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 / codegen / cg_rest_emit.om` 148 lines · 2735 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Eight-word IR wire ABI from omega_gpu_om_ir.h. All scheduling and selection is Omega. 3 const ALL ulong `18446744073709551615` 4 fn av m edit ulong 512 k ulong u ulong to ulong 5 v = get m add 1 u 6 if or and eq u 0 ge v 256 and ne u 0 ge v 32 7 put m 4 1 8 ret 0 9 end 10 put m add 1 u add v 1 11 if eq u 0 12 put m add 64 v k 13 else 14 put m add 320 v k 15 end 16 ret v 17 end 18 fn ob v ulong to ulong 19 if eq and v `4294967295` `4294967295` 20 ret ALL 21 end 22 ret and v `4294967295` 23 end 24 fn os v ulong to ulong 25 if eq v ALL 26 ret 0 27 end 28 ret shr v 32 29 end 30 fn rf x edit ulong 8192 m view ulong 512 f ulong v ulong to void 31 if ge get m 0 1024 32 ret 33 end 34 put x add mul get m 0 8 f v 35 end 36 fn rb x edit ulong 8192 m view ulong 512 op ulong to void 37 rf x m 0 op 38 rf x m 1 ALL 39 rf x m 2 ALL 40 rf x m 3 ALL 41 rf x m 4 ALL 42 rf x m 5 ALL 43 rf x m 6 0 44 rf x m 7 0 45 end 46 fn ri x edit ulong 8192 m view ulong 512 v ulong to void 47 rf x m 6 and v `4294967295` 48 end 49 fn ctl x edit ulong 8192 m view ulong 512 v ulong to void 50 if ge get m 0 1024 51 ret 52 end 53 p = mul get m 0 8 54 put x add p 6 or and get x add p 6 `4294967295` shl v 32 55 end 56 fn arg x edit ulong 8192 m view ulong 512 f ulong v ulong to void 57 if ge get m 0 1024 58 ret 59 end 60 rf x m f ob v 61 p = add mul get m 0 8 7 62 sh = add mul sub f 1 8 16 63 put x p or get x p shl os v sh 64 end 65 fn cw stall ulong wb ulong rd ulong wt ulong to ulong 66 ret or or shl stall 9 shl wb 14 or shl rd 17 shl wt 20 67 end 68 fn finish x edit ulong 8192 m edit ulong 512 k ulong to void 69 if ge get m 0 1024 70 put m 4 1 71 ret 72 end 73 wt = get m 7 74 cc = cw 6 7 7 wt 75 nx = ulong 0 76 if eq k 1 77 cc = cw 14 7 7 wt 78 end 79 if or eq k 2 eq k 3 80 if eq k 3 81 wt = and wt 2 82 end 83 cc = or cw 4 0 1 wt 8192 84 nx = ulong 3 85 if eq k 3 86 nx = or get m 7 3 87 end 88 end 89 if eq k 4 90 cc = or cw 4 2 7 wt 8192 91 nx = ulong 4 92 end 93 if eq k 5 94 cc = or cw 4 7 1 wt 8192 95 nx = ulong 2 96 end 97 if or eq k 7 eq k 8 98 cc = cw 5 7 7 wt 99 if ne and get x add mul get m 0 8 7 2 0 100 nx = wt 101 end 102 end 103 if eq k 9 104 cc = or cw 1 7 7 wt 8192 105 end 106 if eq k 10 107 cc = or cw 5 7 7 wt 8192 108 end 109 ctl x m cc 110 put m 7 nx 111 put m 0 add get m 0 1 112 end 113 fn patch x edit ulong 8192 at ulong target ulong to void 114 if ge at 1024 115 ret 116 end 117 p = add mul at 8 6 118 put x p or and get x p `18446744069414584320` and sub target at `4294967295` 119 end 120 fn lopen m edit ulong 512 to void 121 d = get m 9 122 put m add 10 d get m 0 123 put m 9 add d 1 124 end 125 fn lclose m edit ulong 512 to void 126 d = sub get m 9 1 127 put m 9 d 128 n = get m 5 129 put m add 16 mul n 2 get m add 10 d 130 put m add 17 mul n 2 sub get m 0 1 131 put m 5 add n 1 132 end 133 fn flags x edit ulong 8192 m view ulong 512 v ulong to void 134 if ge get m 0 1024 135 ret 136 end 137 p = add mul get m 0 8 7 138 put x p or get x p v 139 end 140 fn choose cond bool a ulong b ulong to ulong 141 if cond 142 ret a 143 end 144 ret b 145 end 146 fn pack v ulong subr ulong to ulong 147 ret or and v `4294967295` shl subr 32 148 end