code wiki / (root) / nx_nofloat_arch_moe_gate.nx

nx_nofloat_arch_moe_gate.nx

buildroot/runtime/nx_nofloat_arch_moe_gate.nx

6726 B123 linesdepth 9pulls 19 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_arch_moe_gate.nx -- gates the arch-config debt eaten 2026-07-15: EXACT attention scale + REAL rope base from metadata + fx_ln_int, across the fleet's 3 real models. Teeth: T1 fx_ln_int KATs: ln(1e6)~905419, ln(1e4)~603597, ln(2)~45426, ln(1)=0. Tol +-20 Q16-ulps = the Q16 fixed-point floor (~2e-4 rel), NOT slack: after the rope /np division + exp it is negligible, and llama.cpp computes these in f32 with comparable relative error. Exactness would need a Q24/Q32 internal accumulate -- a real but zero-value-for-rope rung, deliberately not spent here. T2 EXACT scale: hd=64 -> 8192 (IDENTITY, unchanged), hd=128 -> 5792 (was 5957 = ~2.8% high), hd=96 exact T3 Qwen2.5-0.5B config UNCHANGED: base=1e6, scale=8192 (identity -- serve/gate reproduce byte-for-byte) T4 Qwen2.5-1.5B: base=1e6, hd=128 -> scale 5792 (the correction lands on the 1.5B's real head_dim) T5 OLMoE: base=1e4 (NOT 1e6 -- the hardcoded default would have garbled OLMoE rope), ln(base) sane Reads real ggufs (arch config only, no forward) -- fast. expect_exit: 0 license_tier: ORIGINAL

dependencies 10 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_tensor.nx nx_gguf.nx nx_gguf_load.nx nx_gguf_meta.nx nx_nofloat_llm.nx nx_nofloat_arch.nx nx_gate_verdict.nx nx_nofloat_arch_moe_gate.nx

imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_nofloat_llm.nxnx_nofloat_arch.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ag_w sys_write fx_ln_int ag_near ag_n ag_w ↻ sys_mmap sys_write ↻ ag_scale isqrt sys_mmap ↻ ag_cfg sys_mmap ↻ sys_map_file sys_openat_rd sys_lseek sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻ nx_le_read_u32 ↻ _gguf_skip_value ↻ sys_mmap ↻ nac_read_config sys_mmap ↻ nx_gguf_meta_find nx_le_read_u64 ↻ nx_le_read_u32 ↻ _gmeta_bytes_equal nx_gguf_skip_value _gguf_skip_value ↻ nx_gguf_meta_read_string_l nx_le_read_u64 ↻ nx_gguf_meta_read_string_p nac_u32 sys_mmap ↻

structs

none

consts

none

functions

23func ag_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: ag_nmain calls 1: sys_write
24func ag_n(v: i64) -> i64
called by 1: main calls 3: ag_wsys_mmapsys_write
37func ag_near(got: i64, want: i64, tol: i64) -> i64 { var d: i64 = got - want; if d < 0 { d = 0 - d } if d <= tol { return 1 } return 0 }
called by 1: main
39func ag_scale(hd: i64) -> i64 { let s: i64 = isqrt(hd << 32); return 4294967296 / s }
called by 1: main calls 1: isqrt
41func ag_cfg(path: *u8, cfg: *i64) -> i64
52func main() -> i64