code wiki / (root) / nx_nofloat_prefix_cache_gate.nx

nx_nofloat_prefix_cache_gate.nx

buildroot/runtime/nx_nofloat_prefix_cache_gate.nx

6010 B124 linesdepth 10pulls 30 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_prefix_cache_gate.nx -- proves the PREFIX-KV-CACHE speed optimization is BIT-EXACT + measures the prefill-step savings (operator 2026-07-15: attack the ~2.4 tok/s prefill wall; coordinated with S2 = the compiler owns the per-matmul 4.2x, this owns the ~10x FEWER prefill matmuls for the forge's fixed crib). The forge re-prefills a FIXED crib (~130 tok) on EVERY task. nsv_generate_pfx snapshots the crib's KV rows once and restores them per task, prefilling only the task suffix. This gate proves the load-bearing property: restore-snapshot + suffix-only-prefill produces output BYTE-IDENTICAL to a full prefill (bit-exactness is the whole point of no-float). Same prompt, two paths: A = full prefill, no cache (prefill = nprompt steps) B = full prefill + snapshot rows 0..P (builds the cache) C = restore rows 0..P + prefill [P..nprompt) (prefill = nprompt-P steps) Teeth: T1 output(A) == output(C) BYTE-EXACT (the cache reuse is lossless) T2 cached prefill < baseline T3 savings ratio reported (forge: crib~130 + task~15 => ~10x fewer prefill matmuls) expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_nofloat_serve_core.nx nx_gate_verdict.nx nx_stage_path.nx nx_nofloat_prefix_cache_gate.n

imports: nx_nofloat_serve_core.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 gw sp_path sp_root sp_resolve_root sp_env sys_openat_rd sys_mmap nxa_die nxa_lock_take nxa_lock_give nxa_report_overrun sys_read sys_close sp_match sp_take_value sp_slen sp_conf ep_open_rd sys_openat_rd ↻ sys_mmap ↻ ep_join sys_mmap ↻ sys_read ↻ sys_close ↻ sp_match ↻ sp_take_value ↻ sp_slen ↻ sp_cat sp_join_name sp_slen ↻ sp_cat ↻ sp_skip_unless sp_present sys_openat_rd ↻ sys_close ↻ sys_mmap ↻ sp_root ↻ sp_skip_because sys_mmap ↻

structs

none

consts

none

functions

19func gw(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: gnmain
20func gn(v: i64) -> i64
called by 1: main calls 1: gw
34func main() -> i64