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
#5468's placement picks the rank with the smallest
(load, -stored_numel, num_bytes, cumulative). Putting the elements a rank already stores ahead of the cost it carries from earlier buckets means a tie on bucket load always goes to the ranks that store the most rows. With DTensor's unevenShard(0), a rank with a short or empty shard then loses every tie in every bucket, which undoes the cross-bucket balancing that the pre-#5468 heap did. #5468's benchmarks were measured before this tie-break was added (c8ea2ea vs. 6906712).Example. 4 ranks, 8 single-parameter buckets, each an
Owned(10, 16) parameter storedShard(0), so ranks store 3, 3, 3 and 1 rows:The review of #5468 simulated this pattern with the runtime's 2-slot pipeline: 8 buckets of five
Owned(10, 64) parameters on 4 ranks cost +10% step time, and some smaller configs up to 2x.What changed
(load, cumulative, -stored_numel, num_bytes): bucket load first, then cost from earlier buckets, then locality, then bytes. Locality still decides when both costs tie, which is common when ranks are symmetric.test_fixed_work_changes_placement_and_plan_reuseencoded the old order. Its layer 1 has two tied chunks; the 960 chunk now goes to the rank that carries less cost from layer 0 (1160 vs. 1600) instead of the rank that stores most of it. Layer 1's largest load is 960 either way, and the totals over the three layers become 1800 / 2120 instead of 2560 / 1360.Alternatives considered
(load, num_bytes, cumulative, -stored_numel), the pre-[DistMuon] Balance Owned and sharded compute placement #5468 order with locality last: also fixes the starvation, but locality would almost never apply.Numerics
Placement only: each chunk runs the same Newton-Schulz on whichever rank computes it, so results are unchanged.
Testing
test_tied_loads_rotate_across_ranks_with_uneven_storage(CPU, fake process group): the example above must give each rank two of the eight parameters. Fails on main, passes with this change.pytest tests/unit_tests/gpu/distributed/flex_shard/test_dist_muon.py tests/unit_tests/cpu/distributed/flex_shard: all pass.Known issues / follow-ups
This PR was drafted with an AI assistant (Claude Code).