Explore report · NVIDIA/hyperflare-inference #641

Raw Markdown for agents: https://autobot.eidonix.com/p/cd77ac39-f34a-4125-aa84-afd3f0b53018.md

Case file — PR #641 "Resample host memory after flushing CUDA cache in CompilePool"

Author nero- (CONTRIBUTOR). Open, ready for review, base main at 0a8c20f, head d82fcfc, +163/−10 in 3 files. Opened 2026-11-30 13:01 and last updated the same minute. Zero comments, zero reviews, no labels, no CI checks, no linked issue.

Key findings

  1. The root cause is real and reproducible from the diff. On base main, compiler_resources() sampled host_memory.available_bytes() (line 45 of main), called torch.cuda.empty_cache(), resampled only free, then clamped available = min(stale_available, new_free) — so every byte the flush returned to host RAM was thrown away. At head the clamp happens before the flush and available is resampled afterwards on unified memory (ignition/preparation/compile_pool.py:51-60).
  2. An open draft PR has already claimed the same function. #639 (original-el8, a charter priority contributor) opened 66 minutes earlier, edits the same compiler_resources body in compile_pool.py, and changes _DISCRETE_WORKER_DEVICE_BYTES from 1 GiB to 704 MiB — which concretely breaks #641's new discrete-capacity test expectations (tests/preparation/test_compile_pool.py:605-623). Neither PR mentions the other.
  3. The description's "unlocking additional compiler workers" is not shown by its own evidence. With the reported after-numbers (~13.3 GiB available, 8192 MiB headroom) a worker still needs 34 GiB by the main loop; the admitted [1, 1, 1] comes from the pre-existing 4 GiB minimum allowance fallback (compile_pool.py:87-94). The measured gain is restoring the one-worker-per-host floor, not extra workers.
  4. The flush becomes near-unconditional, which the description does not say. The new trigger is available - headroom < max_workers * worker_bytes (≥34 GiB per worker on unified memory) / free - headroom_bytes < max_workers * device_bytes (~8 GiB on discrete at defaults), versus the old "one 2 GiB worker does not fit". No cost measurement accompanies an empty_cache() that now runs on essentially every GB10 preparation and on discrete hosts that never flushed before.
  5. The clamp that is moved only does something on Windows. On POSIX integrated GPUs device_memory_info() already returns min(total, available_bytes()) (host_memory.py:108-109), so min(available, free) is a no-op on the platform all the live evidence comes from; the only behaviour the clamp changes is the Windows path, whose sole coverage is a mock.
  6. This is the tail of a long, well-documented bug family the PR never cites. #242, #270, #73, #630 report the identical MemoryError on GB10 unified memory back to 2026-10-24; #122 (closed 2026-11-29) attacked the same failure by making the headroom configurable; #462 (merged 2026-11-22) added the flush #641 widens, for the same error; #584 (closed draft) proposed flush-before-probe and was told to split. #641 references none of them.
  7. Evidence is a three-branch combined stack (#635 + local-inference-lab/hyperflare-recipes#103), one model (DeepSeek V4.1 Flash), one layout (TP3, one rank/host), one hardware (SM121 GB10). Discrete and Windows paths are covered only by monkeypatched CPU tests, and AGENTS.md:194-199 says mocks cannot establish runtime correctness.

The change (what it does, in plain terms)

Three files, all named in the description; nothing hidden in scope (no new flag, config key, env var, dependency, artifact format, or doc).

What it does beyond the description: (a) the trigger widens from one worker to the whole worker budget, making the flush near-unconditional; (b) the moved clamp is effectively Windows-only; (c) on discrete GPUs available is deliberately not resampled while capacity grows — the two numbers allocate_workers multiplies together (:75-86) — leaving available stale there. What the description says that the change does not do: nothing material; the only overreach is "unlocking additional compiler workers" (see Key finding 3). No Fixes # line, so no issue closes.

The why

Recent activity

ignition/preparation/compile_pool.py has been edited by six people in eight weeks: b6d57dad "Centralize preparation memory policy…" (Luke Alonso, 2026-10-12), cf192126 GB10 shared-memory (jasonc, 2026-10-12), 468415d1 Inductor-thread bounding (jasonc, 2026-10-13), 84c1c0a1 lending to idle ranks (Martin Vit, 2026-10-17), c8d4c324 per-host budget (Luke Alonso, 2026-11-09), 346615d8 the flush (#462, Martin Vit, 2026-11-22), b0d35934 (#509, Luke Alonso, 2026-11-24). #641 and #639 would be the 7th and 8th. Zero main commits touch the three changed files between the branch point and head, so #641 is not built on newer work and does not reverse anything already merged; it builds directly on #462 and c8d4c324.

People

Community

No engagement whatsoever: 0 comments, 0 reviews, 0 labels, 0 reactions, no CI checks on d82fcfc, no linked issue, opened and last updated in the same minute. For contrast, #639 drew a 2-blocker Autobot review within an hour, #597 has five comments, and the author's own #635 has two review rounds. Expect #641 to be judged against the same bar once read.

Project fit

Claims and evidence

Claim Backing
available never resampled after flush, so reclaimed bytes are discarded Verified from the diff (main compile_pool.py:45-56 vs head :51-60); arithmetic reproduces the 8435 vs 8192 MiB MemoryError exactly, and the old trigger did fire (243 MiB < 2048 MiB)
Trigger skipped the flush in headroom/worker-budget cases and on discrete below the worker cap Verified: old trigger tested one 2 GiB worker (:49 on main) / 1 GiB discrete constant, regardless of max_workers
release_unused() ran before the barrier with no empty_cache() Verified (aot.py:1068-1074)
"Prevents spurious MemoryError" Backed for the shown case only — one export, 3× GB10, 243 MiB under the floor
"Unlocks additional compiler workers" Not backed by its own evidence: [1, 1, 1] comes from the 4 GiB minimum allowance (compile_pool.py:87-94); a second worker still needs 34 GiB remaining
"160 passed, 0 failed" Author-reported local run of a 5-file subset; the workflow runs all of tests/ (.github/workflows/python-cpu.yml:33 (not opened))
Live 3-node SM121 validation (51/51 forwards, 193/193 graphs, flare run 24/24 determinism, −1.4593 NLL, 3.965 s 32K needle, 61/61 concurrency, 4/4 image) Structurally the strongest evidence, but produced by a three-branch stack (#635 + hyperflare-recipes#103 + this), so AGENTS.md:96-112's "never attribute a combined result to one PR" applies. No isolated main-vs-PR run; no wall-clock A/B (before failed in 2.5 s, after spent 1204.2 s actually compiling)
Windows unified memory Mocked only — and this is the one path where the moved clamp changes behaviour at all

New tests monkeypatch torch.cuda.empty_cache, host_memory.available_bytes, torch.cuda.mem_get_info, get_device_properties and dist.* (test_compile_pool.py:538-566), so they pin the arithmetic of the trigger, not real reclamation. "Resampled exactly once" is asserted only on the discrete path (:622); the Windows test (:595-602) exercises the clamp, not the flush. Unmeasured costs: the near-unconditional flush (including on discrete GPUs where warmup/capture could reuse those segments) and the new per-rank flush before the barrier.

Reach

Process

Ready for review (not draft), ~0 elapsed review time, no CI checks on head d82fcfc. .github/workflows/python-cpu.yml:3-33 (not opened) does run pytest tests/ with CUDA_VISIBLE_DEVICES="" on every pull_request, so tests/preparation/ is covered — older Autobot reviews of #597/#639 claiming no Python CI runs these tests are stale. However the suite was permanently red until #623 was fixed by #624 (merged 2026-11-30 12:39, ~20 minutes before #641 opened), and first-time-contributor workflow runs need maintainer approval (#624's review). Nothing hostile: no instructions directed at agents in the description, comments (none), or #635.

Open questions / what could not be found

  1. No isolated main-vs-PR measurement, and no cost measurement for the extra flushes.
  2. No discrete-GPU (SM103/SM120/SM121) or live-Windows run.
  3. Whether available should also be resampled after a discrete flush, for consistency with the capacity that does grow.
  4. Whether #641 or #639 is the intended landing order for compiler_resources, and how the 1 GiB vs 704 MiB discrete constant is to be reconciled.
  5. Whether a docs line belongs in docs/model-preparation.md:489-495, as #597 and #122 both did.
  6. Nothing found: no linked issue anywhere, no review, no reactions, no mention in any other open item (searched the local PR/issue copy), and no statement of intent from a maintainer about this area.
  7. Minor consistency note a reviewer would raise: worker_bytes on integrated GPUs includes device_bytes (2 GiB) on top of FORWARD_WORKER_BYTES (32 GiB), so the trigger budgets ≥34 GiB per worker while the admission floor it is meant to enable grants a worker for 4 GiB — the trigger is far more conservative than the fallback it unblocks.