Skip to content

perf(diffusion): decode Wan VAE in BF16 - #32697

Merged
BBuf merged 4 commits into
sgl-project:mainfrom
BBuf:bbuf/wan-decode-bf16
Jul 29, 2026
Merged

BBuf merged 4 commits into
sgl-project:mainfrom
BBuf:bbuf/wan-decode-bf16

Conversation

@BBuf

@BBuf BBuf commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add an optional decode-only VAE precision policy
  • default Wan2.1 and LongLive2 VAE decoding to BF16 while retaining their existing encode precision
  • keep standard Wan2.2 pipelines on FP32 decode by default to preserve existing quality baselines
  • keep all non-Wan pipelines on their existing precision policy
  • expose the resolved decode policy through /models

Users can explicitly select --vae-decode-precision {fp32,fp16,bf16} for any supported pipeline.

Why

Wan's VAE decoder is substantially faster in BF16 on H100, but lowering the global VAE precision also changes encode behavior. A decode-only override captures the optimization boundary used by FastVideo without changing image-to-video input encoding.

Wan2.2 keeps its existing FP32 default because B200 ModelOpt NVFP4 consistency is sensitive to the decode policy. LongLive2 explicitly retains BF16 because its existing VAE policy is BF16.

Upstream reference: hao-ai-lab/FastVideo#1472

Precision Defaults

Pipeline family VAE encode VAE decode
Wan2.1 FP32 BF16
Standard Wan2.2 FP32 FP32
LongLive2 BF16 BF16

H100 Benchmark

Native SGLang with Torch SDPA, Wan-AI/Wan2.1-T2V-1.3B-Diffusers, 832x480, 17 frames, one denoise step, seed 42. Decode latency is the median of five runs.

Decode policy Median decode Speedup vs FP32 Configured encode precision
FP32 baseline 441.08 ms 1.000x FP32
BF16 decode 326.00 ms 1.353x FP32

Quality

Comparison PSNR SSIM MS-SSIM
BF16 decode vs FP32 decode, aggregate output 46.83 dB 0.98994 0.99062
SGLang framewise GT Min CLIP Min SSIM Min PSNR Max mean absolute pixel diff
Wan2.1 BF16 decode 0.97385 0.97898 44.96 dB 0.959

Additional H100 tests cover the Wan2.1, Wan2.2, and LongLive2 precision defaults.

NVIDIA Diffusion CI

Hardware / check Coverage Result
B200 Wan2.2 ModelOpt NVFP4 consistency and server tests passed
RTX 5090 diffusion canary passed
H100 component accuracy and LongLive2 consistency passed
H100 all one- and two-GPU model partitions passed
Workflow diffusion coverage and final aggregation passed

CI States

Latest PR Test (Base): ✅ Run #30414407575
Latest PR Test (Extra): ✅ Run #30414407480

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@github-actions github-actions Bot added the diffusion SGLang Diffusion label Jul 28, 2026
@BBuf BBuf added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) labels Jul 29, 2026
@BBuf
BBuf merged commit 4f5b50c into sgl-project:main Jul 29, 2026
121 of 129 checks passed
saturn-acc pushed a commit to saturn-acc/sglang that referenced this pull request Aug 16, 2026
Atituiset pushed a commit to Atituiset/sglang that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant