Explore scratchpad · NVIDIA/hyperflare-inference #642

Raw Markdown for agents: https://autobot.eidonix.com/p/8681bbdb-c193-4036-a391-0fba6451a37e.md

#1 [high] Change: what PR #642 does, files and size

PR #642 "ignition(preparation): skip unreferenced epilogue candidates in relocate_inductor" (jcartu, open 2026-11-30, head 5f6e6a6, base main, +414/-10 across 3 files: ignition/preparation/device_binding.py +57/-6, ignition/preparation/inductor_tuning.py +7/-4, tests/preparation/test_inductor_prepared_winners.py +350/-0).

What it does:

Importance: high. Citation: PR #642 diff; files read at PR head.

#2 [high] Related work: #185 is the direct predecessor — same "unbound static Inductor kernels" bug, single-GPU only

PR #185 "Ignore unreferenced Inductor kernels in static launcher bundles" (mark-yong, merged 2026-11-04, +52/-1: ignition/preparation/inductor_tuning.py +2/-1, tests/preparation/test_inductor_tuning_cuda.py +50). This is the direct predecessor of PR #642's register-side change: it introduced exactly the substring check that #642 replaces.

Original #185 change (description): InductorSelections.register "still requires a bundled autotuner for every kernel the module assigns, and still rejects an extra entry whose kernel name appears in the generated source. It now ignores extra entries the module never references" — i.e. if any(entries[key].kernel_name in graph.source_code for key in set(entries) - set(bindings)): raise ValueError("compiled forward has unbound static Inductor kernels"), the line PR #642 removes (pre-#642 inductor_tuning.py, old lines ~170-173; see diff hunk @@ -161,14 +162,16 @@).

#185 was a single-GPU, compiler-rank-only fix (register runs on every rank but the crash #183 describes was in register). #185 explicitly says "TP > 1 exports are untested" and "the orphaned entry did not reproduce in a standalone forward, so the test supplies it directly". PR #642 is exactly the TP>1 case #185 left untested: register's check does not run on peer ranks during unfrozen deserialization, relocate_inductor does, and it KeyErrors.

#185 fixed issue #183 (qwen3.8-27b export fails warming speculative32x8p128 on SM120, "compiled forward has unbound static Inductor kernels", Inductor bundles an unselected fused-epilogue template variant). #642's title/description is the same root cause class, one level deeper (relocation instead of registration).

Importance: high. Citation: PR #185 description + files; #183.

#3 [high] Why: issue #183 documents the same unbound-autotuner bug on single GPU, and flagged TP>1 as unchecked

Issue #183 (mark-yong, opened 2026-11-03, closed 2026-11-04 by #185): ignition export qwen3.8-27b --gpus 0 on main cc696a6b fails at forward 26/108 (speculative32x8p128) with ValueError: compiled forward has unbound static Inductor kernels. Bundle has 157 static autotuners, module names 156; the extra is an unselected fused-epilogue GEMM template variant with kernel_name still Placeholder.DESCRIPTIVE_NAME, left by config.benchmark_epilogue_fusion (Inductor's speedup_by_fusion compiles template+epilogue candidates for benchmarking; TritonBundler.put_static_autotuner records every statically launchable kernel regardless of whether final code names it). Kernel keys are source hashes, so the benchmark candidate matches no async_compile.triton assignment in the module. Reproduced deterministically on RTX PRO 6000 Blackwell Max-Q (SM120), torch 2.14.1+cu132, triton 3.8.0, both cold cache and cache-hit. Root-cause analysis names the exact PyTorch behavior PR #642 relies on ("any entry whose cache key has no async_compile.triton definition cannot be launched by the generated module").

#183's "Not yet checked" section explicitly lists "TP > 1" as untested — the gap PR #642 fills. #642's hardware reproduction (speculative16x5 forward, KeyError inside relocate_inductor on ranks 1..3) is the TP4 analogue of #183.

Importance: high. Citation: issue #183.

#4 [high] Related work: #597, #639 overlap the same files; closed draft #584 had rewritten the same code

Importance: high. Citation: items_touching(inductor_tuning.py), items_touching(device_binding.py), #597, #584, #639.

#6 [high] Change: what the diff does that the description does not say (extra parse cost, bundle identity, freeze-path scope)

