#1 [high] PR 496 facts and verdict basis
PR 496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" by FujitsuPolycom, open, into main. Files: selene/src/disk_store.rs (+2803/-913 nominal, but ~900 of those are the DiskStore block relocated inside the same file, so real net production code is roughly +900-1000 lines in impl Staged/new types) and docs/prefix-cache-offload.md (+5/-1). Zero discussion on the PR (only the flare-autobot case-file comment).
Design: splits InboundRecord into HostInbound (unchanged private path for read_into/composite) and new DeviceInbound (fetch/pump_device_inbound). New machinery: SharedSegment/SharedSegmentId (one open file handle per (path, Header), acquire_shared_segment disk_store.rs:1362), SharedWindow/SharedWindowId (one staged 64-page window fanned out to per-follower GPU uploads; struct 1070), SharedFileState (Unopened/Opening/Opened/Closing/Closed, 1006), SharedWindowPhase, WindowFollower, PlanState, DeviceActiveWindow, DeviceSegmentRef. plan_aligned_windows (700) slices on 64-page WINDOW_PAGES boundaries instead of per-restore skip offsets. pump_device_inbound (1811) is 5 passes (reap/detach, attach, sweep, start windows, submit reads, per-follower uploads, close, completion) with helpers find_reusable_window (1568), find_best_existing_window_for (1602), build_pending_demand (1647), pick_next_pending_plan (1684), detach_unwinding_windows (1726), sweep_shared_windows (1755), segment_needs_disk_reads (1773), fail_segment_users (1449), fail_window (1475), apply_shared_disk (1489), apply_device_transfer (1548). Test-support counters disk_opens/disk_window_reads/coalesced_windows (1227).
Correctness checks I did: DiskThread replies are per-job FIFO (disk.rs:447-455) so the pending_row_reads VecDeque FIFO matching Operation::ReadRow (window field is 0 at disk.rs:626) is sound, mirroring the old code. Busy/close accounting extended to shared_segments/shared_windows (2344). Fetched waits for last-user segment settle (Pass 5e, 2205-2255) because the index pin is released on Fetched in DiskStore::apply (3609-3615) - correct.
Charter fit: Goal 4 "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene"; docs goal. Not a non-goal. Layer is right (selene runtime, not per-model).
Benefit (author's own numbers): 4 branches sharing a ~61K ancestor on GB10 SM121 disk-only: physical NVMe reads 18.0 GB -> 4.29 GB (-76%, 4.21x); staggered 18.1->4.56 GB (3.97x); Flash-Next TP1 7.94->1.98 GB; TP2 8.39->2.08 GB. Burst median TTFT: 27B TP1 8484->7112 ms (-16.2%), staggered 8200->6539 ms (-20.3%, claim is 3259 ms "dropped" which is only true as a sum of two rows); Flash-Next TP1 simultaneous 3333.5->3337.1 ms (0%), staggered 3052.9->2977.0 (-2.5%); TP2 -4.5%/-6.9%; DeepSeek TP4 4-host 1.00x reads, TTFT -1.1%. So the latency win is concentrated on 27B TP1 bursts; smaller models see ~0-7%.
Costs/risks found: single disk thread at WINDOW_CREDITS(in-flight windows) with shared windows holding pool slots until all followers upload (1070-1092 comment); a coalesced window occupies slots for the max of follower upload times; fair ordering weakened because pick_next_pending_plan (1684) prefers sibling demand; fetch dispatch now scans shared_windows/shared_segments linearly per pump call and build_pending_demand (1647) clones PathBuf+Header keys into a HashMap every pump while free slots exist (author admits "per-pump demand indexing"); acquire_shared_segment (1362) scans all segments on every fetch; one shared read error fails all attached restores (intentional). Timing-sensitive tests: staggered test asserts coalesced_windows() >= 2 and disk_window_reads()+coalesced_windows()==10 (8444-8445).
Evidence gaps the author states: single-pass SM121 runs not repeated after the demand-index/close-count edits or rebase; helios FLARE_RUN_CUDA_TESTS=1, discrete PCIe GPUs, Windows serving, live CompositeStore/PooledStore GPU serving not run. CI does run selene with --features test-support (native-serving.yml:51) so the SimulatedGpu tests do execute.
Alternatives considered: (a) keep single private path but dedupe via copier replication fan-out (copier.rs:31-40) - rejected, replication is for identical rank shares and pages still need one disk read to shared host slot; (b) serve restores out of the host/MemoryStore tier rather than disk staging - many deployments run --prefix-cache-memory 0 at 61K prefixes (~4.19 MB/page * 960 pages ~ 4 GB), so not a substitute; (c) let scheduler dedupe by ancestor checkpoint and share one ticket - Helios tickets are per-key (scheduler.rs:1668-1691) and the pages need different page ranges per branch, so not equivalent.
Companion PR #497 (selene-spark-pipeline) also touches Staged::pump_all; author says merge 496 first then rebase 497. Both from the same author, both unmeasured together.
Verdict leaning: worth it with changes - the problem is real and charter-aligned, the reduction is large on the target hardware, but the implementation is a ~1000-line state machine in an already 8.8K-line hot file and the PR needs a rebase/re-measure of the exact merged form, a guard against per-pump demand rebuild, and documented fair-ordering trade-off.
#4 [high] PR 496 head 0c04b1e2 — prior review items status (run 251)
Head reviewed: 0c04b1e2 (adds docs +33, shard.rs +10, disk_store.rs reworked). disk_store.rs now 9,358 lines total (was 6,976 on main).
FIXED at head (vs my 2026-11-24 report):
- Parity blocker settled: 5 cold-VRAM repeats (seed 1234..1238), identical FP32 top-5 logprobs + token IDs main vs head; new test
misaligned_follower_attaching_to_shared_partial_tail_and_row_matches_private_restore(disk_store.rs ~8790-8990) compares follower byte-exactly with a privateskip_pages = 13restore. - inbound_rate now physical:
TransportEvent::InboundWindowSample { bytes, elapsed }emitted per completed shared window (disk_store.rs:1617-1620), observed inDiskStore::apply(3632-3635) before the stats match;bytes_instays logical (3669). Forwards on rank 0 inSharded::absorb_local(shard.rs:722-725), dropped byPeer::forward(1148-1150). Testcoalesced_restores_keep_inbound_rate_physical_and_bytes_in_logical(9108+). - Docs §2.4 rewritten (docs/prefix-cache-offload.md:337-366) covering 64-page file-boundary alignment, immutable+pinned invariant, close-before-Fetched, both failure scopes, sibling-demand preference relaxing arrival order, physical rate vs logical bytes.
- Module doc updated (disk_store.rs:14-27).
- WindowKey/SegmentKey/HeaderIdentity(Arc) +
window_indexO(1) lookup (1646);build_pending_demandfast-returns empty atdevice_inbound.len() <= 1(1736), built once per pump, Arc clones not PathBuf copies. plan_windows(segments, align_to_window)unified with callers false (host) / true (device).- Benchmarks re-measured at head; TTFT arithmetic now checks out (7974.6->5662.8 = -29.0%; 6883.6->5951.9 = -13.5%; 3327.5->3225.0 = -3.1%; 3137.7->3049.9 = -2.8%).
REMAINS:
- Exact-total flake still present:
assert_eq!(staged.disk_window_reads() + staged.coalesced_windows(), 10)at disk_store.rs:8487 (comment at 8481-8484 admits W3 coalescing is timing-dependent). Kind::ofhasunreachable!("window rate samples stay local to rank zero")for the new variant (shard.rs:476-478) — real panic path in release if any future caller passes the event unfiltered; the two current call sites filter first (722, 1148).- Benchmark topology inconsistency: prose says "8 child branches" but physical-read totals are byte-identical to the previous iteration described as 4 branches (18,177.5 -> 4,306.7 MB), 8 concurrent ~4 GB restores on main would be ~32 GB, and after (4.3 GB) is ~1 copy => the 4.22x looks like ≈4 overlapping restores. Also ratio labels slightly off: 7,944.9/1,981.1 = 4.01 (printed 3.99x), 7,958.0/2,251.5 = 3.53 (printed 3.52x).
- #497 (also FujitsuPolycom, open, head cd5a366b) rewrites
Staged::pump_allincl. MAINTENANCE_DEFER_LIMIT; both now claim "merge in either order". #496's pump_all is at disk_store.rs:2291. - Metering semantics shift:
DiskStore::hitpricesestimated_seconds = bytes / inbound_rate(3625) but inbound_rate is now raw disk-thread window throughput, excluding GPU upload and queueing; previously it was per-restore end-to-end (main observedjob.started.elapsed()).worth_fetching(store.rs:423-438) therefore admits more restores; live disk-only runs were fine but the basis changed. - Still not covered: live CompositeStore/PooledStore GPU serving, 2-GPU split_pools, discrete PCIe, Windows serving, multi-host RoCE (the shard.rs surface).
#5 [high] PR 496 head 0c04b1e2 — benchmark math and code cross-checks
Cross-check at head 0c04b1e2:
- 4.22x is NOT consistent with 8 concurrent restores: after = 4,306.7 MB ≈ exactly one ~61K-prefix copy (61,054/64 = 954 pages x 4.19 MB ≈ 4,003 MB) + 8 tiny tails; before = 18,177.5 MB ≈ 4.5 copies, not 8 (8 would be ~32 GB). So either the burst was ~4-way at read time or
beforeis under-counted. Flash-Next: 7,944.9/1,981.1 = 4.01 (printed 3.99x), 7,958.0/2,251.5 = 3.53 (printed 3.52x) — rounding, acceptable. - TTFT arithmetic now correct (previous iteration's slips fixed): 7974.6->5662.8 = -29.0%; 6883.6->5951.9 = -13.5%; 3327.5->3225.0 = -3.1%; 3137.7->3049.9 = -2.8%. Physical read -76.3% / -73.4% / -75.1% / -71.7% all check out.
- Line counts: main disk_store.rs = 6,976 lines (tests start 2,827); head = 9,358 (tests start 3,937). Net production +1,110 lines, tests +1,272.
- Charter synergy: #497 alone shrinks disk-only intake to
intake_slots(layout, 1)= 2 windows and documents that concurrent unique-prefix restores serialize through them (integrated_two_window_intake_serializes_concurrent_unique_prefix_restores). #496 is what lets 8 shared-ancestor restores share those same 2 windows (each fetch holds <= WINDOWS_IN_FLIGHT=2 credits; followers attach rather than allocate). So the two PRs are complementary, not just touching the same function. - Metering semantics change to note:
DiskStore::hit(disk_store.rs:3615-3628) pricesestimated_seconds = record_bytes / inbound_rate; on main inbound_rate observed per-restore end-to-end (job.started.elapsed(), old code at 3668-3671), now it observes disk-thread window throughput excluding queueing and excluding the GPU upload. Consumers: worth_fetching (store.rs:423-438) and restore_wait.defer (helios/src/server/runtime.rs:2796), plus the user-facing metric flare_host_cache_inbound_bytes_per_second (helios/src/server/metrics.rs:640). Live numbers 6.07-9.01 GB/s sit in the same band as #497's measured 8.68 GB/s single-restore end-to-end throughput, so the bias looks small, but it is a definition change users watch. - Multi-host: Peer::forward drops the sample (shard.rs:1148-1150), so rank-0 inbound_rate measures only rank-0's own NVMe; on main it was aggregate at Fetched. Defensible per-rank proxy, but an uneven slower peer no longer inflates the estimate. Part of the "not covered: RoCE" surface.
- Verified sound: window_index never clobbered by a live entry (Pass 4 only creates a window when attach_pending found no reusable one, 1916-1948); bytes credited per follower = window read_bytes, key includes (segment,first,count,row) so counts always match (1901, 2258); Fetched deferred until last user's segment settled (2244-2255) which is what makes the pin release safe at 3656-3658;
unreachable!for the sample variant in Kind::of (shard.rs:476-478) is guarded by the two filter sites (shard.rs:722, 1148) but is a release-mode panic path if a third call site appears. - Remaining flake: disk_store.rs:8487
assert_eq!(disk_window_reads() + coalesced_windows(), 10)with comment at 8481-8484 admitting W3 coalescing is timing dependent.
#6 [high] PR 496 — copy-count arithmetic and the 4.22x interpretation
Internal consistency check that supports the claim (head 0c04b1e2):
- 61,054-token prefix = 954 pages of 64 tokens; page_record_bytes ≈ 4.19 MB → one full copy ≈ 4.0 GB.
- After: 4,306.7 MB ≈ exactly one copy + 8 small tails → near-perfect coalescing.
- Disk-bound floor: at the measured 6.07-7.71 GB/s a single 4 GB restore is ~0.55-0.7 s, so 3 removed duplicate reads ≈ 1.6-2.1 s, matching the reported 27B TP1 TTFT drop 7,974.6 -> 5,662.8 ms (-29%, -2.31 s). Internally consistent.
- BUT before = 18,177.5 MB ≈ 4.5 copies, while the description says 8 branches and
flare_host_cache_bytes_in_totalis "8x single" logical (~32 GB). So on main the physical reads were NOT 8 full copies. The 4.22x is therefore "≈4.5 → 1 copy", i.e. it is the measured before/after ratio, not the 8-way dedup factor. Also simultaneous (18,177.5) and staggered (18,194.2) differ by 0.1%, so the pre-window total looks invariant to arrival pattern — worth one sentence from the author (was the burst 8-way at read time, or ~4-5 restores overlapping?). Cheap to reconcile; the win itself is not in doubt. - 27B win is on the heaviest model where the single disk thread is the bottleneck; Flash-Next simultaneous reads 75% less but TTFT moves -3.1%, and the description now says so honestly.
#7 [high] PR 496 — final-round findings for the verdict
Points to include in final report (head 0c04b1e2):
Best new findings this turn:
- After = 4,306.7 MB is ~exactly one 61K-prefix copy (954 pages x ~4.19 MB ≈ 4.0 GB); before = 18,177.5 MB ≈ 4.5 copies, while the description says 8 branches and 8x logical bytes_in. So the pre-window read total is NOT 8 copies. Ask the author to reconcile (either the burst overlapped ~4-5 restores at read time, or the physical gauge integrates a rate and undercounts). Directionally favourable either way: an honest 8-way figure would be larger than 4.22x. Simultaneous vs staggered before-totals differ by 0.1% (18,177.5 vs 18,194.2), which suggests a shared cause, not arrival timing.
- CompositeStore is covered by live GPU tests after all: composite.rs:1229 routes non-memory-resident chains to
DiskStore::fetch→Staged::fetch(the coalesced path), and helios/src/offload/gpu_tests.rs:1275-1289 builds CompositeStore + DiskStore over real CUDA Transfers (gated by FLARE_RUN_CUDA_TESTS, which the author ran: 21/21 SM121). read_into (composite.rs:830) is the spill path. So the "Not covered: live CompositeStore GPU serving" line is more conservative than reality. - CompositeStore keeps its own end-to-end
disk_inbound_rate(composite.rs:897, 1000-1003), so the physical-window change only affects pure-DiskStore pricing (disk_store.rs:3615-3628) and the user metric. Add one sentence: the window rate excludes queueing and the GPU upload, and on multi-host it covers only rank-0 NVMe (shard.rs:1148-1150 drops the sample on peers). TransportEventis pub throughselene::disk_store(not re-exported in lib.rs:44-56); no in-repo exhaustive matcher outside selene/shard (searched helios + selene-manager: no matches). Adding a variant is safe in-repo but is a breaking change for any external matcher of a pub enum — worth one line in the description.- No double-crediting found: a follower can only attach to a given (SegmentKey, first, count, row) once per plan,
record.bytes += win.read_bytesper completed active window (1901), totals asserted per fetch in the burst test. - Constant-time behaviour on the single-restore path is now real:
build_pending_demandreturns empty at len() <= 1 (1736),window_indexO(1) (1646), Pass 2/4 shareattach_pending. Only residual single-stream cost isplan_windowsboundary alignment (≤ 1 extra partial window/segment), which is documented at docs:354-358 and matches the old code's per-restore packing closely. - Charter tension to state plainly: +1,110 production lines in
disk_store.rs(6,976 → 9,358 incl. tests), i.e. a 16% growth of the most delicate file in selene, for a win that is ~0-3% TTFT on the smaller supported model and ~29% on the flagship disk-only burst. Justified by the charter's bandwidth/disk-offload goal and by #497's intake shrink, but it should be named as the cost.
#9 [high] PR 496 final-round (run 4): bot should-fix triage + new findings
Head unchanged: 0c04b1e2 (no new commits). Files: docs (+35/-2), disk_store.rs (+3313/-931), shard.rs (+10/-0).
Triage of bot's 5 should-fix items (flare-autobot 2026-11-25 05:23):
- "Take rate sample off TransportEvent" — VALID but the CompositeStore sub-claim is overstated: with
--prefix-cache-memory 0 --prefix-cache-disk(the benchmarked config) memory is None (capture = pool.is_some() && warm_bytes == 0 && directory_lock.is_none()is false when directory_lock is Some), so offload.rs:632-641 returns a bareDiskStore— CompositeStore::poll's per-windowstats.progress += 1(composite.rs:1376) never runs in that config. It only bites warm+disk / capture configs, where each window sample re-runs spill_parked + disk.maintain() (composite.rs:1418-1428), ~954 times per 61K burst instead of ~8. - HeaderIdentity Hash — VALID; but the bot's suggested fix (derive Hash on Header) conflicts with
versiondeliberately excluded from Header::PartialEq (shared/record.rs:118-119, 136-152). Correct minimal fix: replace the..at disk_store.rs:1030 withversion: _: so adding a Header field is a compile error, plus ana == b ⇒ hash(a) == hash(b)` test. Layout::record_slots— cosmetic only:record_slots(pages,row) = pages + usize::from(row)*row_slots(geometry.rs:180-182) is exactly the hand-writtenplan.count + if plan.row { layout_row_slots }(disk_store.rs:1777). No behavioural risk.- Docs duplication — valid: docs/prefix-cache-offload.md:337-366 vs :1528-1531.
- Maintainer design sign-off — valid per AGENTS.md:201-206 ("Resolve conflicts through an explicit maintainer decision on the design").
New findings the bot's review missed:
A. There are TWO unreachable!() sites for the out-of-band event, not one: shard.rs:476-478 (Kind::of) AND disk_store.rs:3638 (DiskStore::apply's match arm, guarded by the early if let return at 3632). Strengthens the "get the sample out of the enum" item.
B. Single-restore cost verified: build_pending_demand returns early at disk_store.rs:1736; window_index O(1) at 1647; plan_windows aligns only for device (682-727).
Still open from my prior report: 8-branch/4.5-copy benchmark reconciliation; disk_store.rs:8487 exact-total assert; Kind::of panic path; sequencing with #497 (both edit Staged::pump_all, disk_store.rs:2291).
Verdict: worth merging, with changes (unchanged direction, smaller remaining list).
#2 [medium] Correction: prefixed models are ~192K, not 256K
Correction to entry 1: the benchmark family is Qwen3.8 (author's 8 branches each = ~61.3K shared prefix + ~256 unique tail tokens, total ~507K tokens across 8 requests, so dedup only within a branch, not across), which implies per-request capacity >= ~63K, so Qwen3.8-27B-NVFP4 / Flash-Next are ~192K-context models, not 256K. The point I wanted to avoid still holds: on compact hardware the prefix-cache --prefix-cache-memory 0 --prefix-cache-disk disk-only configuration is exactly where these duplicated ~61K-prefix bursts land (author's setup: 27B 40G disk limit, Flash-Next 24G), and a memory-first configuration would need 8 x ~4 GB of DRAM for the shared prefix alone, which is the reason disk-only exists for these runs. So "cache it in host memory instead" is not a substitute for the coalescing fix on the benchmarked topology.
Also confirm: docs/prefix-cache-offload.md:318-319 already states the existing dedup rule ("An outbound for a key already present or in flight is skipped. An inbound for a key already in flight attaches the request as another waiter") which is why the old per-branch Staged::fetch each re-read the shared ancestor; that is the gap this PR closes, and section 2.4 (docs:337-343) is the updated paragraph.