Skip to content

Studio: seam-free VAE tiles for Qwen-Image-2.1 on low-VRAM tiers (fixes thin horizontal / vertical lines) - #12696

Merged
danielhanchen merged 17 commits into
mainfrom
studio/q21-line-artifacts
Oct 5, 2026
Merged

danielhanchen merged 17 commits into
mainfrom
studio/q21-line-artifacts

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Problem

There are reports of thin horizontal / vertical lines in Qwen-Image-2.1 images on 12 GB and 16 GB cards, with the FP8, INT8 and GGUF (Q4_K_M) denoisers, on NVIDIA and AMD. Typical shapes: a lighter band about 8 px wide running a few hundred pixels down a face, and short greenish streaks in a plain sky near the right edge. A full-VRAM card does not show them.

The lines come from the VAE decode, not the denoiser. On a B200 with the card capped to 12 GiB (Studio's own planner picks the streaming tier), the final latent is bit-identical to the resident load's latent for all three prompts tried, but the decoded image is not: it differs by up to 69 levels along the VAE tile seams. Decoding that same saved latent with plain diffusers reproduces the lines exactly with tiled_decode and not at all without it.

Why the tiles are wrong for this VAE:

  • diffusers gives AutoencoderKLQwenImage21 the Wan VAE's tile geometry in pixels: 256 px tiles, 192 px stride, 64 px blend.
  • This VAE compresses 16x, not 8x. So a tile is 16 latents, the blend is 4 latents, and at 1024x1024 the last row and column are 4-latent slivers (x and y from 960 to 1024). A 1 MP image is 6x6 tiles.
  • The decoder sees further than 4 latents past a tile edge, so the edge of each tile decodes differently from its neighbour, and a 64 px linear blend cannot hide it. The sliver tiles have almost no context, which is where the streaks along the right edge come from.
  • Studio's planner turns VAE tiling on for the 12 GB and 16 GB tiers. Its comment assumes tiling is exact for a single tile at 1 MP or less, which holds for 8x VAEs but not for this one.

The bug has been there since Qwen-Image-2.1 was added: the first commit that can render it on the 12 GiB tier (c121e80) already shows the lines, and so does main.

Change

New diffusion_vae_tiling.py, installed on the Qwen-Image-2.1 VAE at load for every speed mode:

  • Decode tiles are at least 32 latents (512 px) on a side, with at least a 16-latent (256 px) overlap, the overlap ComfyUI uses for its tiled decode.
  • When free VRAM allows, the tiles are larger, up to one untiled decode. The decode picks the tile shape with the fewest decoded pixels whose cost fits in three quarters of the free VRAM. The cost is the measured 1.7 MiB of peak per latent of tile area, plus the fp32 output buffer. Fewer, larger tiles decode less overlap, which is what keeps the decode at or under main's time on an L4. UNSLOTH_DIFFUSION_VAE_MAX_TILE=<latents> caps the tile side; off CUDA the tiles stay at 32x32.
  • Tiles are spread evenly: the first starts at 0, the last ends at the image edge, and every tile is full size, so there are no sliver tiles.
  • Blending: a tile gets no weight within 4 latents of an edge it shares with another tile, where its decode lacks context, then ramps to full weight over the next 8 latents. Weights are normalised to sum to 1 at every pixel. This matters when the stride drops under 16 latents, because three tiles then overlap.
  • A canvas that fits in one tile decodes untiled, bit-identical to the untiled decode.
  • Each tile goes through the VAE's own untiled _decode, so the fused Triton VAE kernels still apply. It is installed before the speed optims, so the fused batched tile decode does not replace it.
  • Tiled encode: edit inputs on the same tiers (this family has no plain img2img pipeline) are encoded with use_tiling on. The stock tiled encode has the same geometry, and because the encoder attends over the whole tile, its 16-latent tiles shift the condition latent everywhere, not only at the seams. It now uses 64-latent (1024 px) tiles with 32-latent overlaps and the same kind of normalised blend, applied to the encoder's moments in latent space, so an input up to 1024 px a side encodes as one tile, exactly as untiled. The VAE's tile attributes stay as diffusers sets them.
  • Memory accounting:
    • vae_tile_side reports the 512 px minimum tile.
    • The calibrated Qwen-Image-2.1 tiled-decode activation goes from 449 to 1,697 MiB, the unfused worst case for one 512 px tile.
    • The per-call guard therefore charges one 512 px tile (2,048 MiB) at every size.
    • A larger tile is only chosen when three quarters of the free VRAM at decode time covers its measured worst case, so the guard's 512 px figure stays the floor and any growth comes out of memory that is free at that moment.
    • The encode only runs for edit inputs, at the reference resolution, and the guard charges those as weighted condition pixels. That charge covers one 64-latent encode tile (2,322 MiB worst, unfused) at every reference resolution and output size; a test pins this.
    • The planner's headroom for this family is still set by the text encoder and denoise phases, so no plan changes.
  • Kill switch UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0: at load it skips the install, so the fused batched tile decode installs as before. Set later, each decode and encode takes the stock tiled path.

Results

The first two tables were measured on the first version of this change: fixed 32x32-latent tiles and a plain linear blend. The per-size sweep and the L4 timing further down are on the final version.

B200, Studio's real DiffusionBackend in process, card capped with a VRAM simulator so the planner picks the same tier a 12 GB card gets. 1024x1024, 20 steps, guidance 6, fp8 text encoder. Three prompts: the pizza restaurant at dusk from the reports (seed 653672378), the pony and the golden husky (seed 1).

Seam score: worst 64 px window mean of |image - untiled decode of the same latent|, in 8-bit levels, for the three prompts (sorted). Resident Studio vs plain untiled diffusers is 0.5 to 0.6 (fused kernel noise).

12 GiB tier plan before after
GGUF Q4_K_M streaming, 20 / 35 groups resident 13.0 / 17.9 / 22.9 2.6 / 3.0 / 5.9
FP8 streaming, whole denoiser resident 13.9 / 19.1 / 21.2 3.0 / 3.5 / 7.1
INT8 whole-model offload 14.6 / 21.0 / 24.8 2.7 / 3.5 / 4.1
16 GiB tier plan before after
FP8 group offload, VAE tiled 13.9 / 19.1 / 21.2 3.0 / 3.5 / 7.1
GGUF Q4_K_M group offload, VAE tiled 15.2 / 21.2 / 23.4 3.3 / 3.3 / 3.6

Real L4 (sm89, the same architecture as a 4070 Ti) and RTX PRO 6000 (sm120) on Colab, with a VRAM ballast leaving 11.9 GB free and the reported total capped to 12 GB, so the planner sees a real 12 GB card. Same settings, Studio installed from the same base commit with and without this change:

real 12 GB budget plan before after
L4, GGUF Q4_K_M (pizza, pony) group offload, VAE tiled 15.2 / 13.7 3.6 / 2.4
L4, FP8 (pony, husky) streaming 15.1 / 25.4 2.9 / 12.7 *
RTX PRO 6000, GGUF Q4_K_M (pizza, pony) group offload, VAE tiled 15.0 / 24.0 3.5 / 3.2
RTX PRO 6000, FP8 (pony, husky) streaming 22.6 / 13.0 4.2 / 2.4

* a small saturated blob on the husky's chest, which the untiled decode of the same latent also draws; it is not a line. On base the L4 husky shows a column of pale dots, the same streak as in the reports.

  • The remaining score after the fix is content-level difference on high-contrast edges (a lit window, an eye), not lines. Crops before / after / resident show the bands gone.
  • Latents are bit-identical between base and this branch in every B200 and L4 cell, and in the RTX PRO 6000 GGUF cells; only the decode changed. The RTX PRO 6000 FP8 latents differ between the two processes, which is run-to-run FP8 denoiser noise on that card (no A/A was run there).
  • Resident loads never tile: their PNGs are byte-identical to main.

Speed and memory on the B200, first version, base / this branch (shared card, medians of the warm renders):

GGUF Q4_K_M 12 GiB FP8 12 GiB INT8 12 GiB GGUF Q4_K_M 16 GiB FP8 16 GiB
VAE decode, s 0.455 / 0.294 0.439 / 0.335 4.83 / 4.05 0.669 / 0.198 0.552 / 0.154
peak allocated, MiB 6,386 / 6,386 7,987 / 8,032 10,309 / 10,309 6,561 / 6,561 10,655 / 10,655
  • Denoise speed cannot move: the denoiser code is untouched and every latent is bit-identical. The per-step times measured on the shared card (0.31 to 1.5 s depending on tier) differ between arms only by the card's load.

Decode time on an L4

On an L4 with a real 12 GB budget, the first version, with fixed 32x32 tiles, made the warm decode slower: 0.76 to 0.77 s before and 1.01 to 1.02 s after at 1024x1024, about 30% more decoded area than main's 6x6 small tiles. The final version picks larger tiles when free VRAM allows. Here it is on the same Colab L4 setup, Studio installed from the same base commit with and without this change, pony prompt, warm (second) render at each size, 8 steps:

L4, real 12 GB budget decode s, before / after decode tiles, after decode peak MiB, before / after denoise peak MiB s / step, before / after
GGUF Q4_K_M 1024x1024 0.762 / 0.583 2x1 of 640x1024 4,892 / 5,872 5,380 1.77 / 1.86
GGUF Q4_K_M 1344x1344 1.282 / 1.125 2x2 of 800x800 4,902 / 5,863 5,824 3.13 / 3.10
GGUF Q4_K_M 2048x2048 3.090 / 2.947 3x3 of 864x864 4,946 / 6,087 7,220 8.12 / 8.12
FP8 1024x1024 0.759 / 0.700 2x2 of 640x640 7,603 / 8,178 7,972 0.88 / 0.88
FP8 1344x1344 1.257 / 1.114 2x2 of 800x800 5,947 / 6,908 7,471 1.76 / 1.75
FP8 2048x2048 3.117 / 2.640 3x2 of 864x1152 1,204 / 2,755 7,479 5.51 / 5.53
  • The decode now matches or beats main at every size measured on the L4, by 0.06 to 0.48 s. Each cell is a single warm render per arm, with no A/A run, so the 0.06 s FP8 1024x1024 gap is within noise.
  • The denoiser is untouched, and s/step matches within run-to-run noise. The one 5% gap, GGUF at 1024x1024, has the opposite sign on the first render (4.75 / 4.61).
  • The decode can now be the peak phase. The worst case is FP8 at 1024x1024: 8,178 MiB against 7,972 MiB for the denoise of the same render, +206 MiB on a card with 11.9 GB free. That is by construction: a larger tile is only taken when three quarters of the free VRAM covers it.
  • An earlier run of the same arms with the decode limited to half the free VRAM kept FP8 1024x1024 on 32x32 tiles at 1.006 s, which is why the fraction is three quarters.

Every image size

Real renders at every size the Images page offers for this model:

  • the 1:1, 3:2, 4:3, 16:9 and 21:9 ratios at the default 1024 width, and flipped
  • the seven official 2K presets
  • a custom 1184x864 and 1344x1344
  • 512x1536 (one axis fits one tile)
  • 256x256 (the smallest side, one tile)

Setup: Studio's DiffusionBackend at the 12 GiB tier, 8 steps, guidance 1.

  • B200, final version: FP8, pizza and pony prompts. Seam is the worse of the two; decode s is the faster of the two, on a shared card.
  • RTX PRO 6000 on Colab with the 12 GB ballast: GGUF Q4_K_M, pony, measured on the first version (fixed 32x32 tiles).

The seam score is measured against the untiled decode of each render's own latent. Latents are bit-identical between base and this branch in all 40 B200 cells and all 20 RTX PRO 6000 cells.

size B200 seam, before B200 seam, after B200 decode tiles, after B200 decode s, before / after B200 decode peak MiB, before / after B200 denoise peak MiB RTX PRO 6000 GGUF seam, before / first version
1024x1024 20.3 2.8 3x2 of 512x640 0.92 / 0.23 7,694 / 8,131 7,983 18.2 / 3.8
1024x672 13.6 3.1 3x1 of 512x672 0.32 / 0.11 7,691 / 8,155 7,848 13.5 / 2.2
672x1024 18.2 3.9 1x3 of 672x512 0.28 / 0.12 7,694 / 8,158 7,851 16.9 / 2.9
1024x768 24.6 2.0 3x1 of 512x768 or 2x2 of 640x512 0.33 / 0.15 7,697 / 8,193 7,892 14.2 / 2.2
768x1024 18.7 2.4 1x3 of 768x512 or 2x2 of 512x640 0.31 / 0.11 7,696 / 8,194 7,891 16.6 / 3.0
1024x576 23.5 1.4 2x1 of 640x576 0.21 / 0.06 7,693 / 8,199 7,815 18.7 / 2.5
576x1024 16.1 1.3 1x2 of 576x640 0.26 / 0.06 7,693 / 8,198 7,815 18.2 / 2.4
1024x448 15.3 1.8 2x1 of 640x448 0.22 / 0.05 7,691 / 8,059 7,763 12.2 / 1.9
448x1024 18.4 2.8 1x2 of 448x640 0.22 / 0.05 7,690 / 8,058 7,762 15.6 / 2.4
2048x2048 16.1 2.6 3x2 of 864x1152 2.23 / 0.38 1,301 / 2,852 7,521 15.2 / 3.2
2400x1792 15.5 2.5 3x2 of 976x1024 1.98 / 0.39 1,219 / 2,668 7,535 18.1 / 4.2
1792x2400 22.8 3.1 2x3 of 1024x976 1.87 / 0.38 1,235 / 2,683 7,550 19.6 / 4.1
2528x1696 19.9 3.9 3x2 of 1024x976 2.55 / 0.32 1,344 / 2,906 7,565 19.4 / 3.6
1696x2528 20.4 2.6 2x3 of 976x1024 1.98 / 0.37 1,345 / 2,906 7,573 23.3 / 3.0
2752x1536 12.7 2.8 3x2 of 1088x896 1.48 / 0.40 1,345 / 2,864 7,573 11.4 / 1.7
1536x2752 32.4 3.4 2x3 of 896x1088 2.11 / 0.37 1,345 / 2,864 7,573 17.4 / 2.3
1344x1344 22.3 5.0 3x2 of 624x800 0.49 / 0.22 6,089 / 6,816 7,573 17.8 / 2.4
1184x864 16.4 1.6 3x2 of 576x560 0.33 / 0.14 7,732 / 8,163 8,014 13.6 / 2.4
512x1536 26.8 2.4 1x3 of 512x688 0.23 / 0.11 7,715 / 8,195 7,910 16.8 / 3.4
256x256 0.6 0.6 one 0.01 / 0.01 7,691 / 7,691 7,618 0.5 / 0.5
  • After the fix the worst score at any size is 5.0 on the final version (B200), and 4.2 on the first version (RTX PRO 6000). Before the fix it was 11.4 to 32.4 at every size that tiles, on both cards. 256x256 fits in one tile, so it never tiles and is identical before and after.
  • Off-grid sizes:
    • 1328x1328 and 1000x744 cannot be rendered. Studio refuses sizes that are not multiples of 32 for this model ("needs width and height in multiples of 32"), before and after.
    • The UI snaps every width and height to that 32 px grid, so it offers no off-grid size; 1184x864 is the custom, off-preset case.
    • The nearest allowed sizes, 1312 and 1344, are covered: 1344x1344 is in the table, and 1312 is in the unit tests.
  • Decode time: on the B200 the final version decodes faster than main at every size that tiles, including 2K (0.32 to 0.40 s against 1.5 to 2.6 s), because it decodes 6 large tiles instead of main's 120 to 130 small ones.
  • Memory:
    • At 1 MP and below on the FP8 tier, the decode is now the peak phase, by up to 384 MiB (8,199 MiB against 7,815 MiB for the denoise), under a 10.8 GiB allocator cap.
    • At 2K the denoiser is off the GPU during the decode, and the decode peak is 2.6 to 2.9 GiB against 1.2 to 1.3 GiB on main, far under the 7.5 GiB denoise peak.
    • Tile size follows free VRAM, so the decode peak does not grow with the canvas past what the card has free.
  • Largest sizes, final version, B200 with the VRAM simulator, at 1024x1024, 2752x1536 and 2048x2048. None ran out of memory:
    • 16 GiB FP8 (group offload): peaks at 9,142 to 9,930 MiB, and decodes at 8,903 to 9,896 MiB, under a 14.8 GiB allocator cap.
    • 16 GiB GGUF: peaks at 6,432 to 7,165 MiB. 1024x1024 decodes untiled here.
    • 12 GiB GGUF: peaks at 4,521 to 5,809 MiB.
    • 12 GiB INT8: peaks at 8,545 to 9,625 MiB in the denoise phase, which this change does not touch. Its decode stays at 7,056 to 7,447 MiB, under the 10.8 GiB cap.
    • The first version also ran the 2K presets at 16 GiB FP8, 16 GiB GGUF and 12 GiB INT8, and on the L4 and RTX PRO 6000 with a real 12 GB budget, without running out of memory.
  • An earlier synthetic check showed 20.5 at "1328x1328". It came from the metric, not from a seam:
    • That canvas was a 1024 latent tiled 3x3 with hard content edges.
    • Its worst window was the image's last pixel column, which is not a tile seam.
    • The VAE decoder's middle block attends over the whole canvas, so a tiled decode differs slightly from an untiled one everywhere, and the synthetic content magnified that.
    • Real 1344x1344 renders score 1.5 to 5.0.
  • That review did change the blend:
    • When the stride drops under 16 latents, three tiles overlap, and the first blend gave the outer tile some weight within 2 latents of its edge. The blend now gives no weight within 4 latents of a shared edge.
    • On the same 40 real B200 latents, decoded offline with the stock diffusers VAE at 32x32 tiles, the median score went from 3.1 to 2.7 and the worst from 6.9 to 4.7.
    • At 1024x1024 the two blends score the same offline (2.64 / 2.64, 3.64 / 3.77).
  • L4 seam scores at every size are in the next table.

Real L4 with the 12 GB budget (ballast to 11,903 MiB free, total capped to 12 GB): GGUF Q4_K_M, group offload with the VAE tiled, pony, 8 steps, guidance 1. Measured on the first version (fixed 32x32 tiles, plain linear blend); the final version's L4 decode times are in the L4 table above.

  • The reference is the untiled decode of the L4's own latent, made on a B200. 256x256 is one untiled tile on both arms, so its 0.59 is the cross-card floor.
  • Latents are bit-identical between the arms at every size, and no size ran out of memory.
size seam, before seam, first version peak MiB, before / first version
1024x1024 13.5 2.6 5,394 / 5,394
1024x672 10.0 1.8 5,241 / 5,241
672x1024 14.2 1.4 5,243 / 5,243
1024x768 15.7 2.4 5,283 / 5,283
768x1024 18.1 3.4 5,285 / 5,285
1024x576 12.2 3.1 5,198 / 5,214
576x1024 14.3 2.3 5,199 / 5,215
1024x448 12.2 1.9 5,143 / 5,156
448x1024 16.0 2.7 5,144 / 5,157
2048x2048 18.0 2.0 7,230 / 7,230
2400x1792 16.6 3.2 7,299 / 7,299
1792x2400 14.4 2.6 7,306 / 7,306
2528x1696 16.9 3.9 7,304 / 7,304
1696x2528 16.4 2.6 7,310 / 7,310
2752x1536 17.6 1.8 7,285 / 7,284
1536x2752 11.8 1.8 7,290 / 7,289
1344x1344 14.5 3.2 5,836 / 5,836
1184x864 17.6 3.0 5,381 / 5,382
512x1536 18.1 4.8 5,288 / 5,288
256x256 0.6 0.6 5,930 / 5,930
  • Before the fix: 10.0 to 18.1 at every size that tiles. First version: 1.4 to 4.8. Decoding the same latents tiled on the B200 gives the same scores within 0.4, so they come from the tiles, not from the card.

Tiled encode (edits)

The same tiers encode edit inputs with use_tiling on, with the same 16-latent tiles, 4-latent blends and slivers. The encoder attends over the whole tile, so small tiles shift the condition latent everywhere and the edit derails, not only at the seams: on the 12 GiB tier, a "snowy winter" edit of the pony came back as the original meadow with a smeared pony.

End to end through Studio's DiffusionBackend on the B200 with the VRAM simulator, GGUF Q4_K_M, edit workflow, seed 7. The reference arm is the same tree with the input encode forced untiled (two runs of it are bit-identical, so the floor is 0). Score: mean absolute difference of the final image from the reference, in 8-bit levels:

encode tiles, 1024 px reference resolution 12 GiB 16 GiB
stock (16 latents) 8.1 to 106.4 8.8 to 106.9
32-latent tiles (tried first) 1.7 to 3.8, worst 64 px window 29 to 34 0.9 to 3.1, worst 13 to 24
this branch (64 latents, 32 overlap) 0, bit-identical 0, bit-identical
  • 512 px inputs: 4.3 to 17.5 with stock tiles, 0 here. A 16:9 input at 1024 (two tiles wide): 10.6 / 11.0 with stock tiles, 0.94 / 1.29 here.
  • Encode time 0.01 to 0.10 s here, against 0.06 to 0.66 s with stock tiles (warm).
  • The encode's own working memory at 1024 px is about 1.16 GiB, against 74 MiB with stock tiles, still below the denoise peak. The render peak is unchanged on square inputs and up to +307 MiB on the 16:9 one. No OOM at 512 or 1024 on either tier.
  • 2048 px reference resolution: the 12 GiB guard refuses it on every arm, and at 16 GiB with oversized generations allowed every arm (including the untiled encode) runs out of memory in the transformer, which predates this change. Offline at 2K, the 64-latent tiles score 2.0 to 2.8 against 11.6 to 13.9 for stock.
  • With the kill switch set, latents are bit-identical to main.

Images

12 GiB tier, GGUF Q4_K_M, crops at a tile seam. Left: main (tiled). Middle: this PR (tiled). Right: the untiled decode of the same latent:

Pony crop before and after

Sky crop from the reported prompt, before and after

Colab L4, real 12 GB budget, FP8. Each pair is a tiled decode next to the untiled decode of the same latent; the worst-scoring window is shown for each arm. Main leaves a dotted column on the seam; with this PR the only difference left is a small colour blob that the untiled decode draws as well:

L4 husky worst windows

Real T4 and capped L4

Tested on a real T4 (sm75, 15 GB, no bf16) and on an L4 capped to 12 GB and 16 GB. Both arms ran Studio's own ./install.sh --local from the merge base (7911672), and the head arm ran this branch (45aec80). Each arm loaded Studio's real DiffusionBackend with the same seeds. To save T4 time every render used 8 steps.

Setup:

  • Prompts: the pizza restaurant from the report (seed 653672378) and the pony and the golden husky (seed 1). Guidance 6, except the 2048x2048 render, which used guidance 1.
  • Sizes: 1024x1024 (all three prompts), 1024x576 (pizza), 2048x2048 (pony) and 256x256 (pony). 256x256 fits in one tile, so it measures the floor between cards.
  • T4: Kaggle 2xT4 for GGUF Q4_K_M (qwen-image-2.1-Q4_K_M.gguf). Colab T4 High-RAM for Auto on Qwen/Qwen-Image-2.1. On sm75 Auto resolves to a dense fp16 transformer, because Studio offers no fp8 or int8 there. The text encoder stays dense, because text_encoder_quant='fp8' is refused on sm75. Each config ran once with no cap and once capped to 12 GB.
  • L4: VRAM ballast plus a mem_get_info total cap, at 12 GB (11.9 GB free) and at 16 GB (15.6 GB free). GGUF Q4_K_M and FP8.
  • Seam: the worst 64 px window mean of |render - untiled decode of the same latent|, in 8-bit levels. The untiled reference was decoded in bf16 on a B200 from each render's saved latent. Line: the worst full-length row or column mean of the same difference.
card, budget quant plan 1024x1024 seam, pizza / pony / husky, before -> after 1024x576 2048x2048 worst line, before -> after warm decode s at 1024, before / after decode s at 2048, before / after peak MiB, before / after renders with non-finite decode output, before / after OOM
T4, no cap (15 GB) GGUF Q4_K_M streaming / group *, VAE tiled 28.3 / 91.0 / 48.8 -> 1.0 / 2.1 / 1.5 18.1 -> 0.8 75.3 -> 3.0 17.8 -> 0.7 1.97 / 1.14 7.92 / 6.52 3,635 / 7,227 * 3 / 0 of 6 none
T4, capped 12 GB GGUF Q4_K_M streaming / group *, VAE tiled 28.3 / 91.0 / 48.8 -> 1.5 / 1.7 / 1.9 18.1 -> 0.8 75.3 -> 3.4 17.8 -> 0.8 1.91 / 1.32 7.71 / 7.16 3,635 / 7,227 * 3 / 0 of 6 none
T4, no cap (15 GB) Auto (dense fp16) group, VAE untiled up to 1 MP identical, 1.8 / 5.8 / 2.7 identical, 1.2 78.2 -> 3.1 6.2 -> 0.6 2.08 / 2.06 16.57 / 10.86 7,465 / 9,283 1 / 0 of 6 none
T4, capped 12 GB Auto (dense fp16) streaming, VAE tiled 24.4 / 176.5 / 93.5 -> 1.8 / 5.8 / 2.7 17.4 -> 1.2 78.2 -> 3.4 24.6 -> 0.7 3.65 / 1.72 13.91 / 10.09 4,521 / 7,465 3 / 0 of 6 none
L4, capped 12 GB GGUF Q4_K_M group, VAE tiled 29.1 / 61.1 / 34.1 -> 0.8 / 23.3 ** / 2.4 25.7 -> 0.6 18.0 -> 1.6 13.9 -> 1.9 0.77 / 0.58 3.14 / 3.06 7,228 / 7,228 0 / 0 none
L4, capped 16 GB GGUF Q4_K_M group, VAE tiled 29.1 / 61.2 / 34.0 -> 0.8 / 1.8 / 1.1 25.6 -> 0.6 18.0 -> 1.6 13.9 -> 0.5 0.76 / 0.46 3.13 / 2.62 7,228 / 7,228 0 / 0 none
L4, capped 12 GB FP8 streaming, VAE tiled 33.3 / 69.5 / 31.0 -> 2.7 / 31.3 ** / 6.0 19.5 -> 0.5 18.4 -> 1.5 16.9 -> 5.3 0.78 / 0.73 3.07 / 2.63 8,037 / 8,237 0 / 0 none
L4, capped 16 GB FP8 group, VAE tiled 33.3 / 69.5 / 31.0 -> 2.2 / 15.2 ** / 2.8 19.5 -> 0.5 18.4 -> 1.5 16.9 -> 1.8 0.79 / 0.58 3.17 / 2.90 9,955 / 10,560 0 / 0 none
  • Floor: 256x256 decodes as a single tile on both arms. It scores 0.9 to 1.6, identical between the arms on every card.
  • Latents are bit-identical between base and this branch in 47 of 48 cells. The exception is the first FP8 render on the L4 at 12 GB (the pony), which is FP8 run-to-run noise; each arm is scored against its own latent. Denoise s/step is within 6% between the arms in every cell, and the denoiser code is unchanged.
  • * On Kaggle the base arm loaded first, on a cold cache, and Studio planned streaming because the companion size was unknown. The head arm loaded second and planned group offload. The latents are still bit-identical. Peak VRAM is not comparable in those two rows. The diff does not touch that planner path.
  • ** The pony at 8 steps and guidance 6 on the L4 is an unconverged, saturated image. The remaining score sits on the edges of saturated blobs, not on tile boundaries, and the untiled decode draws the same blobs. The worst full-length line drops from 10.5 to 1.9 (GGUF, 12 GB) and from 16.9 to 5.3 (FP8, 12 GB).

What differs from the B200 results:

  • On the T4 the VAE runs in fp16. On main, the stock tiled decode overflows: 3 of the 6 renders on each tiled T4 tier came back with non-finite pixels, drawn as solid black blocks on the seams next to the lines. Examples are the pony at 1024 on the 12 GB tier and the pony at 2048 on both tiers. With this change, no T4 decode produced a non-finite value.
  • At 1 MP and below, an uncapped T4 running Auto does not tile the VAE, so those cells are identical before and after. At 2048x2048 it tiles for that generation, and the score goes from 78.2 to 3.1.
  • The T4 decode is slower than on the B200 or the L4 but faster than main: 1.1 to 1.7 s against 1.9 to 3.7 s at 1024, and 6.5 to 10.9 s against 7.7 to 16.6 s at 2048.
  • Peak VRAM: on the T4 the decode is now the peak phase, as on the B200. The capped 12 GB Auto tier peaks at 7,465 MiB against 4,521 MiB, and the uncapped 2048 render at 9,283 MiB against 7,465 MiB. Nothing ran out of memory.

Edit on the L4 (GGUF Q4_K_M):

Edit of the pony image, "Make it a snowy winter scene", seed 7, 8 steps. The reference arm is this branch with the input encode forced untiled.

budget, output, reference resolution before: mean / worst-window difference from reference after
12 GB, 768x768, 512 6.5 / 115.6 0.0 (bit-identical latent and PNG)
12 GB, 1024x1024, 512 7.8 / 140.2 0.0 (bit-identical)
16 GB, 768x768, 1024 100.8 / 223.4 0.0 (bit-identical)
16 GB, 1024x1024, 1024 107.1 / 200.0 0.0 (bit-identical)

At 12 GB with reference resolution 1024, Studio refuses the edit with ImageActivationShortfallError (needs 5.56 GB, 4.72 GB usable) on both main and this branch, so that combination was not compared.

T4, capped 12 GB, Auto (dense fp16), pony 1024x1024. Left: main (the black blocks are non-finite pixels from the fp16 tiled decode). Middle: this PR. Right: untiled decode of the same latent:

T4 12 GB pony

T4, capped 12 GB, GGUF Q4_K_M, pony 1024x1024:

T4 GGUF 12 GB pony

L4, capped 12 GB, GGUF Q4_K_M, pizza 1024x1024:

L4 GGUF 12 GB pizza

L4, capped 12 GB, GGUF edit ("Make it a snowy winter scene"). Left: main. Middle: this PR. Right: untiled-encode reference:

L4 GGUF 12 GB edit

Tests

  • tests/test_diffusion_vae_tiling.py (580 cases), covering:
    • Tile layout for every length from 1 to 333 and every size the Images page offers: full-size, edge-aligned, overlap of at least 16 latents, fewest tiles.
    • Budget-sized tiles at 9 budgets for every UI size: overlap of at least 16 latents, no slivers, within the budget, and the fewest decoded pixels. Also the UNSLOTH_DIFFUSION_VAE_MAX_TILE cap, and the 32x32 fallback off CUDA or with no budget.
    • Blend weights cover every pixel, sum to 1, and are exactly 0 within 4 latents of a shared tile edge.
    • The per-call guard charges at least the measured one-tile decode at every UI size, and at least one 64-latent encode tile for an edit at every reference resolution (512, 1024, 2048) and every UI output size.
    • A tiny random AutoencoderKLQwenImage21 decoded and encoded tiled vs untiled on CPU. The stock tiles show seams, and the new tiles cut the worst row / column error by more than 4x on the decode (measured 6 to 8x). An encode up to 1024 px a side is bit-identical to the untiled encode; a two-tile encode (1088x256, 256x1088) cuts the stock error by more than 2x. Encode weights sum to 1 at every length from 1 to 199. Larger budget tiles decode as close to untiled as the 32x32 tiles.
    • One-tile canvases are bit-identical to untiled.
    • The kill switch skips the install at load and returns the stock decode and encode when set later.
    • Other VAEs are untouched.
    • Install / uninstall, and vae_tile_side.
    • The load path installs before the speed optims, and the fused batched tile decode does not replace it.
  • Fails on main (the module does not exist there), passes here.
  • With the calibrated-activation tests (772 in total), passes on torch 2.6.0, 2.11.0 (torchao 0.17.0), 2.12.1 (torchao 0.18.0, the latest) and 2.14.1 (torchao 0.18.0). torchao is not involved: the VAE is never quantised. The fused VAE tests pass too (26 passed, 19 skipped without a GPU).
  • Every diffusion, VAE, image and offload test file (185 files, CPU): 8,076 passed here, 7,496 on the merge base; the difference is the 580 new cases. The same 34 tests fail and the same 2 files fail to collect on both, with identical test IDs. They are in dataset import, image search, MCP image, the NVFP4 flag and one training route test, unrelated to this change.

Not covered

  • Real-card runs above are one render per arm (no A/A); the capped L4 is a ballast plus a reported-total cap; the T4 had no 16 GB cap (15 GB card); no AMD card.

  • No consumer card and no AMD card. The 12 GB budget ran on an L4 (same architecture as the reported 4070 Ti) and an RTX PRO 6000 with a ballast, and on a B200 with a VRAM simulator. The defect is in the tile geometry, so it should not depend on the vendor, but ROCm was not run. INT8 and the 16 GB tier ran on the B200 only.

  • The budget-sized decode tiles were scored for seams on the B200 only. On the L4 they were timed but not scored; the L4 and RTX PRO 6000 per-size seam tables are from the first version.

  • Edits ran with GGUF Q4_K_M only; FP8 and INT8 share the VAE path but were not rendered with an input image. One input image per edit; multiple reference images go through the same per-image encode but were not run. Reference resolution 2048 could not be rendered at 12 or 16 GiB on any arm and is covered only offline.

  • The tile budget reads free VRAM just before the decode. Another process that takes VRAM during the decode (a browser or desktop on the same card) eats into the quarter left as margin; this was not tested on a shared consumer card.

  • Timings are one render per arm with no A/A run. The B200 was shared with other jobs.

  • Other 16x VAEs (Wan 2.2 with patchify) and the 8x Qwen-Image VAE keep the stock tiles; not measured for seams.

The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's
tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a
16-latent tile with a 4-latent (64 px) blend, and the last row and column are
4-latent slivers. The decoder sees further than 4 latents past a tile edge,
so every seam and the right / bottom sliver decode differently from their
neighbours, and the short blend leaves thin vertical and horizontal lines
about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB
streaming / offload plans) has drawn them since the family was added;
resident loads decode untiled and never showed them.

Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the
overlap ComfyUI tiles its decode with), spread evenly so the last tile ends
at the image edge at full size. A tile gets no weight within 4 latents of an
edge it shares with another tile and ramps to full weight over the next 8,
normalised to 1 at every pixel, so the edge of an outer tile never shows
where three tiles overlap (strides under 16 latents). A canvas within one
tile decodes untiled. Tiles decode one at a time, so the decode peak does not
grow with the canvas.

