code wiki / (root) / nx_reasoning_paged.nx

nx_reasoning_paged.nx

buildroot/runtime/nx_reasoning_paged.nx

10558 B246 linesdepth 15pulls 62 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_reasoning_paged.nx -- PREFIX-SHARED self-consistency: the paged-KV promotion of nx_reason_selfconsist. Prefill the ChatML prompt ONCE on a root sequence, then FORK per sample (refcounted page-table copy; the fork's first append copy-on-writes at most one tail block). MEASURED 1.48x vs the reset-loop at N=3 (nx_paged_fwd_gate, real model, bytes BIT-IDENTICAL per sample); the win grows with N since N-1 chunked prefills are eliminated. genealogy_id: wang_2023_self_consistency + kwon_2023_pagedattention lineage_id: substrate_reasoning_paged_v1

dependencies 12 imports · 1 importers

nx_syscalls.nx nx_tier.nx nx_prng.nx nx_bpe.nx nx_f32_llm.nx nx_f32_llm_v4.nx nx_f32_sampler.nx nx_reasoning.nx nx_kvcache.nx nx_f32_attn_paged.nx nx_reasoning_paged.nx nx_reason_paged_probe.nx

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

imports: nx_syscalls.nxnx_tier.nxnx_prng.nxnx_bpe.nxnx_f32_llm.nxnx_f32_llm_v4.nxnx_f32_sampler.nxnx_reasoning.nxnx_kvcache.nxnx_f32_attn_paged.nxnx_f32_llama_v4p.nxnx_f32_llama_v4b.nx

imported by: nx_reason_paged_probe.nx

structs

none

consts

none

functions

26func _nxrp_sample_loop(rc: *NxReasonCfg, seq: *NxPagedSeq, logits: *i64,
60func nx_reason_selfconsist_paged(rc: *NxReasonCfg, pool: *NxPagedPool,
114func nx_reason_selfconsist_batched(rc: *NxReasonCfg, pool: *NxPagedPool,