code wiki / (root) / nx_nofloat_moe_block_gate.nx

nx_nofloat_moe_block_gate.nx

buildroot/runtime/nx_nofloat_moe_block_gate.nx

11114 B268 linesdepth 9pulls 18 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_moe_block_gate.nx -- gates the MoE transformer BLOCK (MoE rung 2, 2026-07-15): per-token pre-norm MoE-FFN with residual at T>1 -- out[t] = x[t] + MoE(RMSNorm_gamma(x[t])). The property under test beyond rung 1: PER-TOKEN routing (each token consults the router independently). Teeth: T1 EXACT vs an independent per-token reference (rmsnorm via reversed square-sum + rung-1's reversed reference math + residual) on T=4 distinct tokens (0 mismatched cells of T*D) T2 PER-TOKEN ROUTING proven: at least two tokens select DIFFERENT expert sets (per-token cnt deltas) T3 residual REAL: block out differs from both x (transform happened) and the MoE-only output (residual added) T4 determinism: repeat call byte-identical T5 NEG-CONTROL: negated router row changes some token's selection (routing weight-driven at the block level) Synthetic Q16 weights from the fixed integer formula (no randomness, no clock). Runs in ms. expect_exit: 0 license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_nofloat_moe.nx nx_gate_verdict.nx nx_nofloat_moe_block_gate.nx

imports: nx_syscalls.nxnx_nofloat_moe.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 mb_w sys_write sys_mmap mb_det nmoe_block_forward rmsnorm_gamma_row isqrt qmul nmoe_forward mm_out_in fx_exp qmul ↻ silu qmul ↻ sigmoid fx_exp ↻ mb_ref_token rmsnorm_gamma_row ↻ mg2_ref_forward mg2_ref_dot_rev silu ↻ mb_n mb_w ↻ sys_mmap ↻ sys_write ↻ gv_ctr sys_mmap ↻ gv_verdict gv_puts sys_write ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻

structs

none

consts

none

functions

16func mb_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: mb_nmain calls 1: sys_write
17func mb_n(v: i64) -> i64
called by 1: main calls 3: mb_wsys_mmapsys_write
30func mb_det(i: i64) -> i64 { return ((i * 2654435761) % 8191) - 4095 }
called by 1: main
35func mb_ref_token(mp: *i64, x: *i64, gamma: *i64, t: i64, D: i64, outrow: *i64, xn: *i64) -> i64
47func mg2_ref_dot_rev(a: *i64, W: *i64, o: i64, ind: i64) -> i64
called by 1: mg2_ref_forward
53func mg2_ref_forward(mp: *i64) -> i64
called by 1: mb_ref_token calls 2: mg2_ref_dot_revsilu
121func main() -> i64