#1 [high] Change: what PR #695 does, in plain terms, and size
PR #695 (open, ready for review, opened 2026-12-02, head ccb9f5b, base main, branch point cc0a49d) by lukealonso (COLLABORATOR). 3 files, +526/−15: ignition/preparation/tuning.py (+27/−8), ignition/preparation/tuning_replicas.py (+17/−7), tests/preparation/test_tuning_replicas.py (new, +482).
Plain terms:
- ignition/preparation/tuning_replicas.py:32-34 —
authorization(..., share_across_ranks=False); peers for the local cache exchange and the local candidate race exchange becomestates(all replicas*TP processes) instead ofstates[rank::tensor_parallel](only corresponding TP ranks) when the flag is on. Replica-local collectives are still restricted tostates[replica*tp:(replica+1)*tp](tuning_replicas.py:55-70), so collective readiness stays TP-group scoped. - tuning_replicas.py:74-82 —
ReplicaPreparation.__init__takesshare_across_ranksand stores it as a mutable attribute (later poked from tuning.py:443); the flag is passed intoauthorizationat tuning_replicas.py:123-125. Error strings get a second wording for the shared mode (tuning_replicas.py:41-54). - ignition/preparation/tuning.py:431-451 —
RecordedPreparationSession.tunenow gathers(device.identity, _local_tuning_catalog(requests))from every replica process (previously onlydevice.identity), and if TP>1 and all gathered reports are byte-identical, setsshare_across_ranks=True, setsself._sharded=True, and configures the tuning shard as(replica*tp + rank, range(replicas*tp))i.e. all processes; otherwise it keeps the old(replica_index, range(replicas))corresponding-rank sharding. - tuning.py:519-535 — post-tuning
reconcile_selectionsis no longer skipped for tuning replicas; it runs whenself._coordinatorspans >1 rank AND (tuning_replica is None or tuning_replica.index == 0). The shard-reset condition changed fromif self._shardedtoif shard_ranks is not None(a new local var, so the replay reset also happens on the non-sharded replica path). - tuning.py:546-549 —
agree_selectionslikewise now runs on serving replica 0 (or any non-replica run); previously gated onself._replica_coordinator is None.
Not in the description: share_across_ranks is set by mutating self._replica_coordinator.share_across_ranks after construction (tuning.py:443) rather than passed to the constructor, even though the constructor now accepts it (tuning_replicas.py:74) — the constructor kwarg is only used by the new Gloo test. Also the description's phrase "post-tuning reconcile_selections (with temporary reset/restore of configure_tuning_shard(0,(0,)) around replay)" hides that the reset guard changed from self._sharded to shard_ranks is not None, which also affects the existing multi-host path in the elif branch (tuning.py:452-468 sets shard_ranks only if self._sharded).
#2 [high] Why: the reported failure mode and linked issues
PR #695 "Why" section (PR description): during a TP=8 Amazon-FMR/Ergo export with --gpus 0-7 --tuning-gpus 0-15 (2 TP=8 replicas on 16 RTX PRO 6000 Blackwell GPUs) two failures occurred:
- All 8 ranks inside each replica raced the same candidate half — sharding was 2-way (across replicas) instead of 16-way — and per-rank timing jitter produced different
attention.gqachampions with differentscratch_layoutsizes across ranks 0–7. - Because reconciliation was skipped for tuning replicas, ranks 1–7 failed AOT forward loading (
ForwardCache._prepare_ranks) withBindingMismatchondecoder.layers[0|3].attention.attention.scratch_layout, after autotuning and compilation had completed.
No issue number is cited by the PR; no Fixes # line. It reproduces the same class of defect as the multi-host selection-divergence issues #631 (closed) and #651 (open) but for the local tuning-replica path, not multi-host. Same author's open #668 fixes the multi-host flavour (and closes #651). Neither #631 nor #651 mentions --tuning-gpus; PR #695 asserts the local-replica path is the analogue.
Related open issue #651: "Multi-host default autotune still fails kernel agreement after #631 was marked as completed" — different path (multi-host), same symptom family.
Source: PR #695 description; #631, #651 titles (read via search_items).
#3 [high] Project fit: docs still describe corresponding-rank-only sharing
The PR touches only code and tests (3 files); no docs change. Two documented statements become incomplete or stale:
- docs/cli-design.md:574-578: "For TP2,
--gpus 0,1 --tuning-gpus 0-5creates three independent TP2 groups. Corresponding ranks share candidate results while collectives stay within each replica." That is exactly the pre-#695 semantics (states[rank::tensor_parallel]). After #695, when TP>1 and all processes report identical device identity + local tuning catalog, candidates are shared across allreplicas*tpprocesses; corresponding-rank-only sharing becomes the fallback. - docs/cli-design.md:565-572 also says the four tuning GPUs "benchmark disjoint candidate subsets" for TP1 (TP=1 path unchanged, still fine).
- docs/model-preparation.md:203-209 says candidate dividing across TP ranks happens "Without extra tuning replicas", implying tuning replicas do not divide across ranks — now untrue in the homogeneous case.
- docs/model-preparation.md:252-260 (the
--tuning-gpussection) never mentions that TP ranks inside/between replicas can share one canonical winner, and now under-states the sharding width (R-way documented vs up to R*TP-way after the change). Also relevant: docs/cli-design.md:477 (flag table row) says only "Start with the serving GPU list, then append complete replicas of that TP group on matching hardware" — unchanged, still true.
Tension with charter line 42 ("Check interactions across every supported... parallel layout... and docs") and the charter's PR-description expectation; PR description makes no documentation claim either way.
#4 [high] Related work: #647 introduced the exact gate #695 removes
PR #647 Fix externalized core signing, stream-0 weight race, export I/O, and multi-host tuning (merged 2026-11-30, closes #631) is the direct ancestor of the code #695 changes, all in ignition/preparation/tuning.py:
- #647 introduced the pre-tuning
share_selectionsfor multi-host (tuning.py:461-462) and the post-tuningreconcile_selectionspass gated onself._replica_coordinator is Noneplus restore ofconfigure_tuning_shard(shard_rank, ...)in afinally(now tuning.py:519-535). #695 removes that gate (replaces it withtuning_replica.index == 0) and generalizes the reset guard. - #647 also fixed
ForwardCache._prepare_ranksto exchange cache-root-relative paths — the exact function named in #695'sBindingMismatchfailure — so #695 is the local-replica counterpart of a multi-host fix merged 2 days earlier. - #647 description quotes the same #631 symptom family (divergent kernel selections across retries when sharded multi-host tuning skipped reconcile).
So #695 is chronologically: #543 (removed joint tuning) → #647 (multi-host reconcile) → #668 (multi-host request-name reconcile, open) → #695 (local tuning replicas). Not competing: #695 targets the
--tuning-gpussharding path which #647/#668 explicitly leave alone (tuning_replicas.py:181-182 forbids combining with multi-host ranks).
#5 [high] Related work: #678 disjoint lines, #433/#383/#150 context, no prior CPU test
- #678 (open, brandonmmusic-max, CONTRIBUTOR) is the only other open PR on
ignition/preparation/tuning_replicas.py. Its own Autobot review (2026-12-02 22:20, head 90b0d31) states explicitly: "Disjoint from concurrent PR #695: Although open PR #695 also edits ignition/preparation/tuning_replicas.py, it modifiesauthorization()andReplicaPreparation(lines 32-125), leaving #678's edits in_replicaandprepare_recipe(lines 142-194) non-overlapping." No textual conflict; both can land. #678 is markedduplicatelabel (stale) and relates to source-root propagation into spawned replicas. - #433 (merged, nero-, "Add Inkling 2 Mini ...") is recorded by related-items as touching both
ignition/preparation/tuning_replicas.pyandtests/preparation/test_tuning_replicas.py, butmain'stests/preparation/has notest_tuning_replicas.pyand no*replica*test at all (list_filesat main;search_codefortuning_replica|TuningReplicaon main's tests/ returns onlytest_tuning_shards.py:229). So before #695 the local-tuning-replica coordination had no CPU test in-tree; #695 adds 482 lines of CPU coverage (unit tests forauthorizationboth modes, a real 4-process GlooReplicaPreparation.prepare()spawn test, and 3RecordedPreparationSession.tune()tests with a fake coordinator). - #383 (merged, voipmonitor, "Distribute matching local tuning races across unequal TP catalogs") is the closest precedent in philosophy: it shards matching local races across ranks when catalogs are unequal. #695's homogeneous branch is the tuning-replica analogue of a related idea, but with an important difference: #383 partitions within a job into matched/unmatched batches, #695 instead chooses one global winner across all replica processes and requires identical catalogs (all-or-nothing).
- #150 (open, brandonmmusic-max) touches tuning.py on device-name identity for tuning; relevant because #695's
share_across_ranksgate compares strictDeviceIdentitytuples (tuning.py:439-442), which is exactly the identity comparison #150 wants to loosen (Max-Q/Workstation names). Not overlapping code, but conceptually adjacent. - #546 (merged, lukealonso) added collective deadlock checks; #695 changes when
agree_selections/reconcile_selections/barrier("tuning_complete")are entered per replica, so collective-entry symmetry across replicas is the risk surface (an Autobot review of #546 flagged that a 16-GPU core export cannot show collective behaviour).
#6 [high] Claims and evidence: unmeasured sharding-scaling claim, repro not re-run
Claims in the PR description vs what backs them:
- "Eliminates cross-rank kernel selection divergence ... for homogeneous TP catalogs (via unified cross-rank candidate exchange + agreement check)" — backed by unit + Gloo tests only (tests/preparation/test_tuning_replicas.py, 482 lines). The Gloo test (
test_replica_preparation_over_gloo_shares_single_winner_across_all_ranks) exercises a fake job with fixed latencies, not b12x. No GPU run. - "and for asymmetric TP catalogs or warm retries (via serving-replica reconcile_selections)" — backed by one mocked session test (
test_recorded_session_tune_with_unequal_replica_catalogs_reconciles_serving_replica) asserting shard_calls == [(0,(0,1)), (0,(0,)), (0,(0,1))] and that replica 0 replays with selected_configs. - "Scales local candidate sharding from R-way to (R*TP)-way when all tuning GPUs and local catalogs match, avoiding TP-way redundant local races" — no measurement at all: no preparation-time before/after, no benchmark. Charter ("Bring real evidence... Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)") and the precedent of #383, where the same reviewer (yatesdr) blocked on "The benefit is not measured" (review of #383, point 3), make this the most likely review objection.
- "167 passed" targeted run and "1,170 passed, 74 skipped" full
tests/preparation/CPU run with 3 self-declared unrelated failures (test_inspect_forward_kernels,test_runtime_static_triton,test_source_identity) — the failures are attributed to running against a siblinghyperflare-recipesvenv'sflare_heliopausebuild; same excuse pattern as #543's report ("test_source_identity ... testing against the .venv wheel built from a different checkout"). - Explicitly admitted limitation: "Multi-GPU end-to-end
ignition export --tuning-gpushas not yet been re-run on this commit" — i.e. the exact TP=8 Ergo / 16-GPU scenario in the Why section is not re-verified after the fix. This is the single biggest gap for a reader deciding. Also: CI on head ccb9f5b passed (per orientation packet), but the PR gives no CI reference. Source: PR #695 description; tests/preparation/test_tuning_replicas.py:459-482; #383 review text.
#8 [high] People: author standing, area ownership, zero engagement on #695
- Author: lukealonso, GitHub association COLLABORATOR, and one of the three named priority contributors in the charter ("Priority contributors (@voipmonitor, @original-el8, @lukealonso) carry extra weight—we never close their PRs out of hand as 'low value'", charter Respect contributors section). 40 merged, 0 closed, 3 open in the last 180 days. Merged areas: helios/src (28), docs (23), ignition/preparation (13), flare-cli/src (10), tests/preparation (9) — i.e. he is the dominant recent author of the exact subsystem #695 touches.
- Immediate track record in this subsystem: #543 (removed joint tuning, merged 2026-11-26), #647 (multi-host tuning + ForwardCache reconcile, merged 2026-11-30), #648 (b12x public contracts migration, merged), #546 (TP16 collectives, merged), #668 (multi-host reconcile, open, closes #651). #695 is the 4th consecutive preparation-tuning PR from him in ~a week; #647/#668 and #695 divide the same problem space into multi-host vs local-replica.
- Who else works here: voipmonitor (#383 tuning_shards, priority contributor), nero- (#433 tuning replicas), brandonmmusic-max (#150, #678 tuning.py/tuning_replicas.py), original-el8 (#231 tuning.py). Review labour in this area is concentrated on yatesdr and flare-autobot (see #383's two CHANGES_REQUESTED reviews and #668/#678 Autobot reviews).
- Engagement on #695 so far: zero.
pr_comments→ "No comments."; no reviews, no labels, no Autobot case-file comment on #695 itself (every other recent PR in this area got an Autobot intake + review within 90 min — #647, #668, #678 all have them). So #695 is unusually un-reviewed for this author/area as of 2026-12-02. - Author's stated contact: "Discord: lukealonso" (satisfies the AGENTS.md contact-line convention that #383's review enforced).
#9 [high] Community and process: no engagement yet, no Autobot intake, trailers unverified
- Community: PR #695 has no comments, reviews, reactions or labels (pr_comments returned "No comments."; orientation packet: "Reviews: none yet", "Labels: none"). Compare sibling PRs from the same author in the same week: #668 has 4 discussion entries (Autobot intake, Autobot review "Changes Requested", two independent hardware confirmations from nepenth and Reederey87 on 2× GB10), #678 has 4 (two Autobot review rounds). #695 also lacks the Autobot intake comment ("A case file has been opened for NNN") that #647/#668/#678 all received, i.e. Autobot did not pick it up.
- Interest signals elsewhere: the multi-host counterpart (#668, #651/#631) drew independent hardware reproduction from two users (nepenth, Reederey87) — evidence that cross-rank selection divergence is a real, user-visible problem, but all of it is multi-host, none of it
--tuning-gpus. #631 (closed) was reported by pfn with exact counts (2042/2078/2078 differing selections over 3 attempts). No user has yet reported the--tuning-gpusBindingMismatch that #695 fixes — the only report is the author's own. - Process: open, "ready for review", 0 reviews, CI passed on head ccb9f5b, opened and last updated 2026-12-02 (same day) — very fresh, <1 day old. Base main branch point cc0a49d; "Commits on the default branch since this pull request branched: none" touching these files, so no rebase pressure yet, though #678 is open against the same file.
- No
Signed-off-by/Design-Signed-Off-Bytrailers observable from the diff; #383 was blocked on exactly those (CONTRIBUTING.md "Signing Off Your Work"; .githooks/commit-msg requiringDesign-Signed-Off-By, docs/design-review.md). Unable to verify commit trailers from this vantage point — flag as unverified.
#13 [high] Research summary
Case file for PR #695 (lukealonso, open, ready for review, head ccb9f5b, 3 files +526/−15) is gathered in the scratchpad: 12 entries covering all nine angles with file:line and PR/issue citations.
What the change is: authorization()/ReplicaPreparation in ignition/preparation/tuning_replicas.py gain a share_across_ranks mode so the local cache and candidate-race exchanges span all replicas*tp processes instead of only corresponding TP ranks, while replica-local collectives stay TP-group scoped; RecordedPreparationSession.tune (tuning.py:431-451) now gathers (device.identity, _local_tuning_catalog) from every replica process, switches to (replica*tp+rank, range(replicas*tp)) sharding when TP>1 and all reports are identical, and un-gates reconcile_selections/agree_selections from "not a tuning replica" to "serving replica 0".
Findings a reader could not get from the description: (1) no documentation was updated, and docs/cli-design.md:574-578 and docs/model-preparation.md:203-209, 252-260 still state the old corresponding-rank-only sharing and R-way sharding — the clearest charter friction (charter line 42); (2) the scaling claim ("R-way to R*TP-way") has no measurement at all, and the PR admits the TP=8 / 16-GPU repro was not re-run, the same objection (#383's review, "benefit is not measured") that held a sibling change; (3) the homogeneous gate is all-or-nothing on the whole catalog plus strict DeviceIdentity, so asymmetric catalogs get zero scaling benefit (#150's device-name work is conceptually adjacent); (4) changing shard width invalidates partial, shard-count-keyed tuning checkpoints (docs/model-preparation.md:224-229), an undocumented operator side effect; (5) the description hides that the shard-reset guard changed from self._sharded to shard_ranks is not None, and that share_across_ranks is poked in by attribute assignment after construction rather than via the new constructor kwarg.
History and people: #647 (merged 2026-11-30) introduced the exact reconcile gate #695 removes and fixed the ForwardCache._prepare_ranks function in the BindingMismatch; #668 (open, same author) is the multi-host counterpart and #678 the only other open PR on this file — its own Autobot review confirms the two edits are line-disjoint (32-125 vs 142-194). Before #695 the tuning-replica path had no in-tree CPU test. The author is a charter-named priority contributor and the dominant recent author of this subsystem, yet #695 has zero comments, reviews, labels and no Autobot intake, unlike every sibling PR that week.
Process: CI passed on head; no signed-off trailers verifiable from here; no multi-host reach (rejected at serve.py:142-143 (not opened), 375-376), no format/ABI/CLI changes.
#7 [medium] Change: behaviour details the description does not spell out
Risk/behaviour notes found by reading the code (these are facts about behaviour, not a code review verdict):
- All-or-nothing gate.
share_across_ranks = tensor_parallel > 1 and all(item == reports[0] for item in reports[1:])(tuning.py:439-442) compares the whole(DeviceIdentity, _local_tuning_catalog(requests))tuple for every process. Any single differing request makes all replicas fall back to corresponding-rank sharding. With asymmetric catalogs (e.g. rank-0-only vision encoder, which is exactly the case #383 was written for) the scaling benefit disappears entirely and only the reconcile half of the PR applies. _local_tuning_catalog(tuning.py:35-49) is pickled across the Gloo group on every rank at the start of tuning; it containsportable_declaration(plan)per request. #383's review already flagged catalog size on ~1.5k-request catalogs as a few MiB; here it is a per-rank pickle plusmax(len)buffer allgather inReplicaPreparation.gather(tuning_replicas.py:84-96) — one extra exchange, before tuning, so low risk but it is new wire payload on the--tuning-gpuspath.TuningCompletepath now rarer but still reachable: forindex > 0replicas,reconcile_selections/agree_selectionsare skipped (tuning.py:521-522, 546-548) and they still exit throughbarrier("tuning_complete", self._coordinator.ranks)+close()+raise TuningComplete()(tuning.py:637-643). The barrier is overself._coordinator.ranks(the serving TP group, e.g. (0,1)), executed by replica-0 ranks and replica-N ranks alike — replica N ranks are not members of that serving group but each replica process constructs its own coordinator, so this relies on same-index processes having an equivalent ranks tuple. The new test asserts("barrier", "tuning_complete", (0, 1))on replica 1 (test_tuning_replicas.py:481) with a fake coordinator.share_across_ranksis set by attribute assignment after construction (tuning.py:443) rather than by the new constructor kwarg (tuning_replicas.py:74) — the ctor kwarg exists only because the Gloo test wants it. Slightly odd API shape; worth noting as an undeclared design choice.- Dead branch retained: the
elif self.autotune and self._coordinator is not Nonearm (tuning.py:452-468) is now unreachable for tuning replicas, but line 452'sshard_ranks = self._coordinator.ranksis the only placeshard_ranksis set on that path;partial_shardspath unchanged. Not a defect, just sharding-guard plumbing that changed shape (self._sharded→shard_ranks is not None) in two places (tuning.py:525, 534). - The reset-to-singleton shard
configure_tuning_shard(0, (0,))around the reconcile replay was introduced by #647 for multi-host; #695 reuses it for tuning replicas but keys it offshard_ranks is not None, which is non-None on the non-sharded replica path too (tuning.py:449-450), so unequal-catalog replicas also do the reset/restore. That is intentional per the new test, and it is a behaviour change relative to before (previously no reconcile at all on that path).
#10 [medium] Project fit: charter alignment and two frictions
Facts to map to the charter (charter text from read_charter):
- Charter "How We Work → Solve the right problem in the right place / smallest footprint in shared code": the change is confined to
ignition/preparation/(44 production lines) and adds no flag, no CLI surface, no per-model branch. Lines up. - Charter "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210). Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)." The PR frames itself partly as a bug fix (BindingMismatch) and partly as a performance/scaling change ("Scales local candidate sharding from R-way to (R*TP)-way"). Root cause is named precisely (sharding width + skipped reconcile), which satisfies the #397 half. The #210 half is not satisfied for the scaling claim: no measurement, and the actual GPU repro was not re-run. #383 (same subsystem, different author) was held to exactly this standard by yatesdr.
- Charter "Supported matrix & compatibility: Check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs." #695 changes a parallel-layout interaction (
--tuning-gpus× TP) and leaves docs/cli-design.md:574-578 and docs/model-preparation.md:203-209, 252-260 stating the old semantics. This is the clearest charter friction in the PR. - Charter "Non-Goals: ... Broad production coverage across arbitrary models, GPUs, or deployment setups" — not implicated;
--tuning-gpusis an existing documented local feature (docs/cli-design.md:477, docs/model-preparation.md:252). - Charter "PR descriptions: Expect four parts: why, what changed, claimed result, evidence." #695 has all four sections, and states its limitation openly. Lines up (unlike #383, which was blocked on description quality).
- Charter "Keep the runtime small and model-agnostic" — no runtime/Helios change; preparation-only. Lines up.
- Roadmap: nothing about tuning replicas; roadmap items are the in-process Rust SDK (#6), Engram (#267), FlashInfer dependency (#215). Neither aligned nor opposed.
#11 [medium] Reach: who is affected, what is untouched, and checkpoint-key side effect
Who/what is affected by #695:
- Operators who pass
--tuning-gpusspanning more than one complete TP replica with--gpusof size >1 (i.e. TP>=2 + R>=2). Docs examples:--gpus 0,1 --tuning-gpus 0-5(3 TP2 groups, docs/cli-design.md:574) and--gpus 0 --tuning-gpus 0-3(TP1, docs/cli-design.md:566, model-preparation.md:254). The TP1 example is unaffected (tensor_parallel > 1guard, tuning.py:440). - Only
autotuneruns are affected: the new sharding block is insideif self.autotune:(tuning.py:438);--autotune-effort offbehaviour unchanged. - Not usable together with multi-host:
serve.py:142-143andserve.py:375-376reject--ranks > 1with--tuning-gpus; tuning.py:426-427 raises "local tuning replicas cannot replace multi-host sharding"; tuning_replicas.py:181-182 raises ifranksoption is set. So the blast radius cannot extend to multi-host runs, and the multi-host bug family (#631/#651) is untouched by this PR. - No configuration/default/CLI/doc changes; no new flags; no dependency or version changes; no core-file/ABI/manifest format change (nothing touches runtime_core, proto, or core files) — so exported cores and caches remain compatible. Kernel selection may change for homogeneous replica runs (one global winner instead of per-rank winners), which changes
scratch_layoutand therefore re-compiles forwards; the tuning selection cache is keyed per shard count — docs/model-preparation.md:224-229 says "Partial checkpoints require the same candidate program identities, effort, tuning shard count, and measurement settings", so existing partial checkpoints from a same-model--tuning-gpusrun will not match the new wider shard count (R -> R*TP) and will be invalidated for partial/shared races. That is an undocumented operator-visible consequence. - Entry points that reach this code:
ignition export(serve.py:300-312),ignition debug-serve(serve.py:453-456),ignition bench(bench.py:245-290), all viaprepare_recipe(tuning_replicas.py:177-217). - Also affects test infrastructure: adds the first CPU-only multi-process (Gloo) test for
ReplicaPreparation; it spawns 4 processes with a 30 s join timeout (tests/preparation/test_tuning_replicas.py:252-264), which is new load/possible flake surface for the CPU CI leg (.github/workflows/python-cpu.yml).
#12 [medium] Reach: shard-count-keyed partial checkpoints and all configure_tuning_shard call sites
Verification of the shard-count / checkpoint claim (relevant because #695 changes shard width from R to R*TP):
configure_tuning_shardin tuning.py is called with (shard_rank, shard_ranks): tuning.py:451 (new), 466 (existing multi-host), 526/535 (reconcile replay reset/restore), 260/264 (sharded mixed batch reset/restore).- docs/model-preparation.md:224-229: "Partial checkpoints require the same candidate program identities, effort, tuning shard count, and measurement settings. A kernel or predicate change invalidates the affected race's checkpoint. Completed selection caches remain usable independently of the tuning shard count."
→ So: completed selection caches survive; partial (per-race, in the SQLite tuning checkpoint) races from an R-way
--tuning-gpusrun will not resume under the new R*TP-way shard count, and vice versa if the PR is reverted. First run after this change re-measures local races whose partials were saved with the old shard count. - Same doc, model-preparation.md:216-222, describes the SQLite checkpoint beside the kernel selection cache. This is a real, if minor, operator-visible consequence of the change that the PR description does not mention, and it collides with the documented guidance only in the sense of extra re-measurement, not corruption.
#14 [medium] Recent activity: git history unavailable; PR-metadata reconstruction, and leads judged irrelevant
Recent activity in the touched areas could not be reconstructed from git: search_history on both ignition/preparation/tuning.py and ignition/preparation/tuning_replicas.py returns "git: error: Could not read c513e46a... fatal: cannot simplify commit ef38cb93..." (repo commit graph unreadable at this vantage point). Substitute evidence gathered from PR metadata instead:
- Orientation packet: "Commits on the default branch since this pull request branched (cc0a49d), touching its changed files: none." So #695 needs no rebase and nothing on main reversed or pre-empted it as of 2026-12-02.
- Newest merged work in these files (from related_items / items_touching, within 180 days): #648 "Migrate ignition runtime patches and preparation onto public b12x contracts" (lukealonso, merged), #647 multi-host tuning + ForwardCache (lukealonso, merged 2026-11-30), #546 TP16 collectives (lukealonso, merged), #543 remove joint tuning (lukealonso, merged 2026-11-26), #383 unequal TP catalog sharding (voipmonitor, merged 2026-11-22), #433 Inkling 2 Mini incl. tuning_replicas.py (nero-, merged), #110 / #88 / #85 (voipmonitor, older).
- So the last ~week of work in
ignition/preparation/tuning*.pyis a single author repeatedly repairing cross-rank selection/agreement plumbing: #543 (removed the joint path) → #647 (multi-host share+reconcile) → #668 (multi-host request-name reconcile, still open) → #695 (local tuning replicas). #695 builds directly on #647's mechanism (pre-tune share_selections at tuning.py:461-462, post-tune reconcile_selections at tuning.py:519-535, singleton-shard reset at tuning.py:526/535) and does not conflict with any merged commit. - Also in-flight nearby: #678 rewrites tuning_replicas.py:142-194 (
_replica,prepare_recipe) — explicitly disjoint from #695's 32-125; #682 (docs, logind RemoveIPC risk) cites tuning_replicas.py:175-191 only as an example of spawned pools, no code overlap; #597 keys ForwardCache by GPU name (aot.py) — adjacent to the BindingMismatch symptom but different code. - Reversed/undone by #695: nothing. It does not reverse #543 (no joint/grouped tuning code re-added) and does not touch the multi-host path.
- Orientation leads judged not relevant: #671 (memory budgets for <=16 GiB integrated devices), #558 (collective tuning headers during progress polling — touches the collective_tuning fields the
authorization()local branch still uses, but #695 leaves that branch untouched), #406, #164, #467, #231, #132, #122, #33, #543/#546/#647/#433/#383 (covered above). #651/#631 are the multi-host sibling bugs, not this path.
#15 [medium] File map: where the change lives and its consumers, with head line numbers
File map for anyone re-reading the change (all at PR head ccb9f5b; line numbers from the head):
- ignition/preparation/tuning_replicas.py (217 lines total):
TuningReplicadataclass :16-25 (processes = replicas * tensor_parallel);TuningComplete(BaseException):28-29;authorization():32-70 (peers at :34; local TP slice at :55; error wordings :41-54, :68-69);ReplicaPreparation:73-135 (__init__:74-82 withshare_across_ranks, Gloo group overrole.index*tp + rank:81-82;gather()pickle allgather :84-96;prepare()loop :98-135,authorizationcall :123-125);prepare_recipe():177-217 (spawns replicas,--tuning-gpusgate :179-183, raises withranks:181-182, 60 s join :204-207). - ignition/preparation/tuning.py (720 lines):
_local_tuning_catalog:35-49;RecordedPreparationSession.__init__:90-132 (_sharded:129,_replica_coordinator:118);_prepare_job:220-227 (routes to replica coordinator :222-223);_mixed_tuning_batches:229-255;_prepare_mixed_batch:257-282 (sharded reset :260-264);tune():409-643 (replica branch :422-451; multi-host branch :452-468; reconcile :519-535; agree :546-549; tuning_report :570-593; TuningComplete exit :637-643). - ignition/preparation/collectives.py:
_tuning_results:182-193 (min by(latency_us, candidate_index));_selected_plan_catalog:196-223;CollectivePreparation:226+;share_selections:360-372;agree_selections:374-395 (raises "N kernel selections differ from rank zero's");reconcile_selections:397-426 (_selected_plan_catalogmatched by portable declaration; returns(configs, changed)). - Consumers / exit plumbing: ignition/preparation/rank_group.py:144-150 (
except TuningComplete:→ control.send("tuning_complete") → close → os._exit(1) if not told to close); ignition/preparation/rank_group.py:345-348; ignition/planning.py:186 (tuning_replicaplan field); ignition/cli/serve.py:142-143, 300-312, 375-376, 453-456; ignition/cli/bench.py:245, 290; ignition/cli/preparation.py:65-107 (--tuning-gpusvalidation: must start with serving GPUs and contain complete TP replicas). This map is the fastest route for a reviewer to check the claim that the local-collective branch (tuning_replicas.py:55-70) is genuinely unchanged.
#16 [medium] Claims and evidence: what the new 482 lines of tests actually exercise
Quality of the new test evidence (matters because it is the only evidence behind two of the four claims):
tests/preparation/test_tuning_replicas.py(new, 482 lines) contains 6 tests:test_authorization_shares_local_tuning_across_all_ranks_when_enabled(:66-131, pure function, drivesauthorization()with hand-built_statetuples incl. the mismatched-race-key RuntimeError),test_authorization_corresponding_rank_mode_scopes_to_replica_peers(:134-150),_gloo_replica_worker+test_replica_preparation_over_gloo_shares_single_winner_across_all_ranks(:153-270 — realtorch.multiprocessingspawn of 4 processes with a realdist.FileStore/ProcessGroupGloo, but a_FakeJob/_FakeSessionscripting fixed latencies(320, 315, 318, 302.5)so winner = process 3; asserts all four get("cache-0".."cache-3"),(3, "cfg-3"),"ar-0"), and threeRecordedPreparationSessiontests (:272-482).- The three session tests bypass
__init__withobject.__new__(RecordedPreparationSession)and hand-assign ~30 attributes (_make_replica_session:272-380), monkeypatchdist.get_rank,torch.cuda.get_device_properties, replaceReplicaPreparationwith_FakeReplicaPreparationand_FakeCoordinator(ranks=(0,1),spans_hosts=False), and assert on aneventslist. They therefore verify the scheduling decisions intune()(which shard is configured, whether reconcile/agree run, in what order) and not b12x or CUDA behaviour. - This is the same test style that yatesdr called out in #383 ("The new Gloo test replaces
coordinator.prepareand the session with stand-ins ... So no test runs the real coordinator"), though here the Gloo test does exercise the realReplicaPreparation/authorizationpair, which is the part that changed. - Practical CI note: the Gloo test starts 4 spawned processes with
p.join(timeout=30)and asserts[p.exitcode ...] == [0,0,0,0](:252-264) — new multi-process load and a possible flake/timeout source in the CPU leg (.github/workflows/python-cpu.yml); the PR reports it passing ("including the 4-process Gloo ReplicaPreparation test", 167 passed) and CI passed on ccb9f5b. - No test covers the interaction the PR's own Why section describes: a TP>1 replica export actually loading AOT forwards, i.e. the BindingMismatch itself. Nothing in the diff touches
aot.pyorForwardCache._prepare_ranks.