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/omega-mv/blob/main/gpu/nvidia/checks/streams.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / nvidia / checks / streams.om` 197 lines ยท 4534 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note gpu/nvidia/checks/streams.om: the check of gpu/nvidia/om/streams/streams.om (streams_words) and 3 note gpu/nvidia/om/streams/xq.om (streams_xq) against the C oracle of CUDApp tests/streams_diff_test.c, as 4 note gpu/nvidia/checks/streams.tsv (written outside the tree by the C, see README.md, Oracles). Composed after those 5 note two units and lib.om (gpu/nvidia/checks/checks.tsv). 6 note Case 0 WM IM MODE BAR CHUNKS WORDS HASH: the chunks of the C sweep over a 4-launch list (launch i waits when bit i 7 note of WM is set, is independent when bit i of IM is set), assembled as the C binding emit_chunk_om assembles them: 8 note op 0 setup, op 1 per launch, and in inline mode (o 31 = 2) op 2 then the 96 QMD words for the second-level QMD 9 note (+0x200) and the QMD, then op 3. Over stamps 0..1, first_barrier_none 0..1, skip 0..4, done 0..1 in that order 10 note the chunk count, the word total and the FNV-1a-64 over (word count, words...) of each chunk must equal the C. 11 note A word count above what the C binding accepts for the op (18, 30, 3, 25) fails the case. 12 note Case 1 PAGE K VA CLR0 CLR1: op 5. Case 2 PRESENT LEN C0 MAX R: op 4. Case 3 I OPEN R: streams_xq. 13 text t_name "STREAMS" 14 fn cname to void 15 for i ulong len t_name bound 64 16 ckoc ulong get t_name i 17 end 18 end 19 note sd_s: 0 pass (0 count, 1 hash), 1 chunk word count, 2 hash 20 global sd_s ulong 4 21 fn sdfnv h ulong v ulong to ulong 22 ret mul xor h v `1099511628211` 23 end 24 fn sdw v ulong to void 25 if eq get sd_s 0 0 26 put sd_s 1 add get sd_s 1 1 27 else 28 put sd_s 2 sdfnv get sd_s 2 v 29 end 30 end 31 fn sdput o view ulong 32 k ulong max ulong to bool 32 if gt k max 33 ret false 34 end 35 for j ulong k bound 32 36 sdw get o j 37 end 38 ret true 39 end 40 note the sweep's QMD bytes: word j of the list's QMD area is j * `2654435761` mod 2^32 (1024 bytes per launch) 41 fn sdqmd w ulong to void 42 for t ulong 96 bound 96 43 sdw and mul add w t `2654435761` `4294967295` 44 end 45 end 46 note sd_p: the chunk being assembled: 0 WM, 1 IM, 2 mode, 3 barrier, 4 stamps, 5 first_barrier_none, 6 skip, 7 done 47 note (globals, so that no function needs more than six parameters or sixteen live values) 48 global sd_p ulong 8 49 note the inline header of QMD h (0 the second-level QMD at q1 + 0x200, 1 the QMD at q1) of launch i, then its words 50 fn sdinl i ulong h ulong to bool 51 a = new ulong 16 0 52 o = new ulong 32 0 53 q1 = add `20015998341120` mul i 1024 54 if eq h 0 55 put a 0 add q1 512 56 else 57 put a 0 q1 58 end 59 if not sdput o streams_words 2 a o 3 60 ret false 61 end 62 if eq h 0 63 sdqmd add mul i 256 128 64 else 65 sdqmd mul i 256 66 end 67 ret true 68 end 69 note launch i: op 1 in the call form of emit_chunk_om, then the inline QMDs when o 31 is 2 70 fn sdlaunch i ulong to bool 71 a = new ulong 16 0 72 o = new ulong 32 0 73 put a 0 i 74 put a 1 get sd_p 7 75 if ne and shr get sd_p 0 i 1 0 76 put a 2 add `280220846264880` mul 16 i 77 end 78 put a 3 and shr get sd_p 1 i 1 79 put a 4 get sd_p 6 80 put a 5 get sd_p 5 81 put a 6 get sd_p 3 82 put a 7 get sd_p 4 83 put a 8 `35187254427648` 84 put a 9 get sd_p 2 85 put a 10 add `20015998341120` mul i 1024 86 if not sdput o streams_words 1 a o 30 87 ret false 88 end 89 if ne get o 31 2 90 ret true 91 end 92 if not sdinl i 0 93 ret false 94 end 95 ret sdinl i 1 96 end 97 note one pass over the chunk's words; false when the generator refused or overran 98 fn sdpass to bool 99 a = new ulong 16 0 100 o = new ulong 32 0 101 if not sdput o streams_words 0 a o 18 102 ret false 103 end 104 done = get sd_p 7 105 for t ulong sub 4 done bound 4 106 if not sdlaunch add done t 107 ret false 108 end 109 end 110 put a 0 get sd_p 4 111 put a 1 `35187254427648` 112 put a 2 4 113 put a 3 `123148505645328` 114 ret sdput o streams_words 3 a o 25 115 end 116 fn sdchunks to bool 117 for f ulong 4 118 put sd_p f cknum add f 1 119 end 120 put sd_s 2 `14695981039346656037` 121 nc = ulong 0 122 nw = ulong 0 123 for st ulong 2 124 for fb ulong 2 125 for skip ulong 5 126 for done ulong 2 127 put sd_p 4 st 128 put sd_p 5 fb 129 put sd_p 6 skip 130 put sd_p 7 done 131 put sd_s 0 0 132 put sd_s 1 0 133 if not sdpass 134 ret false 135 end 136 n = get sd_s 1 137 put sd_s 0 1 138 put sd_s 2 sdfnv get sd_s 2 n 139 if not sdpass 140 ret false 141 end 142 nc = add nc 1 143 nw = add nw n 144 end 145 end 146 end 147 end 148 if ne nc cknum 5 149 ret false 150 end 151 if ne nw cknum 6 152 ret false 153 end 154 ret eq get sd_s 2 cknum 7 155 end 156 fn crow to bool 157 k = cknum 0 158 a = new ulong 16 0 159 o = new ulong 32 0 160 if eq k 0 161 if ne ckcnt 8 162 ckbad 163 end 164 ret sdchunks 165 end 166 if eq k 1 167 if ne ckcnt 6 168 ckbad 169 end 170 put a 0 cknum 1 171 put a 1 cknum 2 172 if ne streams_words 5 a o cknum 3 173 ret false 174 end 175 if ne get o 0 cknum 4 176 ret false 177 end 178 ret eq get o 1 cknum 5 179 end 180 if eq k 2 181 if ne ckcnt 6 182 ckbad 183 end 184 for j ulong 4 185 put a j cknum add j 1 186 end 187 ret eq streams_words 4 a o cknum 5 188 end 189 if eq k 3 190 if ne ckcnt 4 191 ckbad 192 end 193 ret eq streams_xq cknum 1 cknum 2 cknum 3 194 end 195 ckbad 196 ret false 197 end