Skip to content

Add Wan FP8 quantization with Sol-Attn - #30

Open
Uxito-Ada wants to merge 3 commits into
Tele-AI:mainfrom
Uxito-Ada:fp8_quant_and_sol
Open

Add Wan FP8 quantization with Sol-Attn#30
Uxito-Ada wants to merge 3 commits into
Tele-AI:mainfrom
Uxito-Ada:fp8_quant_and_sol

Conversation

@Uxito-Ada

@Uxito-Ada Uxito-Ada commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add online FP8 quantization support for Wan2.1 and make it compatible with Sol-Attn.

This PR provides:

  • tf-kernel FP8 quantization for Wan
  • TorchAO activation&weight FP8 for Wan
  • Dense FP8 / Sol-Attn + FP8 examples
  • BF16 Q/K/V handling required by the Sol-Attn kernel

H100 Benchmark

Environment and parameters:

  • GPU: one NVIDIA H100 80GB
  • Model: Wan2.1 T2V-1.3B
  • Resolution: 832x480
  • Frames: 81
  • Inference steps: 50
  • Solver: UniPC
  • CFG scale: 5.0
  • Sigma shift: 5.0
  • Seed: 42
  • SOL dense timesteps: 10
  • SOL dense layers: 1
  • SOL tau: 1.0
  • Each configuration runs in a separate process
  • Timing starts after pipeline loading and includes first-execution kernel/JIT
    costs

Prompt:

Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage.

image

The bars show peak allocated GPU memory. The line shows generation throughput.

Compared with BF16 dense:

  • BF16 + Sol-Attn improves throughput by 26.9%
  • tf-kernel FP8 dense reduces peak allocated memory by 8.0%
  • tf-kernel FP8 + Sol-Attn improves throughput by 36.6% and reduces peak allocated memory by 2.6%

It is seen that Sol-Attn introduces more memory consumption because it saves a huge sparse mask, therefore, quantization is useful to shrink the memory trace when combined at the same time, and also raises the throughput. @lzx1413

Video Generation Comparision

Dense Sol
BF16 https://github.com/user-attachments/assets/bea35bd4-b4c4-4b4b-ae59-efd4b81ca3e2 https://github.com/user-attachments/assets/35067f84-aa32-454e-b468-3bd5ce5d9323
torchao FP8 https://github.com/user-attachments/assets/1a33c28f-8b2b-4d85-94d7-b96b27bba443 https://github.com/user-attachments/assets/d23a1729-2fda-4b5b-a5e7-bb17026da2b6
tf-kernel FP8 https://github.com/user-attachments/assets/f082eab5-c605-48ad-82d4-dbac402fea79 https://github.com/user-attachments/assets/2c7c2d23-bec5-495e-abfb-51e31d6165b7

Testing

  • 18 passed:
    • tests/unit/models/test_wan_video_sol_attention.py
    • tests/unit/pipelines/wan_video/test_sol_quant_example.py
  • H100 Sol-Attn kernel execution test passed
  • Both new example --help entry points passed
  • Ruff lint passed
  • Ruff format passed
  • git diff --check passed
  • Pre-commit hooks passed for all PR files

Checklist

  • Code follows the project coding standards
  • Relevant pre-commit hooks pass
  • Focused tests pass locally
  • New tests cover the new functionality
  • Documentation and runnable examples are included
  • Commit message is clear and descriptive

Add tf-kernel and TorchAO online FP8 choices for Wan2.1 transformer blocks, with dense and Sol-Attn runnable examples.

Keep active Sol-Attn Q/K/V in BF16 while preserving Wan residual dtypes, and cover the quantization and attention interaction with focused tests.

Document the H100 ablation setup and results, including a peak-memory bar and throughput line benchmark chart.

Verified with 18 focused pytest cases (including the H100 Sol-Attn kernel), both example --help entry points, pre-commit hooks, and git diff --check.
Mock the FP8 wrapping entry points so the Wan quantization unit test validates filter and option wiring without requiring the optional tf-kernel package.

Remove the benchmark PNG asset and its README reference while retaining the benchmark table and reproduction details.

Verified the previously failing test, the 18-test focused suite, Ruff, pre-commit, and staged diff checks.
Replace the separate dense FP8 and Sol-Attn FP8 scripts with one Wan2.1 example that independently selects attention and quantization from CLI configuration.

Document Dense/SOL and BF16/tf-kernel FP8/TorchAO FP8/NF4 combinations, and rename the focused tests around the consolidated interface.

Verified the direct --help entry point, 18 focused tests including the H100 SOL kernel, pre-commit hooks, PR-scope diff checks, and stale-reference audit.
@Uxito-Ada
Uxito-Ada requested a review from lzx1413 August 12, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant