From 6b4872240f72bce225f1f3106d1669245345e958 Mon Sep 17 00:00:00 2001 From: Qiming Zhang Date: Fri, 3 Apr 2026 07:10:02 -0700 Subject: [PATCH] [XPU] bump up xpu-kernel v0.1.5, transpose moe weights (#38342) Signed-off-by: mayuyuace Signed-off-by: Qiming Zhang Signed-off-by: Kunshang Ji Co-authored-by: Kunshang Ji --- requirements/xpu.txt | 2 +- .../layers/fused_moe/unquantized_fused_moe_method.py | 12 ++++++++++++ vllm/model_executor/layers/quantization/fp8.py | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/requirements/xpu.txt b/requirements/xpu.txt index 0cddd6dc6a..26ba38f3ef 100644 --- a/requirements/xpu.txt +++ b/requirements/xpu.txt @@ -15,4 +15,4 @@ torch==2.10.0+xpu torchaudio torchvision -vllm_xpu_kernels @ https://github.com/vllm-project/vllm-xpu-kernels/releases/download/v0.1.4/vllm_xpu_kernels-0.1.4-cp38-abi3-manylinux_2_28_x86_64.whl +vllm_xpu_kernels @ https://github.com/vllm-project/vllm-xpu-kernels/releases/download/v0.1.5/vllm_xpu_kernels-0.1.5-cp38-abi3-manylinux_2_28_x86_64.whl diff --git a/vllm/model_executor/layers/fused_moe/unquantized_fused_moe_method.py b/vllm/model_executor/layers/fused_moe/unquantized_fused_moe_method.py index f0d7998244..759f77b365 100644 --- a/vllm/model_executor/layers/fused_moe/unquantized_fused_moe_method.py +++ b/vllm/model_executor/layers/fused_moe/unquantized_fused_moe_method.py @@ -222,6 +222,18 @@ class UnquantizedFusedMoEMethod(FusedMoEMethodBase, CustomOp): self.cpu_fused_moe = cpu_fused_moe.CPUFusedMOE(layer) else: self.cpu_fused_moe = cpu_fused_moe.CPUFusedMOE(layer) + elif current_platform.is_xpu(): + w13 = layer.w13_weight + w2 = layer.w2_weight + + w13.data = w13.transpose(-1, -2).contiguous() + w2.data = w2.transpose(-1, -2).contiguous() + + self._setup_kernel( + layer=layer, + w13=w13, + w2=w2, + ) else: self._setup_kernel( layer=layer, diff --git a/vllm/model_executor/layers/quantization/fp8.py b/vllm/model_executor/layers/quantization/fp8.py index 965e1af72e..259a7d1f6c 100644 --- a/vllm/model_executor/layers/quantization/fp8.py +++ b/vllm/model_executor/layers/quantization/fp8.py @@ -1028,6 +1028,10 @@ class Fp8OnlineMoEMethod(Fp8MoEMethod): layer.w2_weight[expert, :, :] ) + if current_platform.is_xpu(): + w13.data = w13.transpose(-1, -2).contiguous() + w2.data = w2.transpose(-1, -2).contiguous() + # Shuffle weights to runtime format and setup kernel. self._setup_kernel( layer,