Installed at load for every speed mode, before the fused batched tile decode,
so it covers the fused and stock paths. Only the decode changes: the tiled
encode and the tile attributes stay stock. vae_tile_side and the calibrated
tiled-decode activation report the 512 px tile. Kill switch
UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock
tiled decode per call).

Tests cover the tile layout and blend weights at every size the Images page
offers, the per-call memory guard at those sizes, and a tiny random
AutoencoderKLQwenImage21 decoded tiled against untiled.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

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 ✅ Completed 2026-10-05T09:20:06.200496Z ead2c44 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 4, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 4, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 4, 2026
danielhanchen and others added 12 commits October 4, 2026 09:07
…w-VRAM tiers

The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's
tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a
16-latent tile with a 4-latent (64 px) blend, and the last row and column are
4-latent slivers. The decoder sees further than 4 latents past a tile edge,
so every seam and the right / bottom sliver decode differently from their
neighbours, and the short blend leaves thin vertical and horizontal lines
about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB
streaming / offload plans) has drawn them since the family was added;
resident loads decode untiled and never showed them.

Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the
overlap ComfyUI tiles its decode with), spread evenly so the last tile ends
at the image edge at full size. A tile gets no weight within 4 latents of an
edge it shares with another tile and ramps to full weight over the next 8,
normalised to 1 at every pixel, so the edge of an outer tile never shows
where three tiles overlap (strides under 16 latents). A canvas within one
tile decodes untiled. Tiles decode one at a time, so the decode peak does not
grow with the canvas.

