#1 [high] Change: PR #668 overview — 3 coupled fixes, 8 files, +423/−44
PR #668 "fix(ignition): reconcile divergent multi-host selections, propagate peer b12x env and kernel cache, and harden ForwardCache" by lukealonso, base main, head d4d7b2d, open/ready for review, no labels, no reviews, CI pending at head. Fixes #651. Paired FlashInfer PR: local-inference-lab/flashinfer#199.
Size: 8 files +423/−44.
- ignition/preparation/collectives.py (reconcile_selections + _selected_plan_catalog): request-name-first matching, then portable-declaration fallback; changed/configs share one target-selection function.
- ignition/preparation/host_ranks.py: HostRendezvous(b12x_environment=...), _validate_b12x_environment, _remap_peer_config, serve_peer(kernel_cache=...), sends ("b12x-environment", env) before assignment unpickling, includes b12x_environment in assignment, forwards kernel_cache into export_options.
- ignition/cli/serve.py: 3 call sites — _export_hosts (+1 line), debug_serve (+1), join passes kernel_cache=configuration.directory("kernel_cache").
- ignition/preparation/aot.py: _NON_EXECUTION_B12X_ENV frozenset (14 names), _CORRUPT_ARTIFACT_ERRORS tuple, _b12x_forward_env(), _save_compiled_function() atomic tmp+os.replace, ForwardCache.init key includes _b12x_forward_env(), _share_artifacts temp cleanup, _load() catches corrupt errors when required=False -> unlink + return None.
- tests/preparation: test_tuning_shards.py (+2-rank Gloo reconcile test), test_host_ranks.py (+validation + end-to-end serve_peer test), test_forward_cache_sources.py (+3 tests), test_forward_artifact_sharing.py (_Artifact test double now writes payload bytes). Diff read at pr_diff (results 1 and 4).
#2 [high] Why: issue #651 multi-host autotune non-convergence on 2x GB10
#651 (open, labels area:kernels/area:preparation/area:rocenante, bug, performance, triage:investigate) opened 2026-12-01 05:08 by hiroshi-ya, updated 2026-12-01 05:13. 2x DGX Spark GB10 sm_121, CX7 RoCE, ignition export --ranks 2 + ignition join, GLM-5.3-Flash-FP4-Local, hyperflare @571a4471 (includes #631 fix f2ca2c41), flashinfer @e34540cc.
- Symptom:
agree_selectionsfails every attempt: "1321 kernel selections differ from rank zero's ... ['decode1.layer10.moe.experts', ...]; preparing again adopts rank zero's tuning decisions". Retries do not converge: 1277 → 1265 → 1321, warm caches included. Without --row-shard-prefill/--row-shard-attention still 1317. - Diagnosis: unequal per-rank tuning catalogs (
_mixed_tuning_batchesat ignition/preparation/tuning.py:229 ran → 'sharded' labels); race ledgers show 53 vs 65 shard.count=1 races on rank0/rank1 (12 extra split-out components on rank1: layers 6,7,8,11,13,14,18,19,27,28,31,35); selection caches differ (rank0 1020 records / rank1 1319, 1091 shared, 62 one-sided) with different configs (w4a16_tile_config [64,256,64,256] vs [128,128,128,128], block_size_m 64 vs 16/48/8, pipeline_stages 5 vs 4/3, split_k 4 vs 8/16, groups_per_task 4/8/16/32). Retry is pure cache replay (zero ledger rows, no .json mtime changes) yet still diverges. - Root cause pinned on
reconcile_selections(collectives.py:397 on main): keys byportable_declarationand only reconciles keys with participants > 1 (common), so rank-divergent declarations are unmatchable. - Suggested directions include exactly what #668 does: "Make
reconcile_selectionsmatch rank-divergent declarations by request name/component and force rank 0's config". - Repro/attachment: ledger sqlite query on
~/.cache/flare/kernels/b12x/preparation/843e...b57f.progress.sqlite3; diff1.txt, diff2.txt, export_log_head.txt, export_log_worker.txt links in issue. Issue #651 text is the primary problem statement #668 claims to fix.
#3 [high] Why: #631 (closed) and pfn's post-#647 repro — #668 is the second attempt
#631 (closed 2026-11-30 20:37, opened 2026-11-30 07:55 by pfn; labels area:preparation, bug, performance, priority:P2, triage:investigate). Earlier report of the same class on 2x DGX Spark GB10, v0.4.4 (9933960), flashinfer 210003b7: attempts failed 2042 / 2078 / 2078 kernel selections differing (cold then warm caches), --autotune-effort off succeeded. Cost: ~2h15m per failed attempt.
- #647 (merged 2026-11-30 20:37) closed #631 by running share_selections before sharded tuning and reconcile_selections after it (ignition/preparation/tuning.py).
- pfn commented 2026-12-01 03:34 on #631 AFTER close: still reproduces on main @ e85019b9 (includes #647), flashinfer e34540cc, torch 2.14.1+cu132: "2283 kernel selections differ" after 9178s, decode MoE expert kernels; asked whether #647 should be reopened. That comment is the follow-up #651 answers.
- Chain: #631 issue → fixed by #647 → regression/incomplete per pfn → #651 opened by hiroshi-ya with fresh diagnosis → #668 proposed fix.
- pfn is the reporter driving this thread (community member with 2x GB10 hardware).
#4 [high] Related work: #647 (merged, same author) introduced the reconcile path #668 rewrites
#647 "Fix externalized core signing, stream-0 weight race, export I/O, and multi-host tuning" by lukealonso, merged 2026-11-30 20:37, +1648/−352, 27 files. Its part 4 = "Multi-host preparation and AOT lowering fail on distinct roots, sharded autotune, and multi-storage dependencies (Fixes #631)": aot.py ForwardCache._prepare_ranks exchanged cache-root-relative paths; tuning.py added share_selections before sharded tuning + reconcile_selections after (with configure_tuning_shard(0,(0,)) override).
- #668 is the direct successor: it edits the same functions #647 introduced (share_selections caller at tuning.py:446, reconcile_selections at tuning.py:506, agree_selections at tuning.py:530 untouched) plus _share_artifacts (aot.py:868-878), _resolve_shared_path machinery, and _load.
- Autobot review on #647 (2026-11-30 19:00) recommended Changes Requested; the "Related/duplicate/conflict check" said it "addresses #631's core multi-host sharded autotune divergence". After merge, pfn's repro showed it did not.
- So #668 both extends and (implicitly) corrects #647's multi-host tuning fix; #647's reconcile design (declaration keying) is the thing #668 replaces.
#5 [high] Change: collectives.py request-name-first reconciliation, verified in source
Verified against files at PR head:
- collectives.py:_selected_plan_catalog now emits 5-tuples (plan, decl_key, (name, variant, component_id), payload, config); composite plans expand per variant count so
variantdistinguishes variants (collectives.py:196-224). - reconcile_selections (:398-449) builds chosen_name/chosen_decl from the first entry seen in rank order (rank 0 wins), common_name/common_decl by participation count > 1, and
target_forprefers name match then declaration match.changedandconfigsboth use target_for → lockstep entry/skip (tuning.py:506-518 gates the re-prepare pass onchanged). - Caller unchanged: tuning.py:504-518 still calls reconcile then re-prepares, then agree_selections at :530; agree_selections (:375-396) keys by request name only (
local = {item["name"]: (component, json config)}), so #668's name-first matching is what makes the two agree. - Design tension worth noting: for a rank-divergent declaration where rank 1 chose a config that is better than rank 0's, rank 1's whole locally-tuned component (component_key includes portable_declaration per request, tuning_shards.py:56-58) is thrown away and re-prepared with rank 0's config, i.e. cost is a second preparation pass, not just an env fix. #668 does not remove the upstream cause of divergent declarations (rank-local state leaking into declaration identity, per #651 diagnosis item 2); it converges after the fact.
- Also:
target_forprefers name match even when the name-matching entries have different declarations; theportable_declarationfallback only runs for names present on one rank. So a same-name/different-declaration pair no longer needs matching declaration keys.
#6 [high] Change: host_ranks.py peer b12x env propagation and kernel_cache remap
- host_ranks.py:201-209
_validate_b12x_environmentrejects non-B12X_ names,B12X_COMPILE_CACHE_DIR, non-str values. host_ranks.py:212-219_remap_peer_configuses dataclasses.replace when possible else setattr. - host_ranks.py:325-326
prepare()takes an optional per-call b12x_environment, validating it; :344-347 sends ("b12x-environment", env) to every peer control socket BEFORE the checkpoint-fabric/checkpoint-source commands, so import-time b12x reads see it; :377 also includes "b12x_environment" in the assignment dict (belt and braces — the peer applies it twice: :646-648 and :666-668). - serve_peer gains kernel_cache kwarg (:626) and remaps assignment["config"].kernel_cache (:669); export path forwards kernel_cache into export_options (:718-719) so the peer's KV-codec cubin (runtime_core.py:405-408
compile_gpu_codec_cubin(cache_dir=cache.kernel_cache)) lands on the peer's own cache. - Wiring: serve.py:197 (_export_hosts) and serve.py:420 (debug_serve) pass b12x_environment=model.recipe.b12x_environment; serve.py:551-555 join passes kernel_cache=configuration.directory("kernel_cache").
- Rank zero itself applies the same env via environment.apply(...) at serve.py:211 (:apply sets B12X_COMPILE_CACHE_DIR to kernel_cache/b12x, environment.py:36-52), and join calls environment.apply(configuration, (gpu,)) at serve.py:547 before knock() — so peer-local B12X_COMPILE_CACHE_DIR/FLASHINFER_WORKSPACE_BASE/TRITON/TORCHINDUCTOR dirs are peer-local; the new env channel only carries recipe-declared B12X_ settings and deliberately excludes B12X_COMPILE_CACHE_DIR.
- Undeclared in the description: the peer applies the recipe env before the checkpoint fabric handshake, and
_validate_b12x_environmentis applied twice per peer. Also the change does NOT validate/apply the env on rank zero through the new path (rank zero keeps using environment.apply), so two mechanisms exist for the same setting.
#7 [high] Change: aot.py ForwardCache b12x env key, atomic save, corrupt-load recovery
aot.py verified at PR head:
_NON_EXECUTION_B12X_ENV(aot.py:47-61) excludes 14 names incl. B12X_COMPILE_CACHE_DIR, _WORKERS, _MEMORY_CACHE*, _SPEC_MEMO, DISK_CACHE, B12X_ROCE, B12X_PREPARATION_TRACE_DIR, B12X_COLLECTIVE_BARRIER_TIMEOUT, B12X_TIMING, B12X_PRINT_COMPILE_PROGRESS;_b12x_forward_env()(:73-82) also drops anyB12X_LOG_*. Sorted tuple → order-independent.- Cache root key (:897-899) now hashes (namespace, options, _b12x_forward_env(), torch_key(), runtime_patches.identity(), device name/major/minor/SM count) + the ignition and flashinfer .py sources.
_save_compiled_function(:85-96) writes to a NamedTemporaryFile in the target's parent then os.replace; finally unlinks. Used at the three formersave_compiled_function(str(path))sites: aot.py:1326 (shared-artifact publish), :1454 (before reload), :1463 (final save)._share_artifacts(:863-878) now closes the temp file explicitly and unlinks the tmp on failure (previously wrote payload then os.replace without cleanup)._load(:1371-1380) catches_CORRUPT_ARTIFACT_ERRORS= EOFError, pickle.UnpicklingError, struct.error, zlib.error, zipfile.BadZipFile, OSError, ValueError, TypeError, KeyError, AttributeError, RuntimeError → unlink + return None when required=False; re-raises when required or MemoryError/OutOfMemoryError. Note MemoryError is not a subclass of any tuple member except... it is a subclass of Exception only, so the explicit isinstance check is required — the test asserts this (:test_forward_cache_recovers_from_corrupt_cached_bin_on_restore).- Broadness worth flagging: the tuple includes OSError and RuntimeError, so a transient OSError (e.g., EIO/EROFS) or a genuine runtime failure during deserialization on an opportunistic restore now deletes the cached .bin and recompiles rather than surfacing. Also
RuntimeErroris what torch raises for many genuine load failures — the charter's "don't just swallow... an unexplained error (#397)" is worth citing here.
#8 [high] Process/claims: CI state, no reviewers, evidence coverage vs charter #397
- PR states CI on head d4d7b2d "pending"; no reviews, no labels, no comments on the PR itself (pr_comments returned "No comments") — so zero community engagement so far on #668. Author's own validation: preparation CPU suite 192 passed / 0 failed against the paired flashinfer branch; tests/cli 136 passed; not run: GPU tests (FLARE_RUN_CUDA_TESTS=1), Rust crate tests, live 2-host GB10 TP2 export+join of GLM-5.3.
- Repo CI (.github/workflows/python-cpu.yml:30-33) runs
pytest tests/ -qon ubuntu-24.04 with CUDA_VISIBLE_DEVICES="" anduv sync --extra prepare --extra test, i.e. the author's preparation + cli tests ARE covered by the required workflow (unlike earlier PRs where no Python CI existed). Note: the workflow pins flashinfer via pyproject.toml [tool.uv.sources] flashinfer-python = git local-inference-lab/flashinfer branch main (pyproject.toml:47) — so the paired flashinfer#199 changes are NOT installed by CI; #668 must stand with upstream flashinfer main. Author says neither PR requires the other. - The new 2-rank Gloo test (tests/preparation/test_tuning_shards.py:262-325) does exercise real dist.all_gather_object/an agree_selections rpc on CPU, matching this workflow; but the two-rank divergence scenario in the test is synthetic (SimpleNamespace selection configs 1 and 2), not the GLM-5.3 declaration divergence from #651.
- Charter bar that applies: "Bring real evidence... Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)" and "Supported matrix & compatibility: ... verify cross-node". #668 is a bug fix with a diagnosis-linked root cause for part 1 (reconcile keying) but its live GB10 verification is explicitly deferred.
#9 [high] Related work: #597/#639/#314/#667/#394 overlap the same files
- #597 "Key compiled forward sharing and Inductor validation by GPU name" (open, brandonmmusic-max, +950/−107) heavily overlaps ignition/preparation/aot.py: it rewrites
ForwardCache._prepare_ranks,_publication_lock,_share_artifacts(addsscope=parameter), and keys lending by (host, gpu_name). #668 touches_share_artifacts(temp cleanup) and_load/__init__in the same file → textual conflict risk in aot.py, both modify _share_artifacts body. Both also touch ForwardCache.init root keying (597 keys by GPU name, 668 adds b12x env to the hash tuple). - #639 "ignition: tune discrete CompilePool sizing and scale Inductor compile threads" (open, original-el8) touches aot.py too.
- #314 (open, schopde-nvidia) touches aot.py.
- #667 (open, same author, opened 2026-12-01 22:24 — the same day, after #668) also edits ignition/preparation/host_ranks.py (+8/−2) and hosts peer export changes (
remote_cache, peer-cache transient staging,--no-weightson cold peers). It is a different multi-host-peer-export defect set from the same author and overlaps #668's host_ranks.py hunks inexport_options/peer export region (host_ranks.py:718-719). Stacking/ordering risk: two open PRs by the same author editing the same peer export path. - #394 (open, voipmonitor) also touches host_ranks.py (rank export workspace).
- #383 (merged #714745d4, voipmonitor) created tuning_shards.portable_declaration/local_components and first taught
_selected_plan_catalogto use portable_declaration; #668 builds directly on that identity and adds the name key next to it. - Earlier history in collectives.py: b3bf45f9 (2025-11-11, Luke) "Reconcile kernel selections before sharing compiled forwards" — the original reconcile_selections; c4b73c8a (jasonc, 2026-10-13) "Split tuning races across ranks on separate hosts"; fc1c0d0b (jasonc) "Agree on kernel selections across hosts". So this is a ~7-week-old problem area in the same file with the same author lineage.
#10 [medium] People: lukealonso owns these files; #651/#631 reporters silent on this PR
Author lukealonso is a charter-listed priority contributor ("Priority contributors (@voipmonitor, @original-el8, @lukealonso) carry extra weight"), GitHub association COLLABORATOR, 36 merged PRs in 180 days, 3 currently open (#667, #659, #658). Areas: helios/src (26), docs (22), ignition/preparation (10), flare-cli/src (9), heliopause/src (7).
- In these files lukealonso is the dominant recent author: commits to ignition/preparation/collectives.py since Oct include b3bf45f9 (original reconcile), 84ac035c, f377dc85 (#543), 4c74cc6f (#546), 555db719 (#648), f2ca2c41 (#647) and the #668 commit d4d7b2de. He is effectively the owner of the reconcile path and the host_ranks/serve peer path.
- Other frequent names in the areas: voipmonitor (tuning shards, #383, collectives), jasonc (early multi-host agreement commits), Martin Vit (tuning/collectives), yatesdr (reviews on #383, RoCE GID #369), nero- (#641, DGX Spark work), brandonmmusic-max (#597).
- Who has engaged with #668 so far: nobody. #651 was filed by hiroshi-ya; pfn filed #631 and posted the post-#647 repro. Neither has commented on #668 (PR has no comments).
#11 [medium] Project fit: docs gaps — no doc update for reconcile or peer b12x env
docs/preparation-development.md:337-349 documents CollectivePreparation relaying b12x contributions and _mixed_tuning_batches sharded/remainder batches, but says nothing about reconcile_selections, request-name matching, or the post-tuning second preparation pass. docs/preparation-development.md:124-127 says the runtime patch identity contributes to Ignition forward cache keys — #668 extends that key with B12X_* env, with no doc change. docs/multi-host.md:364-369 warns ranks can trail each other "by minutes inside one forward" during compiled warmup; :377 "All hosts need matching Flare executables and preparation sources" is the closest existing statement to #668's peer-env requirement. docs/model-preparation.md:121-123 documents kernel_cache/kv_codec caching under [paths] kernel_cache — the cubin path #668 now remaps onto each peer (runtime_core.py:405-408). Docs changed by #668: none (8 files, no docs/), so the documented multi-host preparation contract is not updated for the peer b12x env or the peer-local kernel cache.