Skip to content

Commit cc4ddba

Browse files
Allow enabling use of MIOpen by setting COMFYUI_ENABLE_MIOPEN=1 as an env var (#11366)
1 parent 8376ff6 commit cc4ddba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

comfy/model_management.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import platform
2727
import weakref
2828
import gc
29+
import os
2930

3031
class VRAMState(Enum):
3132
DISABLED = 0 #No vram present: no need to move models to vram
@@ -333,13 +334,15 @@ def amd_min_version(device=None, min_rdna_version=0):
333334
SUPPORT_FP8_OPS = args.supports_fp8_compute
334335

335336
AMD_RDNA2_AND_OLDER_ARCH = ["gfx1030", "gfx1031", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"]
337+
AMD_ENABLE_MIOPEN_ENV = 'COMFYUI_ENABLE_MIOPEN'
336338

337339
try:
338340
if is_amd():
339341
arch = torch.cuda.get_device_properties(get_torch_device()).gcnArchName
340342
if not (any((a in arch) for a in AMD_RDNA2_AND_OLDER_ARCH)):
341-
torch.backends.cudnn.enabled = False # Seems to improve things a lot on AMD
342-
logging.info("Set: torch.backends.cudnn.enabled = False for better AMD performance.")
343+
if os.getenv(AMD_ENABLE_MIOPEN_ENV) != '1':
344+
torch.backends.cudnn.enabled = False # Seems to improve things a lot on AMD
345+
logging.info("Set: torch.backends.cudnn.enabled = False for better AMD performance.")
343346

344347
try:
345348
rocm_version = tuple(map(int, str(torch.version.hip).split(".")[:2]))

0 commit comments

Comments
 (0)