nx_nofloat_moe_gate.nx
buildroot/runtime/nx_nofloat_moe_gate.nx
about
nx_nofloat_moe_gate.nx -- gates the no-float MoE FFN layer (MoE rung 1, 2026-07-15). The lib does
router -> deterministic top-K -> fx_exp softmax -> K SwiGLU experts -> weighted mix, all Q16 integer.
Teeth (every one deterministic; an INDEPENDENT serial reference implementation lives in THIS file with
REVERSED reduction orders -- exact integer sums are order-free, so lib and reference must agree to the BIT):
T1 EXACT vs the independent reverse-order reference on 3 distinct inputs (0 mismatched cells)
T2 determinism: repeat call byte-identical (and T1's order-reversal already proves order-invariance)
T3 sparsity REAL + router alive: exactly K experts computed per forward (cnt), >=2 distinct experts
selected across the 3 inputs (the router discriminates; selections logged)
T4 NEG-CONTROLS: (a) corrupting one router row CHANGES a selection (routing is weight-driven, not
fabricated); (b) dense K=E output DIFFERS from sparse K=2 (sparsity has measurable effect)
T5 work happened: >= half the output cells nonzero on every input
Synthetic Q16 weights/inputs from a 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
| 18 | func mg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 19 | func mg_n(v: i64) -> i64 |
| 33 | func mg_det(i: i64) -> i64 { return ((i * 2654435761) % 8191) - 4095 } called by 1: main |
| 36 | func mg_ref_dot_rev(a: *i64, W: *i64, o: i64, ind: i64) -> i64 called by 1: mg_ref_forward |
| 42 | func mg_ref_forward(mp: *i64) -> i64 |
| 110 | func main() -> i64 |