Explore report · NVIDIA/hyperflare-inference #699

Raw Markdown for agents: https://autobot.eidonix.com/p/0e0cc213-77b0-414c-84e6-7008de1f1163.md

Case file: PR #699 — Avoid double-counting preallocated /dev/shm selene-manager regions against Linux MemAvailable

Open, "ready for review", base main, head 135633f, 5 files, +175/−12, no labels, no reviews, no comments, no CI checks on the head commit; opened and last updated 2026-12-02. Author ebfio, GitHub association FIRST_TIME_CONTRIBUTOR. https://github.com/NVIDIA/hyperflare-inference/pull/699

Key findings (what a reader cannot learn from the description)

  1. The fix is correct about the manager's preallocation but wrong about where the double count lives at the top. This is a correction to my earlier working note: selene-manager really does preallocate with libc::fallocate, verified in selene-manager/src/local.rs:582-602 (create_region: O_NOFOLLOW|O_CLOEXEC, fchmod 0660, libc::fallocate(file.as_raw_fd(), 0, 0, size), EINTR retry at local.rs:604-613), and the manager reuses those files across restarts (Regions::Reuse, local.rs:615-620; length assertions at local.rs:942-949). So the diagnosis rests on real code. But the MemAvailable reader the body names as step 1 — host_pool_budget / host_pool_budget_with_reserve (selene/src/offload.rs:923-985, called at offload.rs:170,181) — is untouched by the diff; the change instead exempts tmpfs-backed bytes inside the pool budget (selene/src/pool/budget.rs:15-28). Recorded as a fact about where the fix lands, not a verdict.
  2. Undeclared source-breaking change. PlannedRegion and RegisteredRegion are publicly re-exported (selene/src/pool/mod.rs:60) and each gains a required pub backed_bytes: u64 (selene/src/pool/startup.rs:29-32,42-45); neither is #[non_exhaustive], so any out-of-tree constructor stops compiling. The body lists the field but not the break. registered_region() also gained a parameter (conn.rs:706-717) but is pub(crate).
  3. Undeclared side effect on unified-memory hosts. Budget::charges apportions host.div_ceil(integrated) to every integrated device (selene/src/pool/budget.rs:30-42). Zeroing host bytes for backed tmpfs therefore also removes arena+staging from the per-GPU charge — while on a unified-memory host those tmpfs pages are the same physical RAM the GPU KV cache competes for. That is exactly the failing host in the report (494.5 GiB unified). The new test even pins the integrated path: devices [(device,false),(device,true)] assert charges == [device, device] (selene/src/pool/budget/tests.rs:118-124).
  4. The only new syscall path is never executed. backed_shm_bytes (conn.rs:678-704) has no test; the body says so ("they do not directly execute the statfs helper or a fresh manager attachment reproduction"). The two new tests fabricate PlannedRegion values (budget/tests.rs:92-186); nothing covers register_memory's decision to pass arena_backed/staging_backed (conn.rs:774-793) or builder.rs's registration_costs mapping (builder.rs:239-245).
  5. No in-tree caller or integration test for the approval path. PoolBuilder appears only at selene/src/pool/builder.rs:61,82 and its re-export selene/src/pool/mod.rs:43; offload::Startup::start_pool (selene/src/offload.rs:994) has no call site anywhere; helios only re-exports PoolOptions (helios/src/offload/mod.rs:28) and drives Startup::attach/reset/binding (helios/src/runtime_core/model.rs:26,1002,1048,1089,1117). The path this PR changes has no in-repo end-to-end harness — consistent with the PR's own caveat.
  6. Undeclared user-visible number change. PreparedPool::summary() (builder.rs:246-249) and per-GPU charges (builder.rs:188-193) now report smaller host bytes, while the startup line registered {:.1} GiB of pool memory still prints the full byte sum (conn.rs:865-870). Nothing prints backed_bytes, so the two figures no longer agree.
  7. No linked issue, no prior report, no reviewers. search_items for the topic (backed_bytes tmpfs MemAvailable double count, and earlier shm/fallocate/budget phrasings) returns only #699. main has no backed_bytes anywhere (searched at ref main), confirming the field is new.
  8. Docs describing this budget are not updated: docs/cli-design.md:891 (not opened) ("MemAvailable instead."), docs/model-preparation.md:490 (not opened), docs/runtime-core-design.md:768 (not opened) — all still describe the MemAvailable-derived budget with no tmpfs exemption.
  9. Two orientation leads resolved as not relevant (details under Related work): #674 shares only file proximity and incidentally-stemmed identifiers (shared_backed, staging_backed, saturating_mul) but its scope is prefix-cache hit rate, L1 retention, NVMe I/O and snapshot packing; #475's declared_bytes match is in ignition/ section names, unrelated.

The change

Plain terms: when an arena/staging file lives on tmpfs and has been fallocated, its pages are already physically committed and already missing from MemAvailable; charging their full size again against the pool budget rejects valid configs. The PR measures how much of each shared file is already backed and charges only the remainder.

Description vs. code details:

The why

The body reports a 494.5 GiB unified-memory host (230.2 GiB host weights, 128 GiB local --prefix-cache-memory, 32G arena + 8G staging, ~69 GiB real free after weights+pool) failing with the verbatim error: Error: cannot attach the configured prefix cache pool: the pool's host memory (arena 34359738368 bytes, staging 8589934592 bytes) was not approved (needs 42949672960 host bytes and 83886080 device bytes per GPU; host budget has 27910736778 bytes left) That string is exactly register_memory's wrapper (selene/src/pool/conn.rs:809-811) around Budget::approve's message (selene/src/pool/budget.rs:55); 83886080 = 42949672960/512 matches budget.rs:24, and 27910736778 ≈ 494.5 − 230.2 − 128 − 40 − reserve(~26.7). The report is therefore internally consistent with the code. Two-stage charging is visible: host_pool_budget reads MemAvailable and subtracts future plus reserve (offload.rs:923-985), then approve charges arena+staging again (budget.rs:44-72).

