Add support for fused Q Up-Proj GEMM/RoPE/Quant - #6213
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. |
This commit adds support for fusing the q up proj gemm with the following rope and mxfp8 quantization operations. Relies on the TE functionality from NVIDIA/TransformerEngine#3303 Signed-off-by: Chase Block <cblock@nvidia.com>
Signed-off-by: Chase Block <cblock@nvidia.com>
9c543f8 to
d76dee1
Compare
|
/ok to test d76dee1 |
Signed-off-by: Chase Block <cblock@nvidia.com>
Head branch was pushed to by a user without write access
|
/ok to test c262d0a |
Signed-off-by: Chase Block <cblock@nvidia.com>
Signed-off-by: Chase Block <cblock@nvidia.com>
| # --- RoPE backward (unchanged: bf16, same rotary_bwd_q_kernel as the unfused path) --- | ||
| dq3 = dq.reshape(tokens, nh, q_head_dim).contiguous() | ||
| grid = lambda META: (tokens, triton.cdiv(nh, META["BLOCK_H"])) | ||
| rotary_bwd_q_kernel[grid]( |
There was a problem hiding this comment.
are there plans to add a backward fusion? If not is there a way to avoid duplicating the backward pass that done here?
There was a problem hiding this comment.
We haven't been considering a backwards fusion as far as I know, but I don't know that there's a better way to deduplicate this code at the moment.
I think this would require heavier changes to TE fully deduplicate this, and I'm not sure that this is worth it at this point.
Enabling this in the future will require either further modifications to the attention interface or reworking how the P2P communication works for CP. Signed-off-by: Chase Block <cblock@nvidia.com>
Signed-off-by: Chase Block <cblock@nvidia.com>
|
/ok to test 7822da3 |
Requires TE PR: NVIDIA/TransformerEngine#3330 Signed-off-by: Chase Block <cblock@nvidia.com>
Head branch was pushed to by a user without write access
Signed-off-by: Chase Block <cblock@nvidia.com>
|
/ok to test 9527108 |
Signed-off-by: Chase Block <cblock@nvidia.com>
Remove the duplicated Megatron autograd and RoPE-backward implementation because Transformer Engine now owns that operation. Keep Megatron responsible for routing and integration, enforce the MXFP8 DPA and zero-dropout contract found during B200 validation, and test the full Megatron-to-TE backward path. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
This commit adds support for fusing the q up proj gemm with the following rope and mxfp8 quantization operations. Relies on the TE functionality from here.
What does this PR do?
Allows us to fuse the DeepseekV3 Q up proj gemm with the succeeding rope and mxfp8 quantization operations, improving training performance.
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.