[AMD] Support alt stream for Qwen3.5 on AMD platform - #25885
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the SGLANG_HIP_ALT_STREAM environment variable to enable alternative stream support on HIP platforms and adds a configuration check for SGLANG_QK_NORM_ALT_STREAM during Q/K normalization. The review feedback suggests caching the SGLANG_QK_NORM_ALT_STREAM environment variable at the module level to avoid redundant lookups in the performance-sensitive _apply_qk_norm method.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@At1a8 You can refer to this merged PR and this comment. |
|
/tag-and-rerun-ci |
Hi @hubertlu-tw, just add some experiments and analysis in this page. I found alt streams can currently provide performance improvements. CC: @HaiShaw |
|
@At1a8 could you please clarify what
If we have perf numbers for low concurrency and high concurrency, it would be great. |
Hi @hubertlu-tw, this results based on max_concurrency/num_prompts=1, will add more experiment data for larger concurrency later. |
Hi @hubertlu-tw, I have added more cases with larger concurrency (concurrency from 1 to 128, TP8 && TP8EP8), but overall the conclusion is basically consistent with that under low concurrency, i.e., |
|
cc: @mqhc2020 |
|
Running on Qwen3.5 397B MXFP4, which disables shared expert fusion: (1k,1k) — full sweep cc=4..256
Baseline reference (1k,1k): cc4 344.7 / cc256 4014.9 tok/s. (8k,1k) — matched cc=4..64
|
|
@amd-bot ci-status |
CI Status for PR #25885PR: [AMD] Support alt stream for Qwen3.5 on AMD platform AMD: 2 failures (0 likely related) | Others: 7 failures (1 likely related) AMD CI Failures
Other CI Failures
Details🔴 base-a-test-cpu (3) — The PR adds these module-level statements to _disable_shared_experts_fusion = get_global_server_args().disable_shared_experts_fusion
_hip_use_alt_stream = get_bool_env_var("SGLANG_ALT_STREAM") and _is_hip
_gdn_use_alt_stream = (
get_bool_env_var("SGLANG_GDN_QKVZ_BA_ALT_STREAM", "False") and _hip_use_alt_stream
)
_qknorm_use_alt_stream = (
get_bool_env_var("SGLANG_QK_NORM_ALT_STREAM", "False") and _hip_use_alt_stream
)The unit test Stack trace from the log: Suggested fix direction (you decide): read Other failures: all 8 remaining failures are either downstream aggregator/wait jobs cascading from the one real failure (or from the missing
|
|
@At1a8 would you please take a look at the possible CI failure? |
I have fixed this issue by lazy import/init this variable, CI passed at my side |
|
@amd-bot ci-status |

Motivation
SGLANG_ALT_STREAMflagSGLANG_QK_NORM_ALT_STREAMflag to disable qknorm alt stream, becausefused_qk_gemma_rmsnormcould be more effcient than alt stream in AMD platform. On the other device like Nvidia platform, q&k will continue use alt stream path based on default value ofSGLANG_QK_NORM_ALT_STREAMdisable_shared_experts_fusionflag to control it.SGLANG_GDN_QKVZ_BA_ALT_STREAMto disable it when enable alt streamModifications
_hip_use_alt_stream&_is_hipflag)MOE: Using server argsdisable_shared_experts_fusion, it set as false by default. When enable _shared_expert_fusion, sglang will calculatenum_fused_shared_expertsand disable moe alt_stream. Otherwise, will use alt stream to execute shared experts and routed experts at different stream.QKVZ & BA in GDN: UseSGLANG_GDN_QKVZ_BA_ALT_STREAMto control if QKVZBA need use alt stream, the flag set as false by default, cause it make perf regression.QK NORM: UseSGLANG_QK_NORM_ALT_STREAMto control if qknorm need use alt stream, the flag set as false by default, cause it make perf regression.Accuracy Tests
root@smci355-ccs-aus-n12-13:/mnt/raid0/fangyuan/qwen3.5# bash client.sh
100%|████████████████████████████████████████████████████████████████████████████| 200/200 [00:37<00:00, 5.39it/s]
Accuracy: 0.955
Invalid: 0.000
Latency: 37.119 s
Output throughput: 888.580 token/s
Speed Tests and Profiling
The results based on Qwen3.5-397B-A17B-FP8 @ MI355X , I/O=8k/1k
True, SGLANG_ALT_STREAM=FalseFalse, SGLANG_ALT_STREAM=FalseTrue, SGLANG_ALT_STREAM=TrueFalse, SGLANG_ALT_STREAM=TrueMore results based on Qwen3.5-397B-A17B-FP8 @ MI355X , I/O=8k/1k with higher concurrency(TP8 and TP8EP8)
It's very similar to what we see in small concurrency.
Therefore, alt streams can currently provide performance improvements.
However, the gains in the MoE component are not as significant as those from shared expert fusion, and they also introduce performance regressions in QKNorm and GDN.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #26988695592
Latest PR Test (Extra): ❌ Run #26988695503