The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Allow enabling use of MIOpen by setting COMFYUI_ENABLE_MIOPEN=1 as an env var (#11366)
BradPepersAMDcc4ddba1b68a
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex 40717b1e4..1889ab0ac 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -26,6 +26,7 @@ import importlibimport platformimport weakrefimport gc+import osclass VRAMState(Enum):DISABLED = 0 #No vram present: no need to move models to vram@@ -333,13 +334,15 @@ except:SUPPORT_FP8_OPS = args.supports_fp8_computeAMD_RDNA2_AND_OLDER_ARCH = ["gfx1030", "gfx1031", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"]+AMD_ENABLE_MIOPEN_ENV = 'COMFYUI_ENABLE_MIOPEN'try:if is_amd():arch = torch.cuda.get_device_properties(get_torch_device()).gcnArchNameif not (any((a in arch) for a in AMD_RDNA2_AND_OLDER_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.")+ if os.getenv(AMD_ENABLE_MIOPEN_ENV) != '1':+ 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.")try:rocm_version = tuple(map(int, str(torch.version.hip).split(".")[:2]))