code wiki / (root) / nx_nofloat_prefill_gate.nx

nx_nofloat_prefill_gate.nx

buildroot/runtime/nx_nofloat_prefill_gate.nx

9688 B166 linesdepth 10pulls 30 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_prefill_gate.nx -- R0r (2026-09-17): the BATCHED PREFILL is bit-identical to the sequential per-token prefill it replaces, proven on a real model through the serve core's own generate path, and its speed is printed as values. Two runs of nsv_generate on one prompt long enough for two full NF_PREFILL_M blocks plus a partial one: A = g_nsv_prefill_batched 0 (the sequential control) B = 1 (the served default) Teeth: the fixture reached the condition (blocks and a partial block), every KV cache row of every layer for every prompt position identical, a planted cell read as a difference (the comparator is live), the generated bytes and the token count identical, the served default is batched. Prefill ms for both paths and the speedup are values. The model (2026-09-18): argv[1] > sp_engine_model -- the engine model THIS HOST has staged (NX_ENGINE_MODEL env > knowledge/stage.conf engine_model=), a valid subject because the identity holds for ANY model the engine runs -- > the stage's nx_coder_model.gguf > SKIP when none opens. A roster forks this gate BARE, so the host-declared key is how the heavy roster reaches a real model without staging another model under the coder model's name (a label that lies). The rung that answered prints on the MODEL line (model_source=argv|engine_model|stage|none) and as model_source_code. expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_nofloat_serve_core.nx nx_gate_verdict.nx nx_stage_path.nx nx_nofloat_prefill_gate.nx

imports: nx_syscalls.nxnx_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 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 ↻ gv_puts sys_write ↻ sp_engine_model sys_mmap ↻ sp_env sys_openat_rd sys_mmap ↻ 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 ↻ sys_munmap

structs

none

consts

19const PG_OUT_CAP: i64 = 8192
20const PG_MAX_NEW: i64 = 6
21const PG_SEED: i64 = 12345
22const PG_PERMIL: i64 = 1000
23const PG_REPEATS: i64 = 12 // sentence repeats: ~230 tokens, so two full 32-blocks and a partial one
24const PG_PROMPT_CAP: i64 = 4096
25const PG_GP_SLOTS: i64 = 16
26const PG_META_SLOTS: i64 = 8
27const PG_MODE_I8: i64 = 1
46const PG_MSRC_NONE: i64 = 0
47const PG_MSRC_ARGV: i64 = 1
48const PG_MSRC_ENGINE: i64 = 2
49const PG_MSRC_STAGE: i64 = 3

functions

29func pg_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
called by 1: main
31func pg_kv_snapshot(dst: *i64, nrows: i64) -> i64
called by 1: main
43func pg_same(a: *i64, b: *i64, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[i] != b[i] { return 0 } i = i + 1 } return 1 }
called by 1: main
50func pg_src_name(s: i64) -> *u8
called by 1: pg_announce
57func pg_announce(msrc: i64, mpath: *u8, esrc: i64, epath: *u8) -> i64
68func main(argc: i64, argv: *i64) -> i64