Opened by a workflow run, Nov 30, 2026 8:02 AM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: nero- (CONTRIBUTOR; 3 merged/3 closed/3 open in 180 days, two merged PRs in ignition/preparation; Discord: nero)
Motivation: On GB10-style unified-memory GPUs, exporting compiled forwards sometimes fails with "no capacity for a forward compiler" even though PyTorch's CUDA caching allocator is sitting on several GiB of host RAM that torch.cuda.empty_cache() would return. This PR flushes that cache before sampling host memory and re-reads the free figures afterwards, so the reclaimed bytes count toward the compiler-worker budget.
Scale: +163 / −10 lines in 3 files
Proposal:
- Move the
available = min(available, free)clamp ahead of the flush and re-sample bothfreeand hostavailableaftertorch.cuda.empty_cache()on unified memory (compile_pool.py:51-60). - Widen the flush trigger from "one worker doesn't fit" to "the whole worker budget doesn't fit", on both unified and discrete GPUs (
:55-56). - Extract
_DEFAULT_MAX_WORKERS = 8(:26);allocate_workers()untouched. - Call
torch.cuda.empty_cache()afterrelease_unused()and beforedist.barrier()inForwardCache._prepare_ranks(aot.py:1070), inside the existing try/except so failures reach the collective. - Add 5 additive CPU tests pinning resampling thresholds, the Windows clamp, discrete capacity recovery, no-flush skips and flush-before-barrier ordering (
test_compile_pool.py:538-681). Touches: ignition/preparation/compile_pool.py—compiler_resources(), the memory-admission hot spot.ignition/preparation/aot.py— multi-rank preparation barrier ordering.tests/preparation/test_compile_pool.py— new mocks-only tests. Related items:- #639 ignition: tune discrete CompilePool sizing (open, draft): edits the same
compiler_resourcesbody and sets_DISCRETE_WORKER_DEVICE_BYTESto 704 MiB, breaking this PR's new discrete-capacity expectations. - #242 Multi-host export compiles 22 min then fails when one rank lacks compiler memory (open): the identical GB10
MemoryError; only partially relieved. - #122 Make the compiler memory headroom a preparation setting (closed): the alternative lever (lower headroom) for the same failure.
- #462 Flush empty cache in compiler_resources (merged): added the very flush this PR widens.
- #584 Accelerate Ignition forward compilation (closed draft): proposed the same flush-before-probe, was told to split.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/641
Autobot comments: Merged PR #462 added the flush eight days earlier; open draft #639 rewrites the same function and conflicts numerically. The description's "unlocking additional compiler workers" is not shown by its own evidence — the admitted
[1,1,1]comes from the pre-existing 4 GiB minimum-allowance fallback, and a second worker still needs 34 GiB remaining. Two undeclared effects: the flush becomes near-unconditional (no cost measured) and the moved clamp only changes behaviour on Windows, whose sole coverage is a mock. Evidence is a three-branch combined stack (#635 + external recipes #103), one model/layout/hardware, with no isolatedmain-vs-PR run; no issue is linked or closed. No comments, reviews or CI checks yet.
Value Proposition
Value Proposition — PR #641 "Resample host memory after flushing CUDA cache in CompilePool"
Charter alignment. Good. This fixes a reproducible memory-accounting bug in shared runtime code with no new flag, no per-model branch, and no config/artifact/dependency change — inside "PRs that address a reproducible bug or a measured memory issue," and inside the design docs' "release compiler resources before materializing preparation caches" and "account for cached allocator segments." The root cause is verifiable from the diff: main clamps available = min(stale_available, free) after the flush, discarding the reclaimed bytes, and the arithmetic reproduces the reported 8435 vs 8192 MiB failure exactly. Headroom invariants and worker budgets are untouched — unlike the withdrawn #122 lever.
Novelty & status. Not obsolete: no main commit touches the three changed files between branch point and head, and #462 (merged) only added the flush #641 widens. Not superseded: #639 edits the same compiler_resources body but does not address the stale-available cause, and it is a draft with a two-blocker Changes-Requested review. #641 is the small successor that #584's rejection actually asked for — additive, but it cites none of #242/#73/#270/#462/#584, a real gap given five weeks of identical reports.
Value vs maintenance cost. The fix is cheap and general (two call sites, both hardware classes). Evidence is thinner than the description implies: the live run is a three-branch stack (#635 + recipes#103 + this), one model, one layout, TP3 on GB10, so AGENTS.md's "never attribute a combined result to one PR" applies. "Unlocking additional compiler workers" is not backed by its own numbers — [1, 1, 1] comes from the pre-existing 4 GiB fallback, and a second worker still needs ~34 GiB. The flush trigger also widens silently from "one 2 GiB worker doesn't fit" to "the whole worker budget doesn't fit," making empty_cache() near-unconditional on every GB10 preparation and on discrete hosts that never flushed, with no cost measurement. The moved clamp only changes behaviour on Windows, covered solely by a mock; on POSIX it is a no-op.
Verdict: Worth it with changes. Require: (1) reconcile landing order and the 1 GiB vs 704 MiB discrete constant with #639; (2) narrow the flush trigger to what the evidence supports or measure its cost, and resample available on discrete too; (3) drop or correct the "additional workers" claim; (4) cite the #242/#73/#270 family and add the DGX Spark docs line to docs/model-preparation.md; (5) flag the Windows clamp as mock-only.
Full report Decide Value: yes (99%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, priority:P2, bug, performance, area:memory, area:preparation
Threshold: 65%
Triage
- [✓]
triage:review: 99.8% -
triage:design-review: 0.1% -
triage:validation: 0.0% -
none: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
- [✓]
priority:P2: 74.9% -
priority:P1: 18.9% -
none: 6.1%
Type
- [✓]
performance: 94.0% - [✓]
bug: 83.5% -
duplicate: 59.3% -
community: 53.1% -
enhancement: 14.8% -
documentation: 0.1%
Area
- [✓]
area:preparation: 96.3% - [✓]
area:memory: 92.4% -
area:scheduling: 1.2% -
area:caching: 0.9% -
area:rocenante: 0.9% -
area:engram: 0.7% -
area:orbit: 0.4% -
area:selene: 0.4% -
area:kernels: 0.2% -
area:api: 0.1% -
area:packaging: 0.1%
Model
-
model:deepseek-v4.1: 10.7% -
model:deepseek-v4: 3.7% -
model:qwen3.8-flash-next: 1.2% -
model:inkling-small: 0.4% -
model:nemotron-3.5-bolt: 0.4% -
model:kimi-k3.1: 0.3% -
model:glm-5.3: 0.2% -
model:mimo-v2.6: 0.1% -
model:muse-glimmer: 0.1% -
model:gemma4: 0.1% -
model:qwen3.8-27b: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +priority:P2, +bug, +performance, +area:memory, +area:preparation
Subtraction and simplicity
PR #641 is small and mostly lean — no new flag, config key, dependency or abstraction, and aot.py's +2/−1 needs no simplification. Two subtractions in compiler_resources() matter.
-
Delete the widened flush trigger (
ignition/preparation/compile_pool.py:55-56, plus themax_workerslocal at:50) and restore the per-worker test (available - headroom < device_bytes if shared else free - headroom_bytes < device_bytes). The reported case (8435 MiB available, 8192 MiB headroom) already fired onmainbecausehost_memory.py:107-109folds host RAM intofree: 243 MiB < 2048 MiB. The bug was only the missing resample at:59-60. The widening is a flatmax_workers × worker_bytes= 8 × 34 GiB = 272 GiB threshold versus 121.7 GiB total RAM, so on GB10empty_cache()becomes unconditional (it holds for any headroom and any recipe; even 4 CPUs gives 136 GiB); it newly flushes discrete hosts — the pre-existing test attests/preparation/test_compile_pool.py:39-41(12 GiB free, 2 GiB headroom,compile_workers=32) now flushes silently; and it makes the PR's ownaot.py:1070flush redundant, giving twoempty_cache()calls per rank per preparation. It also duplicates the real admission rule inallocate_workers(:78-86).AGENTS.md:188-193rejects such unmeasured churn. Deleting it removes ~4 of the 5 new mocked tests (test_compile_pool.py:569-592,:605-623,:626-642), keeping the resample assertion (:591), the Windows clamp test (:595-602) and the good ordering test (:645-682). -
Collapse the duplicated sample/clamp —
min(available, free)appears twice (:53-54,:59-60) andavailable_bytes()is read 4× when the flush fires (vs 2 onmain), each call being three file reads (host_memory.py:82-100,:51-79). A 4-line localsample()returning(free, min(available_bytes(), free) if shared else available_bytes())gives oneif sharedinstead of three and also fixes the asymmetry where a discrete flush refreshesfreebut notavailable— the two numbersallocate_workersmultiplies (:75-86). No existing repo helper to reuse; this is intra-function dedup.
Minor: _DEFAULT_MAX_WORKERS only needs extracting because of item 1; state["host_samples"] is pinned only on the discrete path (:622). Open: whether the widening was measured anywhere; whether the double flush is intended; landing order against draft #639, which changes the 1 GiB discrete constant and breaks both new discrete test params.
Correctness and contracts
PR #641's ordering and failure propagation are correct; the problems are an undisclosed near-unconditional flush and two claim-accuracy defects.
- Flush is loop-invariant on unified memory (Major).
compile_pool.py:48-57comparesavailable - headroomagainstmax_workers * worker_bytes= 8 × 34 GiB = 272 GiB, which no GB10 (121.7 GiB) can satisfy, soempty_cache()now runs on every integrated preparation. The author's only non-flush integrated test (test_compile_pool.py:626-642) requires a 300 GiB host. Cost unmeasured;mainflushed only when one 2 GiB worker did not fit. - Flush frequency scales with CPU count (Minor).
compile_pool.py:43-45+compilation.py:30make the discrete threshold 8 GiB at defaults, 12 GiB for 12 requested workers (test:608-610), 2 GiB on a 2-core host. - "Unlocking additional compiler workers" is contradicted by the PR's own numbers (Major). With ~13.3 GiB available and 8 GiB headroom, a real worker still needs 34 GiB;
[1, 1, 1]comes from the pre-existing 4 GiB fallback atcompile_pool.py:87-94. The gain is the restored one-worker-per-host floor. - The moved clamp is Windows-only (Major).
host_memory.py:107-110already returnsmin(total, available_bytes())on POSIX integrated, soavailable = min(available, free)(compile_pool.py:53-54,:59-60) changes nothing on GB10; Windows is mock-only, whichAGENTS.md:194-199rules out as proof. - Sound: flush →
dist.barrier→compiler_resources→all_gather_object(aot.py:1070-1081) prevents peer-rank staleness; a flush failure is folded intoerrorand every rank still reaches the barrier and both gathers;_DEFAULT_MAX_WORKERSis behaviour-preserving; no contract/config/artifact change. - Minor: redundant second flush per rank (
aot.py:1070thencompile_pool.py:57); arelease_unused()failure silently skips the new flush despite the reworded comment (aot.py:1068-1073); the flush runs inside the retained storage scope with no reseal of the low-address window until retention exit (core_storage.py:160-165,:248-250).
Open: no isolated main-vs-PR or cost measurement; landing order vs #639 (its 704 MiB discrete constant invalidates test_compile_pool.py:605-623); whether a docs line belongs in docs/model-preparation.md:489-495; and confirmation that the unqualified empty_cache() at the new call site runs with self.device current (unverified, not claimed as a defect).
Final review
Recommendation: Ready To Merge
PR #641 cleanly fixes a verified memory-accounting bug in compiler_resources() and a peer-rank flush ordering gap in ForwardCache._prepare_ranks() without relaxing any headroom invariant, worker budget, or artifact/API contract. The core resample logic, widened worker-cap flush triggers, deadlock-free collective error propagation, and isolated CPU unit tests are all verified sound at head d82fcfc. Only minor optional simplifications (avoiding a redundant second empty_cache() / duplicate POSIX available_bytes() reads) and confirming .github/workflows/python-cpu.yml (not opened) CI is green on d82fcfc remain before merge.
Merge Risk
Level: Low
- Scoped to one-shot forward-compilation worker admission (
ignition/preparation/compile_pool.py:38-64,ignition/preparation/aot.py:1068-1074); serving hot paths, CUDA graph capture contracts,CompilerResourcesfields,allocate_workers()admission math (compile_pool.py:67-98), and exported core formats are untouched. - Multi-rank synchronization and failure propagation remain deadlock-free:
torch.cuda.empty_cache()runs inside the existingtry/exceptahead ofdist.barrier(group=group)(aot.py:1068-1074), so any flush failure is folded intoerrorand surfaced collectively afterall_gather_object(demand, ...)(aot.py:1081-1085, 1130-1131). - Discrete-GPU and Windows (
os.name == "nt") paths are validated by mocked CPU unit tests rather than live hardware (disclosed in the PR description), and.github/workflows/python-cpu.yml(not opened) CI has not yet reported a run ond82fcfc.
Walkthrough
ignition/preparation/compile_pool.py:26: Extracts_DEFAULT_MAX_WORKERS = 8from the previous inline literal.ignition/preparation/compile_pool.py:46-64: Computesworker_bytes,headroom, andmax_workersahead of sampling; clampsavailable = min(available, free)before the flush check whensharedis true; triggerstorch.cuda.empty_cache()whenavailable - headroom < max_workers * worker_bytes(integrated) orfree - headroom_bytes < max_workers * device_bytes(discrete); and resamples bothfreeandavailable = min(host_memory.available_bytes(), free)after flushing on unified memory (while resampling onlyfreeon discrete GPUs).ignition/preparation/aot.py:1068-1074: Callstorch.cuda.empty_cache()immediately afterrelease_unused()inside the existingtry/exceptblock precedingdist.barrier(group=group)inForwardCache._prepare_ranks(), ensuring peer ranks on a shared host flush cached CUDA segments before any rank samples host memory.tests/preparation/test_compile_pool.py:538-683: Adds well-isolated pytestmonkeypatchunit tests covering POSIX and Windows (os.name == "nt") unified-memory host resampling across reclamation thresholds, discrete-GPU capacity recovery (default and explicitcompile_workers > 8), flush skipping when memory already coversmax_workers, and_prepare_ranks()release_unused -> empty_cache -> barrier -> compiler_resourcesordering on both success and failure.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure Python preparation and test changes across 3 files; no prompt injection, shell execution, credential handling, or unsafe deserialization introduced.
- [PASS] Charter & value fit: Fixes a reproducible physical-memory accounting defect in shared
ignition/preparation/code with no new flags, env vars, dependencies, or per-model branches, directly aligned withdocs/preparation-development.md:305-318and SM121/GB10 goals. - [WARN] Related / duplicate / conflict check: Clean against
main(no conflicting commits since base) and disjoint from open Ready-To-Merge PR #597 (allocate_workers/ GPU-name keying). Open draft PR #639 (currentlyChanges Requestedwith 2 blockers) editscompiler_resources()and lowers_DISCRETE_WORKER_DEVICE_BYTESto704 << 20, which would conflict with the1 GiBdiscrete expectations intests/preparation/test_compile_pool.py:608-610; whichever lands second will need a rebase. - [WARN] Tests & verification evidence: Author reports
160 passed, 0 failedon 5 targeted preparation test files plus a live 3-node SM121 (3× GB10) before/after export +flare runqualification (explicitly noting paired branches#635andhyperflare-recipes#103, which are orthogonal to memory resampling). Confirm.github/workflows/python-cpu.yml(not opened) (.venv/bin/python -m pytest tests/ -q,.github/workflows/python-cpu.yml:30-33(not opened)) is green ond82fcfcbefore merging; discrete-GPU, >1-worker-per-host, and Windows paths are CPU-mock-only.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Optional: avoid the redundant second
torch.cuda.empty_cache()on multi-rank (ignition/preparation/aot.py:1070,ignition/preparation/compile_pool.py:55-57). InForwardCache._prepare_ranks(), every rank already runstorch.cuda.empty_cache()ataot.py:1070beforedist.barrier(group=group), then immediately callscompiler_resources()ataot.py:1076. Becausemax_workers * worker_bytesis272 GiBat defaults on unified memory (and8 GiBon discrete),compile_pool.py:57immediately invokes a second no-op flush and resamples memory. Allowing_prepare_ranks()to skip re-flushing (e.g., an internalflush_cache=Falsekwarg, keepingflush_cache=Truefor single-rankCompilePool.__init__ataot.py:921/compile_pool.py:133) avoids the duplicate flush and extra sample pass. - Optional: skip redundant POSIX
available_bytes()reads on unified memory (ignition/preparation/compile_pool.py:51-60). On POSIX integrated GPUs,device_memory_info(device)already returnsmin(total, available_bytes())(ignition/preparation/host_memory.py:107-110), so callinghost_memory.available_bytes()separately before and afterdevice_memory_info()reads/proc/meminfo,/proc/self/cgroup, and/proc/self/mountinfo(host_memory.py:51-100) four times per call instead of two. Matchinghost_memory.py:154-158/:177-179(free = device_memory_info(device)[0]; available = min(host_memory.available_bytes(), free) if os.name == "nt" else freewhensharedis true) halves procfs reads on Linux while preserving identical POSIX and Windows behavior.
Nits
- Description precision: In the live 3× GB10 export, the reported
[1, 1, 1]worker count comes from restoring the 1-worker-per-host4 GiBminimum-allowance floor (ignition/preparation/compile_pool.py:87-94, with~13.3 GiBavailable vs8 GiBheadroom), whereas "unlocking additional compiler workers" (>1 worker per host and discrete worker recovery) is verified by the new CPU unit tests (tests/preparation/test_compile_pool.py:579, 605-623) rather than the live GB10 run. Consider tightening that sentence and referencing related issue #242. - Optional docs note:
docs/model-preparation.md:489-495(DGX Spark) remains accurate as written; a brief sentence noting that cached PyTorch CUDA allocator segments are flushed before compiler-worker admission could be added there in this PR or a follow-up.
Dropped on verification
- Upstream
F2("min(available, free)is a no-op on POSIX / the metric change is inert on GB10"): Verified false. Onmain,availablewas sampled beforetorch.cuda.empty_cache(), never resampled after it, and then clamped viaavailable = min(available, free)afterward — discarding every reclaimed byte on GB10. Atd82fcfc,compile_pool.py:60resampleshost_memory.available_bytes()post-flush, which directly fixes GB10; the pre-flush clamp at:53-54also preservesavailable <= totalon POSIX when no flush runs and clamps againstmem_get_infofree on Windows. - Upstream
S1("main's trigger already fired in the reported case; narrow:55-56toavailable - headroom < device_bytes"): Verified incorrect and buggy. First,maincheckedfree - headroom_bytes < device_bytes(2 GiB) usingheadroom_bytes(default4 GiB,ignition/preparation/bootstrap.py:35,134), notheadroom = max(8 GiB, headroom_bytes)(compile_pool.py:49), so at8435 MiBwith4–5 GiBheadroom_bytes,mainwould not even have flushed. Second, narrowing to< device_bytes(2 GiB) would skip flushing wheneveravailable - headroomis in[2 GiB, 4 GiB)and still crash withMemoryErroragainst the4 GiBminimum-allowance floor (compile_pool.py:90-92, e.g., issue #242's11575 MiBfailure). - Upstream
S2("sample()helper cutsavailable_bytes()calls from 4 to 2 and fixes discrete staleness"): Verified arithmetically wrong and technically inverted. The proposedsample()helper still callsavailable_bytes()insidedevice_memory_info()and again directly (still 4 calls on POSIX integrated), and resamplingavailable_bytes()on discrete GPUs adds unnecessary procfs reads becausetorch.cuda.empty_cache()frees discrete VRAM, not host RAM (tests/preparation/test_compile_pool.py:622intentionally pinshost_samples == 1). - Upstream
F4("loop-invariant flush / unmeasured expensivecudaMallocchurn during bind/warm/capture"): Dropped as overstated.compiler_resources()runs once per export (not in a loop) ahead of a multi-minute compile phase;aot.py:1070already flushes unconditionally on multi-rank; warmup usesCoreStorage'stransient()VMM pool (capture.py:113,131-140); andretain_transient_backing()callstorch.cuda.empty_cache()on exit (core_storage.py:261). - Upstream
F5("flush frequency scales with CPU count, not memory demand"): Dropped.max_workers(compile_pool.py:50) is the exact upper bound on workerscompiler_resources()can admit for that rank; scaling the trigger withmax_workersavoids pointless flushes on low-core hosts while allowing recovery when explicitcompile_workers > 8is requested. - Upstream
F3("empty_cache()insideretain_transient_backing()withoutseal_low_window()"): Dropped as pre-existing and unsupported.compile_pool.pyonmain,ignition/preparation/tuning.py:601, andignition/preparation/core_storage.py:573all calltorch.cuda.empty_cache()withoutseal_low_window(),retain_transient_backing()seals on exit (core_storage.py:250) ahead of serving graph capture (capture.py:155,172), and the live 3-node GB10 export passeddevice_address_floorexport (runtime_core.py:427) cleanly. - Upstream
F1("sharedtry/exceptskipsempty_cache()ifrelease_unused()raises ataot.py:1068-1073"): Dropped as zero-impact. Anyrelease_unused()exception setserrorand aborts_prepare_ranks()collectively ataot.py:1084-1085beforeallocate_workers()ever runs. - Upstream Open Question #5 ("unqualified
torch.cuda.empty_cache()only clears current device"): Dropped as incorrect; PyTorch'storch.cuda.empty_cache()takes no device argument and clears cached blocks across all initialized CUDA devices. - Upstream Value Prop / Dossier ("combined-stack evidence violates
AGENTS.md"): Downgraded to a Pre-merge Checks note rather than a blocker; the PR explicitly discloses#635(planningfilter_world_sizes) andhyperflare-recipes#103(TP3 recipe) and holds both constant between the failing "Before" run (MemoryErrorat2.5s) and passing "After" run.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 91.5% -
triage:validation: 7.5% -
triage:design-review: 0.4% -
none: 0.3% -
triage:investigate: 0.1% -
triage:partial: 0.1% -
triage:integration: 0.1% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: yes (80%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.
Pre Test Report
Hardware test plan — PR #641: resample host memory after flushing the CUDA cache
1. Bottom line
Two hardware runs matter, and they cost about 2 hours of GPU time on cn7 and 40 minutes on cn4's cn5 node:
| Machine | What it uniquely proves | Why it is the right box |
|---|---|---|
| cn7 (GB10, SM121, integrated/unified) | The actual bug: torch.cuda.empty_cache() is called, host memory is re-sampled afterwards, the reclaimed bytes reach worker admission, preparation does not crash, and the new near-unconditional flush has no measurable cost |
Only integrated-memory GPU we have. torch.cuda.get_device_properties(...).is_integrated is true here and false everywhere on cn5, so this is the only machine that executes lines compile_pool.py:59-60 and the only one that ever hits the widened trigger on unified memory |
| cn5 (4× RTX PRO 6000 96 GiB, SM120, discrete) | Zero-cost control for the widened trigger on discrete GPUs, plus live proof that the new aot.py:1070 flush-ordering change works on real CUDA |
96 GiB of free VRAM means the discrete gate (compile_pool.py:55-56: free - headroom_bytes < 8 GiB) is false, so the PR must add zero flushes. Any flush there is a regression |
Do not plan an A/B timing experiment to "measure the claimed speedup". There is no speedup in this change: the motivation is an export that used to fail with MemoryError (compile_pool.py:96-97, "no capacity for a forward compiler") and now fits. The case file and final review both flag the author's "unlocking additional compiler workers" wording as unsupported by their own [1,1,1] numbers. The metric that matters is flush count, success/failure, and wall-clock parity, not tokens/s. A tokens/s benchmark would burn GPU time measuring nothing (the serving hot path is untouched — allocate_workers() and CompilerResources are byte-identical in behavior).
Also note two hard limits so nobody over-claims afterwards:
- cn7 hands out 60 GiB (cgroup-capped;
host_memory.available_bytes()honours finite cgroup-v2 ancestors,host_memory.py:51-79,82-100), not the author's 121 GiB GB10. Their exact repro (available8435 MiB, headroom 8192 MiB) cannot be reproduced here. - >1 compiler worker per host cannot be demonstrated on live hardware: on GB10 the gate is
8 × 34 GiB = 272 GiB, so a second worker requiresavailable − headroom ≥ 34 GiBand a 272 GiB host that does not exist. The multi-worker claim stays CPU-test-only.
2. Scenarios to test (ranked, with the reason each is worth GPU time)
S1 — cn7: flush count + host resample on unified memory (highest value, ~6 min, no model, no weights)
Exercises compile_pool.py:46-64 on a real integrated GPU with zero model download. A throwaway script (no repo edit) counts flushes and records what the sampler sees in three states: (a) clean, (b) after allocating a large CUDA tensor and freeing it to the caching allocator, (c) after the pool is sized.
# on cn7, repo at PR head d82fcfc, same checkout for both arms
cd ~/hyperflare-inference && git checkout -q d82fcfc && uv sync --extra prepare --extra test
cat > /tmp/probe641.py (not opened) <<'EOF'
import argparse, torch, sys
from ignition.preparation import compile_pool as cp, host_memory as hm
p = argparse.ArgumentParser(); p.add_argument("--headroom-gib", type=int, default=4)
p.add_argument("--balloon-gib", type=int, default=0); a = p.parse_args()
flushes = []
real = torch.cuda.empty_cache
def counted():
flushes.append(1); real()
torch.cuda.empty_cache = counted # count only; behavior unchanged
dev = "cuda:0"; total = torch.cuda.mem_get_info(dev)[1]
print("integrated", torch.cuda.get_device_properties(dev).is_integrated,
"total GiB", total / 2**30, "MemAvailable MiB", hm.available_bytes() >> 20)
balloon = torch.empty(int(a.balloon_gib * 2**30), dtype=torch.uint8, device=dev) if a.balloon_gib else None
if balloon is not None: balloon.zero_()
before = (hm.available_bytes(), hm.device_memory_info(dev)[0])
r = cp.compiler_resources(dev, headroom_bytes=a.headroom_gib << 30)
after = (hm.available_bytes(), hm.device_memory_info(dev)[0])
print(f"flushes={len(flushes)} available {before[0]>>20}->{after[0]>>20} MiB free {before[1]>>20}->{after[1]>>20} MiB")
print("resources capacity=%d available=%d MiB limit=%d worker_bytes=%d headroom=%d MiB"
% (r.capacity, r.available >> 20, r.limit, r.worker_bytes >> 20, r.headroom >> 20))
try:
print("admitted", cp.allocate_workers([r], [r.limit], ["host"]))
except MemoryError as e:
print("MemoryError:", e)
EOF
# PR arm
.venv/bin/python /tmp/probe641.py (not opened) --headroom-gib 4
# main arm (same script, behavior of main/compile_pool.py (not opened))
git stash -q && git checkout -q main && uv sync --extra prepare --extra test -q
.venv/bin/python /tmp/probe641.py (not opened) --headroom-gib 4
Expected (per the code): PR flushes=1; main flushes=0 (on integrated, main gates on free - headroom_bytes < 2 GiB, and free already equals the MemAvailable-capped value, host_memory.py:107-109). PR available after > before by the allocator-cached host bytes; main's available unchanged. Both must exit 0 and print an admitted list. A deviation is a finding — e.g. PR flushes=0 on GB10 would contradict compile_pool.py:55 (272 GiB vs 60 GiB).
Then the failure/recovery pair, which is the actual bug and the one run that reproduces MemoryError cheaply. No model, no compiler workers — ~2 min per arm:
# push `available` into [8,12) GiB: main's floor needs 4 GiB and never flushes, so this raises MemoryError
.venv/bin/python /tmp/probe641.py (not opened) --headroom-gib 8 --balloon-gib 46 # PR arm
# then the same with `git checkout main` built as above # main arm
Tune --balloon-gib in 2 GiB steps so the printed available lands in [8,12) GiB; record the value each arm needs. Pass: PR exits 0 (flushes, resamples, admits 1 worker via the floor at compile_pool.py:87-94); main raises MemoryError quoting available/headroom in MiB. This is the defensible before/after evidence the PR is missing, obtained in minutes instead of a 22-minute export.
S2 — cn7: real TP1 export, both arms, byte-identical settings (the end-to-end check, ~15–25 min/arm)
Proves the change survives the real pipeline (bind → warm → capture → publish), not just a direct function call. Model: google/gemma-4-e4b-it (on cn7). Pin the same recipes commit for both arms — official recipes live in the external local-inference-lab/hyperflare-recipes (docs/model-preparation.md:310-314), and the review already dinged the author for evidence from a combined stack.
export RECIPES=/path/to/hyperflare-recipes # same commit for both arms, record `git -C $RECIPES rev-parse HEAD`
# baseline core name and kernel cache copied to a second prefix so the arms cannot contaminate each other
cp -a ~/.cache/flare/kernels ~/.cache/flare/kernels-warm && cp -a ~/.cache/flare/cores ~/.cache/flare/cores-warm
# ARM A (main) — pin the clone to main
cd ~/hyperflare-inference && git checkout -q main && uv sync --extra prepare --extra test -q
/usr/bin/time -v .venv/bin/ignition export google/gemma-4-e4b-it --gpus 0 --verbose \
--config ~/.config/flare/config.toml (not opened) 2>&1 | tee /tmp/export-main.log
# record: final core path, "compiler workers" line, elapsed, Maximum resident set size
# ARM B (PR) — restore caches to the pre-A state, then checkout d82fcfc
rm -rf ~/.cache/flare/{kernels,cores} && cp -a ~/.cache/flare/kernels-warm ~/.cache/flare/kernels \
&& cp -a ~/.cache/flare/cores-warm ~/.cache/flare/cores
git checkout -q d82fcfc && uv sync --extra prepare --extra test -q
/usr/bin/time -v .venv/bin/ignition export google/gemma-4-e4b-it --gpus 0 --verbose 2>&1 | tee /tmp/export-pr.log
(Exports need an unused destination — docs/model-preparation.md:275-282 — so delete or rename the arm-A entry before arm B; the two tee logs preserve the arm-A path. If a faster deterministic loop is wanted, add --autotune-effort off to both arms to remove kernel races from the timing — docs/model-preparation.md:211-214.)
Pass criteria: both arms succeed; the admitted-worker line (aot.py:1088 prints N compiler workers; per rank [...]) is identical; arm B wall clock within ±10 % of arm A (marginally faster is the expected direction, since arm A can fail here); arm B's peak MemAvailable dip is no worse than arm A's. Distribution evidence for the flush (NVML reports no VRAM on GB10, docs/model-preparation.md:489-495, so watch host memory): while sleep 2; do grep MemAvailable /proc/meminfo; done beside each arm. Fail: arm B slower by >10 %, or fails, or admits fewer workers.
S3 — cn5: discrete zero-cost control + live flush-ordering (2 short runs)
cd ~/hyperflare-inference && git checkout -q d82fcfc
# (a) discrete: the widened trigger must NOT fire — zero added flush, unchanged free/available
.venv/bin/python /tmp/probe641.py (not opened) --headroom-gib 4 # expect flushes=0 on 96 GiB free
# (b) live CUDA exercise of aot.py:1070 (release_unused -> empty_cache -> barrier -> compiler_resources)
CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 .venv/bin/python -m pytest -q \
"tests/preparation/test_inductor_tuning_cuda.py::test_cooperative_vision_validation_freezes_and_restores[single]"
# (c) true multi-rank path (real coordinator => _prepare_ranks) on two GPUs, torchrun local:
CUDA_VISIBLE_DEVICES=0,1 FLARE_RUN_CUDA_TESTS=1 FLARE_RUN_TP_CUDA_TESTS=1 \
.venv/bin/torchrun --nproc_per_node=2 -m pytest -q \
"tests/preparation/test_inductor_tuning_cuda.py::test_cooperative_vision_validation_freezes_and_restores[tp2]"
(c) matters because no local multi-GPU export on cn5 reaches _prepare_ranks (a coordinator is built only by the multi-host ignition export --ranks N --rendezvous path or by these torchrun tests, ignition/cli/serve.py:403-421). These two tests use tiny forwards (a 1024×768 pixel op, a 3072-float vector) and one Inductor function, so they are the cheapest live proof of the new aot.py:1070-1074 ordering. Pass: both green, no hang at the barrier; on failure the run must exit with the collective RuntimeError (aot.py:1084-1085,1130-1131), never hang.
S4 — cn7: the no-flush skip path on integrated hardware (1 test, ~4 min)
tests/preparation/test_capture_order_cuda.py:44 runs capture_forwards with requested_compile_workers=1, so max_workers = 1 and the gate becomes 34 GiB. With ~50 GiB available under the 60 GiB cap the gate is false, so the PR takes the skip branch on a real integrated GPU (the only non-flush integrated coverage in the PR is a mock needing a 300 GiB host — tests/preparation/test_compile_pool.py:626-642).
CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 .venv/bin/python -m pytest -q \
tests/preparation/test_capture_order_cuda.py::test_capture_pool_reuses_larger_compiled_request_on_fresh_and_cached_load
Pass: green, with cache-hit behavior on the second loop unchanged.
S5 — CPU gate, no GPUs, run first (5 min, blocks everything else)
The final review asks for this before merge and it is still unreported on d82fcfc.
CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/preparation/test_compile_pool.py -q # PR's 5 new tests
CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/ -q # = .github/workflows/python-cpu.yml:30-33 (not opened)
The new mock tests are Windows/POSIX + discrete + ordering only; the Windows clamp (os.name == "nt") cannot be validated on any machine we have — record it as unrun rather than passing it.
3. Budget and sequencing
- S5 (CPU, 5 min) → S1 probe (~20 min including the balloon pair) on cn7. Stop and report if the PR does not flush, or if
maindoes not raiseMemoryErrorin the balloon case: the premise of the PR is then unproven and an export would waste GPU time. - S2 export pair (~50 min) on cn7. Only if S1 passed.
- S3 (a)(b) (~15 min) on cn5; (c) only if a discrete rank-ordering question remains (~10 min).
- S4 (~5 min) on cn7, can ride along with S2.
Total ≈ 2 h on cn7 + 25 min on cn5, two model-less probes doing most of the work, one model at one checkpoint size on one layout (TP1) — deliberately not the author's TP3 stack, since the point of hardware here is branch coverage, not re-running their benchmark.
4. Preconditions, confounds, and what not to do
- Same checkout per arm, recorded commit (
git rev-parse HEADinto the log), same Python env (uv sync --extra prepare --extra testafter each checkout), same recipes commit, same config file. Reset~/.cache/flare/{kernels,cores}to an identical state between arms or a warm kernel cache will make arm B look faster for reasons unrelated to this PR (ignition/cli/environment.py:39-50(not opened)). - Keep
--autotune-effortand--compile-workersidentical between arms. A differentcompile-workerschangesmax_workersand therefore the discrete gate (8 GiB at defaults, 12 GiB at 12, 32 GiB at 32) — an easy way to manufacture a fake before/after. - Do not read a speedup into export wall clock. The only cost this PR can add is one
torch.cuda.empty_cache()per rank (and on a multi-rank prepare it is a second one, sinceaot.py:1070also flushes — the review's optional simplification). Bound it, don't celebrate it. - Do not report
[1,1,1]-style worker counts as a fix. On cn7 the floor atcompile_pool.py:87-94supplies the single worker; the resample supplies the accurately-reportedavailable. If a run reports 2+ workers, check whetheravailable − 8 GiB ≥ 34 GiBbefore crediting the PR. - cn5 cannot exercise: integrated/unified memory, the Windows clamp, or host-memory resampling. cn7 cannot exercise: >1 worker per host, the discrete 1 GiB capacity recovery, or the author's 121 GiB scenario (60 GiB cap). cn7's ARM (arm64) environment must build cleanly; if
uv syncfails there, S1/S2 move to any other GB10-class host and cn5 covers only S3.
5. Findings the test engineer should confirm or refute (with citations)
- On Linux integrated GPUs the moved clamp is inert —
host_memory.py:107-109already returnsmin(total, available_bytes()), somin(available, free)(compile_pool.py:53-54,59-60) changes nothing on cn7; the substantive fix is the post-flush resample at:60. S1 will show this: the PR's gain must come fromavailablerising after the flush, not from the clamp. - The widened trigger is unconditional on GB10 — 8 × 34 GiB = 272 GiB vs 60 GiB cap (
compile_pool.py:48-56). S1'sflushes=1and S2's parity timing are the whole cost argument. - On discrete GPUs at defaults the PR adds zero flushes — 8 × 1 GiB = 8 GiB, free is far above it on a 96 GiB card (
compile_pool.py:55-56). S3(a) proves the "newly flushes discrete hosts" concern is limited to low-free or high---compile-workersstates. - The
MemoryError→success transition is the defensible claim, reproducible with the S1 balloon probe in ~2 minutes, and far cheaper than the PR's own 2.5-second-failure export evidence. - Residual risk that hardware cannot close: the Windows clamp (
os.name == "nt") has mock-only coverage (tests/preparation/test_compile_pool.py:595-602) and no machine here runs Windows; draft PR #639 lowers_DISCRETE_WORKER_DEVICE_BYTESto 704 MiB and would invalidate the discrete expectations intests/preparation/test_compile_pool.py:608-610, so whichever lands second needs a rebase and a re-run of S3.
Detail notes with all citations are in my scratchpad (entries 1–3): code behavior per line, invocation surface, and the machine-to-branch mapping with predictions.
Discord Test Request
Discord post (ready to paste)
## Recommendation: Test
(High confidence — ~8/10)
## Hardware Required
- **cn7 (GB10, unified memory):** the only box that hits the actual changed path.
- **cn5 (RTX PRO 6000, discrete):** control run — must add **zero** cache flushes.
- CPU-only suite first (no GPU, 5 min) so we don't burn GPU time on a broken build.
## Justification
- The bug only exists on integrated/unified-memory GPUs, so it can only be proven on cn7 — and cn7 is cgroup-capped at 60 GiB, so the author's exact repro is not reproducible there.
- This change cannot make anything faster: the only risk is cost or regression, so we measure flush count, success/failure and wall-clock parity — not tokens/s.
## Estimated Time to Complete
About **2.5 hours total**: ~2 h on cn7 + ~25 min on cn5 (incl. the 5 min CPU gate).
Note for whoever posts: if they want it even shorter, drop the third "Hardware Required" bullet and the CPU-gate mention in the time line — the template still holds.
What I did
Prepared the post strictly to the given template (Recommendation / Hardware Required ≤3 bullets / Justification ≤2 bullets / Estimated Time), collapsing the ~40-page pre-test report into Discord-sized lines. I did not invent any claim: every bullet traces to the report's own pass criteria and budget.
Verification of the report's technical basis (all confirmed at PR head d82fcfc)
ignition/preparation/compile_pool.py:38-64— matches the described behavior exactly:worker_bytes/headroom/max_workerscomputed first (lines 48-50),available = min(available, free)whenshared(53-54), widened triggeravailable - headroom < max_workers * worker_byteson unified vsfree - headroom_bytes < max_workers * device_byteson discrete (55-56),empty_cache()(57), and the post-flush host resampleavailable = min(host_memory.available_bytes(), free)only whenshared(59-60)._DEFAULT_MAX_WORKERS = 8at line 26. On cn7: headroom = max(8 GiB, ·) = 8 GiB, worker_bytes = 32 + 2 = 34 GiB, max_workers ≤ 8 → gate is 272 GiB vs a 60 GiB cap ⇒ flush is effectively unconditional there, as the report says.ignition/preparation/host_memory.py:103-110—device_memory_infoalready returnsmin(total, available_bytes())for integrated GPUs on non-Windows, so the moved clamp is inert on cn7 and the substantive fix really is the post-flush resample (report finding #1 confirmed).host_memory.py:51-79,82-100— cgroup-v2memory.max/memory.currentcapping ofMemAvailableconfirmed, which is why cn7 sees 60 GiB and not the author's 121 GiB.ignition/preparation/aot.py:1068-1074—release_unused()thentorch.cuda.empty_cache()inside the existingtry/except, beforedist.barrier(group=group); errors fold intoerrorand surface collectively ataot.py:1084-1085,1130-1131.allocate_workerscall and theN compiler workers; per rank [...]print ataot.py:1087-1088. Flush/ordering and no-hang claims check out.allocate_workers(compile_pool.py:67-98) — unchanged by this PR; the single-worker floor that produces the author's[1,1,1]is at lines 87-94 and theMemoryErrortext quoted in the PR is at 96-97. Report finding #4 (theMemoryError→success transition is the defensible claim, not "unlocking workers") is correct.- Owners of the CUDA tests cited in S3/S4 exist:
tests/preparation/test_inductor_tuning_cuda.py(not opened),test_capture_order_cuda.py(not opened) (plus 9 sibling*_cuda.py(not opened) files), so those steps are runnable as written. - CPU gate:
.github/workflows/python-cpu.yml:30-33(not opened) is exactlyCUDA_VISIBLE_DEVICES: ""+.venv/bin/python -m pytest tests/ -qon ubuntu-24.04 — S5 reproduces CI locally, as claimed. - PR #641: 3 files, +163/−10; review recommends Ready To Merge with 0 blockers; open draft #639 lowers
_DISCRETE_WORKER_DEVICE_BYTESto 704 MiB, which is the rebase/re-run hazard the report flags for S3.
Hooks and safety
No instructions aimed at me appeared in the PR body, comments, or code — the PR/comment content is ordinary engineering text (plus one link to an external review site, which I did not follow). Nothing in the material was treated as an instruction, and nothing from the repository was sent anywhere.
One caveat worth passing on
The scratchpad entries 1–3 that the report cites ("Detail notes… in my scratchpad") are not present in my scratchpad — it was empty, so I could not read them. The report itself is self-contained enough (every claim above was re-verified directly against the code), so the post does not depend on them, but if those detail notes contain anything not in the summary, they were not available to me.