[FSDP2] enable per-param mesh FSDP2 for MoE#2281
Open
weifengpy wants to merge 2 commits intopytorch:mainfrom
Open
[FSDP2] enable per-param mesh FSDP2 for MoE#2281weifengpy wants to merge 2 commits intopytorch:mainfrom
weifengpy wants to merge 2 commits intopytorch:mainfrom
Conversation
345bbdd to
6e5dcf2
Compare
3c36e53 to
3bf7e27
Compare
b5932fa to
3bf7e27
Compare
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 9, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
weifengpy
added a commit
to pytorch/pytorch
that referenced
this pull request
Feb 10, 2026
this PR applies fully_shard on transformer_block, sharding experts on edp_mesh, and other params on dp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on experts see torchtitan for AG/RS schedules and numeric experiments: pytorch/torchtitan#2281 existing fsdp2 callsite won't be affected because _shard_placement_fn -> ShardPlacementResult is a new code path checked backward-compatiblibility * pytorch: fsdp2_mem_tracker.py is affected, but only if people use it with per-param mesh. I don't think it's a hard blocker * torchtitan: No usages of _fsdp_param_group (singular). Safe. * torchao: No usages of _fsdp_param_group (singular). Safe. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
Contributor
Author
|
those CI errors because we need to land pytorch/pytorch#173509 first |
Member
|
@tianyu-l We're still gonna need the fine-grained workarounds at least for mxfp8, due to #2250 (comment). Until that issue is fixed (dynamo bwd tracing of autograd functions), we will trace wrong bwd graph. |
Contributor
|
@xmfan oh, I didn't know. I marked it as high priority for now. |
Contributor
Author
I didn't change apply_compile because of #2341. #2250 (comment) is new to me |
Add deepseek_v3_16b.toml config for local testing with 4 GPUs.
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.
command:
NGPU=8 MODULE=deepseek_v3 CONFIG=deepseek_v3_16b ./run_train.sh --training.steps 20 --parallelism.expert-parallel-degree 4fsdp2 support per-param mesh: pytorch/pytorch#173509
this PR applies fully_shard on transformer_block, sharding experts on
edp_mesh, and other params ondp_mesh. FSDPModule schedule 2 all-gather sequentially: 1st on transformer blocks, 2nd on expertsthis make it possible for apply torch.compile on each transformer_block. I didn't enable compile per block yet becuase there is still a gap in torch.compile + ac + MoE: #2341
AG order in forward are exactly the same before and after this change

AG order in backward are different but is better

Numerics remains bitwise equal with/without this change