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/replay.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 / replay.om` 220 lines · 3309 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Native diagnostic stream entrypoint. Binary records are observations, not executable code. 3 note No model loading, network, timer, filesystem helper or external runtime is invoked. 4 global packet uchar 65537 5 global reply uchar 2048 6 global nwords ulong 1 7 fn word i ulong to ulong 8 v = ulong 0 9 for j ulong 8 10 v = or v shl ulong get packet add mul i 8 j mul j 8 11 end 12 ret v 13 end 14 fn outword i ulong v ulong to void 15 for j ulong 8 16 put reply add mul i 8 j uchar and shr v mul j 8 255 17 end 18 end 19 fn unpack to int 20 note Common header: SCX1 magic, version1, operation1..3, reserved0; then identities/profile/rows/prior. 21 if lt get nwords 0 182 22 ret 65 23 end 24 if ne word 0 `827867987` 25 ret 65 26 end 27 if ne word 1 1 28 ret 69 29 end 30 if lt word 2 1 31 ret 77 32 end 33 if gt word 2 3 34 ret 77 35 end 36 if ne word 3 0 37 ret 65 38 end 39 for i ulong 64 40 put sid i word add i 4 41 end 42 for i ulong 6 43 put sprofile i word add i 68 44 end 45 for i ulong 77 46 put srows i word add i 74 47 end 48 for i ulong 31 49 put sprior i word add i 151 50 end 51 ret sheader 52 end 53 fn replay1 to int 54 if ne get nwords 0 190 55 ret 65 56 end 57 status = sbegin 0 58 if ne status 0 59 ret status 60 end 61 put scontrol 0 word 182 62 put scontrol 1 word 183 63 status = sselect word 184 word 185 word 186 word 187 word 188 word 189 64 if ne status 0 65 ret status 66 end 67 for i ulong 5 68 outword add i 5 get decision i 69 end 70 outword 4 5 71 ret 0 72 end 73 fn replay2 to int 74 if lt get nwords 0 183 75 ret 65 76 end 77 count = word 182 78 if gt count 224 79 ret 65 80 end 81 if ne get nwords 0 add 183 mul count 16 82 ret 65 83 end 84 status = cstart 85 if ne status 0 86 ret status 87 end 88 for r ulong count 89 for i ulong 16 90 put cobs i word add add 183 mul r 16 i 91 end 92 status = cadd 93 if ne status 0 94 ret status 95 end 96 end 97 status = cseal 98 if ne status 0 99 ret status 100 end 101 for i ulong 77 102 outword add i 5 get srows i 103 end 104 for i ulong 7 105 outword add i 82 get ccount i 106 end 107 for i ulong 21 108 outword add i 89 get crange i 109 end 110 outword 4 105 111 ret 0 112 end 113 fn replay3 to int 114 if lt get nwords 0 317 115 ret 65 116 end 117 for i ulong 5 118 put pconfig i word add i 182 119 end 120 count = word 188 121 if gt count 128 122 ret 65 123 end 124 if ne get nwords 0 add 317 mul count 56 125 ret 65 126 end 127 for i ulong 128 128 put parmids i word add i 189 129 end 130 status = pstart word 187 131 if ne status 0 132 ret status 133 end 134 for r ulong count 135 for i ulong 56 136 put pobs i word add add 317 mul r 56 i 137 end 138 status = padd 139 if ne status 0 140 ret status 141 end 142 end 143 for a ulong 3 144 status = preport a 145 if ne status 0 146 ret status 147 end 148 for i ulong 12 149 outword add add 5 mul a 12 i get summary i 150 end 151 end 152 outword 4 36 153 ret 0 154 end 155 fn publish to int 156 outword 0 `827867987` 157 outword 1 1 158 outword 2 word 2 159 outword 3 get sprofile 4 160 bytes = mul add wordout 5 8 161 done = ulong 0 162 for i ulong 2048 163 if eq done bytes 164 ret 0 165 end 166 w = write 1 reply done sub bytes done 167 if le w 0 168 ret 74 169 end 170 done = add done ulong w 171 end 172 ret 74 173 end 174 fn wordout to ulong 175 v = ulong 0 176 for j ulong 8 177 v = or v shl ulong get reply add 32 j mul j 8 178 end 179 ret v 180 end 181 fn decode bytes ulong to int 182 if ne rem bytes 8 0 183 ret 65 184 end 185 put nwords 0 div bytes 8 186 status = unpack 187 if ne status 0 188 ret status 189 end 190 if eq word 2 1 191 status = replay1 192 end 193 if eq word 2 2 194 status = replay2 195 end 196 if eq word 2 3 197 status = replay3 198 end 199 if ne status 0 200 ret status 201 end 202 ret publish 203 end 204 fn main to int 205 n = ulong 0 206 for i ulong 65538 207 if gt n 65536 208 ret 65 209 end 210 r = read 0 packet n sub 65537 n 211 if lt r 0 212 ret 74 213 end 214 if eq r 0 215 ret decode n 216 end 217 n = add n ulong r 218 end 219 ret 65 220 end