Skip to content

[moe][compile] Turn capture_scalar_outputs off by default - #1649

Merged
xmfan merged 4 commits into
mainfrom
gh/xmfan/1/head
Aug 29, 2025
Merged

xmfan merged 4 commits into
mainfrom
gh/xmfan/1/head

Conversation

@xmfan

@xmfan xmfan commented Aug 28, 2025 •

Copy link
Copy Markdown
Contributor

FIXES #1640, some ranks are hanging during compilation on MoE, not sure why yet. But disabling it because it's just an unstable flag that we really need CI runs in both pytorch core and torchtitan repos to ensure EP configs work.

NGPU=4 CUDA_VISIBLE_DEVICES="0,1,2,3" CONFIG_FILE="./torchtitan/experiments/llama4/train_configs/debug_model.toml" tlp ./run_train.sh --training.steps=50 --parallelism.data_parallel_shard_degree=4 --parallelism.expert_parallel_degree=4 --compile.enable

with compile: MFU ~27%
https://gist.github.com/xmfan/f0a96e1116d507bb4aed8e661ec141f7

without compile: MFU ~25%
https://gist.github.com/xmfan/de15d487dda6ee962645c5047ee1348e

tlparses:
https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_0/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000
https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_1/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000
https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_2/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000
https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_3/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

@danielvegamyhre grouped_mm is still captured in graph 5/0 so i think torchao will still be compiled?
as for comms, i'm not too worried about perf since the eager code is using synchronous collectives atm

Stack from ghstack (oldest at bottom):

xmfan added 2 commits August 27, 2025 23:23
[ghstack-poisoned]
[ghstack-poisoned]
xmfan added a commit that referenced this pull request Aug 28, 2025
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 28, 2025
[ghstack-poisoned]
xmfan added a commit that referenced this pull request Aug 28, 2025
@xmfan
xmfan marked this pull request as ready for review August 28, 2025 06:58
@danielvegamyhre

Copy link
Copy Markdown
Contributor

lgtm, when testing with torchao I found a new different issue, created: #1651

@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.

LGTM, one comment

@@ -107,7 +107,6 @@ def parallelize_llama(
# turn on per-TransformerBlock compile after AC wrapping and before FSDP
if model_compile_enabled:
# NOTE: needed for torch.compile to work with dynamic shapes in token-choice MoE

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.

please remove this line

[ghstack-poisoned]
xmfan added a commit that referenced this pull request Aug 29, 2025
@xmfan
xmfan changed the base branch from gh/xmfan/1/base to main August 29, 2025 09:59
@xmfan
xmfan merged commit 88dfcbe into main Aug 29, 2025
wwwjn pushed a commit that referenced this pull request Sep 3, 2025
FIXES #1640, some ranks are
hanging during compilation on MoE, not sure why yet. But disabling it
because it's just an unstable flag that we really need CI runs in both
pytorch core and torchtitan repos to ensure EP configs work.

`NGPU=4 CUDA_VISIBLE_DEVICES="0,1,2,3"
CONFIG_FILE="./torchtitan/experiments/llama4/train_configs/debug_model.toml"
tlp ./run_train.sh --training.steps=50
--parallelism.data_parallel_shard_degree=4
--parallelism.expert_parallel_degree=4 --compile.enable`

with compile: MFU ~27%
https://gist.github.com/xmfan/f0a96e1116d507bb4aed8e661ec141f7 

without compile: MFU ~25%
https://gist.github.com/xmfan/de15d487dda6ee962645c5047ee1348e

tlparses:

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_0/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_1/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_2/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_3/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

@danielvegamyhre grouped_mm is still captured in graph 5/0 so i think
torchao will still be compiled?
as for comms, i'm not too worried about perf since the eager code is
using synchronous collectives atm

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ #1649
@tianyu-l
tianyu-l deleted the gh/xmfan/1/head branch January 5, 2026 00:38
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 13, 2026
FIXES pytorch#1640, some ranks are
hanging during compilation on MoE, not sure why yet. But disabling it
because it's just an unstable flag that we really need CI runs in both
pytorch core and torchtitan repos to ensure EP configs work.

`NGPU=4 CUDA_VISIBLE_DEVICES="0,1,2,3"
CONFIG_FILE="./torchtitan/experiments/llama4/train_configs/debug_model.toml"
tlp ./run_train.sh --training.steps=50
--parallelism.data_parallel_shard_degree=4
--parallelism.expert_parallel_degree=4 --compile.enable`

with compile: MFU ~27%
https://gist.github.com/xmfan/f0a96e1116d507bb4aed8e661ec141f7 

without compile: MFU ~25%
https://gist.github.com/xmfan/de15d487dda6ee962645c5047ee1348e

tlparses:

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_0/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_1/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_2/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_3/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

@danielvegamyhre grouped_mm is still captured in graph 5/0 so i think
torchao will still be compiled?
as for comms, i'm not too worried about perf since the eager code is
using synchronous collectives atm

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ pytorch#1649
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 25, 2026
FIXES pytorch#1640, some ranks are
hanging during compilation on MoE, not sure why yet. But disabling it
because it's just an unstable flag that we really need CI runs in both
pytorch core and torchtitan repos to ensure EP configs work.

`NGPU=4 CUDA_VISIBLE_DEVICES="0,1,2,3"
CONFIG_FILE="./torchtitan/experiments/llama4/train_configs/debug_model.toml"
tlp ./run_train.sh --training.steps=50
--parallelism.data_parallel_shard_degree=4
--parallelism.expert_parallel_degree=4 --compile.enable`

with compile: MFU ~27%
https://gist.github.com/xmfan/f0a96e1116d507bb4aed8e661ec141f7 

without compile: MFU ~25%
https://gist.github.com/xmfan/de15d487dda6ee962645c5047ee1348e

tlparses:

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_0/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_1/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_2/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

https://manifold.edge.x2p.facebook.net/v0/read/tree/logs/xmfan/643f743e-b4a3-4568-b91f-766024ca10c6/custom/rank_3/index.html?bucketName=tlparse_reports&apiKey=tlparse_reports-key&withPayload=1&timeoutMsec=10000

@danielvegamyhre grouped_mm is still captured in graph 5/0 so i think
torchao will still be compiled?
as for comms, i'm not too worried about perf since the eager code is
using synchronous collectives atm

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ pytorch#1649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Llama4 DP=4, EP=4 with torch.compile crashes with inductor codegen triton kernel error

3 participants