#1 [high] Finding A (Major): unsupported explicit --gpus now reach filter_world_sizes; architecture CapacityError becomes unreachable
File: ignition/planning.py (PR head c2ef797).
Head code (ignition/planning.py:567-591):
chosen = None
if selected is not None:
if any(index >= len(gpus) for index in selected):
raise UsageError(f"--gpus {format_gpus(selected)} names a GPU this host does not have;"
f" it has {len(gpus)}")
chosen = tuple(gpus[index] for index in selected)
filter_gpus = chosen if chosen is not None else tuple(supported)
plan_sizes = params.filter_world_sizes(world_sizes, replace(pre_context, gpus=filter_gpus))
if not plan_sizes:
raise UsageError(f"no supported tensor-parallel size remains for {checkpoint.alias} with the selected parameters")
sizes = " or ".join(map(str, plan_sizes))
if chosen is not None:
if len(chosen) not in plan_sizes:
...
for gpu in chosen:
if not gpu.supported:
raise CapacityError(f"GPU {gpu.index} ({gpu.name}) is not an {SUPPORTED_ARCHITECTURES} device")
Issue: filter_gpus = chosen (line 573) is taken from the raw gpus tuple, NOT from supported, so an explicitly
selected unsupported device (e.g. SM89 RTX 4090, SM90 H100; SUPPORTED_CAPABILITIES at ignition/planning.py:37-38 is
(8,7),(10,3),(11,0),(12,0),(12,1) only) is handed to the recipe's filter. A capability-aware filter of exactly the
shape this PR's own test blesses (tests/cli/test_planning.py:571-575: if context.gpus and all(gpu.capability == (12,1) ...): return sizes in (3,4); return sizes == 4) will return () for that set, so line 576's UsageError fires first and
the specific diagnostic at lines 587-589 is never reached for such a recipe.
Concrete user impact: ignition export MODEL --gpus 0 on a single unsupported GPU changes from
"GPU 0 () is not an SM87, SM103, SM110, SM120, or SM121 device" (CapacityError, exit 4, ignition/errors.py:21-22)
to "no supported tensor-parallel size remains for with the selected parameters" (UsageError, exit 2,
ignition/errors.py:13-14) — a message that blames parameters for a hardware mismatch. docs/cli-design.md:1533-1534
documents created exit codes 2=usage, 4=capacity, so the code changes too. The generic CapacityError at
ignition/planning.py:591 for the automatic path ("this host has N") survives, so the two paths now diagnose the same
hardware mismatch differently.
Fix (small, keeps the PR's intent): in the chosen branch, honour the unsupported-device error before filtering, e.g.
keep filter_gpus = tuple(gpu for gpu in chosen if gpu.supported), or move the for gpu in chosen: if not gpu.supported
loop above the filter_world_sizes call. Either way filter_world_sizes should never see a device planning itself
declares unsupported (it is called with tuple(supported) on the automatic path, at ignition/planning.py:573 and :612).
#5 [high] Finding A addendum: new ordering contradicts the stated precedence intent at planning.py:580-581
Addendum to Finding A — the strongest version of the ordering problem.
ignition/planning.py:575-582 (PR head):
if not plan_sizes:
raise UsageError(f"no supported tensor-parallel size remains for {checkpoint.alias} with the selected parameters")
sizes = " or ".join(map(str, plan_sizes))
if chosen is not None:
if len(chosen) not in plan_sizes:
# Let parameter validation surface explicit UsageErrors (such as TP restrictions)
# before falling back to a generic capacity/GPU-count error.
params.validate(replace(pre_context, gpus=chosen, world_size=len(chosen)))
The inline comment states the design intent: explicit parameter UsageErrors (e.g. TP restrictions, the SM103 guard at
tests/cli/test_planning.py:105-106) must surface before the generic GPU-count/capacity errors. The new ordering puts
the empty-plan_sizes UsageError (line 575-576) above that comment's params.validate (line 582) and above the
unsupported-device CapacityError (587-589).
So the moment a recipe uses the capability-aware filter this PR is built to enable, every "these GPUs cannot do this model" diagnosis collapses into one generic sentence that blames the parameters — the outcome the comment at 580-581 was written to prevent. Verified concretely: a filter of the shape in tests/cli/test_planning.py:571-575 returns () for an unsupported explicit selection, and line 576 fires.
Ordering that satisfies both the PR's goal and the existing intent: keep resolving supported/chosen first (the PR's
actual contribution), then validate the chosen group for unsupported architecture and let params.validate(...) run,
and only then call filter_world_sizes with the already-vetted GPU set. That needs no API change and no model logic in
planning.
Note also this is bounded to recipes that inspect context.gpus: the two in-repo overrides ignore it
(tests/cli/test_planning.py:81-85, tests/cli/test_commands.py:55-59), and the full in-repo test file still passes
reasoning: the SM103 test at tests/cli/test_planning.py:218-220 gets "SM103" from fit()'s validate
(ignition/planning.py:469-478) because SM103 is in SUPPORTED_CAPABILITIES (ignition/planning.py:37), so its filter
returns (2,4) and line 576 does not fire.
#7 [high] Citation index for PR #635 review
Exact head lines for downstream citation (PR head c2ef797, ignition/planning.py):
:563 params.validate(pre_context) (unchanged, gpus=()) :565 world_sizes = recipe.checkpoint_tensor_parallel(checkpoint) :566 supported = [gpu for gpu in gpus if gpu.supported] :567 chosen = None :568-571 out-of-range --gpus UsageError (moved up from main:573-575) :572 chosen = tuple(gpus[index] for index in selected) :573 filter_gpus = chosen if chosen is not None else tuple(supported) :574 plan_sizes = params.filter_world_sizes(world_sizes, replace(pre_context, gpus=filter_gpus)) :575-576 empty plan_sizes UsageError (moved down from main:567-568) :577 sizes = " or ".join(map(str, plan_sizes)) :578-586 missing-size CapacityError (+ params.validate at :582 with "Let parameter validation surface explicit UsageErrors ... before falling back to a generic capacity/GPU-count error.") :587-589 unsupported-device CapacityError ("GPU {index} ({name}) is not an {SUPPORTED_ARCHITECTURES} device") :590-591 automatic host-size CapacityError :611-613 second filter_world_sizes call: replace(pre_context, root=candidate_params, gpus=tuple(supported)) :626, :643 relief/candidate path where :611 is actually reached
main reference: filter at main:566, empty-plan UsageError main:568, --gpus check main:573-575 (verified by read_file ref=main). Other anchors: SUPPORTED_CAPABILITIES ignition/planning.py:37-38; Gpu.supported :52-53; ParameterContext.gpus default ignition/parameters.py:130; filter_world_sizes base ignition/parameters.py:560-564; fit() context ignition/planning.py:469-478; Plan.parameter_context :231-239; exit codes ignition/errors.py:13-22; docs/cli-design.md:1533-1534; docs/preparation-development.md:32-36; AGENTS.md:76-112 (four-part description), :88-94 (explicit before/after), :376-381; .github/workflows/python-cpu.yml:3-33; docs/TODO.txt:263-267.
#8 [high] Research summary
I reviewed PR #635 (Correctness, Contracts & System-Level Consequences lens) by reading the full plan() body at the PR head and at main, ignition/parameters.py (ParameterContext, RecipeParameters.filter_world_sizes), every caller of planning.plan()/derive(), fit() and Plan, the multi-host GPU source (host_ranks.topology_gpu via cli/serve.py), the manifest builders, the two in-repo filter_world_sizes overrides, the docs contract in docs/preparation-development.md and docs/cli-design.md, and AGENTS.md.
One Major finding: the PR passes raw chosen (which may contain devices planning itself calls unsupported) into filter_world_sizes at ignition/planning.py:573-574, while the unsupported-device CapacityError stays below the filter at :587-589. A capability-aware recipe — exactly the shape the PR's own test blesses at tests/cli/test_planning.py:571-575 — therefore returns an empty size set and the new empty-plan_sizes UsageError at :575-576 fires first. ignition export MODEL --gpus 0 on one unsupported GPU changes from "GPU 0 (…) is not an SM87, SM103, SM110, SM120, or SM121 device" (exit 4) to "no supported tensor-parallel size remains for … with the selected parameters" (exit 2), blaming parameters for a hardware mismatch. The new ordering also contradicts the intent stated in the inline comment at :580-581 ("Let parameter validation surface explicit UsageErrors … before falling back to a generic capacity/GPU-count error"), which the empty-size error now pre-empts. Fix: filter chosen through gpu.supported, or move the unsupported-device check above the filter call.
Three Minor findings: (B) automatic planning sees tuple(supported) while explicit --gpus sees the exact selection, so the same physical deployment yields different context.gpus — on a heterogeneous host the all(...) predicate silently drops an architecture-specific size — and world_size is still None at both call sites while every later hook gets it; no doc states the semantics. (C) the empty-plan_sizes error and the out-of-range --gpus error swapped precedence versus main (both exit 2, message only), and the description's "moved … explicit --gpus bounds checks ahead of" implies all --gpus validation moved when the unsupported-device check did not — the very gap enabling the Major finding. (D) test gaps: no unsupported-capability explicit---gpus case (the strings "is not an SM" / "no supported tensor-parallel size remains" have zero coverage repo-wide), the second call site at :611-613 (relief path) is untested for the new argument, multi-host topology_gpu is untested (disclosed), and no CI ran on c2ef797 despite python-cpu.yml triggering on pull_request.
Verified sound, no issue: no concurrency/memory/blast-radius surface (plan() is CLI-setup only, not a request path), backward compatibility (no signature or ParameterContext change; both in-repo overrides ignore gpus), no owner-sign-off contract triggered, manifests byte-identical, right architectural layer per the charter, and no metric/rate-span change.
#9 [high] Verdict summary for PR #635 (lens: correctness, contracts, system-level)
Bottom line for adjudication. The change is conceptually correct and lands in the right layer (recipe-owned policy through an existing hook, no model branch in core) — do not reject on architecture grounds. It needs a small reordering plus contract text before merge. Severities, in order:
MAJOR — scratchpad entry 1 (+ addendum in the entry titled "Finding A addendum").
ignition/planning.py:573-574 hands raw chosen to filter_world_sizes; the unsupported-device CapacityError at :587-589
is still below the filter, so the new empty-plan_sizes UsageError at :575-576 fires first for any capability-aware
recipe. One command, ignition export MODEL --gpus 0 on an unsupported GPU, flips from "GPU 0 () is not an
SM87, … SM121 device" (exit 4) to "no supported tensor-parallel size remains for with the selected
parameters" (exit 2) — wrong cause, wrong exit code (docs/cli-design.md:1533-1534), and it contradicts the intent
written in the comment at ignition/planning.py:580-581. Fix: pass tuple(gpu for gpu in chosen if gpu.supported), or
move the unsupported-device loop above the filter. No API change, no model logic in planning. Add the missing test:
explicit --gpus naming an SM89/SM90 device expects the architecture CapacityError.
Note also: the automatic path is unaffected (it already filters via tuple(supported)), so only explicit --gpus breaks,
which is precisely the path the PR's new third assertion covers — with supported devices only.
MINOR — entry 2. Automatic = whole supported host set, explicit = exact selection; world_size still None at both
call sites (:574, :611-613) while fit()/Plan.parameter_context pass both (:469-478, :231-239); no doc states the
contract (docs/preparation-development.md:32-36). Affects mixed-capability hosts and any recipe author.
MINOR — entry 3. Error-precedence swap vs main (main:566-568 filter first, main:573-575 --gpus check after) not disclosed; description implies all --gpus validation moved. Both are UsageError/exit 2, so message-only.
MINOR — entry 4. Coverage: no unsupported-explicit-GPU case (strings "is not an SM" / "no supported tensor-parallel
size remains" have zero repo-wide coverage), :611-613 relief path untested for the new arg, multi-host topology_gpu
untested (disclosed), and no CI check ran on c2ef797 although .github/workflows/python-cpu.yml runs on pull_request.
The "7 passed" claim is consistent with the file (7 test functions) but unverified from here.
SOUND, no findings (entry titled "Sound areas (verified, no finding)"): no concurrency/hot-path/memory/blast-radius
surface (plan() is CLI setup only; scheduler.plan() elsewhere is unrelated); backward compatible (no signature or
ParameterContext change, gpus default was already () at ignition/parameters.py:130, both in-repo overrides ignore
it at tests/cli/test_planning.py:81-85 and tests/cli/test_commands.py:55-59); manifest output byte-identical
(rebuild_manifest.py:303-310 already passes gpus+world_size); no captured-graph owner sign-off trigger
(AGENTS.md:376-381); no metric/rate/admission span change; Unix/Windows parity unaffected.
Citation map for the write-up: see entry "Citation index for PR #635 review".
#2 [medium] Finding B (Minor): filter_world_sizes sees whole-host supported set on automatic, exact selection on explicit; world_size still None
File: ignition/planning.py (PR head).
Explicit path (ignition/planning.py:573): filter_gpus = chosen ...
Automatic path (ignition/planning.py:573): ... else tuple(supported) — every supported GPU on the host
Second call site (ignition/planning.py:611-613):
candidate_sizes = candidate_params.filter_world_sizes(
world_sizes, replace(pre_context, root=candidate_params, gpus=tuple(supported))
)
Consequences:
- Two different GPU sets for the same deployment. With 3x SM121 and
--gpus 0,1,2the hook sees 3 GPUs; without--gpusit seestuple(supported)= all supported GPUs on the host. On a heterogeneous host (2x SM121 + 2x SM120, a shape the repo already anticipates: ignition/cli/preparation.py:99-102 requires each--tuning-gpusreplica to match "its corresponding serving GPU model and architecture", implying mixed-capability hosts), theall(gpu.capability == (12,1) ...)predicate the new test blesses (tests/cli/test_planning.py:573) is False for the union, so the architecture-specific size is silently pruned even when the SM121 subset could serve it.automatic()cannot segregate by architecture either (ignition/planning.py:599-606 picks in index order or by free_bytes), so this is a contract gap rather than a bug the recipe can work around. world_sizestays None at ignition/planning.py:574 and :611-613, while every later hook gets it:Plan.parameter_context(ignition/planning.py:231-239) carriesgpusANDworld_size, andfit()builds the same (ignition/planning.py:469-478). So a recipe that wants "is TP3 valid on these GPUs" must express it as a set filter withall(), and the same recipe gets different context richness at filter time vs validate/adjust time.- No doc states the semantics. docs/preparation-development.md:32-36 lists
filter_world_sizesamong invoked hooks but says nothing aboutcontext.gpus/context.world_sizeat that point, and nothing was added by this PR. Recipe authors (this PR's stated audience) have no contract text to code against.
Fix: add one line to docs/preparation-development.md (near :32-36) stating exactly what context.gpus holds during
world-size filtering (all supported host GPUs for automatic planning, the exact --gpus selection otherwise, and never
a per-candidate subset), and use the same tuple(supported)-filtered set on both call sites unless the per-selection
asymmetry is the intended contract.
#3 [medium] Finding C (Minor): error-precedence swap and PR-text imprecision about which --gpus checks moved
Files: ignition/planning.py:563-591 (PR head) vs main.
Main (verified at ref main, ignition/planning.py:565-589):
world_sizes = recipe.checkpoint_tensor_parallel(checkpoint)
plan_sizes = params.filter_world_sizes(world_sizes, pre_context) # main:566
if not plan_sizes:
raise UsageError(...) # main:568
...
supported = [gpu for gpu in gpus if gpu.supported] # main:570
chosen = None
if selected is not None:
if any(index >= len(gpus) for index in selected):
raise UsageError(f"--gpus ... names a GPU this host does not have;") # main:573-575
Head: the filter_world_sizes call and the empty-plan_sizes UsageError move below the out-of-range --gpus check
(ignition/planning.py:568-576).
So for an input that fails both ways — --gpus 9 on a 1-GPU host plus parameters that leave no world size — the
reported error flips from "no supported tensor-parallel size remains for with the selected parameters"
(exit 2) to "--gpus 9 names a GPU this host does not have; it has 1" (exit 2). Exit code is unchanged; only which
of the two UsageErrors a user sees changes. Both are UsageErrors (ignition/errors.py:13-14), so this is a diagnostic
precedence change only — Minor. The PR text ("Pre-GPU params.validate(pre_context) and out-of-range --gpus error
behavior are unchanged") is literally true for each call in isolation but omits that their precedence versus the
parameter error changed; AGENTS.md:88-94 requires the before/after transition to be explicit.
Also PR-text imprecision, same family: the description says "moved supported GPU filtering and explicit --gpus
bounds checks ahead of params.filter_world_sizes()" — the out-of-range check moved, but the unsupported-device
CapacityError did NOT (it is still after the filter, ignition/planning.py:587-589), which is what makes Finding A
possible. A reviewer reading the description would conclude the whole --gpus validation moved.
#4 [medium] Finding D (Minor): test gaps — unsupported explicit GPU, relief call site, multi-host; CI never ran
File: tests/cli/test_planning.py:568-596 (+32/-0). Only test added.
sm120_gpus = tuple(planning.Gpu(i, "SM120", f"GPU-{i}", 140 * GIB, 140 * GIB, (12, 0)) for i in range(4))
sm121_gpus = tuple(planning.Gpu(i, "SM121", f"GPU-{i}", 140 * GIB, 140 * GIB, (12, 1)) for i in range(3))
# Automatic planning on 4x SM120 selects TP4, not TP3.
assert planning.plan(model, ckpt, sm120_gpus, reserve_bytes=0).world_size == 4
with pytest.raises(CapacityError, match="needs 4"):
planning.plan(model, ckpt, sm120_gpus[:3], selected=(0, 1, 2), reserve_bytes=0)
# Explicit and automatic planning on 3x SM121 allow TP3.
assert planning.plan(model, ckpt, sm121_gpus, selected=(0, 1, 2), reserve_bytes=0).world_size == 3
assert planning.plan(model, ckpt, sm121_gpus, reserve_bytes=0).world_size == 3
Coverage gaps (all in the file's own idiom, so cheap to add):
- No unsupported-capability case on the explicit path — the exact hole in Finding A.
grepfor the two user-facing strings finds zero test coverage: "is not an SM" / "names a GPU this host does not have" / "no supported tensor-parallel size remains" appear only in ignition/planning.py (verified by search_code over the whole repo). So the unsupported-device CapacityError at ignition/planning.py:587-589 has no test, before or after this PR, and this PR is the change that can pre-empt it. - The second
filter_world_sizescall site (ignition/planning.py:611-613, the relief/candidate path reached when no candidate fits, planning.py:626 / :643) is untested for the newgpus=argument; the new test's plans all fit on the firstattempt()(140 GiB free, 200 GiB device weights spread over 3-4 ranks). - Multi-host: the only non-synthetic source of
context.gpusistopology_gpu()(ignition/preparation/host_ranks.py:135-140, fed by ignition/cli/serve.py:421 and ignition/cli/serve.py:199). No test exercises it. The PR discloses this ("these unit tests run on CPU with syntheticGpudescriptors"), so it is a disclosed limitation, not a misstatement — but it is the motivating path, and docs/TODO.txt:263-267 tracks exactly this RoCE TP2/TP3 gap. - Unverified claim: "
CUDA_VISIBLE_DEVICES="" pytest -q tests/cli/test_planning.pypassed (7 passed, 0 failed)". The file has exactly 7def test_functions (tests/cli/test_planning.py:159, 223, 298, 402, 479, 521, 568), consistent; but no CI check ran on c2ef797, and .github/workflows/python-cpu.yml:3-7 triggers onpull_requestand runspytest tests/ -qwith CUDA_VISIBLE_DEVICES="" (lines 30-33). The absence of any check on the head is unexplained.
#6 [medium] Sound areas (verified, no finding)
Areas checked and found SOUND — state plainly in the report, do not invent issues here.
- No concurrency / hot-path / memory consequences.
plan()is a one-shot CLI setup path: all callers are ignition/cli/preparation.py:70 (derive, used by export and_prepare), ignition/cli/serve.py:200 (_export_hosts), ignition/cli/serve.py:422 (debug-serve), ignition/cli/bench.py:186-188 (via derive). Verified by search_code overignition/forplanning.plan(/derive(: no runtime request path calls it (the similarly namedscheduler.plan()in ignition/bench/runner.py:141 and ignition/direct/server.py:323 is unrelated). No locks, no queues, no buffers, no allocation amplification added; the change moves one list comprehension and one function call. Nothing to say about contention or failure-propagation blast radius. - Backward compatibility holds.
ParameterContext.gpusalready existed with the()default (ignition/parameters.py:130) — no new field, no signature change toRecipeParameters.filter_world_sizes(ignition/parameters.py:560) or its subgroup recursion (:562-564). The two in-repo overrides ignorecontext.gpus(tests/cli/test_planning.py:81-85, tests/cli/test_commands.py:55-59) so their behaviour is unchanged, and both call sites are inside planning.py (:574, :611) — verified by search_code: no other caller exists. - No contract requiring owner sign-off. No proto/manifest field, no CLI flag, no dependency pin, no captured-graph
operation. AGENTS.md:376-381 (captured-graph approval) is not triggered; no
PreparationManifestkey changes —rebuild_manifest.from_planalready passesgpus=plan.gpus, world_size=plan.world_size(ignition/preparation/rebuild_manifest.py:303-310, also :253-260), so manifests are byte-identical before/after. - Right layer per the charter. The policy stays in a recipe
RecipeParameterssubclass; ignition/planning.py gains no model name, flag, or capability branch (charter "Keep the runtime small and model-agnostic"; AGENTS.md:382-396 puts model policy in local-inference-lab/hyperflare-recipes). This is a genuine improvement over the pre-#499/#508 state where capability gating lived in core. - Not a stale-state or reset bug.
pre_contextis a frozen dataclass built per call (ignition/planning.py:556-562);replace(pre_context, gpus=...)at :574/:612 creates a fresh instance. No mutation, no cross-call state. - The performance/rate-metric span check does not apply: this PR changes no metric, latency or admission sample. The
only observability-adjacent surface is the
{"plan": ...}JSON printed on stderr (ignition/cli/serve.py:440, :213; ignition/cli/bench.py:194) viaPlan.to_dict()(ignition/planning.py:383-420), which does not includecontext.gpusand is unchanged in content. - Platform parity (Unix vs Windows) unaffected:
Gpu.capabilityandGpu.supported(ignition/planning.py:42-53) are platform-neutral, and the Windows_integrated_memorypath only feedstotal/free(:76-86).