Patch Triton VAE
Make VAE decode stop eating your wall-clock — fused Triton kernels
- vae
- vae
You've waited through the sampling loop, and then the video still sits there decoding for another minute. That tail is exactly what Patch Triton VAE exists to shorten. It's an experimental node in KJNodes that rewrites the norm-and-activation plumbing inside a handful of popular VAEs so they run on fused Triton kernels instead of a chain of separate layer calls. Not a sampling speedup - a decode/encode speedup - which for video is often a genuinely fat chunk of your end-to-end time.
What it is and why you'd bother
It's a "patch" node, meaning it sits between your VAE loader and the decode/encode step: Load VAE → Patch Triton VAE → VAE Decode. The patched VAE is a copy with internal modules swapped for faster ones, so nothing on disk changes and the effect only lives while that patched VAE is loaded. If you don't like it, you delete one node.
The author's own numbers: roughly 1.4x/1.15x on the Wan 2.1/2.2 video VAEs (including Qwen-Image, which shares that VAE family), about 1.6–1.8x at 2048px on the KL image VAEs (Flux/Flux2, SDXL, SD1.5), and it handles the LTXV/LTX2 video VAEs too. Architecture is auto-detected, so there's nothing to configure to match your model. Those are the VAEs behind most of what people generate in 2026 - Wan and Flux2 have entire ecosystem writeups of their own - so the supported list overlaps with the models people actually wait on.
How it works
Two main tricks, plus one experimental one. First, VAE blocks everywhere run a norm (RMSNorm for Wan, GroupNorm for KL image VAEs, PixelNorm for LTXV) immediately followed by a SiLU. Normally that's separate kernel launches, with cuDNN layout transposes thrown in around every convolution. The node fuses each norm+SiLU chain into a single Triton kernel with fp32 accumulation, and converts conv weights to channels_last memory format to kill the layout shuffles. It's applied via ComfyUI's object-patch mechanism on a cloned patcher - same idea as model patchers elsewhere in the graph, so the VAE file is never rewritten.
The third toggle, int8_conv, is the aggressive one: it runs the 3x3 convolutions as W8A8 quantized int8 operations on tensor cores, which is roughly 4x the bf16 rate on Ada and newer GPUs. The author quotes ~45–48 dB versus the bf16 decode - small enough that most people won't see it. One gotcha buried in the code: for the 4-channel-latent SD1.5/SDXL-class VAEs, int8 is actually skipped outright because quality there is insufficient. So don't be surprised if you flip that switch on an SD1.5 VAE and nothing changes.
The inputs that matter
Four booleans and one VAE in, one VAE out. The ones a beginner actually touches:
- vae - the VAE you want patched.
- fuse_norm_silu (default on) - the main speedup. Requires Triton; this is where the gains come from.
- channels_last (default on) - needed for the fused GroupNorm kernel to engage on KL VAEs, so leave it unless something misbehaves.
- autotune (default off) - benchmarks kernel block sizes on first use of each tensor shape and caches the fastest. Expect a brief stutter the first time you hit a new resolution; afterwards it's a few percent faster.
Output: vae - the patched VAE, wired straight into VAE Decode or VAE Encode. That's the whole graph change.
Install
Via ComfyUI Manager, search "KJNodes", or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt
Then restart ComfyUI. The real dependency gotcha: Triton is not in KJNodes' requirements.txt. If it's missing, the node silently doesn't show up at all - KJNodes catches the import failure and just logs a warning, while the rest of the pack keeps working. Install it yourself with pip install triton (Windows users historically reached for triton-windows). This is CUDA territory, so an NVIDIA GPU is effectively required.
Troubleshooting
- Node is missing from the menu - Triton isn't installed, or the internal ComfyUI module paths moved and the import failed; check the console for the
PatchTritonVAE node could not be importedwarning and update both ComfyUI and KJNodes. - "No fusable norm layers found" - your VAE isn't in the supported family (Wan video VAEs incl. Qwen-Image, KL image VAEs, LTXV/LTX2). Other architectures just won't work; don't try to force it.
- int8 does nothing on SD1.5/SDXL - that's by design, not a bug.
This one's worth it if you generate video or work at high resolution and decode is your slow part. It's experimental and brand-new, so expect the occasional rough edge - but it's free to try, reversible by deleting one node, and the only real cost is installing Triton.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | — | |
| fuse_norm_silu | BOOLEAN | true | Replace norm+SiLU chains (RMSNorm for Wan, GroupNorm for KL VAEs) with fused Triton kernels (single pass, fp32 accumulation). Requires triton. |
| channels_last | BOOLEAN | true | Convert conv weights to channels_last memory format, removing cuDNN layout transposes around every conv. Required for the fused GroupNorm kernel to engage on KL VAEs. |
| int8_conv | BOOLEAN | false | EXPERIMENTAL: run the VAE decoder's 3x3 convolutions on int8 tensor cores (4x the bf16 rate on Ada+). Weights quantized per-out-channel, activations dynamically per-tensor; ~45-48 dB vs the bf16 decode, minor quality loss possible. Wan 2.1/2.2 and KL image VAEs (Flux2/SDXL/SD1.5), ignored for others. |
| autotune | BOOLEAN | false | Benchmark several kernel block-size configs on first use of each tensor shape and cache the fastest. Brief stutter per new resolution, usually a few percent faster after warmup. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| vae | VAE | — |