[Dev] Add permute/unpermute fusion with dispatch/combine in Hybrid-EP#4073
Conversation
548af5e to
75407d6
Compare
| block interleaved format. Instead of interpreting the input tensor | ||
| as a concatenation of gates and linear units, it will be | ||
| interpreted as alternating blocks of gates and linear units. | ||
| moe_hybridep_num_blocks_permute: int = 96 |
There was a problem hiding this comment.
I am trying to understand why restrict this to some blocks and not all the blocks ? Is block an moe block here ? Also why 96 ?
There was a problem hiding this comment.
The 'block' here refers to a CUDA thread block. In fuse mode, it can be thought of as how many SMs are used by the permute operation. 96 is a setting we tested that delivers reasonably good performance. However, after thinking about it more, it would be better to set this to None, because Hybrid EP will automatically choose a good value when None is passed in.
|
@Autumn1998 Can we add this to an existing functional test in MLM that is marked "mr-github-slim" so that we protect this against regressions ? @ko3n1g is "mr-github-slim" the right place to so we run as a part of each PR ? Consider Megatron-LM/tests/test_utils/recipes/h100/moe.yaml |
| block interleaved format. Instead of interpreting the input tensor | ||
| as a concatenation of gates and linear units, it will be | ||
| interpreted as alternating blocks of gates and linear units. | ||
| moe_hybridep_num_blocks_permute: int = 96 |
There was a problem hiding this comment.
may be a nit; just a little unclear to me. Could we add a short info what exactly these blocks are how to select a value for it
There was a problem hiding this comment.
This is actually the number of CUDA thread blocks used by the permute operation. In the fuse path, it corresponds to the number of SMs used. In the non-fuse path, there can be cases where multiple blocks are scheduled on the same SM.
75407d6 to
2b56c07
Compare
There was a problem hiding this comment.
Can this assertion be removed with this PR?
|
/ok to test 4c5a244 |
|
/ok to test db328d0 |
|
/ok to test 6304273 |
|
/ok to test d65baf8 |
…egatron-LM into tongliu_permute_comm_fusion
|
/ok to test ce3f875 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24558203417 |
What does this PR do ?
This PR introduce the new feature: fuse the permute/unpermute with the dispatch/combine into 1 kernel
This feature is provided by the hybrid-ep
related PR in main: #4089
Contribution process
Pre-checks
Code review
Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.
For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.