Skip to content

vllm.model_executor.layers.fused_moe.experts.xpu_moe

Classes:

XPUExperts

Bases: LoRAExpertsMixin, FusedMoEExpertsModular

Methods:

_lora_hooks(ctx, hidden_states, w1, w2, topk_weights, topk_ids, expert_map)

Builds XpuFusedMoe hooks that add the LoRA deltas in place.

gemm1_output / act_output / gemm2_output hold one row per (token, topk) pair grouped by expert; row_map gives each pair's row (-1 for skipped pairs), so the LoRA kernels read and accumulate into those rows directly.

initialize_weights(w1, w2, topk, activation, expert_map)

Bind XpuFusedMoe without prepacking; reuse while weight bindings match.

process_weights_after_loading(layer)

Bind XpuFusedMoe and prepack weights in place for this device's GEMM.

XPUExpertsWNA16

Bases: XPUExperts

W4A16 INT4-symmetric MoE backed by xpu_fused_moe(is_int4=True).

Weight layout when is_int4=True (per xpu_fused_moe docstring): w13: [num_experts, 2inter_size, hidden_size] contiguous int4-packed w13_scales: [num_experts, 2inter_size, hidden_size // group_size] w2: [num_experts, hidden_size, inter_size] contiguous int4-packed w2_scales: [num_experts, hidden_size, inter_size // group_size]

Pairs with INCXPULinearMethod for the linear layers; together they cover full-attn + MoE on Intel XPU end-to-end without IPEX.