Repository navigation
Studio diffusion: fuse the int8 SwiGLU MLP on block-streamed Qwen-Image-2.1 denoisers - #15370
Merged
Merged
Conversation
…ge-2.1 denoisers The onload-device int8 GEMM install (12 / 8 GB budgets) skipped every SwiGLU MLP because its weights were still on the host at install time, so those budgets ran four act quants per MLP where 16 / 24 GB run two. The streamed install now patches them too; the fused path already keeps the stock MLP on any weight that is not on the activation's device. Kill switch UNSLOTH_DIFFUSION_INT8_SWIGLU_STREAMED=0.
…he end-to-end test
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Qwen-Image-2.1 int8 ran about 3% slower per step at 12 / 8 GB VRAM budgets than at 16 / 24 GB on L4 (0.814 against 0.789 s/step at 1024x1024). The group-offload hooks and the block-streamed step graph are not the cause: with every group resident, the replayed graph has no copies and the hooks do not run. The cause is one int8 kernel lever that the streamed load path dropped.
_install_swiglu_ff, Studio diffusion: cut the int8 ConvRot overhead (one rotation per shared input, SwiGLU fused into the down quant, factored rotation kernel) #14982).install(..., device=...)) while the weights are still on the host._install_swiglu_ffkept only MLPs whose weight already sat on the target card, so all 32 MLPs stayed on four separate act quants per block.This change lets the onload-device install patch those MLPs too. The group hook onloads the whole block before the MLP runs.
_swiglu_downandshared_rotq_linearsalready fall back to the stock MLP whenever a weight is not on the activation's device, so a weight that is still on the host can never reach the fused kernels. A layer split (several cards) keeps the per-card filter.Kill switch:
UNSLOTH_DIFFUSION_INT8_SWIGLU_STREAMED=0restores the previous behaviour.Results
Colab L4, one VM, base (main 9e44983) and head interleaved per budget (base, head, head, base). 1024x1024, 25 steps, CFG 1. Each process renders a cold image, 2 cached-prompt images and 4 new prompts. s/step is the median of the 4 new prompts.
one act quant for gate / value on 32 SwiGLU MLP(s) + the SiLU product fused into the down projection's act quant. No base 12 / 8 GB process does.On B200 (local, emulated 12 / 8 GiB caps), the int8 GEMM and ConvRot kernels are off by default on sm100, so this change is a no-op there: same kernels, same images. With the GEMM forced on (
UNSLOTH_DIFFUSION_INT8_GEMM=1), at both caps:Tests
studio/backend/tests/test_diffusion_int8_gemm.py:_swapmarks only the onload-device install as streamed;The new cases fail on main and pass here. The whole file passes: 151 passed.