From 02564b4de069a02d9f6abca57ebfd49115eaae39 Mon Sep 17 00:00:00 2001 From: Yan Ma Date: Wed, 3 Jun 2026 18:20:21 +0800 Subject: [PATCH] [XPU]fallback to TRITON_ATTN for vit attn on xpu when use float32 dtype (#43759) Signed-off-by: Yan Ma Co-authored-by: Kunshang Ji --- vllm/platforms/xpu.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vllm/platforms/xpu.py b/vllm/platforms/xpu.py index f8b5c35a156..5947bff9b08 100644 --- a/vllm/platforms/xpu.py +++ b/vllm/platforms/xpu.py @@ -110,6 +110,13 @@ class XPUPlatform(Platform): dtype: torch.dtype, backend: "AttentionBackendEnum | None" = None, ) -> "AttentionBackendEnum": + if dtype == torch.float32: + logger.warning_once( + "Flash Attention on XPU does not support float32 dtype. " + "Falling back to Triton Attention backend for vit attention." + ) + return AttentionBackendEnum.TRITON_ATTN + if backend is not None: assert backend in cls.get_supported_vit_attn_backends(), ( f"Backend {backend} is not supported for vit attention. "