Use FP32 logits in MoEGate fallbacks (#30323)

This commit is contained in:
Mohammad Miadh Angkad
2026-07-08 23:43:45 +08:00
committed by GitHub
parent b8ca06fdad
commit 04e4fadff3
+5 -1
View File
@@ -490,7 +490,11 @@ class MoEGate(nn.Module):
or mla_use_prefill_cp(forward_batch, self.mla_enable_prefill_cp)
)
):
logits = F.linear(hidden_states, self.weight, None)
if _is_cuda:
from sglang.jit_kernel.dsv4 import linear_bf16_fp32
return linear_bf16_fp32(hidden_states, self.weight)
return F.linear(hidden_states, self.weight, None)
else:
# NOTE(b8zhong): this threshold has been empirically verified
max_router_gemm_tokens = 4 if _device_sm in (100, 103) else 16