Skip to content

make get tp mesh optional in llama4 parallelize - #2185

Merged
danielvegamyhre merged 2 commits into
mainfrom
de20
Dec 29, 2025
Merged

danielvegamyhre merged 2 commits into
mainfrom
de20

Conversation

@danielvegamyhre

@danielvegamyhre danielvegamyhre commented Dec 29, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #2184

get_mesh() throws an exception if the mesh dim is none, so the current code implicitly requires TP > 1.

we should use get_optional_mesh() so the user isn't required to use TP.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 29, 2025
@danielvegamyhre

Copy link
Copy Markdown
Contributor Author

cc @tianyu-l @fegin for review

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg, do we need to modify other moe models as well? Qwen, gpt-oss, deepseek v3

@fegin fegin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching the bug. @tianyu-l yes, other models with EP supported need the same change. I can do this or @danielvegamyhre if you are able to fix it before landing, that also be good.

@@ -135,7 +135,7 @@ def parallelize_llama(

# tp_mesh might have been set above if tp_enabled, otherwise get it here
if tp_mesh is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also remove line 136 and line 137.

@danielvegamyhre danielvegamyhre Dec 29, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated and applied fix to qwen3 as well. dsv3 and gpt-oss both seem to use get_optional_mesh() already

@danielvegamyhre
danielvegamyhre merged commit 62f5806 into main Dec 29, 2025
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 13, 2026
Fixes pytorch#2184 

get_mesh() throws an exception if the mesh dim is none, so the current
code implicitly requires TP > 1.

we should use get_optional_mesh() so the user isn't required to use TP.
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
Fixes pytorch#2184 

get_mesh() throws an exception if the mesh dim is none, so the current
code implicitly requires TP > 1.

we should use get_optional_mesh() so the user isn't required to use TP.
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
Fixes pytorch#2184 

get_mesh() throws an exception if the mesh dim is none, so the current
code implicitly requires TP > 1.

we should use get_optional_mesh() so the user isn't required to use TP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug in parallelize llama4 with tensor_parallel_degree=1

3 participants