@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 1aaecda078
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 13, 14:30 UTC

[XPU] Enable Expert parallel for MoE models (#28263)

Signed-off-by: Yan Ma <yan.ma@intel.com> Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>

Kunshang Ji committed Nov 8, 2025 at 08:33 UTC 1aaecda07809d29e1559791fdb61880d4125c332
3 files changed +6
vllm/model_executor/layers/fused_moe/layer.py
+2
@@ -642,10 +642,12 @@ class UnquantizedFusedMoEMethod(FusedMoEMethodBase, CustomOp):
642 if current_platform.is_xpu():
643 import intel_extension_for_pytorch as ipex
644
645 + ep_rank_start = self.moe.ep_rank * self.moe.num_local_experts
646 layer.ipex_fusion = ipex.llm.modules.GatedMLPMOE(
647 layer.w13_weight,
648 layer.w2_weight,
649 use_prepack=True,
650 + experts_start_id=ep_rank_start,
651 )
652 elif current_platform.is_cpu():
653 from vllm.model_executor.layers.fused_moe import cpu_fused_moe
vllm/model_executor/layers/quantization/ipex_quant.py
+2
@@ -399,6 +399,7 @@ class XPUFp8MoEMethod(FusedMoEMethodBase):
399 layer.w2_weight = torch.nn.Parameter(w2_weight, requires_grad=False)
400 import intel_extension_for_pytorch as ipex
401
402 + ep_rank_start = self.moe.ep_rank * self.moe.num_local_experts
403 layer.ipex_fusion = ipex.llm.modules.GatedMLPMOE(
404 layer.w13_weight,
405 layer.w2_weight,
@@ -407,6 +408,7 @@ class XPUFp8MoEMethod(FusedMoEMethodBase):
408 a1_scale_inv=layer.w13_input_scale,
409 a2_scale_inv=layer.w2_input_scale,
410 use_prepack=True,
411 + experts_start_id=ep_rank_start,
412 )
413
414 def get_fused_moe_quant_config(
vllm/model_executor/layers/quantization/mxfp4.py
+2
@@ -1113,6 +1113,7 @@ class IpexMxfp4MoEMethod(Mxfp4MoEMethod):
1113
1114 layer.w13_weight.data = layer.w13_weight.data.view(torch.int32)
1115 layer.w2_weight.data = layer.w2_weight.data.view(torch.int32)
1116 + ep_rank_start = self.moe_config.ep_rank * self.moe_config.num_local_experts
1117 layer.ipex_fusion = ipex.llm.modules.GatedMLPMOE(
1118 layer.w13_weight,
1119 layer.w2_weight,
@@ -1121,6 +1122,7 @@ class IpexMxfp4MoEMethod(Mxfp4MoEMethod):
1122 w13_bias=layer.w13_bias,
1123 w2_bias=layer.w2_bias,
1124 is_mxfp4=True,
1125 + experts_start_id=ep_rank_start,
1126 )
1127
1128 def apply(