Repository navigation
[DistMuon] turn on pipeline parallelism (again) - #4263
Merged
Merged
Conversation
Duplicate of #4102. That PR was accidentally merged into its ghstack base branch `gh/weifengpy/51/base` instead of `main`, so the change never reached `main`. Re-submitting the identical content here as a plain single-commit PR against `main`. Drop the config gate that rejected Kimi DistMuon under pipeline parallelism, and add a 4-GPU PP+FSDP+EP single-step integration smoke test. Nothing outside the Kimi model folder changes. DistMuon needs no changes for PP, and neither does the optimizer container. torchtitan/distributed/flex_shard/ and torchtitan/components/ are untouched here. DistMuon's math and collectives were already PP-safe: Newton-Schulz runs per matrix, so splitting layers across stages changes no update; `pp` is its own mesh axis, so every transport group it reduces over -- dp_shard, efsdp, ep -- lives inside a single PP coordinate, and ranks in a group own identical layers; and its FQN-keyed inputs are already subset-tolerant, since bucket resolution iterates only the parameters present, empty buckets are dropped, and the compute-layout map is a superset of what a stage holds. The gate's stated reason -- that PP "gives each stage only a subset of the optimizer's parameter-group patterns" -- described OptimizersContainer's strictness rather than a DistMuon limitation, and overstated it. The container rejects a `param_groups` pattern that claims no parameter. Kimi configures two patterns: the DistMuon matrix pattern and an AdamW catch-all. The catch-all always claims something, and the matrix pattern claims something on any stage holding at least one transformer layer. Verified across stage counts on the debug model: every stage builds its param groups at 2 and 4 stages, the shipped test's layout included. The precondition is that every stage owns at least one transformer layer. A stage holding only norm and lm_head has no matrix parameters and raises "matched no parameters" while building the optimizer. Reaching that needs the stage count to approach the layer count -- it first appears at 6 stages over the 6-layer debug model, and would need roughly 60 stages for Kimi K2. No real configuration does that, so it is left as a loud build-time failure rather than loosening a check that every torchtitan optimizer shares. Relaxing that check safely means restoring an equivalent one against the unsplit model, which is a separate concern. The precondition goes in the README's Supported Parallelisms table, beside the existing TP row, since that is where someone configuring PP will look. The registry carries only a short note on why there is no PP gate. The recipe also moves off `training.local_batch_size`, which no longer exists; the microbatch count is now `parallelism.num_pp_microbatches`. Test plan: - Four GPU Kimi PP+FSDP+EP integration smoke (kimi_k2_5_muon_pp+fsdp+ep), PP=2 with Interleaved1F1B over four virtual stages, FSDP=2, EP=2. NOT run locally -- needs a CI run before landing. - Param groups build on every stage at 2 and 4 stages against an unmodified OptimizersContainer; at 6 stages the layer-less last stage raises, matching the documented precondition. - Rebased onto current `main` and re-verified there: `kimi_k2_5_debugmodel_muon_fsdp2_pp2_ep2` builds with PP=2 / Interleaved1F1B / FSDP=2 / EP=2 / 4 microbatches and the PP gate no longer fires; all 16 recipes in torchtitan_recipes/tests/models.py still build; the integration test list builds with the Kimi entry at ngpu=4, timeout=600. - `pre-commit` clean on the four changed files. - Unit suite is unaffected: no shared code is touched.
weifengpy
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
August 21, 2026 16:06
tianyu-l
approved these changes
Aug 21, 2026
acisseJZhong
pushed a commit
that referenced
this pull request
Sep 2, 2026
Handle non-contiguous HF MoE inputs under context parallelism and remove the Kimi DistMuon pipeline-parallel test, which is unsupported on release/0.3 without #4263.
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.
Duplicate of #4102. That PR was accidentally merged into its ghstack base
branch
gh/weifengpy/51/baseinstead ofmain, so the change never reachedmain. Re-submittingwe used to gate PP because OptimizersContainer requires non-empty param_group matching. it's fine as long as each PP stage owns one layer at least (non-empty muon param_groups)