From 4f59a8dcfa04ec0b261a5fbc4fe168772ac9f639 Mon Sep 17 00:00:00 2001 From: Bingxu Chen Date: Thu, 27 Aug 2026 09:52:15 +0800 Subject: [PATCH] [AMD][Bugfix] Skip invalid fused MoE reduction for direct top-1 output (#36309) --- .../srt/layers/moe/moe_runner/triton_utils/fused_moe.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/layers/moe/moe_runner/triton_utils/fused_moe.py b/python/sglang/srt/layers/moe/moe_runner/triton_utils/fused_moe.py index 8cc0f4ff7..546f79b58 100644 --- a/python/sglang/srt/layers/moe/moe_runner/triton_utils/fused_moe.py +++ b/python/sglang/srt/layers/moe/moe_runner/triton_utils/fused_moe.py @@ -908,7 +908,9 @@ def _fused_moe_kernel_sequence( routed_scaling_factor, ) elif _is_hip: - if _use_aiter: + if topk == 1 and routed_scaling_factor == 1.0 and not _use_intermediate: + pass # we wrote directly into out_hidden_states + elif _use_aiter: moe_sum( intermediate_cache3.view(*intermediate_cache3.shape), out_hidden_states,