mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #183] [Feat] Single Batch Overlap (SBO): Overlaping of Down GEMM with Combine Send #282
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#282
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?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/183
Author: @Sulfur6
Created: 9/2/2025
Status: 🔄 Open
Base:
main← Head:sbo.v2.public📝 Commits (10+)
9ac3853feat: add signal gemm api for SBO (Single Batch Overlap).79b5a45feat: add launch config args for coorperative groups.6cf6ca1feat: add signal gemm impl&runtime in jit kernels.1e2c135feat: add signal gemm kernel.a5d23b0feat: add signal gemm import in deep_gemm package.48c741afeat: add test for signal gemm.9a2d3e5feat: add signal threshold as a config arg for signal gemm.03f61d2add comparation test.e86f1f9avoid using bench kinetoe7ebff1test: modify generators to fit bs32 down gemm.📊 Changes
8 files changed (+106 additions, -31 deletions)
View changed files
📝
csrc/apis/gemm.hpp(+19 -5)📝
csrc/jit_kernels/heuristics/common.hpp(+9 -3)📝
csrc/jit_kernels/impls/sm90_fp8_gemm_1d2d.hpp(+17 -9)📝
deep_gemm/include/deep_gemm/common/utils.cuh(+10 -0)📝
deep_gemm/include/deep_gemm/impls/sm90_fp8_gemm_1d2d.cuh(+14 -2)📝
deep_gemm/testing/numeric.py(+14 -0)📝
tests/generators.py(+10 -5)📝
tests/test_fp8.py(+13 -7)📄 Description
1. Motivation
The optimization effect of Two-Batch Overlap (TBO) is suboptimal for the Decode phase on low-compute-power cards (i.e., H20). This is due to two main factors: First, on the Hopper architecture, the WGMMA block_m is 64. Consequently, when TBO is enabled with a small Decode batch size, the MLP GEMM suffers from redundant computations. A positive throughput gain is only observed at larger batch sizes (e.g., 64, 128). Second, at these larger batch sizes, low-compute-power cards like the H20 fail to meet the SLA guarantees for TPOT/ITL.
Therefore, it is necessary to find a solution that can improve Decode throughput even with small batch sizes. Single Batch Overlap (SBO) presents itself as a viable solution.
We implement SBO for DeepSeek v3/R1 by modifying DeepEP and DeepGEMM, including the overlap of Shared Expert and Dispatch Recv, as well as the overlap of Down GEMM with Combine Send.
The overlap of Down GEMM with Combine Send is implemented by modifying SGlang, DeepEP and DeepGEMM, with the detailed implementation available in the PRs below:
We also conducted integration and evaluation in SGLang: https://github.com/sgl-project/sglang/pull/9660.
Since the latest version of SGLang depends on the branch https://github.com/sgl-project/DeepGEMM/tree/sgl, you should not use this branch when starting SGLang. Instead, you should use the branch developed based on the sgl branch https://github.com/Sulfur6/DeepGEMM/tree/sbo.v2.sgl.
2. Overlap Design
SBO implements two overlap for the MoE layers of DeepSeek-V3/R1. One is to overlap the Shared Expert computation with the Dispatch Recv communication, and the other is to overlap the Down GEMM computation with the Combine Send communication.


The interaction between Down GEMM and Combine Send is structured as a producer-consumer model synchronized by signals. For each local expert, a signal unit is allocated for every block_m tokens. The Down GEMM computes the results for these block_m tokens and atomically increments the signaling unit after completing a portion of the work. The Combine Send polls this signaling unit. Once the value reaches a threshold, it sends the corresponding block_m tokens.
3. Modifications
m_grouped_fp8_gemm_nt_signalPython interface to support overlapping Down GEMM with Combine Send.SM90FP8SignalGemm1D2DRuntimeandsm90_m_grouped_fp8_gemm_signal_1d2dto support Signal Down GEMM in SM90.sm90_fp8_signal_gemm_1d2d_implkernel usesatomicAddto write signal after the corresponding block_m tokens are computed.4. Evaluation
We integrated the modified DeepEP and DeepGEMM into SGLang for performance evaluation.
4.1. Experiment Setup
4.2. Performance Evaluation
4.3. Accuracy Tests
4.4. Repro Script
Please refer to https://github.com/sgl-project/sglang/pull/9660.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.