This commit is contained in:
philippthiele 2026-08-15 19:34:57 -04:00 committed by GitHub
commit c23c127d08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -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.")