fix(kb): make a partitioned card a different machine in the KB key (re-land of #1495) - #1542
Merged
Merged
Conversation
Re-land of #1495, which was merged as 31143ab and reverted in #1525 to stabilise the 1.1.1 release rather than for any defect: two unrelated PRs were reverted in the same five minutes, the release PR names all three together, and main's CI was green with the change in it. Restored by reverting the revert onto current main, so the content is the reviewed content. Eight of the nine source files are byte-identical to what was merged. parser.py differs only because main has since refactored --max-hours into DEFAULT_MAX_HOURS; relative to current main this change still only removes the --recipe-kb-strict-fingerprint block. The changelog entries moved into the new [Unreleased] section that the 1.1.1 cut opened, and the "tracked separately" promise in the Removed entry now names the issue it refers to, #1507. Verified on the new base: 264 passed across the four affected suites, including the 14 tests that define the change, and ruff clean. No file overlap with the 21 commits main gained, and #1512's fuzzy KB fallback is in src/kernelforge, a different KB from the recipe KB this touches. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Sep 17, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-land of #1495 at @ZhengGong-amd's recommendation. #1495 was merged as
31143aband reverted in #1525 to stabilise the 1.1.1 release, not for a defect: two unrelated PRs were reverted in the same five minutes, #1519's test plan names all three together ("No residue of the three reverted PRs (#1520, #1511, #1495)"), and main's CI was green with the change in it.The content is the reviewed content. It was restored by reverting the revert onto current main rather than reassembled by hand. Eight of the nine source files are byte-identical to what was merged;
parser.pyis the exception only because main has since refactored--max-hoursintoDEFAULT_MAX_HOURS, and relative to current main this branch's only change to that file is still the removal of the--recipe-kb-strict-fingerprintblock.Two things did change, both deliberate:
[Unreleased]section that the 1.1.1 cut opened, since the release correctly stripped them.### Removedentry promised therocm/aitergap was "tracked separately" without saying where. It now names KB warm replay does not compare the ROCm/AITER build a config was tuned on #1507, with the recording prerequisite in fix(provenance): record the AITER that is actually installed #1508.The gap
The recipe
canonical_idis a seven-tuple:Expert parallelism is not a dimension of it, and neither is the compute-partition mode.
kb_hardware_slugappended topology only whennodes >= 2, so on a single node it returned the bare GPU type. A run in SPX and a run in CPX produced the same id — andrecipe_canonical_idhas no partition parameter, so the difference was not merely unrecorded, it was inexpressible.Nothing downstream caught it either. The warm-start cascade relaxes only
conc/isl/osl, andRecipeScope.matches_workload_shapecompares a hardcoded(tp, conc, isl, osl). So anexacttier hit at confidence 1.0 could hand the PRELUDE auto-replay a config recorded with eight times the partitions.--warm-replay-min-reproduce-pctis a real backstop and the run does recover, but only after paying for the verify round — andstatus=driftreports it as a recipe that failed to reproduce rather than as a machine that never matched.What this changes
The collision is made unrepresentable rather than detectable.
The shape is part of the hardware identity.
kb_hardware_slugtakes apartition_modeand encodes it, plus expert parallelism, at any node count:The default shape is no shape. SPX and
ep <= 1append nothing, so every key written before this change is byte-identical after it:One resolver feeds both sides.
resolve_kb_topologyreturnspartition_mode, read from the state'scompute_partition["mode"]and falling back topublished_shape(), so the KB reader and the writer cannot drift into agreeing only by coincidence.The fallback tiers carry the shape, so a partitioned pod reaches same-ISA siblings at its own shape and never the whole-card row at any tier:
The read-side guard is deleted, along with
_shape_mismatch,_GUARDED_SHAPE_KEYS, thestrict_shapeparameter, and--recipe-kb-strict-fingerprint— a flag declared in the parser and read nowhere.Why identity, not a read-side check
@ZhengGong-amd blocked the original revision of #1495 on mechanism, and all three defects reproduced:
_with_exact_historybuilds a fixed ten-key mapping with notp,eporpartitions, so the check reported a mismatch for dimensions the dict is structurally incapable of carrying:'tp: row=None pod=8, ep: row=None pod=8, partitions: row=None pod=8'.warm_tier/warm_conftoseed_only/0.0 leaves the config-donor block reachable, because it is entered onwarm_pointbeing truthy._donor_is_trustworthycompares onlyconc/isl/osl, so the config replayed anyway — a guard that logged a refusal and handed over the config.DEFAULT_EP = 1demoted the whole corpus. Every dense CLI run hasstate.ep == 1, soworkload_shapepublishedep: 1on every run and the check reported'ep: row=None pod=1'against every historical row.It also closes @meinali-566's point without a separate change:
RecipeScopehad no way to filter oneporpartitions, and distinctcanonical_ids leave nothing to filter.Blast radius
Against a historical row that recorded no shape at all:
ep=1ep=1is not a shapeMI300X_dpx)MI300X_cpx)MI300X_ep8)A partitioned pod misses rather than mis-hits. It falls through the normal cascade and, absent a row at its shape, seeds cold — the honest outcome for a corpus that predates the distinction, and it self-heals as sessions republish.
Verification on the new base
test_recipe_kb_t0_anchor,test_canonical_id_5tuple,test_multi_node_scriptsandtest_remote_recipe_v2, including the 14 tests that define the change.9 failed, 22614 passed. All nine are the known pre-existing set (test_external_multi_node×5,test_agentx_repair,test_preflight_auth_override, two load-flakytest_supervisorcases under-n 32); none touch the KB.ruff checkandruff format --checkclean.src/kernelforge/, a different KB from the inference-optimizer recipe KB this touches.One process note for whoever approves: @meinali-566's sign-off on #1495 was posted as a comment rather than an Approve, so that PR merged with no review on record. Worth using the Approve button this time so the trail exists.