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/q38-head/envelope.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 / q38-head / envelope.om` 32 lines ยท 748 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Folded final RMSNorm weight bits. Return positive upper-norm f32 bits, or zero to refuse. 3 fn q38_envelope bits view uint 5120 to ulong 4 mx = ulong 0 5 for i ulong 5120 6 v = and ulong get bits i `2147483647` 7 if ge v `2139095040` 8 ret 0 9 end 10 if gt v mx 11 mx = v 12 end 13 end 14 note Tiny or zero weights use the conservative constant 1.0. 15 if lt mx `8388608` 16 ret `1065353216` 17 end 18 note 72 bounds sqrt(5120). 1025/1024 provides normalization rounding slack. 19 ex = and shr mx 23 255 20 sig = or and mx `8388607` `8388608` 21 sig = mul sig 73800 22 shift = ulong 0 23 while gt sig `16777215` bound 64 24 sig = div add sig 1 2 25 shift = add shift 1 26 end 27 ex = sub add ex shift 10 28 if ge ex 255 29 ret 0 30 end 31 ret or shl ex 23 sub sig `8388608` 32 end