Repository navigation
Implicit overlap of shared expert compute and token combine communication - #1741
Merged
Merged
Conversation
…oken combine communication
mreso
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
September 23, 2025 07:26
tianyu-l
approved these changes
Sep 23, 2025
tianyu-l
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Error seems unrelated.
xmfan
approved these changes
Sep 23, 2025
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
…tion (pytorch#1741) This PR moves the computation of the shared expert before the possible scoring of the routed expert output which leads to an implicit overlap between shared expert compute and token combine communication in MoE models. Repro (lowered the layer number to 2): ``` CONFIG_FILE="./torchtitan/models/deepseek_v3/train_configs/deepseek_v3_16b.toml" ./run_train.sh --profiling.enable_profiling --profiling.profile_freq 10 --training.steps 10 ``` Trace before the change: <img width="1503" height="625" alt="Screenshot 2025-09-23 at 12 08 31 AM" src="https://github.com/user-attachments/assets/bbcc41cf-6497-482e-972e-d917baf4498e" /> Trace after the change (note that all-to-all comm is now overlapping shared expert compute): <img width="1503" height="625" alt="Screenshot 2025-09-23 at 12 04 56 AM" src="https://github.com/user-attachments/assets/3504e77c-aa14-46fd-8e47-e247b88d7b9c" /> cc @tianyu-l @xmfan
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
…tion (pytorch#1741) This PR moves the computation of the shared expert before the possible scoring of the routed expert output which leads to an implicit overlap between shared expert compute and token combine communication in MoE models. Repro (lowered the layer number to 2): ``` CONFIG_FILE="./torchtitan/models/deepseek_v3/train_configs/deepseek_v3_16b.toml" ./run_train.sh --profiling.enable_profiling --profiling.profile_freq 10 --training.steps 10 ``` Trace before the change: <img width="1503" height="625" alt="Screenshot 2025-09-23 at 12 08 31 AM" src="https://github.com/user-attachments/assets/bbcc41cf-6497-482e-972e-d917baf4498e" /> Trace after the change (note that all-to-all comm is now overlapping shared expert compute): <img width="1503" height="625" alt="Screenshot 2025-09-23 at 12 04 56 AM" src="https://github.com/user-attachments/assets/3504e77c-aa14-46fd-8e47-e247b88d7b9c" /> cc @tianyu-l @xmfan
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.
This PR moves the computation of the shared expert before the possible scoring of the routed expert output which leads to an implicit overlap between shared expert compute and token combine communication in MoE models.
Repro (lowered the layer number to 2):
Trace before the change:

Trace after the change (note that all-to-all comm is now overlapping shared expert compute):

cc @tianyu-l @xmfan