@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 595562651a
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 4, 22:30 UTC

[XPU] fix MoE triton backend in online fp8 quantization (#40109)

Signed-off-by: Yan Ma <yan.ma@intel.com>

Yan Ma committed Apr 20, 2026 at 23:31 UTC 595562651a5a4539ffa910d8570c08fb5169bdc9
3 files changed +13 -4
vllm/model_executor/layers/fused_moe/oracle/fp8.py
+6
@@ -471,6 +471,12 @@ def convert_to_fp8_moe_kernel_format(
471 w2_input_scale=w2_input_scale,
472 is_trtllm=(fp8_backend == Fp8MoeBackend.FLASHINFER_TRTLLM),
473 )
474 + elif fp8_backend == Fp8MoeBackend.XPU:
475 + from vllm.model_executor.layers.fused_moe.xpu_fused_moe import (
476 + prepare_fp8_moe_layer_for_xpu,
477 + )
478 +
479 + w13, w2 = prepare_fp8_moe_layer_for_xpu(w13, w2)
480 else:
481 if fp8_backend not in [
482 Fp8MoeBackend.TRITON,
vllm/model_executor/layers/fused_moe/xpu_fused_moe.py
+7
@@ -24,6 +24,13 @@ if current_platform.is_xpu():
24 from vllm_xpu_kernels.fused_moe_interface import xpu_fused_moe
25
26
27 +def prepare_fp8_moe_layer_for_xpu(
28 + w13: torch.Tensor,
29 + w2: torch.Tensor,
30 +) -> tuple[torch.Tensor, torch.Tensor]:
31 + return w13.transpose(-1, -2).contiguous(), w2.transpose(-1, -2).contiguous()
32 +
33 +
34 class XPUExperts(mk.FusedMoEExpertsModular):
35 def __init__(
36 self,
vllm/model_executor/layers/quantization/fp8.py
-4
@@ -1019,10 +1019,6 @@ class Fp8OnlineMoEMethod(Fp8MoEMethod):
1019 layer.w2_weight[expert, :, :]
1020 )
1021
1022 - if current_platform.is_xpu():
1023 - w13.data = w13.transpose(-1, -2).contiguous()
1024 - w2.data = w2.transpose(-1, -2).contiguous()
1025 -
1022 # Shuffle weights to runtime format and setup kernel.
1023 self._setup_kernel(
1024 layer,