From 954644ef8315267168a5ba0ed7dde44ae496e055 Mon Sep 17 00:00:00 2001 From: Christopher Anderson Date: Mon, 25 Aug 2025 08:56:48 +1000 Subject: [PATCH] Added env var TORCH_BACKENDS_CUDNN_ENABLED, defaults to 1. --- comfy/customzluda/zluda.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/comfy/customzluda/zluda.py b/comfy/customzluda/zluda.py index ff73a0b5b..cd87323b6 100644 --- a/comfy/customzluda/zluda.py +++ b/comfy/customzluda/zluda.py @@ -652,7 +652,11 @@ def do_hijack(): print(" :: Configuring PyTorch backends...") torch.backends.cuda.enable_mem_efficient_sdp(False) torch.backends.cuda.enable_mem_efficient_sdp = do_nothing - torch.backends.cudnn.enabled = True + torch.backends.cudnn.enabled = os.environ.get("TORCH_BACKENDS_CUDNN_ENABLED", "1").strip().lower() not in {"0", "off", "false", "disable", "disabled", "no"} + if torch.backends.cudnn.enabled: + print(" :: Enabled cuDNN") + else: + print(" :: Disabled cuDNN") if hasattr(torch.backends.cuda, "enable_flash_sdp"): torch.backends.cuda.enable_flash_sdp(True) print(" :: Disabled CUDA flash attention")