[XPU]fallback to TRITON_ATTN for vit attn on xpu when use float32 dtype (#43759)

Signed-off-by: Yan Ma <yan.ma@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
Yan Ma
2026-06-03 18:20:21 +08:00
committed by GitHub
parent 209709a8c1
commit 02564b4de0
+7
View File
@@ -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. "