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/om/codegen/cg_qmma_patch.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 / om / codegen / cg_qmma_patch.om` 58 lines ยท 1186 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Patch a single encoded instruction. Result zero untouched, one patched, two refused. 3 note Word constants transcribed from the existing qmma oracle; see codegen migration documentation. 4 fn cg_qmma_read p view uchar 16 off ulong to ulong 5 v = ulong 0 6 for i ulong 4 7 v = or v shl ulong get p add off i mul i 8 8 end 9 ret v 10 end 11 fn cg_qmma_write p edit uchar 16 off ulong v ulong to void 12 for i ulong 4 13 put p add off i uchar and shr v mul i 8 255 14 end 15 end 16 fn cg_qmma_patch op ulong imm ulong p edit uchar 16 to ulong 17 if eq op 37 18 if ne imm `1178940467` 19 ret 0 20 end 21 w0 = cg_qmma_read p 0 22 w1 = cg_qmma_read p 4 23 w2 = cg_qmma_read p 8 24 if ne and w0 65535 29193 25 ret 2 26 end 27 if ne and w1 `4294967040` 0 28 ret 2 29 end 30 if ne w2 `125829120` 31 ret 2 32 end 33 cg_qmma_write p 0 or and w0 `4294901760` 29246 34 cg_qmma_write p 8 `75526399` 35 ret 1 36 end 37 if ne op 16 38 ret 0 39 end 40 if ne imm `1362114610` 41 ret 0 42 end 43 w0 = cg_qmma_read p 0 44 w1 = cg_qmma_read p 4 45 w2 = cg_qmma_read p 8 46 if ne and w0 65535 29244 47 ret 2 48 end 49 if ne and w1 `4294967040` 0 50 ret 2 51 end 52 if ne and w2 `4294967040` 268288 53 ret 2 54 end 55 cg_qmma_write p 0 or and w0 `4294901760` 29306 56 cg_qmma_write p 8 or and w2 255 11264 57 ret 1 58 end