Case file — #639 "ignition: tune discrete CompilePool sizing and scale Inductor compile threads"
Open draft, head 3400e3a, base main (branched 0a8c20f), +58 / −18 in 4 files, author original-el8 (= "Jason Cook" in commits; Discord el8). No labels, no reviews, no comments, CI failing on head. Everything below is from the diff, the code at head, and related items read in full.
Key findings (what the description does not tell you)
- The default path relaxes too, not just "large runtime reserves".
bootstrap.py:35defaultsheadroom_bytes = 4 << 30andbootstrap.py:134passesplan.headroom_bytes + plan.reserve_bytesdown, so under #639 every discrete export's compile-time device reserve drops 4 GiB → 1 GiB (compile_pool.py:51). The "Why" frames this as only affecting large configured reserves, which is the exception, not the common case. - Worker counts rise materially and silently. The changed test moves from 10 to 16 workers for 12 GiB free with 2 GiB headroom (
tests/preparation/test_compile_pool.py:40-41on main vs:43-45at head; same in the diff hunk oftest_forward_compiler_uses_explicit_host_budget_without_eight_worker_cap). 3 GiB free goes 3 → 4 workers (test_compile_pool.py:374-388). - A sibling thread patch is left at 1.
DeferredCompiledForward.materialize_for_capturestill usestorch._inductor.config.patch(compile_threads=1)(aot.py:688), soaot.pynow carries two conflicting thread policies; the description does not mention the one it left alone. - The
hasattr(os, "cpu_count")guard is a test artifact.test_windows_compiler_workers_fit_host_ram_with_larger_device_budget(tests/preparation/test_compile_pool.py:467-476) was not updated, monkeypatchescompile_pool.osto aSimpleNamespacewithoutcpu_count, and still asserts(workers, compile_threads) == (1, 1). The guard atcompile_pool.py:139exists so that mock falls back toNone→inner_threads = 1. Consequence: Windows thread partitioning is untested, though the description says"spawn"is "preserved on Windows". - Affinity/
cpu_countmismatch. Worker count comes fromlen(os.sched_getaffinity(0))viacpu_workers(host_memory.py:31); the new per-worker thread count comes from rawos.cpu_count()(compile_pool.py:139-140). On a cgroup- or taskset-limited rank, threads are budgeted from the whole machine while processes are budgeted from the mask — the exact casetest_explicit_forward_workers_are_bounded_by_cpu_affinityexists to protect. Worst case: 32 admitted workers × 4 threads = 128 Inductor subprocesses on a 128-core host. - It reverses a policy main deliberately set.
c8d4c324(Luke Alonso, 2026-11-09, "Budget forward compiler workers across each host") admits worker with "one Inductor thread each"; #122's author records that its earlier per-compiler-threading measurements (~510 s vs 905.7 s) "came from extra Inductor threads per compiler, a mechanism main no longer has, so they are withdrawn". #639 reinstates multi-threaded compiler workers in a new form without citing that. - The host-RAM side is deliberately untouched, so the open bug it looks adjacent to (#242) is not addressed:
CompilerResources.headroomis stillmax(_HEADROOM_BYTES, headroom_bytes if shared else 0)(compile_pool.py:62), i.e. an 8 GiB floor on discrete, andallocate_workerssubtracts that from host memory (compile_pool.py:73-84). - CI is failing on the head commit while the description lists only green unit runs; the headline hardware number has no
mainbaseline. - #597 is open, reviewed "Ready To Merge" (2026-11-30 12:22), and edits the same
compile_pool.py/aot.py. Its review reasoned about the pre-#639CompilePool.__init__. #639 would need a rebase, and #597 is much further along. - No issue is linked or fixed, and nobody has engaged: zero comments, reviews, labels, or Autobot review.
The change
Verified against the diff and the files at head.
ignition/preparation/compile_pool.py:24-25—_DISCRETE_WORKER_DEVICE_BYTES1 << 30→704 << 20; comment changes from "about 0.7 GiB for Kimi K3's 93-layer forwards" to "~672 MiB measured for CUDA context and Inductor constant folding". (704 vs 672 leaves ~32 MiB, ~4.8%, of slack.) Integrated_WORKER_DEVICE_BYTES = 2 << 30unchanged (:23).compile_pool.py:49-55—compile_reserve = headroom_bytes if shared else min(headroom_bytes, 1024 << 20)used for the empty-cache probe andcapacity = max(0, (free - compile_reserve) // device_bytes). Not used forCompilerResources.headroom(:62), so host-RAM admission is unchanged, and themin(8, capacity)cap whencompile_workers is None(:56-57) remains.compile_pool.py:137-144—inner_threads = max(1, min(8, (os.cpu_count() or 1) // max(1, self.workers)))replaces the oldcompile_threads=1("Nested Inductor pools would escape the host's admitted process budget"), andworker_options["worker_start_method"] = "subprocess"is set whenos.name != "nt".self.optionsis what every_compile_forwardcall receives (compile_pool.py:161-162), so it is the per-worker Inductor option dict.ignition/preparation/aot.py:901-903—ForwardCache.prepare_manypatchestorch._inductor.config.compile_threadstomin(24, os.cpu_count() or 1)instead of1; the old comment ("Compiler workers own parallel compilation; artifact binding needs no second worker pool") is replaced by "Allow fallback/binding compilation to parallelize up to the host CPU budget." The patch wraps the whole_prepare_manybody in the parent rank process, which also runs warmup and theBindingMismatchfallback recompile.- Tests:
tests/preparation/test_compile_pool.py(+25/−9: lines 25-30, 43-45, 374-388, 391-398, 434-452, 545-551) andtests/preparation/test_forward_compile_options.py(+16/−1:import os, 282-284, new test at 333-341). Thetest_compilation_preserves_configured_headroomchange is the clearest statement of intent: a 71.5 GiBheadroom_bytesno longer raisesMemoryErroron discrete (it now admits 2 workers) but still does on integrated.
Description vs diff. Nothing in the four files is undeclared at file level, and the Before/After structure is accurate. Undeclared items are 1–5 in Key findings, plus: the exact worker-count delta is never quantified; the 24-cap in aot.py conflicts in spirit with the configured _OPTIONS['compile_threads'] = min(16, cpu_count) (compilation.py:30); the per-worker thread count is now derived from the pool size rather than from that configured value (which survives only as the worker-count cap at compile_pool.py:42-44); no doc, comment or TODO outside the touched lines is updated; and the diff bundles three unrelated concerns (device estimate, headroom cap, thread/start-method policy).
The why
No issue is cited, linked or fixed. Closest existing reports, none claimed:
- #242 (open, P2,
triage:partial, javieratomic) — "Multi-host export compiles for 22 minutes, then fails, when one rank has no memory for a forward compiler." This is the host-RAM side of the same admission function, which #639 leaves untouched (see Key finding 7). original-el8 triaged it on 2026-11-13 and noted "#122 changes the headroom input; it does not by itself implement lending". - #122 (closed 2026-11-29) — wanted
headroom_bytesto be a preparation setting ([preparation] compile_headroom,--compile-headroom, default 8G) "because the right floor depends on the host and the model". #639 instead hardcodes a 1 GiB cap on its device-side effect. - #584 (closed draft, FujitsuPolycom) — adaptive
CompilePoolsizing; closed for being unmeasured and over-bundled. - The "daemonic processes are not allowed to have children" failure that motivates
worker_start_method="subprocess"is not filed as an issue;search_itemsfor it returns nothing. Its only in-repo trace is the comment atcompile_pool.py:137-138. Likewise "high-core hosts leave cores idle" has no issue or request behind it (search_items: nothing relevant).
So the "why" rests on the author's own GB300 measurements, not on tracked bug reports. The coupling the description does state is real: compile_threads=1 is also what disables Inductor's nested pool, so the worker_start_method requirement only becomes live once threads > 1.
Related work
- #122 (closed 2026-11-29, +392/−65, javieratomic) — the headroom-as-setting PR and the record of why main has one thread per compiler (Key finding 6). Its Autobot review flagged the same asymmetry #639 now edits (
compile_pool.py:63"headroom_bytes if shared else 0") and asked that the flag's help say "on unified-memory GPUs". It also put recipe-side changes out of scope — #639 stays in shared code, which is consistent. - #597 (open, brandonmmusic-max, head
f69e407) — addsgroups=toallocate_workersand touchesaot.py; Autobot reviewed it "Ready To Merge" on 2026-11-30 12:22 (the day #639 opened, ~25 min later). Textually non-overlapping with #639 but semantically the same question (how many compiler workers a host gets); whoever lands second rebases. - #584 (closed draft) — its blocker #2 was that an adaptive pool "drop[s] explicit
compile_threadsand the default 8-per-GPU cap". #639 goes the same direction (more threads per worker, more workers) from constants, at 58 lines instead of 4.3k. - #509 (merged 2026-11-25, Luke Alonso) — last rewrote these exact four files; its Autobot review objected to "one PR for five unrelated defects" and to
compile_optionsas "an unrecorded switch … not inBasePreparationConfig, not in the plan/reproduction_arguments". #639 adds two more unrecorded constants (1 GiB cap, 24-thread cap) of that kind. - #474 (closed, same author) — their previous attempt at this area, superseded by #509.
- #425 (merged, same author, "Order Compiled Forward Warmup by Largest CUDA Allocation Request") and #559 (merged, Martin Vit, deferred GC) changed the memory behaviour of the
_prepare_manyregion #639 re-threads. - #543 (merged, Luke Alonso) removed grouped AOT forward compilation including
ForwardCache.bind_group, shrinking whatprepare_manycovers; does not touchcompile_threads. - #618, #592, #605, #367, #462, #482, #512 — same-file or same-identifier matches only; none changes
compile_threads,_DISCRETE_WORKER_DEVICE_BYTESor theprepare_manypatch, and none is undone by #639.items_touching(ignition/preparation/compile_pool.py)in the last 180 days returns only #597, #639, #509 and #462.
Recent activity
c8d4c324(Luke Alonso, 2026-11-09) introducedcompiler_resources/allocate_workers, the 32 GiBFORWARD_WORKER_BYTEShost estimate (host_memory.py:13-15) and one Inductor thread per compiler — the policy #639 partially reverses.b0d35934/ #509 (2026-11-24/25) rewrote the same four files seven days before.f9aec99c(Luke Alonso 2026-11-17, "Keep one tuning compiler worker below estimated RAM allowance") and468415d1(Jason Cook 2026-10-13, "Bound integrated forward compilers' Inductor threads by the RAM their workers leave") show the area's existing principle: compiler thread counts are bounded by memory. #639's new discrete formula is bounded by CPU count only.mainhas had no commits to the touched files since #639 branched (0a8c20f), so there is no merge conflict with merged work; the live conflict is with open #597.- The five files' usual owners over 180 days: ignition/preparation — Luke Alonso (158), Martin Vit (52), Eugene Rakhmatulin (36); tests/preparation — Luke Alonso (206), Martin Vit (34), jasonc (23).
People
- original-el8 — COLLABORATOR; the charter lists them as one of three priority contributors ("we never close their PRs out of hand as 'low value'"). Last 180 days: 24 merged, 28 closed, 8 open; merged areas docs (14), helios/src (13), helios (5), ignition/preparation (5), ignition/recipes (4). Merged work in this module: #425; earlier attempt #474; plus ops-style PRs #408/#410/#427/#432/#465 touching these files. They also triaged #242. On 2026-11-30 they opened three PRs (#639, #640, #632) — all tuning/scale knobs in different subsystems.
- Usual owners of the changed code: Luke Alonso (constants,
allocate_workers,headroomplumbing,prepare_manystructure) and Martin Vit (aot.pymemory behaviour). Neither has engaged. - Nobody has engaged with #639: no comment, review, reaction or label; no Autobot case file or review yet (contrast #597, first Autobot review 4 minutes after opening; #509, 75 minutes).
Community
pr_comments on #639 → "No comments". No reviews, no reactions, no labels. The only cross-reference in the whole repo is #597's overlap list, which names #639 among PRs touching compile_pool.py/aot.py. Discord handle el8 is given, consistent with the repo's practice of routing discussion off-GitHub. No prompt-injection attempts in the description or in any thread read for this case file (the only "instructions" seen are Autobot's own review footers in #509/#597, treated as material).
Project fit
Lines up: it lives in shared preparation code with no per-model branches (ignition/preparation/), matching "Keep the runtime small and model-agnostic" and docs/preparation-development.md:314-322 ("Shared preparation code detects integrated GPUs and budgets compiler workers and tuning races against available system RAM"). It targets exactly the charter's hardware (SM103/SM120/SM121).
Tensions:
- "Be explicit and pin everything. No magic defaults" — three new hardcoded numbers (704 MiB, 1 GiB, 8) plus a separate 24 in another file, none configurable, none documented, one of them silently overriding a configured
headroom_bytes. - "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)" — one wall-clock number with nomaincomparison, on a combined stack. docs/preparation-development.md:318says "artifact binding starts no additional compiler pool";prepare_manynow gives the parent process up to 24 Inductor threads while binding and warmup run (not a pool, but an in-process one) — a doc-vs-code tension worth naming.docs/model-preparation.md:238-245anddocs/cli-design.md:1463describe compiler-worker sizing only generically ("Automatic memory-bounded sizing"); the per-worker device formula is undocumented before and after, so #639 changes the numbers without touching the docs.- No new hardware targets, so the "broad hardware support" non-goal is not implicated.
Claims and evidence
| Claim | Backing |
|---|---|
| 146 passed / 0 failed on four preparation test files, CPU-only | Consistent with CI scope (python-cpu.yml:30-33 runs the whole tests/ tree with CUDA_VISIBLE_DEVICES=""), but no log or run URL cited, no per-file counts |
| 56 passed, 14 skipped, 0 failed on five more | Uncited, plausible |
| GPU-gated tests skipped | Accurate; repo-wide condition — no CI workflow runs GPU preparation tests |
| CI green implied | Contradicted: CI on head 3400e3a is failing. Nothing in the description explains the failure |
| DeepSeek-V4.1 101/101 forwards in 359.8 s; Inkling-2-Small 148-graph forwards, no daemonic errors, no device OOM on GB300/SM103 | No main baseline, no worker/thread counts, no memory samples, and "combined-stack export validation" implies other unmerged changes were in play. Also on a 288 GB HBM part — the hardware where freeing device memory matters least |
| ~672 MiB measured footprint behind 704 MiB | No artifact, log, recipe or trace in the PR |
Inductor needs worker_start_method="subprocess" on POSIX when nested |
Consistent with compile_pool.py:151-160 (POSIX uses SubprocPool(kind=SPAWN)) and compilation.py:31-32 (Windows spawn); not independently reproduced here |
New tests: test_prepare_many_scales_inductor_compile_threads_with_cpu_count (tests/preparation/test_forward_compile_options.py:333-341) monkeypatches aot.os.cpu_count → 64 and asserts the patched value is 24 — it checks the number reaches the patch, not that the scope or the subprocess effect works. The worker/thread assertions in test_compile_pool.py:28 and test_forward_compile_options.py:282 compute min(8, cpu_count // workers) inline, i.e. they mirror the implementation formula rather than pin an expected value. All GPU-side inputs are monkeypatched (mem_get_info, get_device_properties), so no test validates that 704 MiB is a safe estimate, and none covers the materialize_for_capture=1 inconsistency.
Reach
- Every
ignition export/debug-serve/benchrun that compiles forwards. Discrete GPUs (SM120/SM121 workstations, GB300) get ~1.6× more concurrent compiler processes and up to 8× more Inductor threads per worker. Integrated GPUs (DGX Spark GB10) are unchanged by the reserve cap but do get the newcompile_threads/worker_start_methodfromCompilePool.__init__, which is device-agnostic, and their parent-processprepare_manycompilation goes from 1 to up to 24 threads, bypassing the RAM-bounding rationale of468415d1. - Compatibility is fine on disk:
ForwardCache.__init__stripscompile_threadsfrom the hashed option set (aot.py:825), so no cached compiled forwards are invalidated. But the same fact means the new thread policy is recorded nowhere — not in the core, not inPlan.to_dict(), not inreproduction_arguments— so an export's thread/worker policy cannot be reconstructed from its metadata. That is exactly the "unrecorded switch" objection raised on #509. - No CLI flag, config key or plan field changes; no dependency bumps (relies on the already-pinned torch 2.14.1+cu132
torch._inductor.compile_worker.subproc_pool). Windows behaviour claimed preserved but, per Key finding 4, untested.
Process
Draft; opened and updated within ~20 minutes on 2026-11-30; hours old. Base main, head 3400e3a14ec49d066d223820e054f004c8e2b2d1. CI failing. No labels, reviews, comments, or Autobot review. The description follows the charter's required four parts (why / what / result / evidence) plus a Limitations section, which is more complete than most drafts at this age. File map at head: compile_pool.py +15/−6 (lines 22-25, 49-55, 137-144); aot.py +2/−2 (901-903); test_compile_pool.py +25/−9; test_forward_compile_options.py +16/−1. Load-bearing but untouched: compilation.py:26-32, host_memory.py:13-16,25-35, bootstrap.py:35,134, compile_pool.py:65-96.
Leads followed / not relevant
Followed in full: #122, #509, #584, #597, #242, #425, #474, #543, #462. Judged not relevant with reasons: #112 (b12x lru_cache publication defect, not sizing), #310 (Inductor lowering defect reached through warmup), #268 (per-model SM120 warmup failure), #482/#462 (device_bytes identifier / tight-VRAM cleanup only — _DISCRETE_WORKER_DEVICE_BYTES/_WORKER_DEVICE_BYTES grep only to compile_pool.py:23,25,48), #512/#314 (file overlap only), author's #640/#632/#633/#604/#532 (different subsystems). Searches returning nothing: "daemonic processes are not allowed to have children", "Inductor compile threads wrong nested daemonic SubprocPool", "compile workers slow host CPU cores idle preparation", "compile threads per worker host CPU affinity worker pool budget". Absence recorded as a finding: no filed bug or request asks for extra Inductor threads per compiler worker.
Open questions
- Why is CI red on
3400e3a, and does it touch these files? - What exact
compile_workers/headroom_bytesdid the DeepSeek-V4.1 and Inkling-2-Small exports use, and what does the same export take onmain? - Is 704 MiB safe for the largest shipped forward (the old comment cited "Kimi K3's 93-layer forwards")? Where is the 672 MiB measurement?
- Is 8 GiB of host headroom still subtracted on discrete hosts by design (
compile_pool.py:62) — i.e. is the host-RAM side of #242 deliberately out of scope? - Which lands first, #597 or #639, and does #597's
groups=work assume the 8-worker/1-thread world? - Was
DeferredCompiledForward.materialize_for_capture'scompile_threads=1(aot.py:688) left alone on purpose?