KJNodes/experimentalgenerated

Patch Triton VAE(PatchTritonVAE)

Speeds up VAE decode/encode with fused Triton norm+SiLU kernels and channels_last conv layout. Supported VAEs (auto-detected): Wan 2.1/2.2 video VAEs incl. Qwen-Image (RMSNorm, ~1.4x/1.15x), KL image VAEs such as Flux/Flux2, SDXL and SD1.5 (GroupNorm, ~1.6-1.8x at 2048px), and LTXV/LTX2 video VAEs (PixelNorm; timestep-conditioned decoder blocks get norm-only fusion). Other architectures are not supported. Applied as object patches on a cloned patcher, so it only exists while this VAE is loaded.

Patch Triton VAE

vae
vae
fuse_norm_silu
channels_last
int8_conv
autotune
KJNodes

Description

Speeds up VAE decode/encode by applying fused Triton norm+SiLU kernels and channels_last convolution layout. Supported VAEs are auto-detected:

  • Wan 2.1/2.2 video VAEs (including Qwen-Image variant): RMSNorm, ~1.4×/1.15× speedup.
  • KL image VAEs (Flux/Flux2, SDXL, SD1.5): GroupNorm, ~1.6–1.8× at 2048px.
  • LTXV/LTX2 video VAEs: PixelNorm; timestep-conditioned decoder blocks get norm-only fusion.

Other architectures are not supported and will be passed through unchanged. The node applies patches on a cloned patcher, so the optimizations only exist while this VAE is loaded.

Inputs

NameTypeDefaultTooltip
vaeVAEThe VAE model to patch.
fuse_norm_siluBOOLEANtrueReplace norm+SiLU chains (RMSNorm for Wan, GroupNorm for KL VAEs) with fused Triton kernels (single pass, fp32 accumulation). Requires Triton.
channels_lastBOOLEANtrueConvert convolution 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_convBOOLEANfalseEXPERIMENTAL: run the VAE decoder’s 3×3 convolutions on int8 tensor cores (4× the bf16 rate on Ada+). Weights quantized per-out-channel, activations dynamically per-tensor; ~45–48 dB vs. bf16 decode, minor quality loss possible. Supported on Wan 2.1/2.2 and KL image VAEs (Flux2/SDXL/SD1.5); ignored for others.
autotuneBOOLEANfalseBenchmark 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

TypeDescription
VAEThe patched VAE object (a cloned patcher). Use this output in place of the original VAE connection.

Usage Notes

  • All optimizations require Triton to be installed in your ComfyUI environment (typically via pip install triton). Without Triton, fuse_norm_silu and int8_conv will be silently skipped.
  • The node auto-detects supported VAE architectures; unsupported VAEs are forwarded unmodified.
  • Enable autotune after you have settled on your typical resolutions for best long-run speed, but be aware of the initial stutter on new shapes.
  • The int8_conv flag is experimental – verify your output quality before relying on it in production.
  • Because the VAE is patched via a cloned patcher, the original VAE node in your workflow is unchanged. You must route the output of this node to the decode/encode nodes.
  • This node is found in the KJNodes/experimental category of the node menu.

Comments

Sign in with GitHub to join the discussion.

Loading comments…
Patch Triton VAE (PatchTritonVAE) - ComfyUI-KJNodes | ComfyUI Wiki