The stock tiled encode (img2img and edit inputs on the same tiers) has the
same geometry and seams; it gets the same tiles, blended in latent space.

Installed at load for every speed mode, before the fused batched tile decode,
so it covers the fused and stock paths. The VAE's tile attributes stay stock. vae_tile_side and the calibrated
tiled-decode activation report the 512 px tile. Kill switch
UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock
tiled decode / encode per call).

Tests cover the tile layout and blend weights at every size the Images page
offers, the per-call memory guard at those sizes, and a tiny random
AutoencoderKLQwenImage21 decoded and encoded tiled against untiled.
The 32x32-latent decode tiles with 16-latent overlaps decode about 2.25x the
canvas at 1024x1024 against about 1.7x for the stock tiles, which costs about
0.25 s per decode on an L4. When half the free VRAM holds them, take larger
tiles, down to one untiled decode: fewer tiles decode less overlap, so they
are faster and leave fewer seams. The tile sides are the fewest that cover
each axis with 16-latent overlaps and fit the area budget (1.7 MiB of decode
peak per latent of tile area, measured on 32x32 to 64x64 tiles, plus the fp32
output accumulator). With no room for more, the decode keeps the 32x32 tiles
the planner budgets, so no plan or memory estimate changes.
UNSLOTH_DIFFUSION_VAE_MAX_TILE caps the tile side.
…AM tiers

