diff --git a/comfy/model_management.py b/comfy/model_management.py index ff963eb8e..980865a77 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -475,13 +475,16 @@ except: SUPPORT_FP8_OPS = args.supports_fp8_compute AMD_RDNA2_AND_OLDER_ARCH = ["gfx1030", "gfx1031", "gfx1035", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"] +# MIOpen fp16 conv kernels segfault on RDNA1/RDNA2 (e.g. gfx1030 with ROCm 6.x), so +# keep MIOpen only on the oldest GCN/Vega archs where it was the previous default. +AMD_MIOPEN_KEEP_ENABLED_ARCH = ("gfx906", "gfx900", "gfx803") AMD_ENABLE_MIOPEN_ENV = 'COMFYUI_ENABLE_MIOPEN' try: if is_amd(): arch = torch.cuda.get_device_properties(get_torch_device()).gcnArchName.split(':')[0] - if not (any((a in arch) for a in AMD_RDNA2_AND_OLDER_ARCH)): - if os.getenv(AMD_ENABLE_MIOPEN_ENV) != '1': + if os.getenv(AMD_ENABLE_MIOPEN_ENV) != '1': + if not any(a in arch for a in AMD_MIOPEN_KEEP_ENABLED_ARCH): torch.backends.cudnn.enabled = False # Seems to improve things a lot on AMD logging.info("Set: torch.backends.cudnn.enabled = False for better AMD performance.")