nx_nofloat_moe_block_gate.nx
buildroot/runtime/nx_nofloat_moe_block_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 16 | func 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 } |
| 17 | func mb_n(v: i64) -> i64 |
| 30 | func mb_det(i: i64) -> i64 { return ((i * 2654435761) % 8191) - 4095 } called by 1: main |
| 35 | func mb_ref_token(mp: *i64, x: *i64, gamma: *i64, t: i64, D: i64, outrow: *i64, xn: *i64) -> i64 |
| 47 | func mg2_ref_dot_rev(a: *i64, W: *i64, o: i64, ind: i64) -> i64 called by 1: mg2_ref_forward |
| 53 | func mg2_ref_forward(mp: *i64) -> i64 |
| 121 | func main() -> i64 |