The 12 / 16 GB tiers tile the VAE encode with diffusers' stock 16-latent tiles. The encoder
attends over each tile, so the condition latent shifts everywhere, not only at the seams, and
edits drift from the resident result. Encode in 64-latent tiles with 32-latent overlaps and the
decode's normalised ramp blend: a 1024 px reference (the default) is one tile and matches the
untiled encode exactly. Same kill switch as the decode.
# Conflicts:
#	studio/backend/core/inference/diffusion_vae_tiling.py
#	studio/backend/tests/test_diffusion_vae_tiling.py
# Conflicts:
#	studio/backend/core/inference/diffusion_vae_tiling.py
#	studio/backend/tests/test_diffusion_vae_tiling.py
This family only encodes edit inputs, at the reference resolution, and the per-call guard charges them as weighted condition pixels. Test that this covers the measured 64-latent encode tile (2,322 MiB unfused) at every reference resolution and output size, and describe the encode geometry in the module docstring.
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 5, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 5, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 5, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 5, 2026
@danielhanchen danielhanchen self-assigned this Oct 5, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 5, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ead2c44a59

ℹ️ 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 3161553 into main Oct 5, 2026
@danielhanchen
danielhanchen deleted the studio/q21-line-artifacts branch October 5, 2026 10:45
danielhanchen added a commit that referenced this pull request Oct 6, 2026
…stock, no low-VRAM OOM) (#12764)

* Studio: decode Qwen-Image-2.1 in seam-free VAE tiles on low-VRAM tiers

The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's
tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a
16-latent tile with a 4-latent (64 px) blend, and the last row and column are
4-latent slivers. The decoder sees further than 4 latents past a tile edge,
so every seam and the right / bottom sliver decode differently from their
neighbours, and the short blend leaves thin vertical and horizontal lines
about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB
streaming / offload plans) has drawn them since the family was added;
resident loads decode untiled and never showed them.

Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the
overlap ComfyUI tiles its decode with), spread evenly so the last tile ends
at the image edge at full size. A tile gets no weight within 4 latents of an
edge it shares with another tile and ramps to full weight over the next 8,
normalised to 1 at every pixel, so the edge of an outer tile never shows
where three tiles overlap (strides under 16 latents). A canvas within one
tile decodes untiled. Tiles decode one at a time, so the decode peak does not
grow with the canvas.