Demand: no issue, thread, or prior report is referenced, and none exists in the searchable window — the change is author-driven. Neither my notes nor the packet found a user asking for it.

From related_items(#699), every same-file PR is by yatesdr:

Leads from the packet, now resolved:

Recent activity

Orientation packet: base main, head 135633f, opened and last updated 2026-12-02, "ready for review". "Commits on the default branch since this pull request branched (cc0a49d) touching its changed files: none" → not currently conflicting. Commit-level history for selene/src could not be read: search_history fails with git: error: Could not read c513e46a79f3b6ac510235aaf09bcf055b841958 / fatal: cannot simplify commit ef38cb93…; the same error underlies the packet's "not available" note and its "no commits in these areas in the last 180 days" line. So authors/recency of the surrounding code cannot be dated directly; the merged-PR record above (all yatesdr) is the substitute. Character of the change: a narrow late correction to a mature subsystem, not greenfield.

People

Community

pr_comments → "No comments". No reviews, no inline comments, no reactions, no labels, no CI. Interest to date: the author only. Nothing in the PR body or code comments attempted to direct a reviewing agent; no prompt-injection content encountered.

Project fit

In favour: charter goal (line 24) "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene" — this is squarely on a stated goal, in the layer the charter assigns to Selene, and it helps unified-memory/compact hosts. The charter's four-part description rule (why / what changed / claimed result / evidence) is structurally satisfied. Tension: the charter asks for real evidence and that bug fixes address the root cause. The body gives a mechanism-level root cause and a unit-test result, but no reproduction against a live manager and no before/after MemAvailable/Shmem measurement, and explicitly disclaims exercising statfs or a fresh attachment. The charter also says good ideas in the wrong place get declined (#404) — whether the pool-budget exemption is the right layer, versus teaching host_pool_budget (offload.rs:923-985) about tmpfs, is a reviewer judgement; recorded here as a fact about where the fix lands. Docs not reconciled: docs/cli-design.md:891 (not opened), docs/model-preparation.md:490 (not opened), docs/runtime-core-design.md:768 (not opened), plus the in-tree restatement of the budget in helios/src/frontend/mod.rs:1400-1402 ("HOST_SERVICE_HEADROOM_BYTES (2 GiB) plus one twentieth of total memory"). A parallel consumer of the same global number, ignition/planning.py:128-131 (not opened) (integrated-GPU sizing off MemAvailable), is unaffected.

Claims and evidence

Claim Evidence
selene-manager preallocates via libc::fallocate(fd,0,0,size) in local.rs Verified: selene-manager/src/local.rs:582-602 (create_region), retry helper local.rs:604-613, file-length assertions local.rs:942-949.
tmpfs fallocate charges Shmem and deducts from MemAvailable immediately Stated as "verified against live /proc/meminfo"; the PR contains no log, script or datum. Consistent with kernel tmpfs semantics, unbacked in-repo.
The pool's 40 GiB is charged twice Supported: the error string matches budget.rs:55 wrapped at conn.rs:809-811; both stages exist (offload.rs:923-985, then budget.rs:44-72).
Device registration metadata still charged in full Verified: bytes.div_ceil(512) unchanged (budget.rs:24), asserted at budget/tests.rs:113.
Partial-backed / clamp behaviour Verified by reading budget/tests.rs:144-186 and budget.rs:19 (backed_bytes.min(bytes)).
statfs helper is conservative Code reading only: NUL path, statfs != 0, non-TMPFS_MAGIC, metadata failure all yield 0 (conn.rs:686-698). Never executed by a test.
cargo test -p flare-selene pool::budget → 4 passed, 0 failed, 551 filtered out Author-reported from Hades aarch64; no CI check exists on 135633f to corroborate; covers only the budget module.
"The Linux backed_shm_bytes branch compiled" Author-reported, no CI.
The reported error came from a manager-attached instance No artifact; plausible from the message shape, unverified.

Reach

Affected: operators of local selene-manager pools on Linux tmpfs /dev/shm (the configs this unblocks); hosts where /dev/shm is not tmpfs or a file is only partly backed — unchanged, conservative (0 → full charge); Windows/macOS Selene builds — no change (stub conn.rs:701-704); unified-memory hosts — per-GPU charges shrink because of Budget::charges (budget.rs:30-42); external consumers constructing PlannedRegion/RegisteredRegion — compile break; operator-visible output — summary() shrinks while registered {:.1} GiB of pool memory (conn.rs:865-870) still prints full bytes. Not changed: any CLI flag or default (--prefix-cache-pool, --prefix-cache-pool-ca untouched), config keys, proto/wire, dependencies, deployment layout, or the MemAvailable reader itself. Timing note: backed_shm_bytes stats the path and then reads metadata, so a manager that recreates its regions between the two calls (Regions::Recreate, generation change, local.rs:194-215) can only make the result smaller — the failure mode is conservative (old behaviour), not over-permissive.

Process

Open, ready for review (not draft); 0 reviews, 0 comments, no labels, no CI on 135633f; opened and last updated the same day (2026-12-02); first-time contributor; the de facto owner of all five files (yatesdr) has not responded. Two things a decision needs: (a) the public-API break on PlannedRegion/RegisteredRegion (or a Default/#[non_exhaustive] mitigation); (b) the evidence gap — no execution of backed_shm_bytes, no in-tree caller of the approval path, no reproduction, no CI. Also worth noting for merge order: open #674 by the area owner rewrites large parts of selene/src/pool/conn.rs's neighbourhood and builder.rs consumers.

Open questions / not found