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/graph/record.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 / graph / record.om` 183 lines · 3155 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Graph constant bank codec. Input addresses are full u64; scalar cells carry raw IEEE u32 bits. 3 note Kinds RES=1 SW=2 AM=3 GA=4 GT=5 XB=6 GR=7, matching codegen_dec.h. 4 fn graph_wire v view ulong 16 w edit uint 32 kind uint to ulong 5 if or lt kind 1 gt kind 7 6 ret 0 7 end 8 for i ulong 32 9 put w i 0 10 end 11 n = ulong 7 12 if eq kind 1 13 n = 5 14 end 15 if eq kind 2 16 n = 2 17 end 18 if eq kind 3 19 n = 4 20 end 21 if or eq kind 4 eq kind 5 22 n = 3 23 end 24 if eq kind 6 25 n = 5 26 end 27 for i ulong n 28 put w mul i 2 uint and get v i `4294967295` 29 put w add mul i 2 1 uint shr get v i 32 30 end 31 if eq kind 1 32 put w 10 uint and get v 5 `4294967295` 33 put w 11 uint and get v 6 `4294967295` 34 end 35 if eq kind 2 36 put w 4 uint and get v 2 `4294967295` 37 end 38 if eq kind 5 39 put w 6 uint and get v 3 `4294967295` 40 end 41 if eq kind 6 42 put w 10 uint and get v 5 `4294967295` 43 end 44 if eq kind 7 45 put w 14 uint and get v 7 `4294967295` 46 put w 15 uint and get v 8 `4294967295` 47 end 48 ret 1 49 end 50 51 note Launch admission and dimensions shared by every recorder. Zero dimensions are refused before multiplication. 52 note q: code,gpr,threads,gx,gy,shared,nargs,peak; d: identical launch scalar projection. 53 fn graph_launch q view ulong 16 d edit ulong 16 to ulong 54 if or eq get q 2 0 or eq get q 3 0 eq get q 4 0 55 ret 0 56 end 57 if gt mul get q 2 get q 1 65536 58 ret 2 59 end 60 if ne rem get q 1 8 0 61 ret 3 62 end 63 peak = and add get q 7 2 `4294967295` 64 if lt get q 1 peak 65 ret 3 66 end 67 for i ulong 16 68 put d i get q i 69 end 70 put d 8 mul mul get q 2 get q 3 get q 4 71 put d 9 20000 72 put d 10 200000 73 ret 1 74 end 75 76 note Pure offset and size operations; host shell only supplies actual buffer base and layout fields. 77 fn graph_align v ulong to ulong 78 ret and add v 255 `18446744073709551360` 79 end 80 fn graph_va base ulong dev ulong split ulong off ulong to ulong 81 if lt off split 82 ret add base off 83 end 84 ret add dev sub off split 85 end 86 fn graph_slot base ulong row ulong width ulong to ulong 87 ret add base mul mul row width 4 88 end 89 90 note Scalar layer schedule, shared by decode, Q36 and Q38. c: model,needsnorm,attention,overlap,splitdown. 91 note op: norm1 mix2 ab3 gdn4 gather5 attention6 gate7 projection8 residual9 router10 gateup11 swiglu12 down13 combine14 prefetch15. 92 note p slots are fixed, not host-selected ordering. 0 means skip and 255 means end. 93 fn graph_order c view ulong 16 p ulong to ulong 94 model = get c 0 95 if ge p 18 96 ret 255 97 end 98 if eq p 0 99 if ne get c 1 0 100 ret 1 101 end 102 ret 0 103 end 104 if eq p 1 105 if and ne model 0 and eq get c 2 0 ne get c 3 0 106 ret 3 107 end 108 ret 0 109 end 110 if eq p 2 111 ret 2 112 end 113 if eq p 3 114 if and ne model 0 and eq get c 2 0 eq get c 3 0 115 ret 3 116 end 117 ret 0 118 end 119 if eq p 4 120 if and ne model 0 eq get c 2 0 121 ret 4 122 end 123 ret 0 124 end 125 if eq p 5 126 if and ne model 0 ne get c 2 0 127 ret 5 128 end 129 ret 0 130 end 131 if eq p 6 132 if or eq model 0 ne get c 2 0 133 ret 6 134 end 135 ret 0 136 end 137 if eq p 7 138 if and eq model 0 ne get c 5 0 139 ret 15 140 end 141 if and ne model 0 ne get c 2 0 142 ret 7 143 end 144 ret 0 145 end 146 if eq p 8 147 ret 8 148 end 149 if eq p 9 150 ret 9 151 end 152 if eq p 10 153 if ne model 2 154 ret 10 155 end 156 ret 0 157 end 158 if eq p 11 159 ret 11 160 end 161 if eq p 12 162 ret 12 163 end 164 if eq p 13 165 ret 13 166 end 167 if eq p 14 168 if and eq model 2 ne get c 4 0 169 ret 9 170 end 171 ret 0 172 end 173 if eq p 15 174 if and eq model 2 ne get c 4 0 175 ret 16 176 end 177 ret 0 178 end 179 if eq p 16 180 ret 14 181 end 182 ret 0 183 end