nx_nofloat_prefix_cache_gate.nx
buildroot/runtime/nx_nofloat_prefix_cache_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 18 | func gw(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 gn(v: i64) -> i64 |
| 33 | func main() -> i64 |