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/native/speculation/costs.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 / native / speculation / costs.om` 237 lines · 3766 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Bounded observation collector over the existing native benchmark owner's measurements. 3 note It does not measure time, prove provenance, launch a model or synthesize missing costs. 4 global cobs ulong 16 5 global craw ulong 3584 6 global ccount ulong 7 7 global csum ulong 49 8 global crange ulong 21 9 global cbind ulong 36 10 global cshape ulong 21 11 fn cstart to int 12 if ne get sstate 0 0 13 ret 75 14 end 15 v = sheader 16 if ne v 0 17 ret v 18 end 19 if ne get srows 0 1 20 ret 77 21 end 22 for r ulong 7 23 b = mul r 11 24 if gt get srows b 1 25 ret 65 26 end 27 if eq get srows b 1 28 if ne get srows add b 1 slen r 29 ret 65 30 end 31 if ne get srows add b 2 add slen r 1 32 ret 65 33 end 34 end 35 for i ulong 3 36 put cshape add mul r 3 i get srows add b i 37 end 38 end 39 for i ulong 32 40 put cbind i get sid i 41 end 42 put cbind 32 get sprofile 1 43 put cbind 33 get sprofile 4 44 put cbind 34 get sprofile 2 45 put cbind 35 get sprofile 3 46 for i ulong 7 47 put ccount i 0 48 end 49 for i ulong 49 50 put csum i 0 51 end 52 for i ulong 21 53 put crange i 0 54 end 55 ret 0 56 end 57 fn cbound to int 58 if ne get cbind 34 get sprofile 2 59 ret 69 60 end 61 if ne get cbind 35 get sprofile 3 62 ret 69 63 end 64 for r ulong 7 65 for i ulong 3 66 if ne get cshape add mul r 3 i get srows add mul r 11 i 67 ret 69 68 end 69 end 70 end 71 ret 0 72 end 73 fn cvalid to int 74 status = cbound 75 if ne status 0 76 ret status 77 end 78 for i ulong 32 79 if ne get cbind i get sid i 80 ret 69 81 end 82 if ne get sid i get sid add i 32 83 ret 69 84 end 85 end 86 if ne get cbind 32 get sprofile 1 87 ret 69 88 end 89 if ne get cobs 13 get cbind 32 90 ret 69 91 end 92 if ne get cobs 14 get cbind 33 93 ret 69 94 end 95 if ne get sprofile 4 get cbind 33 96 ret 69 97 end 98 if ne get cobs 15 63 99 ret 65 100 end 101 r = get cobs 0 102 if ge r 7 103 ret 65 104 end 105 if ne get srows mul r 11 1 106 ret 77 107 end 108 if ne get cobs 1 get ccount r 109 ret 65 110 end 111 if ge get ccount r 32 112 ret 77 113 end 114 if ne get cobs 2 1 115 ret 75 116 end 117 if ne get cobs 3 0 118 ret 75 119 end 120 if ne get cobs 12 add slen r 1 121 ret 65 122 end 123 if eq get cobs 5 0 124 ret 65 125 end 126 if eq get cobs 11 0 127 ret 65 128 end 129 if eq r 0 130 if ne get cobs 4 0 131 ret 65 132 end 133 end 134 sum = ulong 0 135 for i ulong 6 136 v = get cobs add i 4 137 if gt v `1000000000` 138 ret 65 139 end 140 sum = add sum v 141 end 142 if lt get cobs 10 sum 143 ret 65 144 end 145 if gt get cobs 10 `1000000000` 146 ret 65 147 end 148 ret 0 149 end 150 fn cadd to int 151 status = cvalid 152 if ne status 0 153 ret status 154 end 155 r = get cobs 0 156 n = get ccount r 157 base = mul add mul r 32 n 16 158 for i ulong 16 159 put craw add base i get cobs i 160 end 161 sum = ulong 0 162 for i ulong 6 163 p = add mul r 7 i 164 v = get cobs add i 4 165 put csum p add get csum p v 166 sum = add sum v 167 end 168 note Attribute uninstrumented round gaps to host overhead, preserving full wall cost. 169 p = add mul r 7 3 170 put csum p add get csum p sub get cobs 10 sum 171 p = add mul r 7 6 172 put csum p add get csum p get cobs 10 173 base = mul r 3 174 if eq n 0 175 put crange base get cobs 10 176 end 177 if lt get cobs 10 get crange base 178 put crange base get cobs 10 179 end 180 if gt get cobs 10 get crange add base 1 181 put crange add base 1 get cobs 10 182 end 183 if gt get cobs 11 get crange add base 2 184 put crange add base 2 get cobs 11 185 end 186 put ccount r add n 1 187 ret 0 188 end 189 fn cseal to int 190 note All enabled rows need at least five observations. No partial table publication. 191 status = cbound 192 if ne status 0 193 ret status 194 end 195 if ne get sstate 0 0 196 ret 75 197 end 198 for i ulong 32 199 if ne get cbind i get sid i 200 ret 69 201 end 202 if ne get sid i get sid add i 32 203 ret 69 204 end 205 end 206 if ne get cbind 32 get sprofile 1 207 ret 69 208 end 209 if ne get cbind 33 get sprofile 4 210 ret 69 211 end 212 for r ulong 7 213 if eq get srows mul r 11 1 214 if lt get ccount r 5 215 ret 75 216 end 217 end 218 end 219 for r ulong 7 220 if eq get srows mul r 11 1 221 csealrow r 222 end 223 end 224 put sstate 11 0 225 ret 0 226 end 227 fn csealrow r ulong to void 228 n = get ccount r 229 b = mul r 11 230 for i ulong 6 231 note Ceiling each phase avoids inventing a faster zero-duration mean. 232 v = div add get csum add mul r 7 i sub n 1 n 233 put srows add add b 3 i v 234 end 235 put srows add b 9 get crange add mul r 3 2 236 put srows add b 10 n 237 end