code wiki / _hdl_build / nx_nofloat_muon_ns.nx

nx_nofloat_muon_ns.nx

buildroot/runtime/_hdl_build/nx_nofloat_muon_ns.nx

4660 B113 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_muon_ns.nx -- SOVEREIGN no-float Newton-Schulz orthogonalization = the core of the Muon optimizer (K3 F405 gap; operator 2026-07-19 "beyond SOTA, novel"). Muon = MomentUm Orthogonalized by Newton-Schulz (Keller Jordan). NS quintic iteration drives a matrix toward its orthogonal polar factor: X0 = G / ||G||_F (Frobenius-normalize so spectral norm <= 1) X_{k+1} = a*X + b*(A*X) + c*(A*A*X), A = X*X^T, (a,b,c) = (3.4445, -4.7750, 2.0315) After ~5 iters X*X^T -> I. Done in PURE INTEGER Q16 (matmul accumulate-then-shift + integer isqrt) = BIT-EXACT DETERMINISTIC orthogonalization -- a float training stack CANNOT reproduce this bit-for-bit (non-associative accumulation); that is the novel exceed. Grounded: kellerjordan.github.io/posts/muon. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_nofloat_muon_ns.nx nx_nofloat_muon.nx nx_nofloat_muon_gate.nx nx_nofloat_muon_ns_gate.nx

imports: nx_syscalls.nx

imported by: nx_nofloat_muon.nxnx_nofloat_muon_gate.nxnx_nofloat_muon_ns_gate.nx

structs

none

consts

12const MN_Q: i64 = 65536 // Q16 one
13const MN_QBITS: i64 = 16
14const MN_NMAX: i64 = 8 // max matrix dim supported
16const MN_A: i64 = 225755
17const MN_B: i64 = 0 - 312934
18const MN_C: i64 = 133136
19const MN_ITERS: i64 = 5

functions

22func mn_isqrt(v: i64) -> i64
called by 1: mn_orthogonalize_it
30func mn_mm(a: *i64, b: *i64, c: *i64, n: i64) -> i64
46func mn_transpose(a: *i64, c: *i64, n: i64) -> i64
52func mn_comb(a: *i64, b: *i64, c: *i64, out: *i64, pa: i64, pb: i64, pc: i64, n: i64) -> i64
called by 1: mn_orthogonalize_it
63func mn_orthogonalize_it(g: *i64, x: *i64, n: i64, iters: i64) -> i64
92func mn_orthogonalize(g: *i64, x: *i64, n: i64) -> i64 { return mn_orthogonalize_it(g, x, n, MN_ITERS) }
called by 2: mu_stepmain calls 1: mn_orthogonalize_it
94func mn_ortho_err(x: *i64, n: i64) -> i64
called by 2: mainmain calls 3: sys_mmapmn_transposemn_mm