From a4905133f375ec721be441e7ec4a3f923daa28f3 Mon Sep 17 00:00:00 2001 From: Hank_ <37239608+ILikeIneine@users.noreply.github.com> Date: Wed, 22 Apr 2026 19:39:40 +0800 Subject: [PATCH] [xpu][rocm] Update `current_platform.supports_fp8()` for TritonExperts (#40132) Signed-off-by: Hank --- .../layers/fused_moe/fused_moe.py | 19 +------------------ vllm/platforms/rocm.py | 2 +- vllm/platforms/xpu.py | 4 ++++ 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/vllm/model_executor/layers/fused_moe/fused_moe.py b/vllm/model_executor/layers/fused_moe/fused_moe.py index 9218d0aff7..3b12f29493 100644 --- a/vllm/model_executor/layers/fused_moe/fused_moe.py +++ b/vllm/model_executor/layers/fused_moe/fused_moe.py @@ -1952,24 +1952,7 @@ class TritonExperts(mk.FusedMoEExpertsModular): weight_key: QuantKey | None, activation_key: QuantKey | None, ) -> bool: - p = current_platform - if p.is_rocm(): - from vllm.platforms.rocm import on_gfx9, on_gfx12x - - is_rocm_on_gfx9 = on_gfx9() - is_rocm_on_gfx12x = on_gfx12x() - else: - is_rocm_on_gfx9 = False - is_rocm_on_gfx12x = False - - device_supports_fp8 = ( - is_rocm_on_gfx9 - or is_rocm_on_gfx12x - or (p.is_cuda() and p.has_device_capability((8, 9))) - or p.is_xpu() - ) - - if not device_supports_fp8: + if not current_platform.supports_fp8(): return (weight_key, activation_key) == (None, None) SUPPORTED_W_A = [ diff --git a/vllm/platforms/rocm.py b/vllm/platforms/rocm.py index 89714f00f6..0801c85242 100644 --- a/vllm/platforms/rocm.py +++ b/vllm/platforms/rocm.py @@ -800,7 +800,7 @@ class RocmPlatform(Platform): @classmethod def supports_fp8(cls) -> bool: - return any(gfx in _GCN_ARCH for gfx in ["gfx94", "gfx95", "gfx12"]) + return on_gfx9() or on_gfx12x() @classmethod def is_fp8_fnuz(cls) -> bool: diff --git a/vllm/platforms/xpu.py b/vllm/platforms/xpu.py index aa67341973..d52ba23243 100644 --- a/vllm/platforms/xpu.py +++ b/vllm/platforms/xpu.py @@ -323,6 +323,10 @@ class XPUPlatform(Platform): ) return "vllm.distributed.device_communicators.xpu_communicator.XpuCommunicator" # noqa + @classmethod + def supports_fp8(cls) -> bool: + return True + @classmethod def get_default_ir_op_priority( cls, vllm_config: "VllmConfig"