From a0a76e44851879bcc2055a61505172c2bab5c361 Mon Sep 17 00:00:00 2001 From: Kaixi Date: Tue, 11 Aug 2026 14:10:19 +0200 Subject: [PATCH] [DSV4] perf: Enable alt stream during BCG prefill (#29070) Co-authored-by: github-actions[bot] Co-authored-by: Claude Fable 5 Co-authored-by: Brayden Zhong --- python/sglang/srt/models/deepseek_v4.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/models/deepseek_v4.py b/python/sglang/srt/models/deepseek_v4.py index 0c45035b6..292aa5bfe 100644 --- a/python/sglang/srt/models/deepseek_v4.py +++ b/python/sglang/srt/models/deepseek_v4.py @@ -1262,7 +1262,10 @@ class MQALayer(MqaAttentionBase): envs.SGLANG_OPT_USE_MULTI_STREAM_OVERLAP.get() and self.alt_streams is not None and get_is_capture_mode() - and x.shape[0] <= self._multi_stream_bs_limit + and ( + is_in_breakable_cuda_graph() + or x.shape[0] <= self._multi_stream_bs_limit + ) and not (self.dsa_enable_prefill_cp and dsa_use_prefill_cp(forward_batch)) and not (_is_hip and self.compressor is None) )