Installed at load for every speed mode, before the fused batched tile decode,
so it covers the fused and stock paths. Only the decode changes: the tiled
encode and the tile attributes stay stock. vae_tile_side and the calibrated
tiled-decode activation report the 512 px tile. Kill switch
UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock
tiled decode per call).

Tests cover the tile layout and blend weights at every size the Images page
offers, the per-call memory guard at those sizes, and a tiny random
AutoencoderKLQwenImage21 decoded tiled against untiled.

* Studio: decode and encode Qwen-Image-2.1 in seam-free VAE tiles on low-VRAM tiers

The Qwen-Image-2.1 VAE compresses 16x, but diffusers gives it the Wan VAE's
tile geometry in pixels (256 px tiles, 192 px stride). On this VAE that is a
16-latent tile with a 4-latent (64 px) blend, and the last row and column are
4-latent slivers. The decoder sees further than 4 latents past a tile edge,
so every seam and the right / bottom sliver decode differently from their
neighbours, and the short blend leaves thin vertical and horizontal lines
about one tile long. Every tier that tiles the decode (the 12 GB and 16 GB
streaming / offload plans) has drawn them since the family was added;
resident loads decode untiled and never showed them.

Decode this VAE in 32-latent tiles with at least a 16-latent overlap (the
overlap ComfyUI tiles its decode with), spread evenly so the last tile ends
at the image edge at full size. A tile gets no weight within 4 latents of an
edge it shares with another tile and ramps to full weight over the next 8,
normalised to 1 at every pixel, so the edge of an outer tile never shows
where three tiles overlap (strides under 16 latents). A canvas within one
tile decodes untiled. Tiles decode one at a time, so the decode peak does not
grow with the canvas.

