Skip to content

MFSDP v2 should support HSDP and HFSDP placements #5616

Description

@wujingyue

MFSDP v2 currently rejects the placement differences needed for HSDP/HFSDP.

megatron_fsdp/experimental/parameter_group.py requires main_grad and main_weight to have identical placements and raises until HSDP/HFSDP support is implemented. That blocks hybrid sharding modes where weights, gradients, and optimizer state intentionally use different inner-DP / outer-DP layouts.

Implementation detail:

  • First microbatch: all-gather across DP-outer.
  • Last microbatch: reduce-scatter or all-reduce across DP-outer.
  • DP-outer communication should probably run on a separate stream so it can overlap with DP-inner communication.

Expected outcome:

  • Define MFSDP v2 layout semantics for HSDP and HFSDP.
  • Support HSDP outer-DP replication / gradient synchronization.
  • Support HFSDP optimizer-state sharding across inner and outer DP ranks.
  • Add focused tests for the required placement and collective transitions.

Development PRs:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Fields

No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions