Hardware test plan — PR #742 selene,helios: bound pool-only capture buffer to max_sequence_pages
Head tested: f26d8a8 (base main f46a9922, +105/−21 in 9 files). Recommendation to the test engineer: run a 4-phase, ~20-minute GPU plan on cn5, plus a 10-minute smoke on cn7 — and nothing else. The change is a startup-only sizing clamp; only three things are worth GPU time: (a) the slab actually shrinks, (b) GPU KV pages are not throttled and startup succeeds where main failed, (c) a near-max_sequence_tokens checkpoint still publishes to the pool and restores. Throughput/isolation benchmarking would burn GPU time without information.
1. What the change does, and therefore what is measurable
In single-process pool-only mode (--prefix-cache-pool + --prefix-cache-memory 0, no disk tier) Selene registers a CPU-readable capture buffer. Before this PR its slot count was "largest GPU page capacity + one row's slots". After it:
selene/src/offload.rs:163-181(headroom_inner):chain_pages = max_sequence_pages.map_or(pages, |l| pages.min(l.get())),slots = max(chain_pages + row_slots, intake_slots) .min(budget), whereintake_slots = 2·max_active·row_slots + 128(offload.rs:226-228) — deliberately uncapped.helios/src/runtime_core/memory.rs:562-569+:1002-1008:MSP = ceil(max_sequence_tokens / contract.cache.page_tokens), guarded against zero page size/zero context.memory.rs:1133-1145feeds it into planning;memory.rs:1494-1497(capture_growth) and:1561-1566(planned_offload_host) clamp the same way, so GPU page throttling by the host budget is removed;memory.rs:1600-1604threads it throughPlannedHostBudgetsintomodel.rs:1047-1053→PrepareInputs(model.rs:1167-1173), so planning and attach cannot disagree.
Three hard preconditions, or the test measures nothing:
- Single process — capture requires
pool_only()andself.cluster().is_none()(memory.rs:1009) andshard.is_none()(offload.rs:699-700). Any--rank,--hosts, or--rendezvousdisables it. - Default
--kv-cache-limit memory(flare-cli/src/cli.rs:926-939). Withcontextorconcurrency,page_ceilingalready caps pages at ≈MSP(memory.rs:585-607), so the newmin()is a no-op — an A/B there shows zero difference and proves nothing. kv_pages ≫ MSP— otherwise the clamp cannot bind. A small-context core on a 96 GiB GPU is the ideal rig (opposite of the PR's own 1M-context example, which would need a 1M-token prompt to hit the boundary).
2. Blocker to clear before touching a GPU (do this first, ~2 minutes, no GPU)
Both hosts list their models at 0 GiB, i.e. no prepared/packed signed core is known to be present. flare run needs an existing core file; exporting one needs the full checkpoint plus a preparation run, which is far outside this plan's budget.
# on cn5
flare models list # or: ls ~/.cache/flare/cores/models/*/*/
flare inspect <CORE|MODEL> --json > /tmp/core.json (not opened)
python3 - <<'PY'
import json; m=json.load(open('/tmp/core.json (not opened)'))['model']; c=json.load(open('/tmp/core.json (not opened)'))['cache']
ctx=m['max_sequence_tokens']; pt=c['page_tokens']
print('context',ctx,'page_tokens',pt,'MSP',-(-ctx//pt),'max_active',m['max_active'])
print('kv_page_bytes',c.get('kv_page_bytes'),'pages(exported)',c.get('pages'),'max_pages',c.get('max_pages'))
PY
Choose the core that maximises kv_pages / MSP with MSP ≥ ~1,500 and a context small enough to prefill in test time (a 128K–262K-context core at 128 tokens/page gives MSP = 1,024–2,048; on 96 GiB that is typically kv_pages ≈ 40k–100k, a 20–60× gap). If only a 1M-context core exists, the plan still works for Phases 1–2 (sizing and no-throttling) with Phase 3 reduced to a partial-chain (~64K token) publication, and the full-length boundary case must be recorded as not covered.
3. Build (once, on cn5; reuse the binary for all runs)
Build in a directory with room — cn5 gives only 16 GiB scratch, so use the workspace disk, not /tmp on scratch:
git fetch origin && git checkout f26d8a8 # PR head
cargo build --locked --release --manifest-path flare-cli/Cargo.toml (not opened)
cp flare-cli/target/release/flare /workspace/flare-head
git checkout f46a9922 # base = A/B control
cargo build --locked --release --manifest-path flare-cli/Cargo.toml (not opened)
cp flare-cli/target/release/flare /workspace/flare-main
cargo build --locked --release --manifest-path selene-manager/Cargo.toml (not opened)
cp selene-manager/target/release/selene /workspace/selene
Optional, CPU-only sanity (skip if CI already showed green): cargo test --locked --release --manifest-path selene/Cargo.toml (not opened) --features test-support pool_only_sizes_registered_capture and cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server pool_capture_growth_caps.
4. Manager (shared by every run)
mkdir -p /run/selene /var/lib/selene
/workspace/selene --socket /run/selene/pool.sock --memory 8G --staging 512M \
--metrics 127.0.0.1:9108 &
In a container this needs --ipc=host (or the same /dev/shm/selene bind-mounted) and the io_uring seccomp profile from selene-manager/deploy/ only if you pass --root. /dev/shm must hold --memory + --staging; check df -h /dev/shm before blaming the PR for a startup failure. Start the manager before instances — a configured pool that cannot attach stops startup.
5. Phase 1 — the claimed win: startup slab size, A/B (cn5, 1 GPU, ~3 min GPU)
Run the same command twice with flare-main and flare-head, one GPU, narrow concurrency so the chain term dominates the uncapped intake floor:
run() { # $1 = binary label, $2 = extra concurrency flags
/workspace/flare-$1 run <CORE> --gpus 0 --host 127.0.0.1 --port 80$3 \
--prefix-cache-pool unix:/run/selene/pool.sock \
--prefix-cache-memory 0 \
--mtp-draft-tokens 0 $2 \
> /workspace/$1.log 2>&1 &
pid=$!; until curl -sf http://127.0.0.1:80$3/health >/dev/null; do sleep 0.2; done
curl -s http://127.0.0.1:80$3/metrics > /workspace/$1.metrics
grep -E 'VmHWM|VmRSS' /proc/$pid/status > /workspace/$1.rss
kill -TERM $pid; wait $pid
}
run main "--max-concurrency 1" 1
run head "--max-concurrency 1" 2
Record from each log the line pool only: capture buffer X GiB (N slots, populate …, register …) (selene/src/offload.rs:432-460, emitted in the Prepare host prefix cache phase), and from each /metrics: flare_host_cache_slots_total, flare_host_cache_intake_slots (must be 0 in capture mode — anything else means you are not in the capture path), flare_total_kv_pages, flare_kv_page_tokens. VmHWM gives per-process host high-water mark (docker stats/cgroup memory.peak if containerised).
Pass criteria (all must hold):
| Check | Expected |
|---|---|
| Capture path engaged | both logs contain pool only: capture buffer; flare_host_cache_intake_slots == 0 |
| Head slot count | slots_head == min(kv_pages, MSP) + row_slots (derive row_slots from the main run: slots_main − kv_pages) |
| Head < main | slots_head < slots_main, and slots_main / slots_head ≈ kv_pages / MSP (expect ≥ 10× on a 96 GiB GPU with a 128K-context core) |
| Bytes | page_record_bytes = bytes_main / slots_main; predicted head buffer = slots_head × page_record_bytes, within rounding of the logged GiB |
| RSS | VmHWM_head − VmHWM_main ≈ slots_main × page_record_bytes − slots_head × page_record_bytes (±1 GiB, since the slab is populated and registered eagerly) |
| No KV throttling | flare_total_kv_pages head ≥ main; equality is the expected result when the host budget was not binding |
Phase 1b (one more run, ~1 min): repeat flare-head with the core's default (wide) --max-concurrency. Expected: slots rise to the uncapped intake floor 2·max_active·row_slots + 128. This is the PR's documented, intentional limitation ("automatic intake is not capped") — record the number, do not fail the run on it. It is the one user-visible caveat the title omits, and it is what tells the maintainer how much of the win survives a wide-concurrency deployment.
6. Phase 2 — the reproduction the PR is justified by: constrained host RAM (cn5, ~5 min GPU)
The claim is "startup succeeds where main exceeded container memory". Reproduce it deterministically with a cgroup rather than guessing:
systemd-run --scope -p MemoryMax=24G -p MemorySwapMax=0 -- \
/workspace/flare-main run <CORE> --gpus 0 --port 8031 --prefix-cache-pool unix:/run/selene/pool.sock \
--prefix-cache-memory 0 --max-concurrency 1 2>&1 | tee /workspace/main-24g.log
systemd-run --scope -p MemoryMax=24G -p MemorySwapMax=0 -- \
/workspace/flare-head run <CORE> --gpus 0 --port 8032 --prefix-cache-pool unix:/run/selene/pool.sock \
--prefix-cache-memory 0 --max-concurrency 1 2>&1 | tee /workspace/head-24g.log
Pass criteria: main fails or degrades — either the clean error host budget cannot hold a full pool capture (selene/src/offload.rs:175-176), an OOM kill, or flare_total_kv_pages visibly smaller than Phase 1's; and head reaches /health with flare_total_kv_pages equal to its Phase 1 value. Tune MemoryMax once (24G → 32G → 16G) until main fails; one retry is enough. If main also succeeds at 16 GiB, the win is real but small on this core/GPU — say so in the report instead of forcing a failure.
7. Phase 3 — the risk this PR introduces: can a long chain still publish and restore? (cn5, ~8 min GPU; the highest-value functional check)
The cap is only safe if no captured chain exceeds MSP. Unit tests prove the arithmetic; only hardware proves the end-to-end path (record → pool → restore) at the boundary. Run on flare-head, pool-only:
- Send one prompt sized to produce a checkpoint chain of
0.9–1.0 × max_sequence_tokens(a repeated filler sentence, ~0.95 × contexttokens; keep it under the core's context to leave room for output). Ask a question answerable only from the middle of it, e.g. "…Item 211 records code 596… What code does item 211 record?" and require the exact answer. - Wait for drain: poll
/metricsuntilflare_host_cache_outbound_in_flight == 0andflare_host_cache_inbound_in_flight == 0. - Force GPU eviction of that checkpoint (send
flare_snapshot_capacity + 8distinct short requests, the pattern used bytests/server/test_minimax_m3_cache.py:128-137), then resend the identical prompt.
Pass criteria:
| Metric | Expectation |
|---|---|
flare_host_cache_stored_total |
> 0 after step 1 (the chain fit the slab) |
flare_host_cache_dropped_total{reason="oversize"} |
0 — non-zero means the slab is smaller than one chain |
flare_host_cache_retry_abandoned_total{reason="slabs"} |
0 — non-zero means publications are being refused for slot space |
flare_host_cache_root_pages_total |
≈ the chain's page count, i.e. close to MSP (confirms a full-length chain, not a short one) |
flare_host_cache_hits_total, flare_host_cache_reused_tokens_total |
increase after step 3; usage.prompt_tokens_details.cached_tokens > 0; answer identical to step 1 |
flare_host_cache_fetch_failed_total, store_failed_total |
0 |
This is the check that would have caught the (later-refuted) "slab sized from minimum_pages" concern, and it is the only one that exercises PlannedHostBudgets::max_sequence_pages reaching prepare_offload on real geometry. If only a 1M-context core is available, run the same at ~64K tokens and label the full-boundary case "not covered".
8. Phase 4 — cn7 (GB10, 1 GPU, 60 GiB unified, arm64) smoke, ~10 min, no A/B
cn7 exercises the other branch: integrated > 0 (memory.rs:1140), sized_concurrency = 1 (offload.rs:683), integrated_offload_host_budget instead of host_pool_budget. One flare-head run, same pool-only flags, --gpus 0, plus one flare-main control only if MSP < kv_pages on this GPU:
- Startup reaches
/health; log showspool only: capture buffer …;flare_host_cache_intake_slots == 0. slots_head == min(kv_pages, MSP) + row_slots(or the intake floor if larger).- Repeat Phase 3's short variant (a ~30K-token prompt):
stored_total > 0, zero oversize drops, one hit on the repeat. - Note for the report: GB10 is SM121/unified memory and the PR does not change device unified-memory accounting — a failure here that also fails on
mainis pre-existing.
Skip cn7 entirely if cn5 shows the slab never shrinks (MSP ≥ kv_pages): the clamp is inert on both hosts and there is nothing to validate.
9. What to compare, and what counts as a failure
Collect into one table before writing up: binary, core, flags, kv_pages, page_tokens, max_sequence_tokens, MSP, row_slots, logged slots and GiB, VmHWM, and Phase 3 counters.
Treat as test-plan failures (do not merge on this evidence): head slots ≠ min(kv_pages, MSP) + row_slots; head slots ≥ main's; flare_total_kv_pages lower on head than on main (the clamps should only relax throttling); any oversize drop or slabs retry on a long chain; a restore that returns a different answer than the cold run; a startup error on head that main does not also produce with identical flags.
Treat as documented, expected, not failures: the uncapped intake floor dominating at wide --max-concurrency; startup succeeding where main failed; a core/GPU combination where MSP ≥ kv_pages and nothing changes.
10. Explicitly do not spend GPU time on
- Any
--kv-cache-limit contextorconcurrencyrun.page_ceilingalready bounds pages to ≈MSP, so the patch is a no-op there and the A/B is guaranteed flat (memory.rs:585-607). - Throughput / latency / isolation benchmarking (
qualify/host_cache_isolation.py(not opened),scripts/benchmark_*.py). Nothing added lies on a per-step, per-request or per-victim path; the only runtime effect is onemin()per probe inside the once-per-startupcapacities()binary search (memory.rs:1494). A ±2 % claim here would be noise. tests/server/test_prefix_cache_offload.pyas-is: it never passes--prefix-cache-pool, sopool_only()is false and the capture path never runs. Worth one run only if you also want the offload-disabled regression, which is unaffected by this diff (that file's own coverage already exists).- The full
helios -- --ignoredGPU suite (each test loads a whole core):helios/src/offload/gpu_tests.rs::memory_store_round_trips_a_multi_window_checkpointis enough, and Phase 3 supersedes it for this change. - Disk-tier, multi-host/
--rank, RoCE, Windows, Kani, TLA+. No.proto, core-format, lifecycle or scheduler-state code is touched;docs/verification.md:15asks for a live trace for a memory cost claim, which Phase 1 provides. - Compression runs.
--lossless-kv-compressionwith a pool is rejected at startup (docs/prefix-cache-offload.md:99).
11. Honest limits of this plan
- It cannot prove the PR's own published numbers (18.74–19.06 GiB vs 7.83–8.04 GiB on Qwen4-35B-A3B, 11.8 GiB / 16,475 slots), because that build was
v0.6.0(f705086), not headf26d8a8, and that checkpoint is not on either machine. Phase 1 replaces it with a first-party A/B on head and is the number to publish. - The single highest-value semantic risk — that a full-length chain is storable — depends entirely on Phase 3 reaching ≥ 0.9 × context. If the available core's context is too large to prefill in the time budget, that coverage must be reported as missing rather than assumed.
- Shared-pool edge case not covered here: two workers of the same core with different
max_sequence_tokensagainst one pool would have different caps. The lead review dropped this as non-applicable (pool restores copy throughpool.start_copies, not the local capture slab) — cheap to confirm by keeping both Phase 1 runs attached to the same manager (they share the pool by construction); no extra run needed. --max-concurrencymust be an integer the core's prepared capacities accept (flare-cli/src/cli.rs:976-978); if1is rejected, use the smallest accepted value and recompute the intake floor rather than abandoning the narrow-concurrency run.