Skip to content

fix: correct non-circular tile placement and blending - #2088

Open
shawn-mengchen-xu wants to merge 1 commit into
leejet:masterfrom
shawn-mengchen-xu:fix-non-circular-tiling
Open

shawn-mengchen-xu wants to merge 1 commit into
leejet:masterfrom
shawn-mengchen-xu:fix-non-circular-tiling

Conversation

@shawn-mengchen-xu

Copy link
Copy Markdown

Summary

Fix non-circular tile placement and blending so that the overlap used for blending matches the actual overlap between adjacent tiles.

The previous src/runtime/tiling.cpp implementation could fail in two ways:

  1. The planned overlap could collapse at certain dimensions.
    In particular, when the dimension is exactly twice the tile size, the planner could select two tiles and then reduce their overlap to zero. For example, a latent dimension of 150 with tile size 75 resulted in two adjacent tiles with no overlap, producing a visible seam.

  2. The nominal overlap could differ from the actual overlap.
    Tile execution used a uniform integer stride and repositioned the last tile when it exceeded the image bounds. The resulting last-tile overlap could therefore differ from the overlap calculated by the planner and passed to the blending code. In some cases this also produced uneven or multiple coverage near the end of the dimension.

The non-circular path now implements a Bresenham-like integer tiling scheme:

position(i) = floor(i * (dimension - tile_size) / (num_tiles - 1))

distributing tiles evenly across the full extent. The actual overlap with each neighboring tile is derived from these positions and used for per-edge blending.

For the dimension = 150, tile size = 75 case, the new placement uses three tiles at positions 0, 37, 75, with overlaps of 38 and 37, instead of two tiles with zero overlap.

The new placement and per-edge blending logic is used for fully non-circular tiling; circular tiling continues to use the legacy executor.

Verification

  • Built successfully with CUDA.
  • Tested Qwen Image 2.1 tiled VAE decode with latent dimensions including:
    • 112 × 150, tile size 56 × 75
    • 106 × 158, tile size 53 × 79
  • Verified that the visible tile-boundary artifacts in both cases are no longer present.

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