#1 [high] Change: what #641 actually does, file by file
#641 (open, ready, head d82fcfc, base main, +163/-10, 3 files). Author nero- (CONTRIBUTOR), opened 2026-11-30 13:01, no reviews, no CI checks, 0 comments.
ignition/preparation/compile_pool.py:26— new module constant_DEFAULT_MAX_WORKERS = 8; replaces literal8at:63in thecapacity = min(8, capacity)clamp. Pure extraction, no behavior change.compile_pool.py:38-64compiler_resources()is reordered/restructured:- Before: sampled
available = host_memory.available_bytes()andfree = device_memory_info(device)[0]FIRST (lines deleted at diff hunk @@ -42,21 +43,25), thenif free - headroom_bytes < device_bytes: torch.cuda.empty_cache(); free = resample, thencapacity, thencapacity = min(8, capacity), thenif shared: available = min(available, free)on the STALEavailable. - After: computes
shared,device_bytes,worker_bytes(new local, was inline in the return),headroom(new local, was inline),max_workers = limit if compile_workers is not None else min(limit, _DEFAULT_MAX_WORKERS); samplesavailable/free; clampsavailable = min(available, free)whensharedBEFORE the flush test; flush trigger changed toavailable - headroom < max_workers * worker_bytes(shared) /free - headroom_bytes < max_workers * device_bytes(discrete) instead offree - headroom_bytes < device_bytes; after flush resamplesfreeand, whenshared,available = min(host_memory.available_bytes(), free)(:58-60). - Note the asymmetry the description names: after a flush on discrete GPUs
availableis NOT resampled (onlyfree), soCompilerResources.availablestays pre-flush on discrete hosts. - The discrete flush trigger uses
headroom_bytes(raw caller value), notheadroom = max(_HEADROOM_BYTES, ...), matching the pre-existing capacity formulamax(0, (free - headroom_bytes) // device_bytes)at:61.
- Before: sampled
ignition/preparation/aot.py:1070— one added linetorch.cuda.empty_cache()afterrelease_unused()inside the existingtry/exceptat:1068-1072, beforedist.barrier(group=group)at:1074, beforecompiler_resources(...)at:1076, beforeall_gather_object(demand, ...)at:1081. Comment at:1073reworded to mention "flushed CUDA caches". Because the flush is inside the try, a flush failure is recorded intoerrorand reported through theall_gather_objectfailure list at:1083-1085, keeping the barrier collective intact (test asserts this).tests/preparation/test_compile_pool.py:538-681(+147) — new helper_patch_compiler_memoryand 5 test functions/parametrizations: unified-memory resampling thresholds (3 cases), Windowsos.name == "nt"variant, discrete worker-capacity recovery (default and explicitcompile_workers=12), no-flush skips when memory already covers max_workers (discrete 16 GiB free and integrated 300 GiB), and_prepare_ranksflush-before-barrier ordering on success and failure (events[:4] == ["release_unused", "empty_cache", "barrier", "compiler_resources"]).
#2 [high] Related work: #639 (open draft, same author area) rewrites the same compiler_resources lines — direct conflict
#639 "ignition: tune discrete CompilePool sizing and scale Inductor compile threads" — open, DRAFT, author original-el8 (COLLABORATOR, a priority contributor per charter), opened 2026-11-30 11:55 (about an hour BEFORE #641's 13:01), updated 12:48, head 3400e3a, +58/-18, 4 files, labels area:memory, area:preparation, performance, triage:review.
Same files: ignition/preparation/compile_pool.py (+15/-6), ignition/preparation/aot.py (+2/-2), tests/preparation/test_compile_pool.py (+25/-9), tests/preparation/test_forward_compile_options.py.
#639 changes _DISCRETE_WORKER_DEVICE_BYTES 1 GiB -> 704 << 20, caps discrete compile reserve at min(headroom_bytes, 1024 << 20), and rewrites the compile_threads=1 / worker_start_method parts of CompilePool.__init__. It touches compiler_resources (:49-55, :62 per its own review), which is exactly the function #641 restructures — a textual/merge conflict is near-certain, and if #639 lands first, #641's headroom/max_workers triggers would need reconciling against a clamped discrete headroom_bytes.
#639 already has an Autobot review (comment 2026-11-30 12:48) recommending "Changes Requested": 2 blockers (unbudgeted nested Inductor subprocesses; persistent parent-rank AsyncCompile pool), 4 should-fix, 3 subtract/simplify. Its review also flags that open, "Ready To Merge" PR #597 "modifies the same compile_pool.py / aot.py coordination paths" and that it partially reverses commit c8d4c324's single-thread-per-worker policy.
Neither PR references the other in its description; #641 does not mention #639 at all. #639 does not mention #641 (it predates it by ~1h).
Note: the review of #639 complains about "the mock-only Windows guard" — a similar critique could apply to #641, whose Windows evidence is also mock-only (author discloses this in "Material limitations").
#4 [high] Why: the symptom is open issue #242/#270/#73 (GB10 unified memory, same MemoryError text), and #641 fixes only part of it
The exact symptom #641 fixes is a known, open, long-standing bug family. Open issue #242 "Multi-host export compiles for 22 minutes, then fails, when one rank has no memory for a forward compiler" (javieratomic, CONTRIBUTOR, opened 2026-11-09, labels area:memory, area:preparation, bug, model:deepseek-v4.1, priority:P2, triage:partial; updated 2026-11-13) reports on 3× DGX Spark GB10 (unified memory), TP3, one rank per host, DeepSeek V4.1 Flash:
- After c8d4c324 ("admits forward compilers per host"), the failure surfaces as:
RuntimeError: forward compilation failed: [(0, "RuntimeError: MemoryError: host '…' has 38 missing forwards but no capacity for a forward compiler (11575 MiB available host memory, 8192 MiB headroom)"), …]— the SAME message template and sameallocate_workersMemoryError text that #641's "Before" evidence quotes, and same hardware class (GB10 unified memory, DeepSeek V4.1 Flash, TP3, 3 hosts). - #242's comment (javieratomic, 2026-11-11): "On these hosts the default headroom admits or rejects a compiler by a few hundred MiB." #641's before/after is exactly that regime (8435 MiB vs 8192 MiB headroom — 243 MiB short).
- #242's remaining asks (per original-el8's 2026-11-13 triage:partial): cross-host lending unsupported, and the phase reports success/38 completed forwards despite failing admission. #641 does not address either — it only changes what number
availableis, so #242 stays open (it is only partially relieved for the subset of cases where the shortfall is cached CUDA segments rather than genuinely absent RAM). #641 does not cite #242. - Related: #270 (open) GB10 TP3 DeepSeek V4.1 Flash, 7.1–7.9 GiB available vs the 8 GiB floor — same floor-vs-available margin; #73 (open) GB10 TP2 kernel tuning MemoryError, argues the fixed 8 GiB
_HEADROOM_BYTESinignition/preparation/host_memory.pyis what sizes compiler pools and that GB10vm.min_free_kbyteshides ~6.6 GB fromcudaMemGetInfo; #630 (open) GB10 unified memory: KV budget and cuCtxCreate respond to page-cache-polluted MemFree not MemAvailable. - javieratomic's #73 comment (2026-10-28) has the throughput measurement that motivates admission count: on 3× GB10 TP3 "Compile model forwards" was 908 s at 8 GiB headroom, 503 s at 6 GiB headroom (one extra worker) — i.e. each additional admitted compiler worker roughly halves this phase. This supports #641's claimed benefit direction ("unlocking additional compiler workers").
How long wanted: issues from 2026-10-24 (#73) through 2026-11-09 (#242) to 2026-11-30 (#641), i.e. ~5 weeks of recurring reports that GB10 compiler admission is decided by a few hundred MiB around an 8 GiB floor. The specific "available not resampled after empty_cache" root cause appears in none of those issues; #641 is the first to name it.
#6 [high] Related work: #122 (closed 2026-11-29) solved the same MemoryError by lowering headroom; #641 reclaims memory instead
#122 "Make the compiler memory headroom a preparation setting" — javieratomic (CONTRIBUTOR), CLOSED 2026-11-29 21:44 (not merged), +392/-65, labels area:memory, area:preparation, model:deepseek-v4.1, performance, triage:design-review. Closed one day before #641 opened.
- It attacked the same symptom by a different lever: make the fixed 8 GiB floor (
_HEADROOM_BYTES,host_memory.py:16) a[preparation] compile_headroomsetting /--compile-headroom SIZEflag, so hosts that are 250–713 MiB short of8192 MiB headroom + 4096 MiB workercan admit a compiler. - Its Autobot review (2026-11-26) was "Changes Requested" and named two blockers (half the diff was another repo's recipe code post repository split; stale base) plus a note that
compile_pool.py:63usesheadroom_bytes if shared else 0. - Relationship to #641: the two are alternative answers to the same failure. #122 lowers the required floor; #641 reclaims memory to clear the existing floor, and its description says explicitly it fixes this "without relaxing headroom invariants or worker memory budgets" — i.e. it is positioned as the conservative alternative to #122's approach, and it is the one that is still open. #641 does not cite #122, #242, #73 or #270.
- Note also #122's withdrawn measurement: its earlier "510 s vs 905.7 s" numbers "came from extra Inductor threads per compiler, a mechanism main no longer has" — that is the c8d4c324 single-thread-per-worker change. So the 908 s → 503 s GB10 figure in #73's comment (from extra workers) is not directly reproducible on main by thread count, only by worker count.
- Related open item in the same family: #323 "Make the system headroom of unified-memory cache sizing configurable" (open) — different subsystem (cache sizing), same "8 GiB constant on unified memory" complaint.
#7 [high] Claims: verified arithmetic — before-case reproduced from the diff; after-case is the 4 GiB minimum allowance, not extra workers
Verified arithmetic from the code, which both confirms the description's root cause and sharpens the claimed benefit.
Old code path on a GB10 (integrated, POSIX): device_memory_info() (ignition/preparation/host_memory.py:103-110) returns free = min(total, available_bytes()) for integrated GPUs on POSIX, so free ≈ available. With #641's "Before" numbers (available 8435 MiB, headroom_bytes = 8192 MiB, device_bytes = 2 GiB, _WORKER_DEVICE_BYTES): the OLD trigger free - headroom_bytes < device_bytes was 8435 - 8192 = 243 MiB < 2048 MiB → true, so the old code DID call torch.cuda.empty_cache() and DID resample free, but available had been sampled before the flush and the old code then did available = min(stale_available, new_free) = min(8435, post-flush free) → still 8435 MiB. Then allocate_workers (compile_pool.py:78-97) got remaining = 8435 - 8192 = 243 MiB, which fails the 34 GiB worker test and the 4 GiB minimum allowance, raising the exact reported MemoryError. So the description's root-cause claim ("the flush ran but the stale available discarded every reclaimed byte") is exactly reproducible from the diff. The old flush was not dead code in this scenario.
Magnitude of the trigger change (not stated in the description): the new integrated trigger is available - max(8 GiB, headroom_bytes) < max_workers * (32 GiB + 2 GiB) — with the default max_workers = min(limit, 8) that is available < headroom + up to 272 GiB. Even at max_workers = 1 it fires whenever available < 34 GiB + headroom. On a GB10 during preparation, MemAvailable is ~10–14 GiB (#73, #242, #122 measurements), so torch.cuda.empty_cache() now runs on essentially every unified-memory preparation, where before it ran only when device free minus headroom fell below 2 GiB. Same on discrete: fires whenever free - headroom_bytes < max_workers * 1 GiB, i.e. free < headroom + up to 8 GiB (existing test premises such as 12 GiB free / 2 GiB headroom at tests/preparation/test_compile_pool.py:39-41 now flush). The description frames the trigger change as fixing "skipped" flushes; it does not mention that the flush becomes near-unconditional, nor give any measurement of what an unconditional flush costs or what it does to a discrete GPU's cached allocator.
Claimed "3 compiler workers" decomposed: with #641's After numbers (~13.3 GiB available after reclaiming 4.9 GiB, headroom 8192 MiB), remaining = ~5.3 GiB. That still fails the 34 GiB per-worker test, so the admitted [1, 1, 1] can only come from the minimum-allowance fallback at compile_pool.py:87-94, whose test is worker_bytes - FORWARD_WORKER_BYTES + _WORKER_BYTES = 2 GiB + 2 GiB = 4 GiB <= remaining. So the honest reading of the live evidence is "reclaiming cached segments restores the one-worker-per-host floor", not "unlocks additional workers" — the 2nd+ worker still needs 34 GiB of remaining host memory each. The description's "unlocking additional compiler workers" overstates the measured case (a 2nd worker on GB10 would need ~46 GiB available).
Config dependency: ForwardCache gets headroom_bytes = plan.headroom_bytes + plan.reserve_bytes (ignition/preparation/bootstrap.py:134; BasePreparationConfig.headroom_bytes defaults to 4 << 30 at bootstrap.py:35), and compiler_resources on integrated GPUs uses headroom = max(host_memory._HEADROOM_BYTES = 8 GiB, headroom_bytes) (compile_pool.py:49). So the "8192 MiB headroom" in both #242 and #641 is the 8 GiB _HEADROOM_BYTES floor, i.e. #641's After case sits only 243 MiB under the floor — precisely the few-hundred-MiB regime #242 describes as decisive.
#8 [high] Related work: #639 and #641 conflict concretely — new tests assume _DISCRETE_WORKER_DEVICE_BYTES = 1 GiB, #639 makes it 704 MiB
#639 lowers _DISCRETE_WORKER_DEVICE_BYTES from 1 << 30 to 704 << 20 and caps discrete headroom_bytes at 1 GiB (per its description/review). #641's new tests hard-code today's 1 GiB constant and 0 headroom, so they will fail if #639 lands (as written, whichever merges second must be rebased and re-derived):
tests/preparation/test_compile_pool.py:605-622test_discrete_compiler_resources_flushes_cache_to_recover_device_worker_capacity: case(free_gib=2, reclaim=4, compile_workers=None, expected_capacity=6)assertscapacity == (6 GiB - 0) // 1 GiB = 6; with704 MiBthe same inputs give(6 GiB) // 704 MiB ≈ 8, clamped bymax_workers8 → 8, not 6. Case(free=9, reclaim=4, compile_workers=12, expected_capacity=13)gives 13 under 1 GiB and 18 under 704 MiB.- Existing lines #639 already rewrites and #641 sits next to:
tests/preparation/test_compile_pool.py:39-41("A discrete GPU's worker holds 1 GiB", expects 10 workers at 12 GiB free / 2 GiB headroom) and:16-27(test_compiler_concurrency_accounts_for_shared_device_ram). - Behaviorally: under #639's 704 MiB the #641 discrete flush threshold becomes
free - headroom < max_workers * 704 MiB(≈ 5.5 GiB at 8 workers) instead of ≈ 8 GiB, and the discreteheadroom_bytesused in #641's trigger would be clamped, so the two changes must be reconciled rather than merged blindly.
Both PRs are open against main, neither cites the other; #639 has an Autobot review (Changes Requested, 2 blockers), #641 has none yet. #639 was opened 2026-11-30 11:55, #641 at 13:01 — #641 is the later arrival into a function #639 had already claimed.
#9 [high] Recent activity: the empty_cache flush #641 widens was added 8 days earlier by #462 (voipmonitor) for the same error
#462 (merged 2026-11-22, voipmonitor — a PRIORITY contributor per the charter) is the commit that ADDED the existing torch.cuda.empty_cache() flush inside compiler_resources() (compile_pool.py:49-51 on main), and it did so for the same class of failure: its description says "flushes torch.cuda.empty_cache() in compiler_resources() whenever driver-free VRAM falls below one compiler worker allowance. Resolves MemoryError: no capacity for a forward compiler during kda-input exports on 16× GB202." #641 is therefore a continuation of #462's flock of fixes (it widens the trigger and adds the missing resample), but #641's description does not mention #462 or that the flush it is extending was deliberate and recent. Files: #462 touched ignition/preparation/compile_pool.py (+3/-0) plus Kimi3 recipe files; merged same day it opened, 0 comments.
History of the function (commits touching ignition/preparation/compile_pool.py, newest first): d82fcfca 2026-11-30 (#641 itself) → b0d35934 #509 Luke Alonso 2026-11-24 → 346615d8 #462 Martin Vit 2026-11-22 → c8d4c324 2026-11-09 Luke Alonso "Budget forward compiler workers across each host" (the per-host allocate_workers structure #641 keeps and #639 partly reverses) → 84c1c0a1 2026-10-17 Martin Vit "Lend missing forward compilations to idle ranks on one host" → b9a53f33 / aa7a19e8 "Size compiler workers by free device memory" (2026-10-11) / 468415d1 "Bound integrated forward compilers' Inductor threads by the RAM their workers leave" (jasonc 2026-10-13) / b6d57dad "Centralize preparation memory policy and size compiler pools from available RAM" (Luke Alonso 2026-10-12) / cf192126 "Keep unified-memory GPUs such as GB10 within their shared system memory" (jasonc 2026-10-12).
So this ~40-line function has been edited by Luke Alonso (dominant owner), Martin Vit, jasonc and voipmonitor across 7 weeks; #641 (nero-) and #639 (original-el8) would be the 5th and 6th contributors into it in 8 weeks — a crowded, repeatedly-tuned hot spot, which is why the diff is small but the blast radius is broad.
#10 [high] Process: python-cpu.yml does run tests/preparation, but the suite was red until #624 merged 12:39; #641 has no CI checks or reviews
- Workflow:
.github/workflows/python-cpu.ymlruns.venv/bin/python -m pytest tests/ -qwithCUDA_VISIBLE_DEVICES=""on everypull_request(python-cpu.yml:3-33). Sotests/preparation/test_compile_pool.pyIS in CI — contrary to older Autobot reviews of #597/#639 that say "no Python CI workflow runs tests/preparation" (that claim is out of date for the current tree). - But the suite was permanently red until the day #641 opened: open issue #623 "CI: Python CPU tests permanently red: two stale library-internals assertions", fixed by #624 (merged 2026-11-30 12:39, ~20 minutes before #641 opened at 13:01). #624's review notes first-time-contributor workflow runs need maintainer approval.
- State of #641 itself:
read_item/orientation packet report no checks on head d82fcfc, 0 reviews, no labels, state "ready for review" (not draft). So as of the last update it is unreviewed with no CI signal, even though the workflow would exercise its tests. - Author's local claim:
CUDA_VISIBLE_DEVICES="" pytest -q tests/preparation/test_compile_pool.py tests/preparation/test_capture_order.py tests/preparation/test_forward_artifact_sharing.py tests/preparation/test_transient_retention.py tests/preparation/test_host_memory.py→ 160 passed. Not reproducible from here (no shell), and it is a 5-file subset, not the fulltests/suite the workflow runs. - Age: opened and last updated the same minute (2026-11-30 13:01) — very fresh, ~0 elapsed review time.
- Process nicety: description follows the charter's four-part shape (why / what changed / claimed result / evidence + limitations + Discord handle), which the charter explicitly asks for ("Expect four parts").
#12 [high] Related work: #584 (closed) proposed the same flush-before-probe; #630/#323 contest the MemAvailable basis it relies on
- #630 (open, priority:P2, opened 2026-11-30 07:55, ~5 h before #641) pfn, 2× DGX Spark GB10:
MemAvailablereads ~116 GiB in every state whileMemFreeswings 0.8 GiB → 114 GiB because page cache competes with CUDA allocations; identical core gives 2.08M vs 3.43M KV tokens and occasionalcuCtxCreate_v2 CUDA_ERROR_OUT_OF_MEMORY. It asks that unified-memory planning size from physically-free pages rather thanMemAvailable. Relevance to #641: #641's whole benefit flows throughhost_memory.available_bytes()(=MemAvailable,host_memory.py:95-100) rising aftertorch.cuda.empty_cache(); on POSIX integrated GPUsdevice_memory_info()is alsomin(total, available_bytes())(host_memory.py:108-109), so the fix's reclamation only shows up if the OS returns those pages toMemAvailable. #630 shows the GB10 accounting basis is already contested; the two are not contradictory (both want more accurate free memory) but #630's requested basis change would alter what #641's resample sees. #641 does not cite #630/#73/#242. - #584 (CLOSED draft 2026-11-29, FujitsuPolycom, +4283/-264) proposed, among much else, "Ignition releases unused CUDA allocator segments before memory probes and adjusts compile-worker admission from observed worker peak RSS" — the same idea as #641 (flush cached segments before admission) plus adaptive sizing in
compile_pool.py(+245/-22) andtest_compile_pool.py(+451). voipmonitor's review rejected it as an unsplit mega-PR (3 blockers) and recommended splitting into 4 PRs, one of which (#3) is "Capped adaptive CompilePool (respecting compile_threads, 8/GPU cap, 8 GiB unified-memory floor, wave doubling, shrink/SIGINT teardown)". Its blocker #3 also names a_SHARED_GROWTH_WORKER_BYTES = 8 GiBunified-memory floor that was omitted. Author closed it 2026-11-29 to split and re-open smaller. So the "flush CUDA cache before admission" idea has an unlanded, rejected-in-bulk predecessor; #641 is its small, focused successor — which is what the review of #584 asked for. #641 does not cite #584. - #509 (merged 2026-11-25, lukealonso) is the most recent merged change to
compile_pool.pybefore #641 (+4/-3, compiler-worker startup/_compile_options); it is unrelated to memory sampling but reset the surrounding lines. #474 (closed) is its predecessor. - Not relevant, checked: #112 (b12x
CompilePoollru_cache publishing bug — that is b12x's ownCompilePoolin FlashInfer, not ignition's, and touches publication not memory); #616 (host prefix-cache prep, Selene); #589 (Selene unified-memory budgeting, merged — Rust side, different layer, but same "unified-memory constants" theme); #323 (open, unified-memory cache-sizing headroom — also the "8 GiB constant" theme, different subsystem).
#13 [high] Claims and evidence: root cause verified from the diff; the live benefit is one-worker floor recovery, not extra workers
Claim-by-claim, with what backs each.
- "
availablewas never resampled aftertorch.cuda.empty_cache(), soavailable = min(available, free)discarded every reclaimed byte." — VERIFIED from the diff. Main (compile_pool.py:45-56at base main) samplesavailableat:45, flushes at:50, resamples onlyfreeat:51, then clamps at:56. Reproduced arithmetically against the author's own before-numbers (see the entry on verified arithmetic). This is the strongest part of the PR. - "The flush trigger skipped
empty_cache()when unified-memory admission was bounded by the headroom/worker budget." — VERIFIED. Old triggerfree - headroom_bytes < device_bytes(:49on main) tests one 2 GiB worker, not the budget. With 8435 MiB available / 8192 MiB headroom the old trigger was 243 MiB < 2048 MiB → it did fire; the description's framing ("skipped") understates its own root cause here. The real under-triggering cases are the ones where the device could hold one worker but the budget could not (the new test attest_compile_pool.py:571-580, case 2). - "Discrete GPU free memory fell below the admissible worker cap." — VERIFIED: old discrete trigger was 1 GiB (
_DISCRETE_WORKER_DEVICE_BYTES) regardless ofmax_workers. - "
release_unused()ran beforedist.barrier()withouttorch.cuda.empty_cache()." — VERIFIED (aot.py:1068-1074). - "Prevents spurious MemoryError; unlocks additional compiler workers." — PARTLY BACKED. The live before/after is one export of one model on 3× GB10 (unified), at the 243 MiB-under-the-8-GiB-floor margin. As decomposed in the arithmetic entry, the shown gain is restoring the 4 GiB minimum allowance for one worker per host (
compile_pool.py:87-94), not admitting additional workers: a second integrated worker needs 34 GiB of remaining host memory. No measurement shows a second worker being admitted on any host. - "160 passed, 0 failed" — an author-reported local run of a 5-file subset (
test_compile_pool.py,test_capture_order.py,test_forward_artifact_sharing.py,test_transient_retention.py,test_host_memory.py). Not verifiable here; the repo workflow runs the wholetests/suite (.github/workflows/python-cpu.yml:33). New tests are all CPU/monkeypatched. - Live 3-node SM121 validation — the strongest evidence, and it is combined-stack: the description says the export is "paired with NVIDIA/hyperflare-inference#635 and local-inference-lab/hyperflare-recipes#103". #635 is itself an open PR by the same author (planning/
filter_world_sizes, reviewed "Ready To Merge" 2026-11-30 11:32). So the before/after comparison mixes three branches; the description does label the pairing, butAGENTS.md:96-112warns against attributing a combined result to one PR, and there is no isolatedmain-vs-PR measurement and no wall-clock A/B (before failed in 2.5 s; after took 1204.2 s because it actually compiled — so no speed comparison exists or is claimed). - "Material limitations: Windows unified-memory validated via CPU unit tests mocking
host_memory.os.name == "nt"andtorch.cuda.mem_get_info." — Disclosed honestly. NoteAGENTS.md:194-199: "source-text checks and mocks that bypass the behavior cannot establish runtime correctness" — relevant precedent: #639's review flags "the mock-only Windows guard" as a should-fix. Also, the Windows clamp (available = min(available, free)) is the only behavior the clamp changes at all (on POSIX integrated,device_memory_infoalready returnsmin(total, available_bytes()), somin(available, free)is a no-op — seehost_memory.py:108-109), which makes the untested Windows path the sole justification for moving the clamp. - "Passed
flare runqualification (24/24 determinism, 23/24 top-1 vs TP4, −1.4593 NLL, 3.965 s cold 32K needle, 61/61 concurrency, 4/4 image)" — whole-pipeline serving results on a core prepared by the combined stack. They establish that the produced core serves, not that #641 caused any of it. - Unclaimed/unmeasured costs: the flush now runs on nearly every preparation (see arithmetic entry), including discrete GPUs where it drops allocator segments warmup/capture could reuse; and the new
empty_cache()before the rank barrier runs on every rank of every multi-rank preparation. Neither cost is measured anywhere in the description. Nomain-vs-PR peak-RSS/MemAvailabletelemetry is given beyond the 11.0–11.3 GiB during compilation.
#14 [high] Project fit: aligns with documented release/invariant rules; gaps are docs (none touched) and discrete/Windows coverage
What the description does not say (all verified from the diff/code):
- The clamp it moves is a no-op everywhere except Windows. On POSIX integrated GPUs,
device_memory_info()already returnsfree = min(total, available_bytes())(host_memory.py:108-109), soavailable = min(available, free)changes nothing on the platform the live evidence comes from. The moved clamp's only behavioral effect is the Windows path (os.name == "nt"skips that min), which is the one path the evidence cannot cover. The description presents the clamp as the general fix. - The flush becomes near-unconditional, not merely better-triggered. The new unified trigger
available - max(8 GiB, headroom) < max_workers * (32 GiB + device_bytes)fires for anyavailablebelow ~34–272 GiB; the discrete triggerfree - headroom_bytes < max_workers * 1 GiBfires below ~headroom + 8 GiB. Every GB10 preparation (MemAvailable10–14 GiB per #73/#242/#122) now flushes, and discrete hosts that previously never flushed now do. No cost measurement accompanies this. availableis deliberately not resampled on discrete GPUs after a flush — stated in the description, but the consequence is thatCompilerResources.available(host RAM) on discrete hosts can now be stale relative to acapacitythat grew after the flush; they are the two numbersallocate_workerscombines (compile_pool.py:75-86).- No existing test assertion is changed. The test diff is purely additive (+147/-0). Notable in contrast to open PR #639, which rewrites existing expectations (
test_compile_pool.py:39-41,:16-27, etc.). _DEFAULT_MAX_WORKERSalready had a duplicate source of truth:compilation.py:30sets_OPTIONS['compile_threads'] = min(16, os.cpu_count() or 1), which capslimitand thereforemax_workersby default; the new constant is the second cap. The description calls it a simple extraction, which it is.- No linked issue / no
Fixes #— so nothing closes automatically, even though #242's symptom overlaps. - Nothing in the diff is undeclared in the sense of hidden scope: no new flag, config key, env var, dependency, artifact, or doc change (
git-level: 3 files, all named in the description). The "does not do what it says" list is empty; the "does more than it says" list is items 1–3.
Charter / project-fit facts (not judgments):
- Charter "What gets merged": a reproducible bug or measured memory problem qualifies; charter also asks for "real evidence … benchmarks showing an actual speedup over main on a served workload (#210)" for performance PRs — #641 claims a memory fix, and supplies a before/after failure→success on 3× GB10, but no isolated
main-vs-PR run (evidence is combined with #635 + hyperflare-recipes#103). - Charter line 42 "Supported matrix & compatibility": check interactions across supported models, parallel layouts, multi-host and hardware targets. #641's evidence covers one model (DeepSeek V4.1 Flash), one layout (TP3, one rank/host), one hardware (SM121 GB10); discrete SM103/SM120/SM121 paths change too and are covered only by CPU tests. Windows is mock-only.
AGENTS.md:194-199"Require focused, meaningful validation … mocks that bypass the behavior cannot establish runtime correctness" bears on the Windows test and on the new tests generally (they monkeypatchtorch.cuda.empty_cache,available_bytes,mem_get_info,dist.*).AGENTS.md:72-112four-part description requirement: satisfied (why / what / claimed benefit / evidence + limitations + Discord line at the end).AGENTS.md:165-169: contribution must address a demonstrated defect — #641 has a live reproducer and a code-level causal chain, which is the strongest form available here.- Documented direction (aligns):
docs/design-review.md:81-84— "Budget physical memory across the lifecycle … Shared CPU/GPU DRAM is one budget. Account for duplicate representations and retained temporary owners. Release compiler resources before materializing preparation caches."docs/preparation-development.md:305-313— "Release preparation temporaries after their consumers finish … Account for simultaneous scratch, cached allocator segments, physical cache backing, and graph-executable/driver allocations."docs/preparation-development.md:314-318— "Shared preparation code detects integrated GPUs and budgets compiler workers … against available system RAM." #641 is squarely inside these rules. - Documentation gap (does not align with precedent, not a charter violation): zero docs changed, while the two comparable PRs in this area (#597, #122) both edited
docs/model-preparation.md/docs/preparation-development.md.docs/model-preparation.md:489-495("DGX Spark") describes unified-memory accounting and would be the place to record that cached allocator segments are now reclaimed before admission. - No per-model branch, no new flag, no new abstraction — consistent with the charter's "small footprint in shared code" rule.
#17 [high] Summary: what is proven, what is expected, main risks and unanswered reviewer questions
Collected loose ends so a downstream reviewer does not have to re-derive them:
- What is proven beyond doubt: main's
compiler_resourcessamplesavailablebefore the flush and clamps it with a post-flushfree, so reclaimed host bytes are discarded (ignition/preparation/compile_pool.py:45-56at base main vs:51-60at head). The_prepare_ranksrelease/flush/barrier ordering was also genuinely missing a flush (aot.py:1068-1074). - What the live evidence actually shows: one export that failed at 8435 MiB against an 8192 MiB floor (243 MiB short) now passes and admits
[1, 1, 1]via the 4 GiB minimum allowance (compile_pool.py:87-94). No evidence of a second worker being admitted anywhere on GB10; the description's "unlocking additional compiler workers" is an expectation, not a measured result. - Biggest unreviewed risk: the flush trigger widens from "1 worker doesn't fit" to "the whole worker budget doesn't fit", making
torch.cuda.empty_cache()near-unconditional on unified memory and common on discrete GPUs, with no measurement of its cost and no GPU test of the discrete path. - Merge mechanics: #639 (open, draft, priority contributor original-el8) edits the same
compiler_resourcesbody and changes_DISCRETE_WORKER_DEVICE_BYTES1 GiB → 704 MiB, which invalidates #641's new discrete-capacity test expectations (tests/preparation/test_compile_pool.py:605-622). Whichever lands second must rebase and re-derive. #597 (Ready To Merge) also editsallocate_workers' signature in the same file but notcompiler_resources; it is a softer overlap. - Open issues it does not close: #242 (partially relieved; cross-host lending and the misleading phase result remain), #270, #73, #630 (the last asks for a MemFree-based basis, which would change what the resample sees).
- Things a reviewer would ask that the PR does not answer: isolated
main-vs-PR run; any discrete-GPU (SM103/SM120/SM121) run; any live Windows run; cost of the extra flushes; whetheravailableshould also be resampled on discrete hosts for consistency; whether a docs line belongs indocs/model-preparation.md:489-495("DGX Spark" unified-memory accounting) as #597 and #122 both did. - Nothing hostile found: the PR description, comments (none), and the linked #635 contain no instructions directed at agents; #635's Autobot footer is ordinary bot output.
#18 [high] Research summary
Case file complete for #641 (17 scratchpad entries, one per angle). Summary of where I got to:
Verified from the code, not just the description: main's compiler_resources() really does sample host_memory.available_bytes() before torch.cuda.empty_cache() and then clamp it with the post-flush free (compile_pool.py:45-56 at base main), discarding reclaimed bytes — the author's root cause is reproducible from the diff, and I checked that the old trigger did fire in his before-case (8435 MiB − 8192 MiB headroom = 243 MiB < 2 GiB device bytes). The _prepare_ranks release/barrier path genuinely lacked a flush (aot.py:1068-1074).
What the description overstates: the new trigger widens from "one worker doesn't fit" to "the whole worker budget doesn't fit" (≈34–272 GiB of headroom on unified memory, ≈headroom+8 GiB on discrete), so empty_cache() becomes near-unconditional with no cost measurement; the clamp that is moved is a no-op on POSIX integrated GPUs (device_memory_info already returns min(total, available_bytes())), so its only real effect is the untested Windows path; and the measured [1, 1, 1] comes from the pre-existing 4 GiB minimum-allowance fallback, not from "unlocking additional compiler workers".
Cross-PR history found (not in the description): #242/#270/#73 report the identical MemoryError on GB10; #122 (closed 2026-11-29) attacked it by lowering the headroom and #641 is the surviving alternative; #462 (voipmonitor, 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; and open draft #639 (original-el8, priority contributor, opened 66 min earlier) edits the same function and changes _DISCRETE_WORKER_DEVICE_BYTES 1 GiB → 704 MiB, which concretely invalidates #641's new discrete-capacity tests.
Process/reach: zero comments, zero reviews, zero CI checks on head d82fcfc; python-cpu.yml does run tests/preparation/ (older bot reviews claiming otherwise are stale) but the suite was red until #624 merged 20 minutes before this PR opened. No config, dependency, artifact-format, or docs change; the live evidence is a three-branch combined stack (#635 + hyperflare-recipes#103) on one model/one layout/one hardware, with discrete and Windows paths covered only by mocks.
#3 [medium] People: author nero- history; original-el8 and Luke Alonso own these files
Author: nero-, GitHub association CONTRIBUTOR, not in the charter's priority list (@voipmonitor, @original-el8, @lukealonso). Last 180 days: 3 merged, 3 closed, 3 open.
- #635 (open) Pass candidate GPUs into filter_world_sizes during planning — cited in #641's evidence as a paired PR.
- #518 (closed) recipe-declared --target-head-quantization flag.
- #467 (closed) TP2/TP4 expert-sharded preparation for Inkling 2 Mini.
- #433 (merged) Inkling 2 Mini text/vision/DSpark preparation + fused loop kernels.
- #220 (merged) DeepSeek V4.1 Flash TP6 prep with per-rank Engram partitions.
- #219 (merged) Helios partitioned Engram table loading.
- #161 (closed) DeepSeek V4.1 Flash TrellisMX checkpoints on TP2.
- #119 (open issue) Orbit agent eviction removes
flare download's model store. - #118 (open issue) DeepSeek V4.1 Flash context-free logits before token 128. Merged-PR areas: helios/src (2), ignition/preparation (2), ignition/recipes (2), tests/preparation (2), tests/recipes (2). So he has landed 2 prior PRs in ignition/preparation — he is an established contributor in this exact area but not a maintainer.
Area owners (default-branch commits, last 180 days): ignition/preparation — Luke Alonso 158, Martin Vit 52, Eugene Rakhmatulin 36. tests/preparation — Luke Alonso 206, Martin Vit 34, jasonc 23. So Luke Alonso dominates review/ownership here; original-el8 (#639) is a priority contributor who also works in this file.
Community engagement on #641 so far: none — 0 comments, 0 reviews, no labels, no CI checks on head d82fcfc, no linked issue. It has drawn no interest yet.
#5 [medium] Related work: #641 builds on c8d4c324's per-host admission, which #639 partly reverses
- c8d4c324 is the commit that made
allocate_workersadmit forward compilers per host (per #242's 2026-11-11 comment: "since c8d4c324 admits forward compilers per host it is reported before any forward compiles"). #641 builds directly on that structure: it keepsallocate_workers' admission loop andMemoryErroruntouched and only changes theCompilerResourcesvalues fed into it. Also relevant: #639's Autobot review says #639 "partially reversesc8d4c324's single-thread-per-worker policy" — so c8d4c324 is the shared ancestor both PRs are negotiating around. - #639's review (2026-11-30 12:48) also cites
docs/preparation-development.md:317-318anddocs/design-review.md:81-84as resource-release invariants that #639 violates by not releasing memory. #641 is squarely in that documented direction (it adds a release before sampling), so it is aligned with the documented invariant rather than against it. Worth quoting in the report as project-fit evidence — but I should verify the doc text.
Also, the pre-existing compiler_resources flush (before #641) only triggered on free - headroom_bytes < device_bytes, i.e. only when the device could not hold a single worker — so on integrated GPUs where device_memory_info returns min(total, available_bytes()), the old trigger was effectively "host RAM nearly exhausted". That is why the flush almost never ran before and why the code that resampled available was effectively dead.
#11 [medium] Reach: only two call sites, but it changes discrete hosts too, adds no config and no docs
Who/what is affected (verified from the code):
- Two call sites only:
CompilePool.__init__→compiler_resources(...)(compile_pool.py:133, single-rank path used byForwardCache._prepare_manyfor non-distributed runs and by any directCompilePooluser) andForwardCache._prepare_ranks→compiler_resources(...)(aot.py:1076).ForwardCacheitself is constructed in exactly one place (ignition/preparation/capture.py:118), so everyflare export/debug-serve/benchpreparation of compiled forwards goes through this. - Both hardware classes change, not just unified memory: the discrete trigger changes from
free - headroom_bytes < device_bytes(1 GiB) tofree - headroom_bytes < max_workers * device_bytes(up to 8 GiB), so discrete SM120/SM121/SM103 workstation exports begin flushing the caching allocator in cases they never did (e.g. the existing test premise of 12 GiB free with 2 GiB headroom attests/preparation/test_compile_pool.py:39-41). - On integrated/POSIX GPUs
device_memory_infoalready returnsfree = min(total, available_bytes())(host_memory.py:108-109), somin(available, free)is a no-op there today; the clamp only changes behavior on Windows integrated (where that clamp is skipped foros.name == "nt") — which is why the author added a Windows-specific test. The description presents the clamp as a general fix; its only real effect is the Windows path. - No configuration surface changes: no new CLI flag, no new
[preparation]/[memory]key, no change to_HEADROOM_BYTES(8 GiB),FORWARD_WORKER_BYTES(32 GiB),_WORKER_DEVICE_BYTES(2 GiB),_DISCRETE_WORKER_DEVICE_BYTES(1 GiB), the 8-worker cap, or the 4 GiB minimum allowance. Headroom invariants and worker budgets are untouched, as the description claims. - No compatibility/dependency/deployment impact: no artifact-format change, no change to the on-disk compiled-forward cache key (which hashes
_OPTIONSfromignition/preparation/compilation.py:26-32,293), nouv.lock/dependency change, no exported-core change. Existing cores still load. - Docs: no documentation file is touched. Precedents in the same area (#597 and #122) both edited
docs/model-preparation.mdand/ordocs/preparation-development.md. No existing doc states the flush-trigger formula, so nothing becomes wrong — but the operator-visible behavior change (an extra allocator flush in most preparations, and one before the rank barrier) is undocumented (docs/model-preparation.md:475-495"DGX Spark" is the natural home;docs/preparation-development.md:305-318holds the release/memory-budget invariants). - Test-file reach:
tests/preparation/test_transient_retention.py(empty_cache ordering in transient retention) andtests/preparation/test_forward_compile_options.pyare the suites whose premises sit closest to this change; the author reports both green (the former explicitly, the latter not in his list).
#15 [medium] Community: no engagement at all on #641 (0 comments, 0 reviews, no CI); natural reviewers identified by commit history
Engagement: zero. #641 has 0 comments, 0 reviews, 0 labels, no linked issue, and no CI checks on head d82fcfc; it was opened and last updated in the same minute (2026-11-30 13:01). No human or bot has responded. (By contrast, #639 — opened 66 minutes earlier into the same function — had an Autobot review by 12:48, #635 by the same author had two Autobot review rounds, and #597 has five comments.)
Who usually works here (and would be the natural reviewers): Luke Alonso (158 commits in ignition/preparation, 206 in tests/preparation in 180 days; author of c8d4c324 "Budget forward compiler workers across each host", b6d57dad "Centralize preparation memory policy and size compiler pools from available RAM", 468415d1-era work, and the most recent merge into compile_pool.py, #509) and Martin Vit/voipmonitor (52 commits in ignition/preparation; #462 added the flush #641 extends; reviewed and rejected #584). Jason Cook/jasonc wrote the earlier integrated-memory sizing commits (cf192126 "Keep unified-memory GPUs such as GB10 within their shared system memory", 468415d1). None of them has engaged with #641.
Who reported the underlying failures: javieratomic (#242, #122, and the GB10 measurements in #73) and CaptKitCarson (#73), pfn (#630) — all end users/reporters of GB10 unified-memory admission and memory-accounting failures, none of whom is involved in #641. So the fix arrives from a different contributor than the ones who reported the pain, and does not cross-reference their reports.
Reaction/temperature: none measurable yet. The PR is new (same-day). Its neighbouring work carries heat: #639 drew a 2-blocker Changes Requested review within an hour; #584's draft was rejected as an unsplit mega-PR; #597 reached "Ready To Merge" after two rounds. Expect #641 to be judged against the same bar (isolated measurement, GPU coverage, split scope) once someone looks.
#16 [medium] Reach/process: three-branch combined stack (#635 + hyperflare-recipes#103) and existing gloo tests that now flush for real
Stacked / paired work (declared by the author): the live evidence says the export was "paired with NVIDIA/hyperflare-inference#635 and local-inference-lab/hyperflare-recipes#103".
- #635 (open, same author nero-, +53/-10,
ignition/planning.py,ignition/parameters.py,tests/cli/test_planning.py) = "Pass candidate GPUs into filter_world_sizes during planning". It only affects world-size selection during planning, not memory sampling; it is reviewed "Ready To Merge" (Autobot, 2026-11-30 11:32) and author-fixed after one round. It cannot cause the before/after memory difference, so #641's causality claim survives, but the run is not an isolated single-variable experiment. - hyperflare-recipes#103 is in a different repository (
local-inference-lab/hyperflare-recipes) and is the DeepSeek V4.1 TP3 recipe; per #122's triage (original-el8, 2026-11-24) recipes live there now, so the recipe half of this validation is outside this repo and not reviewable here. - Together this is a three-branch combined stack, which
AGENTS.md:96-112explicitly warns against attributing to one PR ("Distinguish component measurements from whole-model or service results, and isolated changes from combined-stack results. Never attribute a combined result to one PR.").
Cross-reference to existing tests that will now call the new flush for real: _prepare_ranks is exercised by multi-process gloo tests that monkeypatch compile_pool.compiler_resources but NOT torch.cuda.empty_cache — tests/preparation/test_capture_order.py:266-284 (test_prepare_ranks_warms_compiled_forwards_in_agreed_largest_allocation_order, test_prepare_ranks_propagates_allocation_size_failure_without_hanging at :325) and tests/preparation/test_forward_artifact_sharing.py:238,415-418. Because the new flush is inside the try/except Exception at aot.py:1068-1072, any raise there would be turned into a collective failure at :1083-1085 and fail those tests; in practice torch.cuda.empty_cache() is a no-op when CUDA is uninitialized (CPU-only runs), and the author lists both files as passing. This is the one place where the new line could have broken existing green tests — worth naming because it was not called out in the description.
Ordering detail: release_unused() (default generation=2, host_memory.py:38-48) runs gc.collect + malloc_trim(0) and escalates to full GC when available_bytes() < _HEADROOM_BYTES; the new torch.cuda.empty_cache() therefore runs after host-side reclamation and before the barrier — the order that makes the resample see both kinds of reclaimed memory.
#19 [medium] File map: exact head line ranges, base commit, and the constants the fix leans on
For downstream reviewers who need to re-derive anything:
Base state. #641's base is main at the branch point 0a8c20f; orientation packet reports zero default-branch commits since the branch point that touch any of the three changed files, and the whole repo activity around this area is same-day. Head is d82fcfc. Branch fix/compile-pool-empty-cache → main, +163/−10, 3 files, labels: none, state: ready for review (not draft), opened = last updated = 2026-11-30 13:01.
File map at head (line cites at d82fcfc):
ignition/preparation/compile_pool.py—:26new_DEFAULT_MAX_WORKERS = 8;:38-64compiler_resources()rewritten (new localsshared:46,device_bytes:47,worker_bytes:48,headroom:49,max_workers:50; samples:51-52; shared clamp:53-54; combined trigger:55-56; flush:57;freeresample:58; sharedavailableresample:59-60; capacity:61-63; return:64).allocate_workers()untouched at:67-98(its 4 GiB minimum allowance is:87-94, itsMemoryErrortext:96-97).ignition/preparation/aot.py—:1068-1072try/except withrelease_unused():1069+ newtorch.cuda.empty_cache():1070; barrier:1074;compiler_resources(...):1076;all_gather_object(demand, ...):1081; failure raise:1083-1085.tests/preparation/test_compile_pool.py— new block:538-681: helper_patch_compiler_memory:538-563; unified resample test:566-593; Windows test:595-602; discrete capacity test:605-622; no-flush test:626-642;_prepare_ranksordering test:645-682. Pre-existing discrete premises that stay unchanged::16-27,:30-41.- Base
maincounterpart for comparison:compile_pool.py:36-59onmain(sampling at:45-46, old 1-worker trigger:49, stale clamp:55-56).
Values the code depends on (unchanged by #641): host_memory._HEADROOM_BYTES = 8 << 30 (host_memory.py:16), FORWARD_WORKER_BYTES = 32 << 30 (:15), _HEADROOM_BYTES-escalated release_unused (:38-48), integrated device_memory_info = min(total, available_bytes()) on POSIX (:103-110), CompilePool/compiler_resources constants 2 << 30 and 1 << 30 (compile_pool.py:23-25).
#20 [medium] Claims and evidence: what the new tests do and do not pin, and two consistency questions left open
Fidelity notes on the new tests and description that a reviewer should not have to rediscover:
- The tests replace the two inputs the code actually reads with stubs, but keep the real formula.
_patch_compiler_memory(tests/preparation/test_compile_pool.py:538-563) setscompile_pool._OPTIONS['compile_threads'] = cpu_limit, makescompile_pool.cpu_workersa lambda returning the request, stubstorch.cuda.get_device_properties,torch.cuda.empty_cache,host_memory.available_bytes, andtorch.cuda.mem_get_info. So they assert the arithmetic of the new trigger, not real allocator reclamation — consistent withAGENTS.md:194-199("mocks that bypass the behavior cannot establish runtime correctness"), and the one live run is the only proof the flush actually returns bytes. - No test asserts
host_samples == 1for the shared path (only the discrete test assertsstate["host_samples"] == 1,:620); the shared tests assert the resultingresources.availableand worker count instead. Fine, but it means "resampled exactly once" is only pinned on the discrete path. - The Windows test (
:595-602) does not exercise the flush trigger at all (available 10 GiB, free 105 GiB, no reclaim), so what it pins is themin(available, free)clamp onos.name == "nt"— i.e. exactly the one behaviour whose only real-world effect the change has. It is the sole Windows coverage. - No
Fixes #line and no issue link anywhere in the description, so nothing auto-closes and #242/#270/#73/#630 stay open and cross-unreferenced (entry on #242 records what remains unfixed there). - Description completeness against
AGENTS.md:72-112: all four required parts present, material limitations stated (Windows mock-only), Discord line present (Discord: nero,AGENTS.md:142-153), and the combined-stack pairing disclosed by name — above the median for this repo, but it never names the PRs/issues it supersedes in spirit (#122, #462, #584) or the ones it relieves (#242). - Two unaddressed consistency questions a reviewer would raise: (a) after a flush, discrete hosts resample
freebut notavailable, socapacitygrows whileCompilerResources.availablestays stale — the two numbersallocate_workersmultiplies together (compile_pool.py:75-86); (b)worker_byteson integrated GPUs includesdevice_bytes(2 GiB) on top ofFORWARD_WORKER_BYTES(32 GiB), so the new trigger's budget term is at least 34 GiB per worker even though the admission floor grants one worker for 4 GiB — the trigger is deliberately far more conservative than the fallback it is meant to enable.