code wiki / (root) / nx_nofloat_olmoe_forward_gate.nx

nx_nofloat_olmoe_forward_gate.nx

buildroot/runtime/nx_nofloat_olmoe_forward_gate.nx

15045 B295 linesdepth 9pulls 26 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_olmoe_forward_gate.nx -- MoE rung 5 (2026-07-15): a COMPLETE OLMoE forward -- 16 stacked real layers + token embedding + final norm + LM head -> a REAL next-token from the real 64-expert model, in deterministic no-float. Lazy per-layer weight load (attn set into REUSED buffers; experts lazy) over the zero-copy mmap. Composes every eaten-debt piece: full-quant dequant, exact scale, real rope base 1e4, sys_map_file, nolmoe_attn/nolmoe_moe (rung 4). Teeth: T1 TOKENIZER round-trip: encode(prompt) -> decode == prompt (our BPE self-consistent on OLMoE's gpt2 vocab) T2 NON-DEGENERATE logits: argmax logit strictly > min logit (the head discriminates, not all-equal) T3 DETERMINISM: the full forward's predicted id + top logit byte-identical on repeat T4 ROUTING ALIVE AT DEPTH: >=2 distinct expert-masks seen across the 16 layers' last-token routing T5 PREDICTION real: a valid non-negative vocab id, decoded + printed (honest: OUR segmentation, uniform Q16 -- HF-canonical BPE + q24 precision + H2H = rung 6, deliberately not claimed here) Requires the OLMoE gguf. Heavy (~1-3 min: 16 layers x lazy dequant + 50304-row head). Return from main. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL

dependencies 13 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_tok.nx nx_nofloat_arch.nx nx_nofloat_olmoe_forward_gate.

diagram shows first 10 each side; +3 more imports, +0 more importers in the complete lists below.

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

imported by: nobody (leaf or entry point)

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

main of_w sys_write sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_map_file sys_openat_rd sys_lseek sys_close sp_guarded sp_path sp_root sp_resolve_root sp_env sys_openat_rd ↻ sys_mmap ↻ sys_read sys_close ↻ sp_match sp_take_value sp_slen sp_conf ep_open_rd sys_mmap ↻ sys_read ↻ sys_close ↻ sp_match ↻

structs

none

consts

none

functions

28func of_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: of_nmain calls 1: sys_write
29func of_n(v: i64) -> i64
called by 1: main calls 3: of_wsys_mmapsys_write
42func of_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
44func of_load_blk(buf: *u8, hdr: *NxGgufHeader, L: i64, suffix: *u8, out: *i64, nvals: i64) -> i64
53func of_expbase_blk(buf: *u8, hdr: *NxGgufHeader, L: i64, suffix: *u8, eb: *i64, slot: i64) -> i64
65func main() -> i64