๐งฉ Smart Tile Solver V6.1 (Grid-Lock)
The grid-first upscaler that wastes nothing
- image
- upscaled_image
- tile_width
- tile_height
- overlap
- output_width
- output_height
- tiles_x
- tiles_y
- total_tiles
- latent_tile_w
- latent_tile_h
- actual_upscale
- efficiency
- debug_info
Every other tiled-upscale calculator works tile-first: pick a tile size, see how many fit, round up, and eat the waste. The Solver V6 flips it. It works grid-first: pick a grid (say 3ร4), calculate exactly what tile size makes that grid cover the image perfectly, snap it to alignment, and nudge the output size within tolerance so the math comes out clean. The result it's selling is zero wasted pixels - every tile you sample is a tile that needed sampling. It's the most opinionated node in the "Smart Tile" subsystem of ComfyUI-ArchAi3d-Qwen (Amir Ferdos's pack), and its "Grid-Lock" branding is not just marketing: that's the actual algorithm.
The core idea
Old logic: tile size โ count tiles โ round up โ overhang waste. New logic:
output_w = tile_w * tiles_x - overlap * (tiles_x - 1)
tile_w = (output_w + overlap * (tiles_x - 1)) / tiles_x
The node tries different grid configurations, computes the exact tile size each implies, snaps to your alignment, and picks the most efficient. Because the output is allowed to "breathe" within upscale_tolerance, it can usually find a grid that locks perfectly.
Inputs that matter
- upscale_by / upscale_tolerance - target factor and how much the output may deviate (default ยฑ10%).
- target_mp / mp_tolerance - tile megapixels and how much they may drift.
- min_overlap - floor for blend overlap.
- divisibility - the alignment. The tooltip is the whole story: 64 for Flux/Qwen, 8 for SD1.5. This is the setting most likely to bite you if you switch model families.
- ar_constraint - how extreme tile aspect ratios may get (1:1 only โ free).
- output_mode -
shrink_only(never exceed target),allow_grow, orforce_tile_size(useforced_tile_width/forced_tile_height, the optional inputs). - aspect_lock - keep the output aspect locked so you don't get non-square pixel distortion.
Outputs: upscaled_image, the full grid geometry (tile_width, tile_height, overlap, tiles_x, tiles_y, total_tiles, output_width, output_height), plus two things the other calculators don't expose: latent_tile_w / latent_tile_h (tile size at latent resolution, handy for sampler-compatible crops) and actual_upscale. Plus efficiency and debug_info. Its V6.2 sibling adds a tile_params bundle output that drives the Simple USDU batch nodes.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen
pip install -r requirements.txt
Or ComfyUI Manager โ "ArchAi3d Qwen". Pure math, no model downloads. Free for personal use; commercial use needs a license.
The honest take
Grid-lock is a genuinely good idea - on a 2x upscale it routinely eliminates a row or column of near-useless edge tiles, which is real VRAM and real time. Two things to remember: the output won't be exactly your target size (that's the tolerance doing its job), so don't build a workflow that hard-codes the output dimensions; and if you switch between SD and Flux models, change divisibility or the tiles will misalign in ways that are confusing to debug. The debug_info output exists precisely because this math is subtle - read it before blaming your sampler.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | โ | |
| upscale_by | FLOAT | 2.01โ8 | Target upscale factor |
| upscale_tolerance | FLOAT | 0.100โ0.5 | How much output can deviate from target (ยฑ10% = 0.1) |
| target_mp | FLOAT | 1.00.25โ4 | Target megapixels per tile |
| mp_tolerance | FLOAT | 0.300โ1 | How much tile MP can deviate from target (ยฑ30% = 0.3) |
| min_overlap | INT | 640โ512 | Minimum overlap between tiles for blending |
| divisibility | COMBO | 64 | Tile alignment (64 for Flux/Qwen, 8 for SD1.5) |
| ar_constraint | COMBO | 16:9 max | Maximum aspect ratio deviation for tiles |
| upscale_method | COMBO | lanczos | Interpolation method for upscaling |
| output_mode | COMBO | shrink_only | shrink_only: Output never exceeds target. allow_grow: Can grow within tolerance. force_tile_size: Use exact tile from forced inputs. |
| aspect_lock | BOOLEAN | true | Lock aspect ratio to prevent non-square pixel distortion |
| forced_tile_widthopt | INT | 00โ4096 | Force specific tile width (0 = auto). Only used when output_mode='force_tile_size' |
| forced_tile_heightopt | INT | 00โ4096 | Force specific tile height (0 = auto). Only used when output_mode='force_tile_size' |
Outputs (14)
| Name | Type | Description |
|---|---|---|
| upscaled_image | IMAGE | โ |
| tile_width | INT | โ |
| tile_height | INT | โ |
| overlap | INT | โ |
| output_width | INT | โ |
| output_height | INT | โ |
| tiles_x | INT | โ |
| tiles_y | INT | โ |
| total_tiles | INT | โ |
| latent_tile_w | INT | โ |
| latent_tile_h | INT | โ |
| actual_upscale | FLOAT | โ |
| efficiency | FLOAT | โ |
| debug_info | STRING | โ |