From d5899b95c4d54db58d5412b9ce0cc487b212d9a0 Mon Sep 17 00:00:00 2001 From: YAMY <74099316+YAMY1234@users.noreply.github.com> Date: Mon, 15 Jun 2026 06:44:21 -0700 Subject: [PATCH] fix(qwen3.5): keep CUDA dual-stream overlap (regressed by #25885) (#27868) --- python/sglang/srt/models/qwen3_5.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/python/sglang/srt/models/qwen3_5.py b/python/sglang/srt/models/qwen3_5.py index de3af00e1..e8648b4b0 100644 --- a/python/sglang/srt/models/qwen3_5.py +++ b/python/sglang/srt/models/qwen3_5.py @@ -119,10 +119,10 @@ _is_gfx95 = is_gfx95_supported() _is_hip = is_hip() _use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip _hip_use_alt_stream = get_bool_env_var("SGLANG_ALT_STREAM") and _is_hip -_gdn_use_alt_stream = ( +_gdn_use_alt_stream = _is_cuda or ( get_bool_env_var("SGLANG_GDN_QKVZ_BA_ALT_STREAM", "False") and _hip_use_alt_stream ) -_qknorm_use_alt_stream = ( +_qknorm_use_alt_stream = _is_cuda or ( get_bool_env_var("SGLANG_QK_NORM_ALT_STREAM", "False") and _hip_use_alt_stream ) _is_amx_available = cpu_has_amx_support() @@ -594,7 +594,11 @@ class Qwen3_5LinearDecoderLayer(nn.Module): layer_id=layer_id, config=config, quant_config=quant_config, - alt_stream=(alt_stream if _disable_shared_experts_fusion() else None), + alt_stream=( + alt_stream + if (_is_cuda or _disable_shared_experts_fusion()) + else None + ), prefix=add_prefix("mlp", prefix.replace(".linear_attn", "")), is_nextn=is_nextn, support_shared_expert_fusion=not _disable_shared_experts_fusion(), @@ -806,7 +810,11 @@ class Qwen3_5AttentionDecoderLayer(nn.Module): layer_id=layer_id, config=config, quant_config=quant_config, - alt_stream=(alt_stream if _disable_shared_experts_fusion() else None), + alt_stream=( + alt_stream + if (_is_cuda or _disable_shared_experts_fusion()) + else None + ), prefix=add_prefix("mlp", prefix.replace(".self_attn", "")), is_nextn=is_nextn, support_shared_expert_fusion=not _disable_shared_experts_fusion(),