Nodes/ComfyUI-ArchAi3d-Qwen/๐Ÿงฉ Smart Tile Solver V6.1 (Grid-Lock)
ComfyUI Node

๐Ÿงฉ Smart Tile Solver V6.1 (Grid-Lock)

The grid-first upscaler that wastes nothing

By amir84ferdosยทCreated 11 months agoยทUpdated 5 months agoยท 70
๐Ÿงฉ Smart Tile Solver V6.1 (Grid-Lock)
  • 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
โ—„upscale_by2.0โ–บ
โ—„upscale_tolerance0.10โ–บ
โ—„target_mp1.0โ–บ
โ—„mp_tolerance0.30โ–บ
โ—„min_overlap64โ–บ
โ—„divisibility64โ–บ
โ—„ar_constraint16:9 maxโ–บ
โ—„upscale_methodlanczosโ–บ
โ—„output_modeshrink_onlyโ–บ
โ—„aspect_locktrueโ–บ
โ—„forced_tile_width0โ–บ
โ—„forced_tile_height0โ–บ

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, or force_tile_size (use forced_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.

CategoryArchAi3d/Upscaling/Smart Tile

Inputs (13)

NameTypeDefaultDescription
imageIMAGEโ€”
upscale_byFLOAT2.01โ€“8Target upscale factor
upscale_toleranceFLOAT0.100โ€“0.5How much output can deviate from target (ยฑ10% = 0.1)
target_mpFLOAT1.00.25โ€“4Target megapixels per tile
mp_toleranceFLOAT0.300โ€“1How much tile MP can deviate from target (ยฑ30% = 0.3)
min_overlapINT640โ€“512Minimum overlap between tiles for blending
divisibilityCOMBO64Tile alignment (64 for Flux/Qwen, 8 for SD1.5)
ar_constraintCOMBO16:9 maxMaximum aspect ratio deviation for tiles
upscale_methodCOMBOlanczosInterpolation method for upscaling
output_modeCOMBOshrink_onlyshrink_only: Output never exceeds target. allow_grow: Can grow within tolerance. force_tile_size: Use exact tile from forced inputs.
aspect_lockBOOLEANtrueLock aspect ratio to prevent non-square pixel distortion
forced_tile_widthoptINT00โ€“4096Force specific tile width (0 = auto). Only used when output_mode='force_tile_size'
forced_tile_heightoptINT00โ€“4096Force specific tile height (0 = auto). Only used when output_mode='force_tile_size'

Outputs (14)

NameTypeDescription
upscaled_imageIMAGEโ€”
tile_widthINTโ€”
tile_heightINTโ€”
overlapINTโ€”
output_widthINTโ€”
output_heightINTโ€”
tiles_xINTโ€”
tiles_yINTโ€”
total_tilesINTโ€”
latent_tile_wINTโ€”
latent_tile_hINTโ€”
actual_upscaleFLOATโ€”
efficiencyFLOATโ€”
debug_infoSTRINGโ€”