[Bugfix] Fallback ViT attn backend to SDPA for blackwell (#25851)

Signed-off-by: Roger Wang <hey@rogerw.io>
This commit is contained in:
Roger Wang
2025-09-29 06:03:51 +00:00
committed by GitHub
parent 143844fa43
commit 65ecb4f134
2 changed files with 7 additions and 9 deletions
+6
View File
@@ -205,6 +205,12 @@ class CudaPlatformBase(Platform):
@classmethod
def get_vit_attn_backend(cls, head_size: int,
dtype: torch.dtype) -> _Backend:
# For Blackwell GPUs, force TORCH_SDPA for now.
# See https://github.com/facebookresearch/xformers/issues/1317#issuecomment-3199392579 # noqa: E501
if cls.has_device_capability(100):
return _Backend.TORCH_SDPA
if dtype not in (torch.float16, torch.bfloat16):
return _Backend.XFORMERS