Explore scratchpad · NVIDIA/hyperflare-inference #695

Raw Markdown for agents: https://autobot.eidonix.com/p/d8d0d5f4-d23d-49fc-a4fe-4c235c54f542.md

#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:

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:

  1. 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.gqa champions with different scratch_layout sizes across ranks 0–7.
  2. Because reconciliation was skipped for tuning replicas, ranks 1–7 failed AOT forward loading (ForwardCache._prepare_ranks) with BindingMismatch on decoder.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:

  1. docs/cli-design.md:574-578: "For TP2, --gpus 0,1 --tuning-gpus 0-5 creates 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 all replicas*tp processes; corresponding-rank-only sharing becomes the fallback.
  2. docs/cli-design.md:565-572 also says the four tuning GPUs "benchmark disjoint candidate subsets" for TP1 (TP=1 path unchanged, still fine).
  3. 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.
  4. docs/model-preparation.md:252-260 (the --tuning-gpus section) 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:

#5 [high] Related work: #678 disjoint lines, #433/#383/#150 context, no prior CPU test

#6 [high] Claims and evidence: unmeasured sharding-scaling claim, repro not re-run

Claims in the PR description vs what backs them:

  1. "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.
  2. "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.
  3. "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.
  4. "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 sibling hyperflare-recipes venv's flare_heliopause build; same excuse pattern as #543's report ("test_source_identity ... testing against the .venv wheel built from a different checkout").
  5. Explicitly admitted limitation: "Multi-GPU end-to-end ignition export --tuning-gpus has 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

#9 [high] Community and process: no engagement yet, no Autobot intake, trailers 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):

  1. 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.
  2. _local_tuning_catalog (tuning.py:35-49) is pickled across the Gloo group on every rank at the start of tuning; it contains portable_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 plus max(len) buffer allgather in ReplicaPreparation.gather (tuning_replicas.py:84-96) — one extra exchange, before tuning, so low risk but it is new wire payload on the --tuning-gpus path.
  3. TuningComplete path now rarer but still reachable: for index > 0 replicas, reconcile_selections/agree_selections are skipped (tuning.py:521-522, 546-548) and they still exit through barrier("tuning_complete", self._coordinator.ranks) + close() + raise TuningComplete() (tuning.py:637-643). The barrier is over self._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.
  4. share_across_ranks is 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.
  5. Dead branch retained: the elif self.autotune and self._coordinator is not None arm (tuning.py:452-468) is now unreachable for tuning replicas, but line 452's shard_ranks = self._coordinator.ranks is the only place shard_ranks is set on that path; partial_shards path 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).
  6. 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 off shard_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):

#11 [medium] Reach: who is affected, what is untouched, and checkpoint-key side effect

Who/what is affected by #695:

#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):

#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:

#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):

#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):