Skip to content

perf(qwen-image-2.1): skip unused single-frame VAE cache and add residual-gate reuse opt-in - #8967

Closed
Asthenia0412 wants to merge 1 commit into
vllm-project:mainfrom
Asthenia0412:feat/qwen21-vae-memory-optim
Closed

Asthenia0412 wants to merge 1 commit into
vllm-project:mainfrom
Asthenia0412:feat/qwen21-vae-memory-optim

Conversation

@Asthenia0412

Copy link
Copy Markdown
Contributor

Background

Qwen-Image-2.1 VAE decode on vLLM-Omni allocates temporal feature-cache copies even for single-frame decode where they contribute nothing to the output, and re-recreates residual gates per block instead of reusing them.

Problem

  • Single-frame untitled VAE decode: temporal feature-cache allocations are materialized but unused
  • Residual gates in VAE forward: recreated per residual block

Solution

  1. Add opt-in pipeline config qwen21_skip_single_frame_vae_cache (default off)
  2. Conditionally skip temporal cache materialization in untitled single-frame VAE decode path
  3. Add opt-in qwen21_reuse_vae_residual_gates kwarg threading through VAE blocks

Testing

  • Config default off + opt-in configurable
  • Single-frame decode: byte-identical output with/without opt-in
  • Multi-frame decode: unchanged (opt-in no-ops)
  • Tiled path: unchanged
  • Distributed VAE: inheritance preserved
  • 569-line test module covering all paths
  • Memory benchmark script (57 lines)

Relates to #8776 and #8775.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-15T05:36:04.043000Z 6c013c2 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@vllm-omni-review-bot

Copy link
Copy Markdown

This PR appears to belong to: docs/design/module/diffusion/index.md.

Module owners: @princepride @wtomin @david6666666

Routing: @princepride via module of the changed files, CODEOWNERS; @wtomin via module of the changed files, CODEOWNERS; @david6666666 via module of the changed files

@Asthenia0412, please review your own changes and leave a short self-review comment describing what you checked. PRs without author self-review may not be assigned a reviewer.

Please take a look when you have a chance. If you would like an automated review, mention @vllm-omni-review-bot in a comment.

@vllm-omni-review-bot

vllm-omni-review-bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Omni ReviewBot triage note

Resolved as of 4e804ae60fe9: the high-priority or low-quality signal noted on an earlier commit no longer applies.

Copy link
Copy Markdown
Collaborator

@Asthenia0412 Current-head merge checklist for 6c013c2: GitHub currently reports conflicts with the target branch.

  • Contributor: update against the target branch and resolve the conflicts; identify the resulting fix/head commit.
  • Contributor: include the local affected VAE test commands, environment, results and log/screenshot evidence for that updated head. For this performance change, preserve the paired baseline/candidate memory and output-parity evidence with exact SHAs.
  • Reviewer: inspect the conflict resolution and evidence, then verify the new-head checks and outstanding review concerns.
  • Maintainer: confirm whether a CUDA CI run is needed after that verification, avoiding duplicate runs.
  • hs: final squash-and-merge confirmation.

This is conflict/evidence triage, not a completed substantive code review.

@BLANKETusers

Copy link
Copy Markdown
Contributor

The qwen21_reuse_vae_residual_gates opt-in is threaded through the forward signatures, but the cache-producing paths still unconditionally allocate fresh clones (cache_x = ...clone()) and assign them into feat_cache; the _reuse_gates value is never consulted here. As a result, enabling the flag does not reuse any destination buffer or reduce the per-layer allocator churn described in the PR. Please either implement the slot allocation/copy path for this flag or remove the opt-in until it has an observable effect, and add a test that verifies allocation/reuse rather than only output equality.

@vllm-omni-review-bot

vllm-omni-review-bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Omni ReviewBot: superseded

The CI failure noted on b7eb32569879 refers to an earlier head; the pull request now points at 2bfeb83fb730.

@vllm-omni-review-bot

vllm-omni-review-bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Omni ReviewBot: superseded

The CI failure noted on 2bfeb83fb730 refers to an earlier head; the pull request now points at cc230fdf3e1d.

@Asthenia0412
Asthenia0412 force-pushed the feat/qwen21-vae-memory-optim branch from 9fe371f to 37dc516 Compare October 15, 2026 16:11
…dual-gate reuse opt-in

Qwen-Image-2.1 VAE decode optimizations:
- Skip unused temporal feature-cache allocation for single-frame decode
- Reuse residual gate tensors across blocks to reduce allocator overhead
- Both opt-in flags guarded by default-off config flags

Signed-off-by: Asthenia0412 <Asthenia0412@users.noreply.github.com>
@Asthenia0412
Asthenia0412 force-pushed the feat/qwen21-vae-memory-optim branch from 40ee18f to 4e804ae Compare October 15, 2026 18:08
@hsliuustc0106 hsliuustc0106 added the enhancement New feature or request label Oct 16, 2026
@Asthenia0412 Asthenia0412 closed this by deleting the head repository Oct 16, 2026
@Asthenia0412

Copy link
Copy Markdown
Contributor Author

@hsliuustc0106 @BLANKETusers Hello could you review it thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants