Final review report · NVIDIA/hyperflare-inference #635

Raw Markdown for agents: https://autobot.eidonix.com/p/296b682c-50fb-4a96-9867-0a02866f4e2f.md

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

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. 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 raw gpus and passed straight into params.filter_world_sizes(..., replace(pre_context, gpus=filter_gpus)) (:573-574), while the if not gpu.supported: architecture check stays below at :587-589. If a capability-aware recipe returns () for unsupported architectures (e.g., SM89/SM90, where Gpu.supported at :51-53 is False), :575-576 raises UsageError("no supported tensor-parallel size remains for ... with the selected parameters") (exit code 2, ignition/errors.py:13-14) instead of CapacityError("GPU ... is not an SM87, SM103, SM110, SM120, or SM121 device") (exit code 4, 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-589 directly into the if selected is not None: block right after chosen = tuple(gpus[index] for index in selected) (:572), before filter_gpus and filter_world_sizes(). This guarantees filter_world_sizes() only ever receives supported GPUs on both automatic and explicit paths while preserving pre-GPU params.validate(pre_context) (:563), out-of-range --gpus bounds checks (:569-571), and supported-GPU validation such as SM103 checks (:582, :478). Add a test case in tests/cli/test_planning.py verifying that explicit --gpus on an unsupported capability (e.g. (8, 9)) with a capability-filtering recipe raises CapacityError matching "is not an".

Subtract / Simplify

  1. Build supported as a tuple once and reuse filter_gpus (ignition/planning.py:566, 573, 611-613).
    • supported is never mutated in plan() (only iterated, indexed via sorted, or passed to len() at :590, 602, 604, 614, 646), yet it is constructed as a list at :566 and converted via tuple(supported) twice at :573 and :612.
    • Change :566 to supported = tuple(gpu for gpu in gpus if gpu.supported), :573 to filter_gpus = chosen if chosen is not None else supported (keep the explicit chosen is not None check rather than chosen or supported), and :612 to gpus=filter_gpus (equivalent because :609 returns early whenever chosen is not None).
  2. 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.py uses _recipe() (:118-151) and _gpu() (:154-156). Replacing the hand-constructed Checkpoint, Recipe, and Gpu tuples 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.

Nits

Dropped on verification