You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sm_120 arch forces SDPA attention, even with functional xformers #4631
if HAS_FLASH_ATTENTION:
from flash_attn import flash_attn_func, flash_attn_varlen_func
HAS_XFORMERS = xformers is not None
#xformers kernels (FA3, FA2, cutlass) only support compute capability <= 9.0.
#Disable xformers on newer GPUs (e.g. RTX 5070 Ti / sm_120) and fall back to SDPA.
if HAS_XFORMERS and torch.cuda.is_available():
_cc = torch.cuda.get_device_capability()
if _cc[0] >= 12:
HAS_XFORMERS = False
Even without FA3, FA2, or cutlass, xformers still gives an over 50% VRAM savings over SDPA.
You can replace that code block with the following if you have a functional xformers build. Remove the debug print if you'd like.
if HAS_FLASH_ATTENTION:
from flash_attn import flash_attn_func, flash_attn_varlen_func
HAS_XFORMERS = xformers is not None
# TEMP DEBUG: do not disable xformers on cc >= 12
if HAS_XFORMERS and torch.cuda.is_available():
_cc = torch.cuda.get_device_capability()
print("[ATTN_DEBUG] compute capability =", _cc, "keeping HAS_XFORMERS =", HAS_XFORMERS)
Activity
Say when xFormers is installed but its kernels cannot load (#8157)