The stock tiled encode (img2img and edit inputs on the same tiers) has the
same geometry and seams; it gets the same tiles, blended in latent space.

Installed at load for every speed mode, before the fused batched tile decode,
so it covers the fused and stock paths. The VAE's tile attributes stay stock. vae_tile_side and the calibrated
tiled-decode activation report the 512 px tile. Kill switch
UNSLOTH_DIFFUSION_VAE_WIDE_TILES=0 (at load: skip the install; later: stock
tiled decode / encode per call).

Tests cover the tile layout and blend weights at every size the Images page
offers, the per-call memory guard at those sizes, and a tiny random
AutoencoderKLQwenImage21 decoded and encoded tiled against untiled.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: decode Qwen-Image-2.1 in larger tiles when free VRAM allows

The 32x32-latent decode tiles with 16-latent overlaps decode about 2.25x the
canvas at 1024x1024 against about 1.7x for the stock tiles, which costs about
0.25 s per decode on an L4. When half the free VRAM holds them, take larger
tiles, down to one untiled decode: fewer tiles decode less overlap, so they
are faster and leave fewer seams. The tile sides are the fewest that cover
each axis with 16-latent overlaps and fit the area budget (1.7 MiB of decode
peak per latent of tile area, measured on 32x32 to 64x64 tiles, plus the fp32
output accumulator). With no room for more, the decode keeps the 32x32 tiles
the planner budgets, so no plan or memory estimate changes.
UNSLOTH_DIFFUSION_VAE_MAX_TILE caps the tile side.

