Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions python/sglang/srt/layers/moe/moe_runner/flashinfer_trtllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,16 +1710,27 @@ def fused_experts_flashinfer_to_flashinfer_trtllm(
use_routed_topk=True,
)
elif isinstance(quant_info, FlashInferTrtllmFp8MoeQuantInfo):
if dispatch_output.hidden_states.dtype != torch.bfloat16:
raise TypeError(
"FlashInfer A2A + TRT-LLM Gen FP8 MoE requires a BF16 "
f"dispatch payload, got {dispatch_output.hidden_states.dtype}."
)
if dispatch_output.hidden_states_scale is not None:
raise ValueError(
"FlashInfer A2A + TRT-LLM Gen FP8 MoE quantizes locally; "
"the BF16 dispatch payload must not carry activation scales."
)
mxfp8_dispatch = (
quant_info.use_mxfp8
and dispatch_output.hidden_states.dtype == torch.float8_e4m3fn
)
if mxfp8_dispatch:
if dispatch_output.hidden_states_scale is None:
raise ValueError(
"FlashInfer A2A + TRT-LLM Gen MXFP8 MoE requires activation "
"scales alongside the FP8 dispatch payload."
)
else:
if dispatch_output.hidden_states.dtype != torch.bfloat16:
raise TypeError(
"FlashInfer A2A + TRT-LLM Gen FP8 MoE requires a BF16 "
f"dispatch payload, got {dispatch_output.hidden_states.dtype}."
)
if dispatch_output.hidden_states_scale is not None:
raise ValueError(
"FlashInfer A2A + TRT-LLM Gen FP8 MoE quantizes locally; "
"the BF16 dispatch payload must not carry activation scales."
)
result = fused_experts_none_to_flashinfer_trtllm_fp8(
dispatch_output,
quant_info,
Expand Down
Loading