[main] add thd sequence packing dispatcher support for main - #5008
Conversation
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Signed-off-by: HaochenYuan <haocheny@nvidia.com>
Signed-off-by: HaochenYuan <haocheny@nvidia.com>
129a58d to
5c46612
Compare
| moe_permute_fusion_into_hybridep: bool = False | ||
| """Fuse token rearrangement ops during token dispatching for HybridEP.""" | ||
|
|
||
| moe_hybridep_pad_variable_tokens: bool = False |
There was a problem hiding this comment.
Is this feature only intended to be used for sequence packing? If so it feels awkward that if a user were to enable a sequence packed dataset that produced uneven sequence lengths, they would also need to know about this knob (which doesnt mention anything about sequence packing)
I think we generally want to avoid creating new configs when we could otherwise reasonably infer them from elsewhere. Could we set this path by doing something like detecting the presence of packed_seq_params by plumbing it down the moe_layer?
There was a problem hiding this comment.
Yes we expect users to turn this toggle on specifically for HybridEP + THD and we will guide our customers when should we turn this on. On the other hand, having packed sequence doesn't always mean we needs to pad if we apply offline packing and the dataset was created without the need to pad.
However, the accuracy impact of doing offline packing & memory overhead concerns of always padding to max seq-len are often key factors for us to introduce this specific toggle to do minimum amount of padding while also being able to use HybridEP.
There was a problem hiding this comment.
can we rename this and update the description to reflect this reasoning? maybe moe_hybridep_pad_uneven_sequence_packed_inputs ?
There was a problem hiding this comment.
I agree that documentation might need to be updated, but moe_hybridep_pad_variable_tokens might be a better name because this is a general enough feature to handle dynamic sized inputs across EP ranks, while technically sequence packed inputs is orthogonal, because we can have the following two cases:
- if I choose not to do seq-packing, but processing single document (accuracy concerns about offline seqpacking might lead to this), I will need this toggle to do minimum amount of padding.
- if I choose to do seq-packing, there are cases where my data distribution is good enough that it's actually acceptable to pad to MBS * seqlen because the utilization rate is very high, so that we don't really need to pad right before HybridEP, for example Nemotron RL seems to this case.
Overall, I avoided to bring in seq-packing & thd into the naming in the first place.
There was a problem hiding this comment.
then maybe: moe_hybridep_pad_uneven_dispatch_inputs ? to disambiguate we're padding the input tokens which vary across ranks
There was a problem hiding this comment.
I am okay with this one
Signed-off-by: HaochenYuan <haocheny@nvidia.com>
23397d5 to
d31e983
Compare
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30051892799 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30052012281 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30052269034 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30052580528 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30055538264 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30071618606 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30092277340 |
What does this PR do ?
Corresponding main branch PR for dev branch PR 4816 & PR 5048.
Previous dev PR 2924 added support for thd format in training, but for MoE dispatcher, only all2all type is supported. This PR adds the deepep & hybridep backend.
While currently the thd e2e support PR 3386 is not merged, this PR will remain draft state until 3386 proceeds.
Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/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.