feat: add basic zluda support

This commit is contained in:
LeagueRaINi 2024-02-18 19:45:01 +01:00
parent dccca1daa5
commit daeabb3fdb
2 changed files with 21 additions and 2 deletions

View File

@ -254,7 +254,24 @@ def get_torch_device_name(device):
return "CUDA {}: {}".format(device, torch.cuda.get_device_name(device))
try:
print("Device:", get_torch_device_name(get_torch_device()))
torch_device_name = get_torch_device_name(get_torch_device())
if "[ZLUDA]" in torch_device_name:
print("Detected ZLUDA, support for it is experimental and comfy may not work properly.")
if torch.backends.cudnn.enabled:
torch.backends.cudnn.enabled = False
print("Disabling cuDNN because ZLUDA does currently not support it.")
torch.backends.cuda.enable_flash_sdp(True)
torch.backends.cuda.enable_math_sdp(False)
torch.backends.cuda.enable_mem_efficient_sdp(False)
if ENABLE_PYTORCH_ATTENTION:
print("Disabling pytorch cross attention because ZLUDA does currently not support it.")
ENABLE_PYTORCH_ATTENTION = False
print("Device:", torch_device_name)
except:
print("Could not pick default device.")

View File

@ -50,7 +50,9 @@ def cuda_malloc_supported():
except:
names = set()
for x in names:
if "NVIDIA" in x:
if "AMD" in x:
return False
elif "NVIDIA" in x:
for b in blacklist:
if b in x:
return False