TorchCompileLoadControlNet
ControlNet runs every step of sampling — TorchCompileLoadControlNet makes it cheaper
- controlnet
- CONTROL_NET
ControlNet is the thing that runs in lockstep with your model for the entire denoising loop. Every step, the condition image goes through the control model and its outputs get added into the UNet's skip connections. That's real compute you're paying for on every single step, and it's exactly what TorchCompileLoadControlNet is for: it takes a ControlNet you already loaded, wraps the control model in torch.compile, and returns the same CONTROL_NET ready to plug into your apply node.
A quick honesty check before you get excited: compiling the ControlNet rarely shaves seconds off a single 20-step image, because the sampler itself dominates. Where it pays off is ControlNet-heavy work - multiple ControlNets stacked, high-res generation with many steps, or video, where the same control model runs thousands of times. Compile once, reap the savings on every subsequent call. That's the same trade as the sibling TorchCompileLoadVAE node in this pack, just aimed at the guidance path instead of the decoder.
How it works
Peek at the source and it's refreshingly small. The node calls torch.compile() on controlnet.control_model, then returns the ControlNet object untouched. Two details are worth knowing:
- It guards with a
_compiledflag so the model is only compiled once even if the node runs repeatedly - this is the "Buff Fix" commit that patched a real bug where running multiple ControlNets caused the same model to be recompiled (or error) every pass. - It wraps the compile in a try/except and raises a clear
RuntimeError("Failed to compile model")on failure, rather than silently handing you a broken ControlNet.
The compile is JIT, so the first sampling run with this wired in is slower - sometimes dramatically, depending on your mode - and then every run after that uses the cached graph. Don't judge it by one generation.
The inputs that matter
controlnet- plug in theCONTROL_NEToutput from your normal ControlNet loader (or a DiffControlNet, or any Apply-style source). This is the only model input.backend-inductor(default, safe) orcudagraphs(CUDA graph capture, faster when it works, pickier when it doesn't).mode-defaultto start.max-autotunegives the best kernels but a long one-time compile;reduce-overheadis the compromise;max-autotune-no-cudagraphsis what people tend to fall back to when graphs cause trouble.fullgraph- off by default; on, it demands the whole module fuse into one graph and will throw if there's unfusable Python in it.
The output is one CONTROL_NET - same type you started with - so it drops into ControlNetApply, ControlNetApplyAdvanced, or whatever apply node your workflow already uses, no rewiring needed.
Installing it
Same pack as TorchCompileLoadVAE, so you get both in one go. ComfyUI Manager is the easy path: search "ComfyUI-Torch-Compile", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/yondonfu/ComfyUI-Torch-Compile
cd ComfyUI-Torch-Compile
pip install -r requirements.txt
The requirements file is just torch - no model downloads, no exotic deps. The actual prerequisite is a PyTorch build where torch.compile works at all.
Common issues
- Nothing compiled, no error. Inductor needs
tritonon NVIDIA/Linux, and this pack doesn't install it for you.pip install triton(or your distro's wheel) and retry. Windows is the classic pain point here. max-autotuneerrors out. It needs a card with 80+ SMs - think 4090-class, not 4060. Drop todefault; you'll still get most of the benefit.cudagraphsbackend hangs or gives garbage. Known on some 30-series cards. Switch toinductorormax-autotune-no-cudagraphsand move on.- Compile takes forever on first run. Normal for
max-autotune. Start withdefaultand only crank the mode after you've confirmed the speedup is worth the one-time cost.
The pack comes from Yondon Fu, the engineer behind ComfyStream (Livepeer's realtime ComfyUI streaming tool) - someone whose day job is making repeated inference as cheap as possible. This node is that philosophy applied to the ControlNet pass: small, MIT-licensed, two files, and it just sits in your graph doing nothing until the compile pays off.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| controlnet | CONTROL_NET | — | |
| backend | COMBO | 2 options: inductor, cudagraphs | |
| fullgraph | BOOLEAN | false | Enable full graph mode |
| mode | COMBO | default | 4 options: default, max-autotune, max-autotune-no-cudagraphs, reduce-overhead |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONTROL_NET | CONTROL_NET | — |