[Bug] Guard FlashInfer CUTLASS MoE against 0-token inputs (#38780)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Xiaoyu Zhang <1182563586@qq.com>
This commit is contained in:
Xiaojia Wu
2026-09-18 11:03:27 +08:00
committed by GitHub
co-authored by Cursor Xiaoyu Zhang
parent f447bb7080
commit 826d5170ae
@@ -346,9 +346,12 @@ def _fused_experts_flashinfer_mxfp4_cutlass(
from sglang.srt.layers.moe.token_dispatcher.standard import StandardCombineInput
from sglang.srt.layers.moe.topk import TopKOutputChecker
x = dispatch_output.hidden_states
if x.shape[0] == 0:
return StandardCombineInput(hidden_states=x)
flashinfer_cutlass_fused_moe, ActivationType = _flashinfer_cutlass_fused_moe()
x = dispatch_output.hidden_states
topk_output = dispatch_output.topk_output
# Under ``--moe-runner-backend flashinfer_mxfp4`` topk may be in bypassed