PotionUI Docs v0.3.0

Temporal-Chunked VAE Decode

Decoding a video's latent back into pixels can use a lot of VRAM, since the accumulated pixel-frame output and intermediate activations grow with clip length. Wan's causal-3D video VAE already processes one latent frame at a time internally, carrying convolution state forward between frames. PotionUI reuses that same internal mechanism from the outside: instead of asking the VAE to decode a whole clip in one call, it builds one persistent decode cache and feeds the clip through in temporal slices across repeated decode calls. The result is mathematically identical to a single whole-clip decode — it's a memory-shaping change, not a quality or approximation tradeoff — but peak decode VRAM is bounded by the chunk size instead of the full clip length.

On this page

This is automatic engine behavior on Wan video generations: PotionUI decides at decode time, based on live free VRAM, whether to decode the whole clip at once, in temporal chunks, or (if even one frame's spatial decode doesn't fit) fall back to spatial tiling. There is nothing to turn on in a preset.

When to use it#

Nothing to configure — PotionUI applies chunked decode automatically on Wan video generations whenever a temporal chunk is needed to fit the decode inside available VRAM, and steps out of the way (full single-call decode) when there's enough headroom to not need it. Longer clips and tighter VRAM budgets are where it engages most often.

How to enable it#

Not a preset or environment toggle — it's an automatic part of the Wan video decode path (engine.py's decode orchestration and the Wan generator pipes' own decode call sites). If a decode runs low on VRAM mid-clip, PotionUI restarts the whole clip at half the chunk size rather than resuming partway (resuming would double-count the carried causal state), and falls back to spatial tiling if even a single-frame chunk doesn't fit.

Tradeoffs and limitations#

  • Wan-only: this depends on the Wan causal-3D VAE's internal per-frame decode cache (new_feat_cache). LTX's video pipes call the same shared decode primitive for consistency, but it is a verified no-op there — LTX's VAE has no new_feat_cache method, so causal3d_chunk_frames always returns None and LTX falls straight through to a plain single decode call regardless of clip length.
  • SeedVR2's VAE is excluded by the same detection: it self-normalizes rather than using the Wan-style causal feature cache, so it's never routed through temporal chunking either.
  • When a single frame's full-spatial decode does not fit in VRAM, the Wan pipes decode in spatial tiles, each tile one latent frame at a time with its own decode cache, so the two combine there. Tiles change the pixels near the seams. The engine's own causal-3D decode still picks one or the other.
  • When a Wan pipe's decode still runs out of VRAM, it steps down in the same order. A whole or chunked decode that fails clears the card and decodes one latent frame per chunk. If that fails too, the card is cleared again and the clip is decoded in spatial tiles sized from a fresh reading of free VRAM, or from the smallest tile when the card cannot be read. The tile then halves on each further failure. A driver OOM that the driver policy makes fatal (POTIONUI_CUDA_DRIVER_OOM; by default under WSL2 with expandable segments) is not retried at any of these steps.
  • The spatial tiles are blended in host RAM, not on the card. The blend keeps two full-clip float32 buffers (the weighted sum and the summed weights), then the division makes a third and the cast back to the VAE's compute dtype a fourth, so the peak is about 42 bytes per output pixel with a bfloat16 VAE and 48 with a float32 one, about 3.5 and 4 float32 copies of the clip. That is about 1.4 GB for 832x480 with 81 frames, 3.1 GB for 1280x720 with 81 frames, 4.7 GB for 1280x720 with 121 frames and 10.6 GB for 1920x1088 with 121 frames. The temporal-only path keeps one copy of the clip in the compute dtype while it gathers the chunks, plus the joined result.
  • No user-facing knob: you cannot force chunk size or disable this behavior from a preset or setting.