* Studio: encode Qwen-Image-2.1 edit inputs in wide VAE tiles on low-VRAM tiers

The 12 / 16 GB tiers tile the VAE encode with diffusers' stock 16-latent tiles. The encoder
attends over each tile, so the condition latent shifts everywhere, not only at the seams, and
edits drift from the resident result. Encode in 64-latent tiles with 32-latent overlaps and the
decode's normalised ramp blend: a 1024 px reference (the default) is one tile and matches the
untiled encode exactly. Same kill switch as the decode.

* Studio: let a Qwen-Image-2.1 decode tile use three quarters of the free VRAM

* Studio: format the Qwen-Image-2.1 VAE tiling files

* Studio: pin that the edit guard covers one Qwen-Image-2.1 encode tile

This family only encodes edit inputs, at the reference resolution, and the per-call guard charges them as weighted condition pixels. Test that this covers the measured 64-latent encode tile (2,322 MiB unfused) at every reference resolution and output size, and describe the encode geometry in the module docstring.

* Studio: give the Qwen-Image-2.1 VAE test skip an explanatory reason

* Studio: tighten the Qwen-Image-2.1 VAE tiling comments

* Studio: trim the Qwen-Image-2.1 VAE tiling test comments

* Studio: seam-free tiled decode for every image VAE whose stock tiles fall under the floor

