Repository navigation
fix: halve VAE decode tiles on OOM retry instead of jumping to 256px - #2120
Merged
Merged
Conversation
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
Fixes #2108.
prepare_vae_decode_retry_tilingclamps the first spatial-tiling retry tomin(size/2, 256 / scale_factor), so the fallback jumps straight to 256px image tiles even when much larger tiles would fit. Removing the clamp makes every retry halve the tile size (1024→512→256…, 1536→768→384…), matching the behavior already used once tiling is enabled and what #2108 asks for.Each failed attempt only costs a graph build plus a failed workspace allocation, so trying intermediate sizes is cheap compared to running many more small tiles.
Test evidence (RTX 5070 Ti Laptop 12 GB, CUDA, Qwen Image 2.1 Q6_K)
At 1536x1536, decode previously fell back to 121 tiles at 256px in 32.6 s. With progressive halving it lands on 9 tiles at 768px in 10.3 s. For a 1024px decode the first retry is now 512px; #2108's own measurements show 512px tiles decode ~2-4x faster than 256px when they fit.
Summary by CodeRabbit