mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #370] Incompatibility between DeepEP V2 ElasticBuffer non-expanded output and DeepGEMM masked/contiguous grouped GEMM input format #178
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#178
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @litiantian00 on GitHub (Jul 1, 2026).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/370
Incompatibility between DeepEP V2 ElasticBuffer non-expanded output and DeepGEMM masked/contiguous grouped GEMM input format
Problem Summary
We are integrating DeepEP V2 ElasticBuffer with DeepGEMM for sglang's MoE dispatch/combine pipeline.
DeepEP V2's
ElasticBuffer.dispatch()API returns two formats:do_expand=False(non-expanded/deduplicated): Returns[num_recv_tokens, H]2D unsorted flat tensor +recv_topk_idx [N, topk](which experts each token was routed to)do_expand=True(expanded): Returns[num_expanded_tokens, H]2D flat tensor, already sorted by expert with expert-alignment paddingHowever, DeepGEMM's two grouped-GEMM variants have conflicting input format requirements:
[E_local, expected_m, K](3D)masked_m[e][M, K](2D)m_indices[m]tells which expert each row belongs toThe Core Issue
DeepEP V2
do_expand=Falseoutput matches neither format directly:[N, H](not sorted by expert, unlike contiguous GEMM)recv_topk_idx [N, topk]tensor rather than being implicit in layoutIn contrast, the
do_expand=Trueoutput is directly compatible with contiguous GEMM (already sorted by expert, just need to extractm_indicesfrompsum_per_expert).Our Configuration
We are adapting DeepEP V2 for sglang with the following setup:
do_expand=True→ contiguous GEMM (zero-copy, works well)do_expand=False→ masked GEMM (requires format conversion kernels)The decode path is where the format mismatch creates a problem:
do_expand=Falseis necessary for CUDA Graph compatibility, but its output does not directly map to either DeepGEMM variant without intermediate conversion kernels.Questions for DeepGEMM Team
We would like to inquire whether there are any plans to provide a third DeepGEMM variant that natively supports the DeepEP V2 non-expanded output format, or if there are recommended solutions to efficiently bridge this format mismatch.
Specifically:
topk_idxandtopk_weightsmetadata?Any guidance would help us determine the best path forward for production deployment.