code wiki / (root) / nx_nofloat_prefix_cache_gate.nx

nx_nofloat_prefix_cache_gate.nx

buildroot/runtime/nx_nofloat_prefix_cache_gate.nx

5914 B122 linesdepth 10pulls 22 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 2 imports · 0 importers

nx_nofloat_serve_core.nx nx_gate_verdict.nx nx_nofloat_prefix_cache_gate.n

imports: nx_nofloat_serve_core.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

main gw nsv_init sys_now_ms sys_mmap sys_clock_gettime_mono nsv_log sys_write nf_pool nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn sys_mmap ↻ nx_thread_spawn_fn sys_mmap ↻ sys_mmap ↻ nsv_load_meta sys_mmap ↻ nsv_log ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻ nx_le_read_u32 ↻

structs

none

consts

none

functions

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