Six distinct behavior changes are in the diff; the description covers the big ones but several are undeclared or understated:

  1. register no longer installs a known winner inline for a newly registered tuner before finishing validation — it now defers instances/_install until after _filter_static_autotuners. That is the declared "validate before mutating" change (good), but note the observable side effect: on the reject path previously some tuners had already been _installed (mutating their compile_results/launchers/inductor_meta); now none are. The description does say "without mutating ... sibling autotuners".
  2. register also changed when self.forwards[id(bound)] is recorded (still last, but now after the filter, which can raise) — so a rejected bound leaves no forwards entry; the old code also set it last, so same. OK.
  3. register's error path also lost the set(entries) - set(bindings) set-difference semantics: _filter_static_autotuners skips entries whose cache_key is in bindings and, for others, decides by kernel-name membership. It no longer detects the missing direction (a source kernel with no bundle entry) — that was already a TypeError earlier at inductor_tuning.py:156-162, unchanged.
  4. UNDECLARED, potentially important: in the no-relocate path, relocate_inductor now runs _filter_static_autotuners and _freeze_tuning_winners unconditionally whenever freeze_tuning is true and a bundle exists, and _filter_static_autotuners raises ValueError on a referenced but unbound entry. On a single-GPU artifact prepared before this change this is a new hard failure mode — though it only triggers when the module names a kernel it has no binding for, which the old code would also have failed on in register (substring check). More importantly: the no-relocate path's _source_kernel_keys(graph.source_code) re-parses the whole generated source (usually thousands of lines) on every frozen load, where the old code did no parsing at all in relocate_inductor. _source_kernel_keys is a fresh module-level AST pass (device_binding.py:105-114); _freeze_tuning_winners then does its own work. Not measured in the PR.
  5. UNDECLARED: graph._triton_bundle is now replaced with dataclasses.replace(...) in the no-relocate/freeze path and in the relocate/freeze path, instead of being mutated in place (device_binding.py:185-187, 194-196). _freeze_tuning_winners mutates the entry kernels in place, so kernel objects are shared with the old bundle, but any code holding a reference to the old bundle object or relying on bundle.static_autotuners[:] = ... identity would now see a different bundle. Existing tests assert identity in one place (assert graph._triton_bundle is orig_bundle on the reject path only).
  6. UNDECLARED: on the relocate path the order of graph mutations changed. Previously graph.source_code, graph.cache_key and graph.device_idxs were written before the per-kernel device updates; now they are written after the filter/freeze but still before the per-kernel loop. Since the per-kernel loop can still KeyError on kernel_keys[entry_kernel.cache_key]... actually no: after filtering, every retained entry has cache_key in kernel_keys, so that lookup is now guaranteed. That is the actual fix for the reported KeyError (device_binding.py:192, 208). The old code indexed unfiltered entries.
  7. Minor: _filter_static_autotuners ignores bound_keys content type — register passes bindings (a dict keyed by cache_key) and relocate_inductor passes kernel_keys (a dict) or _source_kernel_keys(...) (a set); membership works, but three different meanings of "bound" are mixed in one helper.
  8. The retained bundle truthiness check if bundle := graph._triton_bundle: uses dataclass truthiness — a bundle with an empty static_autotuners list still creates a new compiled_fn_runner-based object but is falsy only if __bool__/__len__ is defined; torch's TritonBundler dataclass defines neither, so a bundle is always truthy. Consistent with prior code (if bundle := graph._triton_bundle: in main).

Importance: high. Citation: PR #642 diff vs main device_binding.py:126-160 and inductor_tuning.py:135-172.

#7 [high] Reach: every prepared-forward load goes through relocate_inductor; default options mean the unfrozen peer path is the common one

Verified in the repo (not just claimed):

Importance: high. Citation: file:line above.

#8 [high] Claims and evidence: the TP4 hardware reproduction did not run the submitted code; no CI on head

Claims → what backs them:

  1. "CPU regression tests pass: 32 passed (27 in test_inductor_prepared_winners.py, +9 cases)" — claimed only; no CI checks exist on head 5f6e6a6 ("CI on the head commit: no checks"). The repo's .github/workflows/python-cpu.yml runs pytest tests/ -q on every PR, but it requires maintainer approval for first-time contributors, and per issue #623 it has 0 successful runs in 61 because of two unrelated deterministic failures. So a green CPU run is not currently obtainable as a signal; #624 (merged 2026-11-30 12:39, i.e. same day, after this PR opened) fixed those two tests, so the suite may now be green for later runs — but not for 5f6e6a6's recorded state.
  2. "Full tests/preparation suite: 1,157 passed, 74 skipped, 2 failed, the same 2 as unmodified 0a8c20f" — matches #623/#624's description of the two stale tests exactly (test_inductor_template_mutations.py::…[clean] and test_runtime_triton.py). Consistent and self-reported only.
  3. "Revert check: 8 behavior-change cases fail without the production change" — self-reported, not reproducible from the PR artifacts.
  4. "4x RTX PRO 6000 Blackwell sm_120 TP4 with a locally patched Flare v0.4.4 (99339606) unblocked qwen38 TP4 preparation through native core export and flare run health startup" — this is the key evidence and it is NOT the submitted diff: it is "an uncommitted guard in relocate_inductor that skipped static_autotuners entries absent from kernel_keys when entry.kernel_name was not a substring of graph.source_code". The submitted implementation differs in mechanism (exact identifier membership via AST, deferred, fail-closed before mutation) and was never run on that hardware. Also 99339606 / Flare v0.4.4 is not a commit in this repository (search_history for 99339606 finds only this PR's commit), and the checkpoint local-inference-lab/Qwen3.8-Flash-Next-NVFP4-MXFP8-CSF-QAD dc5b8ab2 with the qwen38 recipe has no corresponding issue. The forward named speculative16x5 does not exist in this repo's graph naming (no matches for speculative16x5).
  5. "No GPU preparation was run on 0a8c20f4 with this exact diff; standalone CUDA tests (tests/preparation/*_cuda.py) were not run" — disclosed. Note there IS an existing GPU test that exercises exactly this area, tests/preparation/test_inductor_tuning_cuda.py::test_unreferenced_bundled_candidates_are_dropped_and_named_kernels_still_bind (:490-536, added by #185), plus test_distributed_catalog_reconciles_real_conflicting_candidates (:553+, needs torchrun ≥2 ranks). #642 does not add or run an equivalent GPU/two-rank test; test_inductor_tuning_cuda.py:535 still asserts the ValueError path and would exercise the new _filter_static_autotuners.
  6. The PR description states the two pre-existing failures "neither touches device_binding.py or inductor_tuning.py" — true.

Importance: high. Citation: PR #642 description; #623; #624; tests/preparation/test_inductor_tuning_cuda.py:490-536; search_history.

#12 [high] Research summary

I prepared the case file for PR #642 (ignition(preparation): skip unreferenced epilogue candidates in relocate_inductor, jcartu, open 2026-11-30, head 5f6e6a6, 3 files, +414/−10, no reviews, no comments, no CI on head).

What I verified: relocate_inductor is reached from exactly one production site (aot._load_inductor, ignition/preparation/aot.py:58), i.e. every artifact load in preparation, and the default triton.autotune_at_compile_time=False (compilation.py:28) makes the reported unfrozen peer load the common path, not an edge case. InductorSelections.freeze (inductor_tuning.py:318-330) already discards unreferenced bundle entries on every rank, which supports the PR's soundness argument; _freeze_tuning_winners raising on unresolved candidates before binding validation is a real second bug given #183's evidence.

Key findings for the report: (1) the direct predecessor is merged PR #185 by mark-yong, which introduced exactly the substring check this PR removes and which explicitly left TP>1 untested — #642 is the TP>1 case; issue #183 documents the same PyTorch mechanism (benchmark_epilogue_fusion leaving placeholder-named template candidates in the static bundle). (2) The TP4 hardware evidence was produced with a different, uncommitted substring guard at a commit (99339606, "Flare v0.4.4") that does not exist in this repository; the submitted diff was never run on GPU, and existing GPU coverage (tests/preparation/test_inductor_tuning_cuda.py:490-536) was not run or extended. (3) Four undeclared behavior deltas, most notably a new unconditional full-source AST parse (_source_kernel_keys) on every frozen single-rank load, and bundle objects now replaced via dataclasses.replace instead of mutated. (4) Overlap with open PR #597 (Ready To Merge, same import lines in inductor_tuning.py) and closed draft #584 (had rewritten device_binding.py/inductor_tuning.py (not opened) and may return). (5) The touched machinery dates from cb6187bf, which users bisected as the trigger of GB10 Xid 13 in #137 — this subsystem has a history of hardware-sensitive failures. (6) No CI signal is currently obtainable for this PR's head (issue #623: 0 green runs in 61), though merged #624 fixed the two stale tests on the same day.

All scratchpad angles are covered: change, why, related work, recent activity, people, community, project fit, claims/evidence, reach, process.

#5 [medium] Recent activity: the relocation/freeze machinery dates from cb6187bf, which is also bisected as the trigger of GB10 Xid 13 in #137

The code #642 changes was authored 2026-10-27 in cb6187bf "Agree and freeze Inductor kernels before graph capture" (Luke Alonso) — that commit introduced relocate_inductor, _freeze_tuning_winners, InductorSelections.register, and the _triton_bundle handling in ignition/preparation/device_binding.py and inductor_tuning.py (search_history for device_binding.py: 5f6e6a62 (this PR), 0edad23f (2026-11-11 Luke Alonso "Plan Kimi temporary storage through Inductor"), 28f0833b, cb6187bf (2026-10-27), a08efb01 (2026-10-16 Jason Cook "Preserve prepared Triton launches and tuning winners on restore"), 03074c11, bd438d78, 794b0bb4). inductor_tuning.py history: 5f6e6a62, dfea2875 (Luke Alonso 2026-11-09 autotune Kimi sparse-candidate exchange), af0907d9 (Luke Alonso 2026-11-07 TP16), b4196955 (Mark Yong 2026-11-04, the #185 register change with the substring check — #642 removes it), 28f0833b, e60bb3bc (Martin Vit, #110), cb6187bf.

cb6187bf is also the commit two users bisected as the trigger for the GB10 Xid 13 "Illegal Instruction Encoding" fault during the frozen warm pass (issue #137, javieratomic/calvarado2004; driver 580→615 fixed it; a794c99d mitigated). That is a different failure (cubin module reload in _install), not the bundle-inspection code #642 changes, but it is the same subsystem and shows the relocation/freeze path has a history of hardware-sensitive failures and no TP4 GPU coverage.

Importance: medium. Citation: search_history for the two files; #137 comments (javieratomic 2026-10-29).

#9 [medium] Project fit: root-cause bug fix in shared preparation, SM120 TP goal, no docs/flags touched

Charter mapping (read_charter, docs/design-review.md):

Importance: medium. Citation: read_charter; docs/design-review.md:124-134; PR #642 description.

#10 [medium] People: jcartu is a frontend/core contributor; the preparation files are owned by Luke Alonso, Mark Yong, Martin Vit

Importance: medium. Citation: orientation packet; pr_comments; #183; #505; #621.

#11 [medium] Process: open with no review, no CI run, no comments; tests depend on torch private internals like the ones #623/#624 had to repair

Importance: medium. Citation: orientation packet; pr_comments; pr_files; .github/workflows/python-cpu.yml; tests/preparation/test_inductor_prepared_winners.py:317-400.

#13 [medium] Why: how long and how widely wanted — timeline from #183 (Nov 3) to #642 (Nov 30)

Timeline of the problem class this PR addresses:

Importance: medium (context for how long the gap existed: ~26 days between #185 declaring TP untested and this PR). Citation: #183, #185, #268, search_items results.

#14 [low] Community: zero engagement; no Autobot case file yet, unlike sibling PRs opened the same day

Community/reactions for #642: none. pr_comments returns "No comments"; the orientation packet reports "Reviews: none yet", no labels, and "CI on the head commit: no checks".

Contrast with sibling PRs opened/updated the same day: #597, #624 and #639 each received a flare-autobot case-file comment within minutes of opening and a full Autobot review later (#597's latest: "Ready To Merge"; #639's: "Changes Requested"). #642 has neither, so it has not entered that automated review pipeline (possibly because it was opened later in the day, or because the auto-review runs 90 minutes after a code update — worth a maintainer noting if the intake is expected to be automatic).

No reactions, no cross-references from other threads: search_items for the PR's distinguishing phrases ("relocate_inductor KeyError static_autotuners tensor parallel", "KeyError bundle cache_key peer rank load") returns only #642 itself.

Importance: low. Citation: pr_comments; orientation packet; #597/#624/#639 comment threads; search_items.