Pre-test report — PR #496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" (round 2, head 0c04b1e2)
Decision: REFER to hardware testing, with a deliberately small plan (≈2–2.5 h of cn7 GPU time), after a Step 0 desk gate.
Last round I said do not test yet. All three blockers from that report are now settled at this head, and the three lenses that were negative on substance have flipped to clean (Correctness: clean; Simplicity: clean; Prose: clean; Architecture: no blocking finding). What remains is one internal-API layering objection, one silent-drift hazard, two duplications and a pile of nits — none of which changes a byte of the path a hardware test would exercise, and none of which any reviewer asks to be re-measured. Two lenses independently endorse the approach ("belongs in the repo", "worth merging, with changes").
Head 0c04b1e2 (base main c0c4f798), 3 files, +3358/−933: selene/src/disk_store.rs, selene/src/shard.rs (not opened), docs/prefix-cache-offload.md. Author FujitsuPolycom. One author response in the thread, no human maintainer sign-off, no CI at head. Security screen: all clear (test-fixture strings such as injected private transfer failure and the unreachable!("window rate samples stay local to rank zero") guard are benign; the only agent-directed text in the thread is this repo's own flare-autobot footer, which I did not act on).
The three prior blockers, re-verified at this head
- Logical vs physical byte accounting feeding admission — fixed.
TransportEvent::InboundWindowSample { bytes, elapsed }is emitted once per completed physical shared window (inapply_shared_disk), andDiskStore::applyshort-circuits it intoself.inbound_rate.observe(bytes, elapsed)beforestats.progress += 1(disk_store.rs:3632-3635); theFetchedarm no longer samples the rate and only doesself.stats.bytes_in += bytes(:3669), sobytes_instays logical.hit()'sestimated_seconds(:3625) is now priced from physical bandwidth. A dedicated test,coalesced_restores_keep_inbound_rate_physical_and_bytes_in_logical, asserts rate stability and logicalbytes_inacross 1 vs 8 restore concurrency. The split is documented (docs/prefix-cache-offload.md:362-366and:1528-1531). - The 61.3K 8/9-vs-7/9 accuracy regression — resolved, not swallowed. The author showed Flare has no greedy decoding (temperature 0 is clamped into a positive sampling range) and that the original script used per-build prompt nonces; five cold-VRAM repeats (
seed = 1234..1238, 60,534 tokens,top_logprobs = 5) produced identical FP32 top-5 logprobs and token IDs on both arms (6/9, 8/9, 7/9, 9/9, 4/9 each). The suspect hazard is now directly covered bymisaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore, which byte-compares askip_pages = 13follower against a private-store baseline across a partial ancestor tail ([64..71)) and a partial leaf chunk carryingrow = true— the exact pair I asked for. - Benchmarks predating the tree — fixed. The table is keyed
main c0c4f798vs0c04b1e2, the head under review: 18,177.5 → 4,306.7 MB (4.22×) and TTFT 7,974.6 → 5,662.8 ms (−29.0%) simultaneous; 18,194.2 → 4,843.6 MB (3.76×) and 6,883.6 → 5,951.9 ms (−13.5%) staggered; Flash-Next 7,944.9 → 1,981.1 MB with only −3.1% TTFT. Un-rerun multi-host rows moved to "Not covered"; the single-restore cost is now labelled an expected bound withbuild_pending_demand'sdevice_inbound.len() <= 1fast path named.
What still stands, and why none of it blocks the test
- Should fix (layering, not behaviour): the metering sample rides
TransportEvent, the enum that is also the cross-rank wire event set, forcingunreachable!()inKind::of(shard.rs:477(not opened)) upheld by two hand-written guards (shard.rs:722-725(not opened),:1148-1150).selene::disk_storeispub mod(lib.rs:25), so this is also a public-API addition. A thirdKind::ofcaller would panic in release; both current paths filter first, and no hardware test reaches a third caller. The existing helper atshard/tests.rs:339mapsKind::ofover aSharded's events and survives only because those tests issue no fetch. - Should fix (metering semantics, worth sanity-checking in the test):
inbound_ratenow measures pure disk-thread time (disk::Reply.elapsedaroundworker.executeonly — oneO_DIRECTread plusxxh3, no queueing, no GPU upload), so restore estimates are slightly optimistic — the mirror image of the previous inflation.CompositeStorestill measures its own end-to-end rate, so the two stores now measure different quantities under one name. The author's live figures (6.07 GB/s single vs 7.71 GB/s 8-way) sit in the same band as #497's 8.68 GB/s end-to-end number, i.e. the bias looks small. Direction is provable from code; magnitude is not. - Should fix (silent drift):
HeaderIdentityhand-writesHashover fourteenHeaderfields with a..rest pattern (disk_store.rs:1014-1050), mirroringPartialEq1,200 lines away inshared/record.rs:136-152(not opened). I re-checked the field lists: they agree today, so coalescing is correct at this head. The hazard is future — the pending compression PRs (#504 addsHeader.packed) would silently drop a field from the hash. Not testable on hardware. - Should fix (duplication):
pick_next_pending_planrestatesLayout::record_slots(disk_store.rs:1766-1777) instead of calling the helper (geometry.rs:180-182) that the allocator it guards already uses. Cosmetic. - Known-fragile assertion:
staggered_arrival_attaches_out_of_order_to_in_flight_windowsasserts an exact total,disk_window_reads() + coalesced_windows() == 10(disk_store.rs:8487). The Value lens flags it as a load-dependent flake; it reads as a total-window invariant rather than a timing count. Run it once in Step 0 and note the result — if it flakes that is a test bug, not a product bug, and does not justify hardware time. - The one reviewer proposal that could change a tested number: the Subtractive lens wants
build_pending_demand+ thedemandplumbing deleted (~80 lines). Its own open question is whether the staggered-arrival figure (3.76× vs 4.22×) survives. Do not test that variant. Test0c04b1e2as merged, and report simultaneous and staggered separately so a later deletion has a baseline. - Process note for the maintainer, not a test question: the design call — a second reference-counted inbound lifecycle inside
Stagedrather than inDiskThread— is now argued in the PR's Why section (staging slots must stay pinned until every follower's asynchronousCopierupload finishes, whichDiskThreadcannot see) but has no recorded maintainer sign-off (AGENTS.md:204-206(not opened)). Also: #497 is not stacked on this PR (pr/497still haspump_inbound/Destination), and #496's ownpump_allstill submits maintenance first (disk_store.rs:2291-2312) —pump_allwill keep moving after merge. Neither affects what I would test.
Expected value of the hardware test
High, but sharply bounded. The mechanism is host-side Rust I/O bookkeeping: no CUDA, no record-format or Header change, no new flag/env/recipe knob, no per-model branch, sharing keyed on (path, expected Header) identity, failure isolation preserved (private child/upload errors fail one restore; shared open/read errors fail the cohort and route through is_record_read() → drop_row). Unit tests assert the right properties — byte-exact SimulatedGpu pages and rows, pool.free_slots() == pool.slot_count(), no pinned index nodes.
Two things only a run settles:
- Does the ~4× physical-read reduction and the −29% burst TTFT reproduce at head on GB10? This is the load-bearing claim.
- Is the admission-rate change harmless? Single-stream restore TTFT/bytes must stay at parity with
main; the metering nit predicts a small optimism, not a cliff.
The description's own inconsistency (8 branches claimed, but "before" 18.18 GB is ≈4.5 copies of a ~4.0 GB prefix, not 8, while bytes_in is stated as 8× single) is answered for free by testing 4 branches.
Do not spend hardware time on
- Flash-Next rows (−3.1%/−2.8% TTFT for 75% fewer reads): no decision turns on it; it costs another warm-up cycle on a second model.
- DeepSeek TP4
1.00×: reported null with a stated cause (per-rank 52.8 MB reads finish before tokenization, so requests never overlap inStaged). Nothing to validate. - Multi-host RoCE, Windows IOCP, discrete PCIe, 2-GPU
split_pools: no matching hardware (cn5 is not connected; cn7 is a single GB10). Theshard.rs(not opened) edits are unit-covered; live multi-host is out of scope for both nodes. - cn5: never connected; and even then, a different GPU class useful only as a disambiguator if cn7 surprises.
- Re-running the crate suite more than once, or otherwise using GPUs to check "tests pass" — desk work.
- The deleted-demand-index variant — do not test code that is not in this PR.
Minimal test plan — cn7, ≈2–2.5 h of GPU time (≈4 h wall clock)
Target cn7: 1× GB10 (SM121, the same class as the author's evidence). Job gets 10 CPUs / 60 GiB RAM / 16 GiB scratch. Use nvidia/Qwen3.8-27B-NVFP4 (matches the load-bearing row). The model list shows all three checkpoints at 0 GiB — confirm the NP4 weights are actually cached before starting, or a cold download will dominate the run.
Two setup traps to avoid (both verified in the docs):
- Disk limit.
docs/prefix-cache-offload.md:839-842: the limit defaults to one tenth of free space at startup. On a 16 GiB scratch that is ~1.6 GB, while a ~61K-token Qwen3.8-27B TP1 prefix is ≈954 pages × ~4.19 MB ≈ 4.0 GB of parent record. Left at default, the warm prefix is evicted and the burst restores from prefill — the test would silently measure nothing. Pass--prefix-cache-disk-limit 8Gexplicitly and confirm the startup line reports it. Child branch records are tails only, so 4 branches fit alongside the parent in 16 GiB. - Metric semantics.
flare_host_cache_bytes_in_totalis logical by design (that is the whole point of the PR) andflare_host_cache_inbound_bytes_per_secondnow reports DiskStore's disk-thread-only rate. Physical NVMe traffic must come from the device, not the store.
Step 0 — desk, on the node, no GPU (≈20 min). Stop if red.
cargo test -p selene --features test-support at 0c04b1e2; expect ≈476 passing. Watch specifically: coalesced_restores_keep_inbound_rate_physical_and_bytes_in_logical, misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore, and the == 10 assertion in staggered_arrival_attaches_out_of_order_to_in_flight_windows. Also build main (c0c4f798) once for the A/B arm.
Step 1 — the burst, A/B, simultaneous (≈60 min GPU).
Start flare run with --prefix-cache-memory 0 --prefix-cache-disk <scratch dir> --prefix-cache-disk-limit 8G. Warm one ~61K-token shared prefix plus 4 distinct child branches to disk; restart so VRAM is cold. Send 4 concurrent /v1/chat/completions follow-ups. Repeat the identical script on main. Three trials per arm, interleaved (main, head, main, head…) to cancel drift. Measure:
- Physical NVMe bytes for the restore window from
/proc/diskstats(or/sys/block/<dev>/statsectors-read deltas) on the device backing the cache directory. Expect ≈4× reduction (author's 4-way equivalent: ~4 copies ≈16 GB before vs ~4 GB after). - Burst median TTFT (ingress-to-first-token, same definition as the table). Expect ≈−20% to −30% on 27B-NVFP4 TP1.
flare_host_cache_fetched_total == 4,flare_host_cache_fetch_failed_total == 0,flare_host_cache_reused_tokens_totalwell above the prefix size,flare_host_cache_slots_in_usereturning to 0 after drain (inbound_in_flight == 0). All names verified inhelios/src/server/metrics.rs:1087-1310.
Three trials is enough: a 25–30% effect needs no tighter bound to be actionable.
Step 2 — correctness of the coalesced path (≈20 min, folded into Step 1's runs).
- All 4 branches' full generated text byte-identical to the same requests served with disk offload disabled. All four, not one.
- One staggered burst (submit branch 1, wait for first token, then submit the rest), 1 trial, no TTFT claim: confirm no hang, no
fetch_failed, coalescing still engages. - 3 repeats of the 61.3K 9-fact retrieval probe on both arms, cold-VRAM restart. The author's 5-seed parity run predicts agreement; a consistent head-only loss is stop-and-escalate, not a qualification result.
Step 3 — regressions this PR can plausibly break (≈30 min).
- Single-stream restore (one request, no sibling): TTFT and physical bytes within noise of
main. This is the path the metering nit predicts could be mis-priced and the path the "expected bound" is about. read_into/ corrupt-record path:tests/server/test_prefix_cache_offload.py— note it is not a drop-in CLI check::26-31requiresFLARE_RUN_CUDA_TESTS=1,CUDA_VISIBLE_DEVICES, andFLARE_OFFLOAD_TEST_CORE=<core .safetensors>, plus a built release CLI and--basetempon a direct-I/O filesystem (docs/prefix-cache-offload.md:1438-1447). It launches its own servers and already asserts exactly the properties I want (fetched>0,fetch_failed==0,reused_tokens>32000at:160-173; corrupt-record fallback at:185-186). Pre-check those env vars in Step 0; if no runtime core is available on cn7, substitute a hand-driven corrupt-record HTTP check rather than skipping the regression entirely — it matters more now that one shared read error fails a whole cohort.- Idle and shutdown: one restore, then
SIGTERM; clean exit. If drain is slow, capture the"N disk transport jobs did not complete"message — its count is known to mix unrelated quantities, so record rather than act on it.
Stop conditions. No read reduction in Step 1 → mechanism failure, stop and report. Any differing output in Step 2 → correctness defect, stop and report (and say which configuration diverged, since the private-baseline test should have caught it). Single-stream regression beyond noise in Step 3 → report as the under-stated cost.
Budget: 20 min desk + 60 min burst A/B + 20 min correctness + 30 min regressions + 20 min slack ≈ 2–2.5 h cn7 GPU time, one node, one model, no multi-host.
Bottom line
The change solves a real, measured, charter-aligned bandwidth problem in the correct layer. At this head its evidence is attributable to the commit that would ship, its accuracy question is answered with a five-seed parity run plus a dedicated misalignment test, and its metering error is corrected. Residual issues — a statistic riding the wire-event enum, a hand-written Hash that will rot when Header gains a field, two duplications, a stale doc paragraph, and a maintainer sign-off that has not been recorded — are worth fixing before merge but change nothing a hardware test measures. Refer it, run the plan above once on cn7, and the merge decision rests on Step 1's physical-read delta and Step 2's output parity.