[Main] Support device-init grouped linear module too with when not using TE opfuser - #6000
[Main] Support device-init grouped linear module too with when not using TE opfuser#6000zhongbozhu wants to merge 7 commits into
Conversation
7294e71 to
1f4a49e
Compare
944cb4e to
a78c12b
Compare
|
/ok to test 1f647e6 |
| ) | ||
|
|
||
| @staticmethod | ||
| def _apply_packed_bias(intermediate_parallel, packed_bias, tokens_per_expert, permuted_probs): |
There was a problem hiding this comment.
Note: only models with routed expert bias will use this
|
/ok to test d5c9aed |
d6d76b2 to
f921404
Compare
|
/ok to test f921404 |
YangFei1990
left a comment
There was a problem hiding this comment.
Just for my understanding, mcore will pass moe_use_grouped_tensor / use_transformer_engine_op_fuser into TE, but it is TE's responsibility to pick the groupgemm backend, which is depending on hardware/dtype/envs, so it might not necessarily follow what exactly provided by mcore, is that right?
| # Some dispatchers have already padded each expert's token segment before the tokens | ||
| # reach this module: | ||
| # * router padding changes the routing map before dispatch; | ||
| # * HybridEP pads as part of its fused dispatch/permute operation; |
| # The token buffer may already contain per-expert padding when padding was performed | ||
| # before expert compute: | ||
| # * router padding modified the routing map before dispatch; | ||
| # * HybridEP fused padding into dispatch/permute; |
| assert torch.isfinite(hidden_states.grad).all() | ||
|
|
||
|
|
||
| class TestGroupedTensorDispatcherNumerics: |
There was a problem hiding this comment.
Could we also add test cases for NCCL EP?
If we have single weight, then fallback is banned. If we have discrete weight plus that certain recipes don't have fully implemented grouped kernels, it will fallback to CPU based m_split and launch multistream gemms. |
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
f921404 to
c542386
Compare
|
/ok to test c542386 |
What does this PR do?
Proper single weight support, discrete weight is not affected. Adds many numerical unit tests running on GB200.
Unit testing:
Note: some tests can only run with TE updated (NVIDIA/TransformerEngine#3224), for CI image, it should just pass without causing errors.
E2E testing:
Model - Qwen3.5 VL SFT
Dispatcher - HybridEP
Experiements - bf16 cublas grouped gemm [single weight ON/OFF] vs. cuteDSL with TE op fuser mxfp8 [single weight ON/OFF] vs mxfp8 cublas grouped gemm [single weight ON/OFF]
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.