Repository navigation
Conversation
This was referenced Oct 29, 2026
This branch has not been deployed
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.
Stack from ghstack (oldest at bottom):
Why
When a rank computes several chunks of one parameter, their packed layout is defined twice. The region planner packs the chunks along dim 0 in the order it is given and uses those offsets for its routes; DistMuon separately recomputes each Newton-Schulz view's offset by summing the sizes of earlier
logical_regions. Nothing checks that the two agree. A planner change that packs in a different order, for example by size, would still pass plan validation and the cross-rank check, while Newton-Schulz silently ran on the wrong rows.Example.
BlockShard(dim=0, block_sizes=(4, 2))on a (6, 4) weight with both chunks on one rank. If the planner listed the chunks in one order but packed the 2-row chunk first, DistMuon's re-derived offsets would make the 4x4 view read logical rows[4, 5, 0, 1]. After this PR, DistMuon reads each chunk's position from the plan, so listing order no longer matters.What changed
_ParticipantPartitiongainstensor_regions: where each logical region sits in the participant's tensor. The region planner fills it from the same packed offsets its routes use._matrix_batch_views_for_regionsbecomes_matrix_batch_views_for_region, which describes one chunk relative to its own start; the cost estimators already passed a single region.Numerics
Unchanged: the planner packs in the same order as before, so the views have the same offsets.
Testing
pytest tests/unit_tests/gpu/distributed/flex_shard/test_dist_muon.py tests/unit_tests/cpu/distributed/flex_shard: 20 passed.test_shared_bucket_matches_per_parameter_buckets(previous PR) passes on this PR and fails on the previous one (layers.0.blocks).This PR was drafted with an AI assistant (Claude Code).