#1 [high] PR #742 mechanism and code sites
PR #742 head f26d8a8, base f46a9922, +105/-21 in 9 files. Fixes pool-only capture-buffer oversizing.
Sizing chain (verified by reading head):
- selene/src/offload.rs:163-181 headroom_inner: capture = local_pages.filter(|_| self.pool_only()); chain_pages = inputs.max_sequence_pages.map_or(pages, |l| pages.min(l.get())); chain = chain_pages + layout.row_slots(); budget = host_budget/page_record_bytes; if chain > budget -> Err("host budget cannot hold a full pool capture"); intake = chain.max(intake_slots(layout,max_active)).min(budget).
- intake_slots (offload.rs:226-228) = 2max_activerow_slots + 2*WINDOW_PAGES(64) [UNCAPPED by design]
- pool_only() (offload.rs:116-118) = pool.is_some() && memory_bytes==0 && !disk_enabled()
- helios/src/runtime_core/memory.rs:562-569 new fn max_sequence_pages(context, page_tokens) -> Result (guards 0 page size/0 context)
- memory.rs:1002-1008 context from server_config["max_sequence_tokens"], filter >0; page_ceiling; max_sequence_pages; minimum_pages = active*ceil(8192/page_tokens) under KvCacheLimit::Memory (memory.rs:713, 1008)
- memory.rs:1009 capture = options.prefix_cache.pool_only() && self.cluster().is_none() (single-process only!)
- memory.rs:1133-1145 passes Some(max_sequence_pages) + capture.then_some(minimum_pages) into headroom_with_inputs_for_budget
- memory.rs:1494-1497 capture_growth(..., pages.min(max_sequence_pages.get()), ...) inside capacities
- memory.rs:1561-1566 planned_offload_host chain_bytes = pages.min(max_sequence_pages)+row_slots * page_record_bytes, Some(tier_host.max(chain_bytes))
- memory.rs:1599-1604 PlannedHostBudgets{offload_host, max_sequence_pages, async_transfer_host_caps}
- model.rs:1047-1053 prepare_offload(..., Some(planned.max_sequence_pages)); model.rs:1125,1167-1173 -> PrepareInputs
- Startup log line (from selene/src/offload.rs:432-460 summary()): "pool only: capture buffer X GiB (N slots, populate …, register …)"; emitted via helios/src/runtime_core/model.rs:1130 phase "Prepare host prefix cache" + phase.finish(summary).
IMPORTANT bug-class caveat for planning (from code-correctness lens, later dropped on verification): memory.rs:1143 passes capture.then_some(minimum_pages) (NOT allocated pages) into headroom_inner; final slab at offload.rs:699 uses geometry page_capacity (allocated). Reviewer verified this is fine because the 1133 call only computes the pre-registration tier_host reservation and the real slab is built at offload.rs:702-754 from bytes derived again from headroom_inner with local_pages = allocated capacity (offload.rs:699). Still: the actual slab size at startup is min(allocated page_capacity, max_sequence_pages)+row_slots.
Gov/doc: docs/prefix-cache-offload.md:1593-1609 documents ceiling min(GPU page capacity, ceil(max_sequence_tokens/page_tokens)) + one row. Bypass risk: with --kv-cache-limit context|concurrency, page_ceiling caps maximum_pages near max_sequence_pages, so the min() is a no-op; A/B must use default --kv-cache-limit memory.
#2 [high] Hardware test plan facts for PR #742 (pool-only capture bound)
Mode gate: capture requires options.prefix_cache.pool_only() (selene/src/offload.rs:116-118: pool.is_some() && memory_bytes==0 && !disk_enabled()) AND self.cluster().is_none() (helios/src/runtime_core/memory.rs:1009) AND local_pages.is_some() && shard.is_none() (selene/src/offload.rs:699-700). So: --prefix-cache-pool ADDR, --prefix-cache-memory 0, NO --prefix-cache-disk, single process (no --rank/--hosts). Must use default --kv-cache-limit memory (flare-cli/src/cli.rs:926-939): with context|concurrency, page_ceiling caps maximum pages ≈ ceil(context/page_tokens) (memory.rs:585-607) so the new min() is a no-op and A/B shows nothing.
Expected slab slots (chain-dominated, max_concurrency small): slots = min(allocated page_capacity, MSP) + layout.row_slots(), MSP = ceil(max_sequence_tokens/page_tokens) (memory.rs:562-569, 1007). intake floor (uncapped): intake_slots = 2max_activerow_slots + 2*64 (selene/src/offload.rs:226-228); on main slots = max(pages+row_slots, intake); with wide --max-concurrency the cap can be invisible (intake dominates) — doc example: 1,664 intake slots /11.0 GiB vs 7.1 GiB chain.
Observables: startup log line "pool only: capture buffer {GiB} ({N} slots, populate …, register …)" (selene/src/offload.rs:432-460, emitted in phase "Prepare host prefix cache", helios/src/runtime_core/model.rs:1130); startup error "host budget cannot hold a full pool capture" (selene/src/offload.rs:175-176). Metrics gauges: flare_host_cache_slots_total (host_slots[1]) & flare_host_cache_intake_slots (=0 in capture mode) & flare_host_cache_slots_in_use, flare_total_kv_pages, flare_kv_page_tokens (helios/src/server/metrics.rs:1334-1400,1467-1501). Failure signals if the cap under-sizes: flare_host_cache_dropped_total{reason="oversize"} and flare_host_cache_retry_abandoned_total{reason="slabs"} (metrics.rs:861-873, 905-912), plus flare_host_cache_stored_total (must be >0) and flare_host_cache_hits_total/reused_tokens for restore.
page_record_bytes can be derived from the startup log (bytes/slots) or cache.kv_page_bytes in flare inspect CORE --json (models: max_sequence_tokens, max_active; cache: page_tokens, pages, max_pages).
RSS: /proc//status VmHWM; cgroup memory.peak for the failure-mode run.
Hardware fit: cn5 (SM120, 4×96 GiB, 125 GiB RAM, amd64) is the right host — single-process TP1 or TP4, default --memory-limit gives ~99k pages on 96 GiB so pages >> MSP for any 128K-context core (large gap). cn7 (GB10, 1 GPU, 60 GiB unified, arm64, SM121) exercises the integrated branch (integrated_offload_host_budget, sized_concurrency 1) — smoke only.
Risk: model entries on both hosts are listed at 0 GiB, so a prepared signed core may not exist; flare models / flare inspect must confirm before any GPU run (exporting would need the full checkpoint).
Not worth GPU time: throughput/isolation benchmarks (no hot-path change; qualify/host_cache_isolation.py), full helios --ignored GPU suite, tests/server/test_prefix_cache_offload.py (does not exercise pool-only), Kani/TLA+.