ROCm enable Dynamic atten only for RDNA2 and older GPUs

This commit is contained in:
Disty0
2025-11-08 22:53:26 +03:00
parent 31f09cf266
commit 93797dff8e
+9 -6
View File
@@ -39,15 +39,18 @@ def get_default_modes(cmd_opts, mem_stat):
default_diffusers_offload_min_gpu_memory = 0
default_cross_attention = "Scaled-Dot-Product"
default_sdp_options = ['Flash', 'Memory', 'Math']
default_sdp_override_options = []
if devices.backend == "zluda":
default_sdp_options = ['Math attention', 'Dynamic attention']
elif devices.backend in {"rocm", "directml", "cpu", "mps"}:
default_sdp_options = ['Flash', 'Memory', 'Math']
default_sdp_options = ['Math']
default_sdp_override_options = ['Dynamic attention']
if devices.backend == "rocm":
import torch
if int(getattr(torch.cuda.get_device_properties(devices.device), "gcnArchName", "gfx0000")[3:]) < 1100:
default_sdp_override_options = ['Dynamic attention'] # only RDNA2 and older GPUs needs this
elif devices.backend in {"directml", "cpu", "mps"}:
default_sdp_override_options = ['Dynamic attention']
else:
default_sdp_options = ['Flash', 'Memory', 'Math']
default_sdp_choices = ['Flash', 'Memory', 'Math']
default_sdp_override_choices = ['Dynamic attention', 'CK Flash attention', 'Triton Flash attention', 'Sage attention']