Repository navigation
fix moe-expert-shard-degree-hsdp - #4767
Merged
Merged
Conversation
rakkit
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
September 17, 2026 16:22
|
|
Contributor
Author
|
another related question, i think pytorch at some point does not really care about it anymore? (number of experts can be smaller than shard world size, i.e. some rank can have 0 experts) so do we really have to switch to shard(1)? |
tianyu-l
reviewed
Sep 17, 2026
Comment on lines
+300
to
+303
| dp_storage_mesh = fsdp_config["mesh"] | ||
| efsdp_ep_size = dp_storage_mesh.size() | ||
| if "dp_replicate" in (dp_storage_mesh.mesh_dim_names or ()): | ||
| efsdp_ep_size //= dp_storage_mesh["dp_replicate"].size() |
Contributor
There was a problem hiding this comment.
instead of division, could we use "dp_shard"
https://github.com/pytorch/torchtitan/blob/main/torchtitan/distributed/parallel_dims.py#L278
Contributor
Author
There was a problem hiding this comment.
yes you are right.
i switched to efsdp_ep_size = dp_storage_mesh["dp_shard"].size()
but i think we need to multiply CP when it exists?
rakkit
force-pushed
the
fix-moe-expert-shard-degree-hsdp
branch
from
September 18, 2026 09:08
10783b6 to
d61fe19
Compare
tianyu-l
approved these changes
Sep 18, 2026
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.
apply_fsdp_to_decoderpicksShard(0)/Shard(1)for routed experts by comparing an FSDPshard degree against
num_experts, but the two branches compute different things:by definition,
efsdp_ep_sizeshould be "FSDP" size, but since lots of refactor and at some pointfsdp_config["mesh"]included theDPdimension so nowefsdp_ep_sizeinclude DP.a broken example is
dp_replicate=2, dp_shard=4, num_experts=4: current gives 8 > 4 → Shard(1). which should be Shard(0) as its HSDP..