Skip to content

Studio video: Auto keeps INT8 attention off for the two-expert Wan 2.2 A14B - #18790

Merged
danielhanchen merged 1 commit into
mainfrom
studio-wan-a14b-int8-auto-off
Nov 21, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-wan-a14b-int8-auto-off

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

With INT8 attention on Auto (the default), Wan 2.2 A14B renders a different clip from the one it renders with INT8 attention off. Auto races the INT8 kernel for every WanTransformer3DModel, and the two A14B experts are that class, so on A100 both experts take it: 160 attention modules, the CUDA kernel. It is about 10% faster per step, but the error compounds over the steps of both experts and the clip changes. On a busy prompt the stall layout, a vehicle, the signs and the lighting all change.

Change

  • diffusion_int8_attention_dispatch.py: a new AUTO_SINGLE_EXPERT_ONLY set (WanTransformer3DModel) and a two_expert_pipeline(pipe) check (transformer_2 present). With the switch unset, a DiT in that set is not raced when its pipeline has a second expert.
  • diffusion_int8_attention.install_auto applies the same rule to the strided route.
  • These still route both experts exactly as before:
    • an explicit per-load On,
    • unsloth_int8 requested by name,
    • UNSLOTH_DIFFUSION_INT8_ATTENTION_KERNEL=1.
  • Wan 2.2 5B, which has one expert, keeps its race and its INT8 default (Studio: INT8 attention for diffusers-dispatch DiTs (Qwen-Image-2.1, Wan 2.2) #17758).

Evidence

Colab A100-SXM4-40GB, main 8b7cde79eb, hosted INT8 pair (group offload, FP8 text encoder). 832x480, 33 frames, 10 steps, 2 prompts, fresh process per arm.

Arm INT8 modules Steady s/step Frames sha256, prompt 1 / prompt 2
INT8 off 0 3.91 022433d8... / ef160cf3...
INT8 off, second fresh process 0 3.91 022433d8... / ef160cf3...
INT8 on (forced) 160 3.51 d39260ae... / 9303ed2a...
main, Auto 160 3.53 d39260ae... / 9303ed2a... (the forced-on clip)
this branch, Auto 0 3.98 022433d8... / ef160cf3... (the off clip)
  • On vs off:
    • LPIPS (alex, all 33 frames) 0.135 and 0.277; PSNR 23.1 and 17.7 dB.
    • The off-vs-off repeat is bit-identical, so none of this is run-to-run noise.
    • The latent error grows about 1.5 to 2x per step through both experts, reaching rel L2 0.20 and 0.39 by the last step. No single step or expert accounts for it.
  • Visual check: first, middle and last frames side by side. Both clips are clean, with no artifacts. The first prompt keeps the scene with shifted positions; the second changes its content.
  • Main and branch Auto ran on two different A100 VMs. Each matches its expected arm by frame hash.

Tests

  • tests/test_diffusion_int8_attention_dispatch.py::test_auto_leaves_a_two_expert_wan_alone_and_keeps_a_one_expert_wan, on CPU with a fake card:
    • Auto routes 0 modules of a two-expert Wan pair.
    • The name and On each route all 8.
    • A one-expert Wan still routes its 4.
  • On main this test fails (Auto routes the pair), and here it passes. test_differential.py reports DISCRIMINATING: 1 fixed, 0 head failures.
  • tests/test_diffusion_int8_attention_{dispatch,auto,families,toggle}.py: 164 passed and 7 skipped here, against 163 passed and 7 skipped on main.

Not covered

  • Only A100 and only 832x480x33 were run. On L4, G4 and the 720p default this branch is the same code path (A14B Auto stays off), but main's drift there was not measured.
  • Wan 2.1 14B (single expert) keeps its race and was not measured.
  • AMD gfx1151 Linux, where Wan is in the ROCm Auto list, gets the same rule. It did not run there.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T18:36:52.817079Z 78b4a73 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 78b4a73b33

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 2699bce into main Nov 21, 2026
@danielhanchen
danielhanchen deleted the studio-wan-a14b-int8-auto-off branch November 21, 2026 21:42
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