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/om/gpu/dsv41/head/launch.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 / om / gpu / dsv41 / head / launch.om` 174 lines ยท 3467 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Code is generated from the same emitter as the cubins and placed at 256-byte QMD alignments. 3 global codePos ulong 1 4 global entry ulong 38 5 global codeMap long 1 6 global codeWriteFailed uint 1 7 global bindings uint 16 8 global bindingCount ulong 1 9 global frameDirty uint 1 10 fn dsWrite w view ulong 4 to void 11 p = get codePos 0 12 b = new uchar 16 0 13 if gt get codeMap 0 0 14 for i ulong 16 15 put b i uchar and shr get w div i 4 mul rem i 4 8 255 16 end 17 if ne mapwrite get codeMap 0 p b 0 16 16 18 put codeWriteFailed 0 1 19 end 20 end 21 put codePos 0 add p 16 22 end 23 fn vocabularyDot to void 24 note One warp per vocabulary row. Each lane accumulates 80 pairs, then the warp sums in FP32. 25 dsStart 3 26 mad 20 15 2560 14 27 mad 21 14 1 Z 28 literal 22 0 29 literal 23 10 30 literal 24 1 31 literal 25 256 32 number 26 0.0f32 33 mark = get dsPc 0 34 for pair ulong 8 35 readAt 27 0 21 mul pair 128 36 readAt 28 2 20 mul pair 128 37 mad 29 27 65536 Z 38 mad 30 28 65536 Z 39 fmaReg 26 29 30 26 40 inst 18 29 27 Z Z 0xffff0000 41 inst 18 30 28 Z Z 0xffff0000 42 fmaReg 26 29 30 26 43 end 44 iadd 20 20 25 45 iadd 21 21 25 46 nextLoop 22 23 mark 24 47 for stage ulong 5 48 inst 42 27 26 Z Z shr 16 stage 49 fop 30 26 26 27 50 end 51 inst 28 Z 14 24 Z 0 52 inst 9 16 15 Z 4 4 53 put dsGuard 0 2 54 inst 12 Z 16 26 Z 0 55 end 56 fn headRms to void 57 note Sum squared BF16 hidden elements in 32 lane-local FP32 partials before reducing across the warp. 58 dsStart 2 59 mad 20 14 1 Z 60 literal 21 0 61 literal 22 20 62 literal 23 1 63 literal 24 256 64 number 25 0.0f32 65 mark = get dsPc 0 66 for k ulong 8 67 readAt 26 0 20 mul k 128 68 fmaReg 25 26 26 25 69 end 70 iadd 20 20 24 71 nextLoop 21 22 mark 23 72 for stage ulong 5 73 inst 42 26 25 Z Z shr 16 stage 74 fop 30 25 25 26 75 end 76 number 27 0.`0001953125f32` 77 number 28 1e-20f32 78 fmaReg 25 25 27 28 79 fop 41 25 25 Z 80 inst 28 Z 14 23 Z 0 81 put dsGuard 0 2 82 inst 12 Z 2 25 Z 0 83 end 84 fn headEmit to void 85 put codePos 0 0 86 for i ulong 6 87 p = mul div add get codePos 0 255 256 256 88 put entry i p 89 put codePos 0 p 90 put dsPc 0 0 91 if eq i 0 92 convert true 93 end 94 if eq i 1 95 hcPre 96 end 97 if eq i 2 98 convert false 99 end 100 if eq i 3 101 headRms 102 end 103 if eq i 4 104 rmsApply 105 end 106 if eq i 5 107 vocabularyDot 108 end 109 done 110 end 111 end 112 fn headArg v uint to void 113 i = get bindingCount 0 114 put bindings i v 115 put bindingCount 0 add i 1 116 end 117 fn headPtr m long to void 118 a = mapaddr m 119 headArg gblo a 120 headArg gbhi a 121 end 122 fn recordHeadKernel id ulong grid uint threads uint to bool 123 shape = new uint 4 1 124 put shape 0 grid 125 put shape 3 threads 126 ret recordDsGrid id shape 127 end 128 fn recordDsGrid id ulong shape view uint 4 to bool 129 gbqmd 1 130 a = add mapaddr get codeMap 0 get entry id 131 put gbq1 32 gblo shr a 4 132 put gbq1 33 or uint and shr a 36 `2097151` `20971520` 133 put gbq1 59 gblo shr a 8 134 put gbq1 34 or 65536 get shape 3 135 put gbq1 35 or 131073 shl uint 64 8 136 put gbq1 39 get shape 0 137 put gbq1 40 get shape 1 138 put gbq1 41 get shape 2 139 put gbcb 216 get shape 3 140 put gbcb 220 get shape 0 141 put gbcb 221 get shape 1 142 put gbcb 222 get shape 2 143 cb = mapaddr get gbmem 1 144 words = get bindingCount 0 145 endva = add cb add 896 mul words 4 146 put gbcb 212 gbhi endva 147 put gbcb 213 gblo endva 148 put gbused 0 0 149 gbsetup 150 if ne get frameDirty 0 0 151 note Invalidate stale sysmem cache lines after CPU writes, before the first GPU load. 152 gbmth 0 40 4 153 gbemit 0 154 gbemit 0 155 gbemit 0 156 gbemit `2281701376` 157 put frameDirty 0 0 158 end 159 gbdma cb 224 160 for j ulong 224 161 gbemit get gbcb j 162 end 163 gbdma add cb 896 uint words 164 for j ulong words 165 gbemit get bindings j 166 end 167 q = mapaddr get gbmem 2 168 gbinline q false 169 gbdma add q 8192 1 170 gbemit 1 171 gbinline add q 4096 true 172 put bindingCount 0 0 173 ret gbappend id get gbst 1 174 end