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/tests/host-trace/batch-test.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 / tests / host-trace / batch-test.om` 191 lines · 4286 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Compose batch-fake.om vector.om launch.om batch.om batch-test.om. Host-only. 3 global bttally ulong 2 4 global btold uchar 65536 5 global btgot uchar 65536 6 global btdig uchar 32 7 text btpass "BATCH_HOST_PASS checks=" 8 text btfail "BATCH_HOST_FAIL checks=" 9 text btpar " parity_cases=32 parity_bytes=" 10 text btcount " batch_launches=287 kicks=1 waits=1 negatives=8\n" 11 global btbytes ulong 1 12 fn btnum n ulong to void 13 if ge n 10 14 btnum div n 10 15 end 16 put btdig 0 uchar add ulong 48 rem n 10 17 r = write 1 btdig 0 1 18 end 19 fn btck ok bool to void 20 put bttally 0 add get bttally 0 1 21 if not ok 22 put bttally 1 add get bttally 1 1 23 end 24 end 25 fn btreset to void 26 put nvfault 0 0 27 put bffail 0 0 28 put gbst 3 0 29 for i ulong 4 30 put bfstat i 0 31 end 32 end 33 fn btparity n uint to void 34 gbbuild n 35 sz = get gbused 0 36 for i ulong sz 37 put btold i get gbcmd i 38 end 39 btck gbbegin 1 40 gbbody n 41 btck gbappend ulong n 0 42 btck gbbsubmit `1000000` 43 btck eq sz get gbst 2 44 r = mapread get gbpkt 0 0 btgot 0 sz 45 btck eq r long sz 46 for i ulong sz 47 btck eq get btold i get btgot i 48 end 49 put btbytes 0 add get btbytes 0 sz 50 end 51 fn btrecord n ulong to bool 52 if not gbbegin n 53 ret false 54 end 55 for i ulong n 56 gbbody 64 57 if not gbappend add ulong 100 i i 58 ret false 59 end 60 end 61 ret true 62 end 63 fn main to int 64 btck gbopen 64 65 btck gbbopen 66 note Packet and control/code/marker mappings 0-4 GPU-uncached; data operands 5-7 cached. 67 btck eq get bfallocs 0 9 68 for i ulong 5 69 btck eq get bfcache i 2 70 end 71 for i ulong 3 72 btck eq get bfcache add i 5 1 73 end 74 btck eq get bfcache 8 2 75 for i ulong 32 76 btparity uint add i 1 77 end 78 btreset 79 btck btrecord 287 80 btck gbbsubmit `1000000` 81 btck eq get bfstat 0 1 82 btck eq get bfstat 1 1 83 btck eq get gbst 6 1 84 btck eq get gbst 7 1 85 for i ulong 287 86 btck eq mapget get gbmem 3 add ulong 32 mul i 4 4 6 87 end 88 note Negative 1: future producer, then attempted submit must not send the valid prefix. 89 btreset 90 btck gbbegin 3 91 gbbody 64 92 btck gbappend 100 0 93 gbbody 64 94 btck not gbappend 101 2 95 btck not gbbsubmit `1000000` 96 btck eq get bfstat 0 0 97 btck eq get gbst 4 1 98 btck eq get gbst 5 101 99 note Negative 2: count > capacity before any send. 100 btreset 101 btck not gbbegin 513 102 btck not gbbsubmit `1000000` 103 btck eq get bfstat 0 0 104 note Negative 3: an extra launch poisons the whole recording, cannot send a prefix. 105 btreset 106 btck btrecord 1 107 gbbody 64 108 btck not gbappend 101 1 109 btck not gbbsubmit `1000000` 110 btck eq get bfstat 0 0 111 note Negative 4: failure inside a batch names index 1 and caller id 101, not final kernel 102. 112 btreset 113 btck btrecord 3 114 put bffail 0 2 115 btck not gbbsubmit `1000000` 116 btck eq get gbst 4 1 117 btck eq get gbst 5 101 118 btck eq get bfstat 0 1 119 btck eq get bfstat 1 1 120 btck eq get bfstat 2 4 121 btck eq get bfstat 3 100000 122 btck ne get nvfault 0 0 123 btck not gbbegin 1 124 btck not gbappend 104 0 125 note Negative 5: incomplete recording refused before send. 126 btreset 127 btck gbbegin 2 128 gbbody 64 129 btck gbappend 100 0 130 btck not gbbsubmit `1000000` 131 btck eq get bfstat 0 0 132 note Negative 6: malformed body length is refused and poisons the batch. 133 btreset 134 btck gbbegin 1 135 put gbused 0 3 136 btck not gbappend 100 0 137 btck not gbbsubmit `1000000` 138 btck eq get bfstat 0 0 139 note Negative 7: byte capacity overflow refused before copy, never sends a prefix. 140 btreset 141 btck gbbegin 32 142 for i ulong 16 143 put gbused 0 65536 144 ok = gbappend i 0 145 if lt i 15 146 btck ok 147 else 148 btck not ok 149 end 150 end 151 btck not gbbsubmit `1000000` 152 btck eq get bfstat 0 0 153 note Negative 8: after the reserve is consumed exactly, a further 4-byte body is refused (-75), 154 note not accepted through an unsigned wrap and later trapped by the mapping bounds check. 155 btreset 156 put nverr 0 0 157 btck gbbegin 18 158 for i ulong 15 159 put gbused 0 65536 160 btck gbappend i 0 161 end 162 put gbused 0 64956 163 btck gbappend 15 0 164 btck eq get gbst 2 `1048508` 165 put gbused 0 4 166 btck not gbappend 16 0 167 btck eq get nverr 0 -75 168 btck eq get gbst 4 16 169 btck not gbbsubmit `1000000` 170 btck eq get bfstat 0 0 171 note Existing per-launch entry still does one send and one wait with unchanged completion checks. 172 btreset 173 btck gblaunch 64 174 btck eq get bfstat 0 1 175 btck eq get bfstat 1 1 176 for i ulong 8 177 r = mapdrop get gbmem i 178 end 179 r = mapdrop get gbpkt 0 180 if ne get bttally 1 0 181 r = write 1 btfail 0 len btfail 182 btnum get bttally 1 183 ret 1 184 end 185 r = write 1 btpass 0 len btpass 186 btnum get bttally 0 187 r = write 1 btpar 0 len btpar 188 btnum get btbytes 0 189 r = write 1 btcount 0 len btcount 190 ret 0 191 end