Architecture report · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/145be1f5-eaa0-42ef-aa3c-2904454209d3.md

PR #496 — Coalesce shared ancestor reads across concurrent Selene disk fetches

Review lens B: architecture and scope (does it belong, is the approach right), judged against the charter, AGENTS.md, docs/design-review.md and docs/prefix-cache-offload.md. Head commit f9c9191; 2 files, +2808/−914.

Key findings

Scope: does this belong in the repository?

Yes, in principle. The charter's "What gets merged" includes "a measured performance/memory issue" (charter, Standards & Contributions), and AGENTS.md:165-166 says a measured performance problem is sufficient justification. The PR reports a measured problem (8 concurrent branch restores repeating the same ancestor O_DIRECT opens and reads, up to 18.0 GB read for a 61.3K shared prefix) and a measured result on a served workload (flare run, /v1/chat/completions, TTFT), which is exactly what the charter's "Bring real evidence" line requires (charter: "Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)"). The area touched — Selene's disk transport — is covered by the goal "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene."

Nothing found for the rejection criteria that usually catch changes of this shape:

Approach: is the layering and complexity right?

Finding 1 (should fix, high) — logical and physical bytes are conflated, inflating the inbound rate used for restore pricing. selene/src/disk_store.rs:1530, :1829, :3626-3628, :3587.

Finding 2 (should fix) — the new ownership protocol is a large addition to shared cache machinery and the module contract no longer matches it. selene/src/disk_store.rs:8-24, with the protocol at 1000-1160 (SharedSegment/SharedWindow/DeviceInbound), 2205-2255.

Finding 3 (should fix) — the doc states coalescing as unconditional and keeps signatures that do not exist. docs/prefix-cache-offload.md:337-342.

Compatibility with what exists

Nothing found. No record-format, header, or on-disk layout change; sharing keys on (path, expected Header), so records written by main are read unchanged. WINDOWS_IN_FLIGHT still derives from crate::shared::WINDOW_CREDITS (line 60). Host-path callers (CompositeStore, host_inbound) keep the private path via plan_windows (now documented as "for caller-owned host reads", line 670), so the read_into contract is preserved. Staged::in_flight() correctly grows to host_inbound.len() + device_inbound.len() (1210-1217). The stacked-companion note (#497 also edits Staged::pump_all) is a merge-order cost, not a compatibility defect.

No per-model special cases, flags, or new knobs

Nothing found. No model names, no cfg-gated alternative paths, no env vars, no recipe fields. The only new conditional compilation is test-support-gated counters (see nit 2), which does not create a production path difference.

Measured evidence for the performance claims

The evidence is real and of the right shape (served workload, before/after on main at 425ab2d4, physical NVMe bytes via device counters, TTFT). Two reservations, both non-blocking:

Open questions / what could not be settled from the code