cuDNN Toggle (AMD-aware)
The cuDNN switch AMD owners are flipping to make VAE decode fast
- any_input
- any_output
- prev_cudnn
If you run ComfyUI on AMD, you've probably seen the forum post that goes "just disable cuDNN and your VAE decode gets faster." Sound like voodoo? It kind of is - but it's real, and this node is the cleanest way to do it. cuDNN Toggle (AMD-aware) flips torch.backends.cudnn.enabled off around the exact parts of your graph you tell it to, and it only touches anything when it detects an AMD/ROCm/HIP or ZLUDA setup. On NVIDIA it politely does nothing and says so in the console. Safe to leave in every workflow.
It ships inside the ovum-cudnn-wrapper pack, and it's the manual control knob for the pack's main trick. Out of the box that pack already auto-wraps common VAE Encode/Decode node types (VAEDecode, VAEDecodeTiled, WanVideoDecode, and friends) to disable cuDNN around them on AMD - you often don't need to add anything. The toggle node exists for when you want the off switch in your own workflow, mid-graph, with full control, instead of trusting the defaults or ComfyUI's global setting.
How it works
The mechanism is one line of PyTorch with an AMD guard around it. On each run the node reads the current torch.backends.cudnn.enabled value, checks whether it's on an AMD-like box (device name contains "radeon", "amd" or "zluda", the torch.version.hip flag is set, or a ZLUDA env var exists), and only then sets the flag to whatever you asked. Non-AMD? It prints [OVUM_CUDDN_TOGGLE] AMD GPU not detected and passes through untouched.
One wrinkle: torch.backends.cudnn.enabled is global state, not per-node. That's why the node has a pass-through pair of any-type wires - you route your IMAGE or LATENT through them so ComfyUI is forced to run the toggle at exactly the point in the graph you want, immediately before or after the VAE node you're targeting. The author's recipe: put a toggle set to false feeding into the wires just ahead of VAE Decode, and if you want to be tidy, save the old state so you can restore it after.
The inputs and outputs that matter
Only three things exist, and only one is worth touching:
enable_cudnn(BOOLEAN, defaulttrue) - the on/off switch. Set itfalsefor the speedup.any_input/any_output(any type) - the pass-through. Connect your latent/image in and out; it's returned unchanged.prev_cudnn(BOOLEAN output) - the state the flag had before this node ran. Wire this into theenable_cudnnof a second toggle placed after the VAE node, and you've restored the original setting like a try/finally block. This is the pattern the tooltip spells out, and it's the one you'd reach for if you care about leaving cuDNN the way you found it.
Installing it
Same as any custom node - no model files, no heavy downloads. Via ComfyUI Manager, search ovum-cudnn-wrapper and install. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/ovum-cudnn-wrapper
Restart ComfyUI and the node appears under ovum/cudnn-wrapper. The pack's only declared Python dependencies are aiohttp and requests, which your ComfyUI install almost certainly already has.
Gotchas worth knowing
- It's AMD-only by design. Expect no speedup (and no change at all) on NVIDIA - the guard is the feature, not a bug.
- If the wrapped-node AMD logo shows up red, that's the pack telling you a wrap needs a server restart to take effect. And when you do restart, wrapping resets - add node types to
classes_to_cudnn_wrap.txtto make it automatic (copy it to your ComfyUI root so updates don't stomp it). - The AMD detection reads the torch device name, so weird installs (WSL, ZLUDA on NVIDIA hardware, ROCm preview drivers that don't report cleanly) can fool it. If you're not seeing the expected
[OVUM_CUDDN_TOGGLE]lines in the console, that's the first thing to check. - One honest take: ComfyUI now has a built-in setting for the default cuDNN state, which covers the "always off" crowd. This node is for when you want the toggle inside a workflow, before and after specific nodes, rather than as a global default. That's its reason to exist - use it that way.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| enable_cudnn | BOOLEAN | true | — |
| any_inputopt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| any_output | * | — |
| prev_cudnn | BOOLEAN | — |