Nodes/ComfyUI-ArchAi3d-Qwen/๐Ÿงฉ Smart Tile Solver V6.2 (Matrix Search)
ComfyUI Node

๐Ÿงฉ Smart Tile Solver V6.2 (Matrix Search)

The tile planner that brute-forces every grid so your upscale isn't wasting VRAM

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

If you've ever tiled an upscale by hand, you know the grind: pick a tile size, watch 0.4 of a tile dangle off the edge, round up to 4 tiles, and eat the wasted VRAM. The Smart Tile Solver V6.2 is the fix for exactly that. It's the planning node in the "Smart Tile" half of the ArchAi3d pack - feed it your image, tell it how big you want the result and how much VRAM per tile you can afford, and it brute-forces every valid combination of tile size, grid layout, and overlap to find the one with the highest efficiency. The author claims 95โ€“100%, and honestly, the math backs it up.

How it works

The key idea is in the name: Matrix Search. Instead of picking a tile size and seeing how many fit (the old "tile-first" approach), it generates all valid tile dimensions within your megapixel tolerance, all grid configs up to 12ร—12, all overlaps in your range, then evaluates ~50,000+ combinations at once using NumPy broadcasting. Coverage is tile_w * tiles_x - overlap * (tiles_x - 1), and efficiency is output pixels divided by processed pixels. It picks the argmax and upscales your image to that exact output size with the interpolation method you chose (default lanczos).

The two tolerance sliders are what give the solver room to optimize. upscale_tolerance (default 0.1) lets the output drift from your target upscale factor; mp_tolerance (default 0.3) lets tile size drift from target_mp. Crank both up if you care about VRAM efficiency more than hitting an exact resolution. divisibility matters more than it looks: 64 for Flux/Qwen-Image, 8 for SD1.5. And output_mode has three personalities - shrink_only (never exceed target), allow_grow, and force_tile_size, the last one activating the optional forced_tile_width/forced_tile_height pins.

What comes out

The upscaled_image output is the whole image upscaled to the solved output size (this is your img2img base). Everything else is the plan:

  • tile_width, tile_height, overlap - feed these into a USDU node's tile fields
  • output_width, output_height, tiles_x, tiles_y, total_tiles
  • latent_tile_w/h - tile size รท 8, handy for latent-space nodes
  • efficiency and debug_info - the debug string prints the searched/valid counts and the top 10 candidates, which is genuinely useful for learning why it picked what it did
  • tile_params - a TILE_PARAMS bundle that carries the whole plan in one wire, used by the pack's cropper and conditioning nodes

Installing it

This is one node in the bigger ComfyUI-ArchAi3d-Qwen pack by Amir Ferdos (ArchAi3d), the architect behind the Qwen-VL interior-design tooling. Install via ComfyUI Manager (search "ArchAi3d Qwen"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen
pip install -r requirements.txt

Then restart. The USDU/tile family only needs what ComfyUI already ships (torch, numpy, Pillow); the heavy deps in requirements.txt - sam3, opencv, timm, google-genai and friends - are for other nodes in this pack. Licensing is worth a glance: free for personal use, but commercial work requires a paid license from the author.

Where people get burned

The solver is a planner, not a sampler - it returns a clean upscaled image and a plan, and the plan is only as good as what you do with it. If you wire its output into the pack's "No Upscale" USDU variants, keep safe_guard on so mismatches between the plan and the node's tile fields error out instead of silently producing a wrong grid. Also, the target_mp default of 1.0 assumes roughly a 1024ร—1024-class tile; drop it toward 0.25โ€“0.5 if you're on 6โ€“8 GB. It's a front-end node, so judge it by whether its plan gives you clean seams downstream - and it usually does.

CategoryArchAi3d/Upscaling/Smart Tile

Inputs (14)

NameTypeDefaultDescription
imageIMAGEโ€”
upscale_byFLOAT2.01โ€“8Target upscale factor
upscale_toleranceFLOAT0.100โ€“0.5How much output can deviate from target (ยฑ10% = 0.1). Higher = more freedom to optimize.
target_mpFLOAT1.00.25โ€“4Target megapixels per tile (VRAM usage)
mp_toleranceFLOAT0.300โ€“1How much tile MP can deviate from target (ยฑ30% = 0.3). Higher = more tile size options.
min_overlapINT640โ€“512Minimum overlap between tiles for blending
max_overlapINT25632โ€“512Maximum overlap to search
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.
aspect_lockBOOLEANtrueLock output aspect ratio to match input (prevents 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 (15)

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โ€”
tile_paramsTILE_PARAMSโ€”