Read the stock tile and overlap off each VAE (Wan-family pixel tiles and
strides, AutoencoderKL-style latent tiles and overlap factor) and its
compression ratio, instead of covering only AutoencoderKLQwenImage21.
Each tiled decode keeps diffusers' tiles when every tile is at least 32
latents and every overlap at least 16, and otherwise takes the wide,
edge-aligned tiles (floor 32 / 16, or the stock tile when larger).

This covers Qwen-Image / Qwen-Image-Edit / Krea-2 (8x, 8-latent blends),
HunyuanImage-2.1 (32x, 12-latent tiles with 3-latent blends) and the
edge-sliver sizes of AutoencoderKL / FLUX.2 (an 8-latent last tile at
1600 px), and keeps Qwen-Image-2.1 bit-identical. 4-D latents are
supported, the decode budget scales per output pixel, and KEEP_STOCK
holds VAEs that must keep stock tiles, with the measured reason.

* Studio: size wide VAE tiles from measured per-class peaks, never decode more than stock at the floor

- Decode budget per VAE class from measured bf16 peaks (unfused / fused MiB per latent): Qwen-Image 0.27 / 0.18,
  Qwen-Image-2.1 1.7 / 0.43, HunyuanImage-2.1 1.3, AutoencoderKL and FLUX.2 0.17 / 0.09, the worst of each ratio
  for an unmeasured class. Tiles are sized on the fused figure where the fused VAE kernels are installed. The old
  per-pixel figure was 5x HunyuanImage's peak and 2.9x AutoencoderKL's.
- The floor layout of a VAE whose stock tile is larger than 32 latents picks the fewest tiles of the smallest side
  that keeps the overlap (two 116-latent tiles on a 1600 px FLUX.1 side, not two 128s), so it never decodes more
  than stock.
- A VAE whose stock tile is smaller than the floor tile (HunyuanImage, Qwen-Image-2.1) decodes in its stock tiles,
  with a logged reason, when even the floor tile cannot fit the free VRAM. An OOM in the wide tiles retries at the
  floor tile, then in the stock tiles.
- The stock tiles the wide path falls back to keep the fused batched tile loop on the Wan family.
- Geometry and blend weights are cached per VAE.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: tighten the VAE tiling comments

* Studio: at an AutoencoderKL / FLUX.2 edge sliver, take the widest tiles that decode no more than stock

The wide floor for a VAE whose stock tile is the floor tile (AutoencoderKL, FLUX.2, which take the wide path only
for an edge sliver) picked the smallest covering side (two 116-latent tiles on a 1600 px side). That kept the seam
lines away but lost per-tile context against the 128-latent tiles: SDXL's worst 64 px window rose from 3.1 to 5.1
levels on DIV2K 0010. Now it takes the fewest decoder calls, then the largest tile, among layouts that decode no
more latents per side than the stock loop: two 120-latent tiles (240 decoded latents, as stock, in 4 calls instead
of 9). Qwen-Image, Qwen-Image-2.1 and HunyuanImage keep the fewest-latents choice.

* Studio: grow AutoencoderKL / FLUX.2 wide tiles past the floor only into device-free memory

A VAE whose stock tile is the floor tile takes the wide tiles only to drop an edge sliver. Counting the allocator's
cached blocks as free let FLUX.1 at 1600 px on an 8 GB tier decode untiled (3.7 GB) out of the denoiser's cache;
3 of 5 decodes stalled on cache flushes (0.21 s median against stock's 0.08). Its tiles now grow past the floor only
into the memory the device has free. Qwen-Image, Qwen-Image-2.1 and HunyuanImage still count the cache, as #12696
does (measured faster there), and the floor-fit check counts it for every VAE.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: trim the VAE tiling comments

* Studio: drop restating VAE tiling comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant