PR #668 — fix(ignition): reconcile divergent multi-host selections, propagate peer b12x env and kernel cache, and harden ForwardCache
https://github.com/NVIDIA/hyperflare-inference/pull/668 · base main · head d4d7b2d · open, ready for review · no labels · no reviews · CI pending · Fixes #651 · Paired FlashInfer PR: local-inference-lab/flashinfer#199 · Discord: lukealonso
Key findings
- It is the second attempt at the same bug. #631 (opened by pfn, closed 2026-11-30 by #647) reported the same multi-host autotune divergence; pfn reproduced it again on main after #647 merged ("2283 kernel selections differ" after 9178s). #651 (hiroshi-ya, 2026-12-01) is the fresh diagnosis, and #668 rewrites the very
reconcile_selectionsthat #647 introduced, all from the same author. (#631, #647, #651) - Convergence, not root cause.
reconcile_selectionsnow prefers a request-name match over a declaration match, so ranks with different declarations for the same request adopt rank zero's config. #651's second diagnosed cause — rank-local state leaking into declaration identity (_mixed_tuning_batchesproducing 53 vs 65 shard races, 1020 vs 1319 selection-cache records) — is untouched; #668 converges after the fact, at the price of a second preparation pass that discards rank 1's locally tuned configs. (collectives.py:398-449, tuning.py:504-518, #651) - Undocumented, undeclared behaviour in the peer env channel.
HostRendezvous.preparesends("b12x-environment", env)to every peer before the checkpoint-fabric/checkpoint-source commands so import-time b12x reads see it, then repeats it insideassignment;serve_peertherefore validates and applies it twice (host_ranks.py:344-347, :374-377, :646-648, :666-668). Rank zero itself still applies the same settings throughenvironment.apply(serve.py:211, :547), so two mechanisms now exist for one setting. - Corrupt-load recovery is broad.
_CORRUPT_ARTIFACT_ERRORScontainsOSError,ValueError,TypeError,KeyError,AttributeErrorandRuntimeError(aot.py:69-81). On an opportunistic restore (required=False) any of these unlinks the cached.binand recompiles instead of surfacing — including transient EIO/EROFS and genuine torch load failures. That sits uneasily with the charter's "don't just swallow, skip, or retry an unexplained error (#397)". - Evidence stops short of the reported hardware. Author's validation: 192 passed / 0 failed for the preparation CPU suite (against the paired FlashInfer branch) and 136 passed for
tests/cli. Explicitly not run: GPU tests, Rust tests, and a live 2-host GB10 TP2export+joinof GLM-5.3 — i.e. exactly the configuration in #651. The new 2-rank reconcile test is synthetic (SimpleNamespace(selection=… config=1|2)), not the GLM-5.3 declaration divergence. - CI does not install the paired FlashInfer branch.
.github/workflows/python-cpu.yml:30-33(not opened) runspytest tests/ -qwithCUDA_VISIBLE_DEVICES="", which does cover the touched tests, butpyproject.toml:47pinsflashinfer-pythontolocal-inference-lab/flashinferbranchmain— flashinfer#199's contract-version bumps and fingerprinting are not exercised here. - Two same-author PRs edit the same peer-export path. #667 (open, opened the same day, after #668) also changes
ignition/preparation/host_ranks.pyaround peer export/export_options; #597, #639 and #314 all touchaot.py. Ordering/conflict risk is real but unresolvable from this PR alone. - No engagement. Zero comments, zero reviews, no labels; neither #651's author nor pfn has commented. No docs were updated for either the reconcile contract or the new peer env channel.
The change (what it does, size, and what the description omits)
Size: 8 files, +423/−44 — ignition/preparation/collectives.py, ignition/preparation/host_ranks.py, ignition/preparation/aot.py, ignition/cli/serve.py (5/−2), and four test files under tests/preparation/ (+252/−3). No docs, no Rust.
1. Request-name-first reconciliation (ignition/preparation/collectives.py).
_selected_plan_catalog now returns 5-tuples (plan, decl_key, (name, variant, component_id), payload, config), expanding composite plans per variant so variant disambiguates (collectives.py:196-224). reconcile_selections gathers them, builds chosen_name/chosen_decl in rank order (rank 0 wins) plus participant counts, and a single target_for(decl_key, name_key) prefers a shared request name, falling back to a shared declaration (collectives.py:413-434). Both the changed flag and the returned configs use target_for, so every rank decides to enter or skip the re-prepare pass identically (collectives.py:436-449). The caller is unchanged: tuning.py:504-518 reconciles, re-prepares with selected_configs (forcing configure_tuning_shard(0, (0,)) when sharded), then agree_selections at tuning.py:530 — which keys purely on request name (local = {item["name"]: (component, json config)}, collectives.py:375-396), which is exactly why the name key is what makes the two agree.
Not said in the description: a name match wins even when the two ranks' declarations differ, so the portable_declaration fallback only fires for names present on a single rank; and a divergent rank's whole locally tuned component (component_key includes portable_declaration, per tests/preparation/tuning_shards.py:56-58 (not opened)) is thrown away and re-prepared with rank zero's config — the fix costs a second tuning/preparation pass in the very scenario of #651 (which already takes ~2h15m per failed attempt per #631).
2. Peer b12x_environment and kernel_cache (ignition/preparation/host_ranks.py, ignition/cli/serve.py).
_validate_b12x_environment rejects non-B12X_ names, B12X_COMPILE_CACHE_DIR and non-string values (host_ranks.py:201-209); _remap_peer_config uses dataclasses.replace when possible, else setattr (host_ranks.py:212-219). HostRendezvous.__init__ takes and stores b12x_environment (host_ranks.py:229-234); prepare() takes an optional override, sends the env to every peer control socket before the checkpoint-fabric/checkpoint-source commands (host_ranks.py:344-347) and also embeds it in assignment (host_ranks.py:374-377). serve_peer gains kernel_cache= (host_ranks.py:626), applies the early env command (host_ranks.py:646-648), re-applies from the assignment and remaps config.kernel_cache to Path(kernel_cache) (host_ranks.py:666-669), and forwards kernel_cache into export_options in the peer export branch (host_ranks.py:718-719; export_options(cache, *, no_weights, reuse_weights, kernel_cache) at core_snapshot.py:25-33). Wiring: serve.py:197 (_export_hosts), :420 (debug_serve) pass model.recipe.b12x_environment; serve.py:551-554 join passes kernel_cache=configuration.directory("kernel_cache"); rank zero's own env comes from environment.apply(configuration, local, plan.recipe.b12x_environment) at serve.py:211 (and serve.py:547 in join).
Not said in the description: the two-mechanism redundancy for rank zero; the double validation/application on each peer; and that B12X_COMPILE_CACHE_DIR is deliberately excluded because environment.apply already points it at the peer-local kernel_cache/b12x, so the new channel cannot redirect a peer's compile cache.
3. ForwardCache hardening (ignition/preparation/aot.py).
New _NON_EXECUTION_B12X_ENV frozenset of 14 names (compile cache dir/disk/memory/workers/spec memo, RoCE cache/GID/HCA, preparation trace dir, barrier timeout, timing knobs, compile progress) and _b12x_forward_env() returning a sorted tuple of the remaining B12X_*, also excluding B12X_LOG_* (aot.py:47-82). The cache root key tuple becomes (namespace, options, _b12x_forward_env(), torch_key(), runtime_patches.identity(), device props…) (aot.py:894-901). _save_compiled_function writes to a sibling NamedTemporaryFile(suffix='.tmp') then os.replace, unlinking in finally (aot.py:85-96), and replaces all three former direct save_compiled_function(str(path)) sites (aot.py:1326, :1454, :1463); _share_artifacts now closes the temp handle and unlinks on failure (aot.py:868-880). _load wraps the deserialize in try/except _CORRUPT_ARTIFACT_ERRORS, unlinking and returning None when required=False, re-raising for required=True and for MemoryError/torch.OutOfMemoryError (aot.py:1371-1386).
Not said: the breadth of the caught tuple (see Key findings) and that MemoryError needs its explicit check because it is not in the tuple.
Tests added: 2-rank Gloo _gloo_reconcile_divergent_worker + test_reconcile_selections_matches_divergent_declarations_by_request_name (tests/preparation/test_tuning_shards.py:262-325, synthetic configs 1/2 for a same-name/divergent-declaration request plus a different-name/shared-declaration alias); validation and end-to-end serve_peer env/kernel-cache test (tests/preparation/test_host_ranks.py:332-438); b12x env key inclusion/exclusion, atomic save rollback, corrupt-restore recovery (tests/preparation/test_forward_cache_sources.py:63-140); _Artifact test double now writes its payload bytes instead of asserting existence (tests/preparation/test_forward_artifact_sharing.py:130-155, :262).
The why
- #651 (open; area:kernels/area:preparation/area:rocenante, bug, performance, triage:investigate; hiroshi-ya, 2026-12-01) is the problem statement: 2x DGX Spark GB10 sm_121, CX7 RoCE,
ignition export --ranks 2+joinof GLM-5.3-Flash-FP4-Local on hyperflare @571a4471 (which includes #631's fix f2ca2c41).agree_selectionsfails every attempt — "1321 kernel selections differ from rank zero's… preparing again adopts rank zero's tuning decisions" — retries go 1277 → 1265 → 1321 even with warm caches, and 1317 without row-sharding. Root cause pointed atreconcile_selectionskeying byportable_declarationand skippingparticipants <= 1, so rank-divergent declarations are unmatchable; the issue's suggested direction is precisely "match rank-divergent declarations by request name/component and force rank 0's config". It also documents unequal per-rank tuning catalogs (_mixed_tuning_batches, tuning.py:229): 53 vs 65shard.count=1races, 12 extra split-out components on rank 1, selection caches 1020 vs 1319 records with differing tile configs,block_size_m,pipeline_stages,split_k,groups_per_task. - #631 (closed 2026-11-30, labels area:preparation/bug/performance/priority:P2/triage:investigate; opened by pfn) is the earlier report of the same class on 2x GB10 with v0.4.4: attempts differed by 2042 / 2078 / 2078 selections, ~2h15m per failed attempt,
--autotune-effort offsucceeded. #647 closed it. pfn then commented on 2026-12-01 03:34 (after close) that main @ e85019b9 still reproduces, asking whether #647 should be reopened — that comment is the reason #651 exists. - Duration/interest: the problem has been open continuously since at least 2026-11-30 and is now on its second fix; the underlying file lineage goes back to b3bf45f9 ("Reconcile kernel selections before sharing compiled forwards"), fc1c0d0b ("Agree on kernel selections across hosts", jasonc) and c4b73c8a ("Split tuning races across ranks on separate hosts", jasonc) — roughly seven weeks of iteration in the same code.
Related work
- #647 (merged 2026-11-30, same author, +1648/−352, 27 files) introduced the machinery #668 edits:
share_selectionsbefore sharded tuning,reconcile_selectionsafter (Fixes #631), and the_prepare_rankscache-root-relative path exchange. #668 both extends and implicitly corrects it: #647's declaration-only reconcile is what fails per #651 and pfn's repro. #647's own Autobot review (2026-11-30) had said it "addresses #631's core multi-host sharded autotune divergence" — that judgement was wrong, which matters as calibration for the review of #668. - #383 (merged, voipmonitor) created
portable_declaration/local_componentsand first taught_selected_plan_catalogto key onportable_declaration; #668 builds directly on that identity by adding the name key next to it. - #597 "Key compiled forward sharing and Inductor validation by GPU name" (open, brandonmmusic-max, +950/−107) is the biggest overlap: it rewrites
ForwardCache._prepare_ranks,_publication_lockand_share_artifacts(adding ascope=parameter) and keys lending by (host, gpu_name) — i.e. it touches_share_artifacts,__init__keying and_loadin the same file as #668. Textual conflict risk in aot.py; both alter the cache root key (597 → GPU name; 668 → extra B12X env tuple entry). - #639 (open, original-el8, CompilePool sizing / Inductor compile threads) and #314 (open, schopde-nvidia) also touch aot.py.
- #667 "Harden Orbit payload integrity, multi-deployment TP seams, GB10 page-cache release, Unix flock drop…" (open, same author, opened 2026-12-01 after #668) edits
ignition/preparation/host_ranks.py(+8/−2) in the peer export region — a different multi-host-peer defect set that overlaps #668'sexport_options/peer export hunk (host_ranks.py:718-719). Two open PRs by the same author on the same peer path: stacking/ordering risk. - #394 (open, voipmonitor) also touches host_ranks.py (rank export workspace).
- Adjacent, not overlapping files but same symptom space: #641 (merged, nero-, DGX Spark/CompilePool memory), #648 (merged, runtime patches onto public b12x contracts — the b12x
candidate_contract_version/TuningContractsurface that flashinfer#199 bumps), #584/#425 (compiled-forward acceleration and warmup ordering).
Recent activity
- The files' immediate history is the author's own: f2ca2c41 (#647) is the last commit touching both
tests/preparationandignition/preparationbefore branch point, 555db719 (#648) migrated runtime patches and preparation onto public b12x contracts, 7e9f9634 (#641) touched CompilePool in the same area.ignition/cli/serve.pylast changed by a3c80e19 (#657), which is also the merge-base commit — no commits on main since the branch point have touched any of #668's changed files, so there is no rebase conflict today. - The change therefore builds on #647 and #648 rather than reversing them, but it does reverse one #647 design decision (declaration-only reconciliation). Nothing in main has undone #668's premises.
- Beyond the repo: the paired
local-inference-lab/flashinfer#199bumps collided b12xcandidate_contract_versioncounters, adds deterministic AST/source fingerprinting toTuningContract, and gates unusedsplit_fc1_scales/shared_input_scalesflags — i.e. it attacks the declaration identity side of #651 that #668 does not touch. The PR states the two are independent for merge.
People
- lukealonso — COLLABORATOR, charter-listed priority contributor, 36 merged PRs in the last 180 days, 3 currently open (#667, #659, #658). He is the dominant recent author in these files (commits to collectives.py since October: b3bf45f9, 84ac035c, f377dc85 #543, 4c74cc6f #546, 555db719 #648, f2ca2c41 #647, d4d7b2de) and effectively owns both the reconcile path and the host_ranks peer path. The PR was self-reviewed only; no other reviewer assigned.
- Area regulars: voipmonitor (tuning shards, #383, #394), jasonc (early cross-host agreement commits), Martin Vit (tuning/collectives), yatesdr (reviews on #383, RoCE GID work), nero- (#641, DGX Spark), brandonmmusic-max (#597).
- Thread reporters: pfn (filed #631, posted the post-#647 repro), hiroshi-ya (filed #651 with the ledger diagnosis). Neither has commented on #668 — so the people with the hardware to confirm the fix are not yet involved.
Community
Nothing found beyond the PR body: pr_comments returns no comments, there are no reviews, no labels, no reactions recorded, and no linked discussion on #651 or #631 pointing at this PR. Interest so far is zero on the PR itself; the interest in the underlying problem is two independent GB10 operators (#631's pfn, #651's hiroshi-ya) both blocked.
Project fit
- Charter: "Bring real evidence… Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)" — relevant to both the deferred live GB10 verification and the broad corrupt-error swallow. "Supported matrix & compatibility: … verify cross-node" is the bar this PR's untested 2-host path sits against. Keeping the runtime small/model-agnostic is respected: all changes are in ignition preparation/CLI, with no per-model branches (the b12x knobs come from
recipe.b12x_environment). - Docs:
docs/preparation-development.md:337-349documentsCollectivePreparationand_mixed_tuning_batchesshard/remainder batches but says nothing aboutreconcile_selections, name matching or the second preparation pass;docs/preparation-development.md:124-127says runtime-patch identity contributes to forward cache keys (now extended by B12X env, undocumented);docs/multi-host.md:377"All hosts need matching Flare executables and preparation sources" is the nearest existing statement to #668's peer env requirement;docs/model-preparation.md:121-123(not opened) documents thekernel_cache/kv-codec cubin path that #668 now remaps per peer (runtime_core.py:405-408compile_gpu_codec_cubin(cache_dir=cache.kernel_cache)). #668 changes no docs, so the documented multi-host preparation contract lags the code.
Claims and evidence
| Claim | Evidence | Verdict |
|---|---|---|
Peers prepare with rank zero's recipe b12x_environment |
host_ranks.py:201-219, :344-347, :374-377, :646-648, :666-669; end-to-end test tests/preparation/test_host_ranks.py:342-438 asserting both B12X_W4A16_A4_PREFILL and B12X_W4A16_SMALL_M_HOST_BARRIER_RESET land and config.kernel_cache becomes Path(peer_cache) |
Verified in code and unit-tested |
| Peers write cubins into their own cache | kernel_cache forwarded into export_options (host_ranks.py:718-719; core_snapshot.py:25-33) → runtime_core.py:405-408 |
Verified in code; no test covers the export branch |
reconcile_selections converges rank-divergent declarations to rank zero |
collectives.py:398-449; 2-rank Gloo test tests/preparation/test_tuning_shards.py:262-325 | Logic verified; the test's inputs are synthetic, not #651's GLM-5.3 divergence |
| "#651 is fixed" | Fixes #651 in the body; no live run |
Unproven — author explicitly did not run 2x GB10 export+join, the reproduced configuration |
ForwardCache separates forwards across differing B12X_* settings |
aot.py:47-82, :894-901; tests test_forward_cache_sources.py:63-92 | Verified and tested |
.bin writes are atomic; crashes leave no partial artifact |
aot.py:85-96, :868-880, three call sites; test test_forward_cache_sources.py:95-116 | Verified and tested |
Corrupt cached .bin becomes a cache miss |
aot.py:1371-1386; test test_forward_cache_sources.py:119-140 | Verified and tested; breadth of swallowed errors is the caveat |
| 192 preparation tests + 136 cli tests pass | author's Validation section (CPU, CUDA_VISIBLE_DEVICES="", local FlashInfer branch) |
Reported, not independently re-run here; CI on head is still pending |
| Independent of flashinfer#199 | PR body; CI installs flashinfer main (pyproject.toml:47) |
Plausible; means the declaration-identity half of #651 is not exercised by this PR |
Reach
- Operators: multi-host (
--ranks 2/3/4/6) export/join and multi-hostdebug-serve, i.e. GB10/DGX Spark-class tensor-parallel deployments — the users who filed #631 and #651. - Configuration: introduces a new transmitted setting,
recipe.b12x_environment, whose values now must bestr,B12X_-prefixed and must not beB12X_COMPILE_CACHE_DIR; a recipe with a non-string b12x value would now fail at rendezvous construction. Peerkernel_cacheis no longer inherited from rank zero — a behaviour change for any deployment that relied on a shared absolute path. - Artifacts/compatibility: the forward-cache root name changes for every host that has any execution-relevant
B12X_*set (new hash tuple member), so existing compiled-forward caches will be re-keyed and recompiled once — no migration path is mentioned. Corrupt-cache deletion is a new destructive behaviour onrequired=Falseloads. - Dependencies: none required for merge (flashinfer#199 is a companion, not a prerequisite), but #651's declaration divergence is only half-addressed here.
- Documentation: not updated (see Project fit).
Process
Open and marked ready for review; 8 files, +423/−44; no labels, no reviewers requested, no reviews, no comments; CI on head d4d7b2d pending at the time of the orientation packet; no commits to main since the branch point (a3c80e1) touch its files, so no stale-branch conflict. The PR is one of three open from the same author in the same week (#667, #658, #659), two of which touch adjacent multi-host code.
Open questions / not found
- Whether #668 actually converges on 2x GB10 with GLM-5.3 — no live run; #651's reporter has not been asked to verify.
- Whether the paired flashinfer#199 is needed for the reconcile logic to converge in practice, or only for declaration identity stability — the PR asserts independence but does not show the reconcile path working against unmodified flashinfer
main. - Why
reconcile_selectionsdiscards rather than compares rank 1's locally tuned (and possibly faster) configuration; no measurement of the added second-pass cost on the ~2h15m-per-attempt workload from #631. - Which of
OSError/RuntimeErrorcorrupt classifications the author intends to cover (disk corruption vs. transient I/O) — not stated in the description. - No information found on a reviewer being lined up, on CI results for
d4d7b2d, or on coordination between #668 and #667 landing order inhost_ranks.py.