Recommendation: Changes Requested
The design and layering are right—resolving candidate GPUs before RecipeParameters.filter_world_sizes() keeps ignition.planning model-agnostic, matches the existing ParameterContext.gpus contract from fit(), and cleanly enables SM120/SM121 capability-dependent TP sizing on both single-host and multi-host paths. One concrete defect in the reordered prologue needs fixing before merge: explicit --gpus currently forwards unsupported GPUs (e.g., SM89/SM90) into filter_world_sizes() before the architecture check runs, which can turn a hardware CapacityError (exit 4) into a misleading parameter UsageError (exit 2) for capability-gated recipes. Moving the existing 3-line if not gpu.supported: check ahead of filter_world_sizes() (with a matching unit test and passing python-cpu.yml CI) resolves this cleanly.
Merge Risk
Level: Low
- Touches a single CLI planning function (
ignition/planning.py:565-614) used only during one-shot setup (ignition/cli/preparation.py:70,ignition/cli/serve.py:200, 422,ignition/cli/bench.py:186); no serving hot path, concurrency, memory-budget, or manifest/schema surface changes. - Fully backward compatible for recipes whose
filter_world_sizes()ignorescontext.gpus(verified across both in-repo overrides attests/cli/test_planning.py:81-85andtests/cli/test_commands.py:55-59). - Risk is confined to error classification when a capability-aware recipe filters
context.gpuson an explicitly selected unsupported GPU.
Walkthrough
ignition/planning.py:566-577: MovessupportedGPU filtering and explicit--gpusindex bounds checking ahead ofparams.filter_world_sizes(), passingreplace(pre_context, gpus=filter_gpus)wherefilter_gpusischosenwhenselected is not Noneandtuple(supported)otherwise.ignition/planning.py:578-591: Re-entersif chosen is not None:after world-size filtering for the existinglen(chosen) not in plan_sizesvalidation/capacity error and theif not gpu.supported:check.ignition/planning.py:611-613: Passesgpus=tuple(supported)intocandidate_params.filter_world_sizes(...)insidecandidates()on the automatic planning path.tests/cli/test_planning.py:568-596: Addstest_filter_world_sizes_receives_selected_or_supported_gpus, exercising automatic and explicit--gpusplanning on synthetic 4×SM120 and 3×SM121Gputuples with aCapabilityAwareParamssubclass.
Pre-merge Checks
- [PASS] Security / malicious screen: Small, transparent Python-only change in
ignition/planning.pyand its unit test; no I/O, deserialization, subprocess, or unsafe code introduced. - [PASS] Charter & value fit: Keeps hardware/TP policy in recipe
RecipeParameterssubclasses without adding model branches or flags to coreignition, supporting the charter's SM120/SM121 single- and cross-node goals. - [PASS] Related / duplicate / conflict check: Direct completion of the
ParameterContext.gpushook introduced in #545; rebase-clean againstmain(no conflicting commits since branch point). - [WARN] Tests & verification evidence: The new CPU test is well-isolated and exercises both call sites (
:574and:611-613), but no unsupported-GPU explicit--gpuscase is tested, andpython-cpu.ymlCI should be confirmed green on the PR head before merge (live 3-node SM121 validation is disclosed as living inlocal-inference-lab/hyperflare-recipes#103).
Blockers
None.
Should Fix
- Reject unsupported explicitly selected GPUs before calling
filter_world_sizes()(ignition/planning.py:568-576, 587-589).- Verified behavior/impact: When
selected is not None,chosen = tuple(gpus[index] for index in selected)(:572) is drawn from rawgpusand passed straight intoparams.filter_world_sizes(..., replace(pre_context, gpus=filter_gpus))(:573-574), while theif not gpu.supported:architecture check stays below at:587-589. If a capability-aware recipe returns()for unsupported architectures (e.g., SM89/SM90, whereGpu.supportedat:51-53isFalse),:575-576raisesUsageError("no supported tensor-parallel size remains for ... with the selected parameters")(exit code2,ignition/errors.py:13-14) instead ofCapacityError("GPU ... is not an SM87, SM103, SM110, SM120, or SM121 device")(exit code4,ignition/errors.py:21-22), violating the documented preparation exit-code contract (docs/cli-design.md:1533-1534) and giving users a misleading parameter diagnostic for unsupported hardware. - Fix: Move the existing 3-line loop from
:587-589directly into theif selected is not None:block right afterchosen = tuple(gpus[index] for index in selected)(:572), beforefilter_gpusandfilter_world_sizes(). This guaranteesfilter_world_sizes()only ever receives supported GPUs on both automatic and explicit paths while preserving pre-GPUparams.validate(pre_context)(:563), out-of-range--gpusbounds checks (:569-571), and supported-GPU validation such as SM103 checks (:582,:478). Add a test case intests/cli/test_planning.pyverifying that explicit--gpuson an unsupported capability (e.g.(8, 9)) with a capability-filtering recipe raisesCapacityErrormatching"is not an".
- Verified behavior/impact: When
Subtract / Simplify
- Build
supportedas a tuple once and reusefilter_gpus(ignition/planning.py:566, 573, 611-613).supportedis never mutated inplan()(only iterated, indexed viasorted, or passed tolen()at:590, 602, 604, 614, 646), yet it is constructed as alistat:566and converted viatuple(supported)twice at:573and:612.- Change
:566tosupported = tuple(gpu for gpu in gpus if gpu.supported),:573tofilter_gpus = chosen if chosen is not None else supported(keep the explicitchosen is not Nonecheck rather thanchosen or supported), and:612togpus=filter_gpus(equivalent because:609returns early wheneverchosen is not None).
- Reuse existing
_recipe()and_gpu()helpers in the new test (tests/cli/test_planning.py:577-588).- Every other test in
tests/cli/test_planning.pyuses_recipe()(:118-151) and_gpu()(:154-156). Replacing the hand-constructedCheckpoint,Recipe, andGputuples with_recipe("toy", device_gib=60, ranks=(3, 4), parameters=CapabilityAwareParams(max_concurrency=4, prefill_chunk=512)),ckpt = model.checkpoints[0], and_gpu(i)/_gpu(i, capability=(12, 1))cuts ~12 lines to 4 while preserving all assertions and memory-fit margins.
- Every other test in
Nits
tests/cli/test_planning.py:591, 593, 595, 596:reserve_bytes=0is redundant (the default inRecipeParameters.reserve_bytesatignition/parameters.py:1405is already0, and_normalize_parametersatignition/planning.py:443-444leaves it at0when omitted); dropping the four kwargs matches the rest of the file.ignition/parameters.py:561(optional): Adding a short phrase toParameterGroup.filter_world_sizes's docstring noting thatcontext.gpusholds the explicitly selected GPUs or all supported host GPUs (andcontext.world_sizeisNone) would make the hook contract explicit for external recipe authors.
Dropped on verification
- Claim that the second call site (
ignition/planning.py:611-613insidecandidates()) is untested: False. On automatic planning (chosen is None),plan()immediately callsattempt(params, ...)(:619) ->candidates(params, ...)(:617) ->candidate_params.filter_world_sizes(..., gpus=tuple(supported))(:611-613). Thustests/cli/test_planning.py:591and:596directly execute and verify:611-613(omittinggpus=there would make:596fail with emptycandidates). - Claim that the PR moved the empty-
plan_sizesUsageErroraboveparams.validate(:582), reversing the comment at:580-581: Inaccurate. Onmain(ignition/planning.py:567-568),if not plan_sizes: raise UsageError(...)already preceded bothparams.validate(...)(main:580) andfor gpu in chosen: if not gpu.supported:(main:585-587). The actual new regression is strictly the unsupported-GPU leak captured in Should Fix #1. - Claim that
params.validate(pre_context)(:563) is "brokenly asymmetric" because it still receivesgpus=(): False/undesirable. Pre-GPU validation at:563intentionally rejects invalid CLI flag combinations before GPU index checks and avoids false rejections on mixed-capability hosts; GPU-awarevalidate()already runs infit()(:478),Plan.__post_init__()(:196), and the mismatch path (:582). - Claim that
context.world_sizebeingNoneinfilter_world_sizes()is a gap: False.filter_world_sizes(world_sizes, context)takes the tuple of candidateworld_sizesas its first argument specifically to filter them; there is no single selectedworld_sizeyet at that stage. - Claim that passing
chosenon explicit--gpusvstuple(supported)on automatic planning is a bug on mixed-capability hosts: False. Becauseautomatic()(:599-606) draws acrosssupportedwithout segregating by architecture, passingtuple(supported)is the accurate candidate pool for automatic planning (preventing a mixed host from falsely passingall(gpu.capability == (12, 1))), while explicit--gpusallows selecting a homogeneous subset. - Claim that moving out-of-range
--gpusbounds checks ahead of empty-plan_sizesUsageErroris a defect: Dropped. Bounds-checkingselectedbefore indexinggpus[index]is required to constructchosenwithoutIndexError, and both paths raiseUsageError(exit code 2). - Demand for a separate multi-host
--ranksunit test forplan(): Low-signal. Verified inignition/cli/serve.py:199-208, 421-431andignition/preparation/host_ranks.py:135-140that multi-host planning builds standardplanning.Gputuples fromtopology_gpu()and callsplanning.plan(..., gpus, selected=tuple(range(len(gpus)))), which exercises the exact sameselected=(0, 1, 2)code path already covered attests/cli/test_planning.py:595. - Dossier note that no
flare-autobotcase file comment or labels existed: Stale—verified via PR metadata that labels (area:preparation,enhancement,triage:review) and the case-file comment are present.