Repository navigation
fix(cli): drop unreachable guards in validate_pipeline_parallel_args - #2532
Merged
Merged
Conversation
The maintainer decision on #1131 is reading (a): TP-only (`--tp-size > 1` with PP off) is a supported path and stays accepted. Two ensures in the validator could never fail: the "2D parallelism requires --pp-size >= 2" check, which is the exact negation of the early return above it, and the `--pp-size must be at least 2` else arm, which only runs when the early return already guaranteed pp_size >= 2. The `total_ranks > 0` check is kept because it is reachable (`--pp-size 0 --pp-layers 0-3,4-7 --tp-size 2`); it is simplified to `pp_size > 0` with an accurate comment. The misnamed test is renamed to match its assertion and a new test pins the reachable inconsistent-topology branch. Refs #1131
Formatting only; no behavior change. Refs #1131
validate_pipeline_parallel_args_requires_two_stages_without_manual_ranges has asserted is_ok() on every input since it was added, and its name described the `--pp-size must be at least 2` else arm this PR removes as unreachable. Rename it to validate_pipeline_parallel_args_accepts_single_stage_and_manual_ranges and add a comment saying why each case is accepted, so no test name in the file contradicts its assertions. Validated with the test-fast validate_pipeline_parallel unit tests (6 passed), the cli_help_consistency suite (27 passed), and clippy on the bin with tests (clean). Refs #1131
validate_pipeline_parallel_args had no test reaching the --pp-micro-batch-size zero check, the empty --pp-layers check, or the text-only (image/audio/video) check. One new test now exercises each and asserts on the error message. Validation: - cargo test --profile test-fast -p mlxcel --bin mlxcel validate_pipeline_parallel: 7 passed - cargo test --profile test-fast --test cli_help_consistency: 27 passed - clippy -D warnings (bin + tests) and cargo fmt --check clean Refs #1131
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.
Closes #1131
Implements reading (a) from the maintainer comment on #1131: TP-only (
--tp-size > 1with PP off) is a shipped path and stays accepted. The set of accepted and rejected inputs is unchanged; only two messages that could never be emitted are gone.ensure!s invalidate_pipeline_parallel_args. The "2D parallelism requires --pp-size >= 2" check was the exact negation of the early return above it. The--pp-size must be at least 2else arm only ran withpp_layers == None, where the early return already guaranteespp_size >= 2; it is not named in the issue but falls under the "no unreachable branch" criterion.total_ranks > 0check, simplified to the equivalentpp_size > 0with the same message. It is reachable:--pp-size 0 --pp-layers "0-3,4-7" --tp-size 2passes the early return. The issue body assumedpp_size >= 1there, but--pp-sizeis an unrestrictedusize...._rejects_2d_without_pp_enabledto..._accepts_tp_only_when_pp_disabledand..._requires_two_stages_without_manual_rangesto..._accepts_single_stage_and_manual_ranges, since both always assertedis_ok(). Added tests that reach every remaining check: thepp_size 0topology error,--pp-micro-batch-size 0, an empty--pp-layers, and multimodal input under PP.every_flag_named_in_command_source_exists_in_some_helpintests/cli_help_consistency.rs(from test: assert every flag named insrc/commandsexists in some--help#1604, checked against the union of all subcommand helps and flag-surface dumps), so no duplicate was added. A stricter per-command variant was evaluated with a throwaway script (each command source's string-literal--flagtokens against its own subcommand's help:generate*.rsagainstgenerate,serve.rsagainstserveincl.--dump-flag-surface, and the other single-subcommand sources against their own). It found no real gaps, so no new test was added and no stale flag needed fixing.Validation (test-fast profile, default features):
cargo test -p mlxcel --bin mlxcel validate_pipeline_parallel(7 passed),cargo test --test cli_help_consistency(27 passed),cargo clippy -p mlxcel --bin mlxcel --tests -- -D warnings(clean),cargo fmt --checkon touched files (clean).Unverified: CI results.