Skip to content

[Feature] Add MoE expert tensor parallelism - #2007

Open
jayhenry wants to merge 7 commits into
InternLM:mainfrom
jayhenry:etp_pr
Open

[Feature] Add MoE expert tensor parallelism#2007
jayhenry wants to merge 7 commits into
InternLM:mainfrom
jayhenry:etp_pr

Conversation

@jayhenry

Copy link
Copy Markdown
Collaborator

Summary

This PR ports MoE expert tensor parallelism onto the latest upstream/main while keeping checkpoint formats topology-independent. The work is split into four ordered, independently testable commits.

flowchart LR
    A["DTensor-aware HF planning"] --> B["InterleavedShard HF I/O"]
    B --> C["InterleavedShard DCP"]
    C --> D["Expert TP"]
Loading

Changes

  • Make HF load/save planning aware of DTensor placements.
  • Add InterleavedShard HF checkpoint round trips.
  • Add InterleavedShard DCP save/load and reshard planning.
  • Add (FSDP, EP, ETP) meshes and Expert TP support for Naive, All2All, and DeepEP dispatchers, including async/Domino and tile-wise FP8 paths.
  • Keep HF and DCP checkpoint representations independent of the runtime EP/ETP topology.

Verification

  • Pre-commit hooks, Ruff, formatting, mypy, and git diff --check passed.
  • HF planning/config tests: 42 passed.
  • Dispatcher/model-path tests: 9 passed.
  • TrainEngine focused tests: 7 passed.
  • DCP model/optimizer round trips: 2 passed.
  • InterleavedShard distributed tests passed on both 4 and 8 GPUs.
  • Qwen3-30B-A3B 8-GPU end-to-end runs completed 10/10 steps for EP1/ETP1 and EP2/ETP2 DeepEP, in both BF16 and FP8.
  • Against this branch's direct upstream/main parent, EP1 throughput changed by +0.12% (BF16) and -0.10% (FP8), with matching loss and peak memory.
  • With the historical FA3/non-deterministic runtime flags, EP1 BF16 and FP8 throughput reproduced the previous baseline within 1%, while reducing peak memory by about 4 GB.

Result

The final tree preserves the existing Expert TP behavior and numerical results while integrating it with the current upstream/main checkpoint and training architecture.

@jayhenry
jayhenry force-pushed the etp_pr branch 2 times, most recently from 2087502 to c6c042d Compare August 12, 2026 11:40
@jayhenry

Copy link
Copy Markdown
Collaborator Author

@claude review

@jayhenry
jayhenry force-pushed the etp_pr branch 2 times, most recently from 71433df to ff3d262 Compare August 12, 2026 15:43
@jayhenry

Copy link
Copy Markdown
Collaborator Author

@claude review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant