nx_nofloat_moe_real_gate.nx
buildroot/runtime/nx_nofloat_moe_real_gate.nx
about
nx_nofloat_moe_real_gate.nx -- MoE rung 3 (2026-07-15): REAL MoE WEIGHTS, LAZILY. Loads a real sparse-MoE
gguf (OLMoE-1B-7B: 64 experts, top-8, per-expert ff=1024, D=2048 -- the canonical small real MoE) and runs
ONE real MoE-FFN through our integer machinery with LAZY PER-SELECTED-EXPERT dequant -- the design the
operator's environment correction settled (dequant-once-everything is the WRONG shape for MoE; sparsity
means only K experts' weights are touched per token, so fetch exactly those). Composes the proven pieces:
nac_read_config (+ the MoE metadata keys), nx_gguf 3-D tensor info, dequant_row / dequant_to_q16 windows,
mm_out_in / fx_exp / silu / qmul. HONEST SCOPE: this rung proves REAL-WEIGHT ROUTING + LAZY FETCH + THE
MIX MECHANISM on blk.0 -- NOT a faithful OLMoE model output (full arch = QK-norm etc., a later rung).
T1 MoE METADATA read from the model itself: expert_count=64, expert_used_count=8 (olmoe.* keys)
T2 3-D expert tensors located, dims EXACT (gate/up [D,ff,E]; down [ff,D,E]; router [D,E] 2-D)
T3 LAZY-SLICE LIAR-KILLER: bulk expert-slice dequant (type-aware block offset) == per-row dequant_row
on sampled rows x sampled experts x gate+down, EXACT (0 mismatches) -- kills offset-math bugs
T4 REAL ROUTING: top-8 = 8 distinct ids; deterministic repeat; a second input selects a DIFFERENT set
(the real router discriminates -- the neg-control against constant routing)
T5 REAL MIX: K experts lazily fetched (counter == 8), output dense-nonzero, byte-identical repeat
Requires /home/elderwesto/nx_stage/nx_moe_model.gguf. ~4.4GB read; slices ~400MB. Return from main.
No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 10 imports · 0 importers
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
structs
| none |
consts
| none |
functions
| 29 | func mr_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 30 | func mr_n(v: i64) -> i64 |
| 43 | func mr_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 44 | func mr_det(i: i64) -> i64 { return ((i * 2654435761) % 8191) - 4095 } called by 1: main |
| 49 | func mr_val_byteoff(ty: i64, voff: i64) -> i64 |
| 55 | func main() -> i64 |