fix(qwen3.5): keep CUDA dual-stream overlap (regressed by #25885) - #27868
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/tag-and-rerun-ci |
|
I tested this PR on another Qwen3.5-MoE-family workload with the official SGLang benchmark, and the result looks positive. Environment / setup:
Results:
All cases used 10 successful requests and generated the configured output token count. I also compared against a narrower shared-expert-only dual-stream variant; this PR was another ~3.7-4.2% faster in output TPS on the same benchmark, likely from additionally restoring the GDN input-proj and QK-norm alt-stream overlap. One small note: applying the patch locally reported a trailing blank/whitespace warning, so the lint failure may be due to a simple formatting issue. Adding unit coverage for the CUDA alt-stream routing would also make this easier to review, but the performance direction looks correct from this independent run. |
|
/rerun-failed-ci |
| self.alt_stream is not None | ||
| and get_is_capture_mode() | ||
| and _qknorm_use_alt_stream | ||
| and (_is_cuda or _qknorm_use_alt_stream) |
There was a problem hiding this comment.
can you fold _is_cuda to the flag?
for example:
_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 = _is_cuda or (
get_bool_env_var("SGLANG_QK_NORM_ALT_STREAM", "False") and _hip_use_alt_stream
)
Motivation
#25885 ("[AMD] Support alt stream for Qwen3.5 on AMD platform") gated three existing CUDA dual-stream (
alt_stream) overlaps inqwen3_5.pybehind AMD-only conditions:_gdn_use_alt_streamand_qknorm_use_alt_streamboth require_is_hip, and the MLPalt_streamis forced toNoneon the (default) shared-experts-fusion path. These overlaps are therefore silently disabled on all CUDA GPUs (the original code enabled them whenever_is_cuda, with no arch gating), with no env var to re-enable them — regressing Qwen3.5 decode throughput. Hopper (H200) is simply where it was first observed in CI; Blackwell/Ampere are affected too.git bisecton the Qwen3.5-FP8conc4 / isl8192 / osl1024workload (H200, TP8/EP8) identifies7f919ed(#25885) as the first bad commit.Modifications
Preserve the pre-#25885 behavior on CUDA while keeping the new AMD env gating intact:
Qwen3_5GatedDeltaNet._forward_input_proj:and (_is_cuda or _gdn_use_alt_stream)Qwen3_5AttentionDecoderLayer._apply_qk_norm:and (_is_cuda or _qknorm_use_alt_stream)alt_stream:(alt_stream if (_is_cuda or _disable_shared_experts_fusion()) else None)Accuracy Tests
GSM8K via
sglang.test.run_eval --eval-name gsm8k --thinking-mode qwen-3 --max-tokens 16384(chat API + thinking, 1319 examples), Qwen3.5-397B-A17B-FP8 on H200:Within run-to-run variance — the change only re-enables CUDA stream overlap and does not alter the forward computation.
Speed Tests and Profiling
Qwen3.5-397B-A17B-FP8, 8×H200, TP8/EP8, flashinfer attention, random
isl=8192 osl=1024,concurrency=4,--quantization fp8 --kv-cache-dtype fp8_e4m3:~15% decode-throughput recovery, matching the pre-#25885 baseline (verified by checking out the parent commit in the same image).
CI States
Latest PR Test (Base): ✅ Run #27525425492
Latest PR Test (Extra): ❌ Run #27525425339