engine: honor compile flag in tiled mode

Tiles are fixed-shape, so fused compilation applies the same as full-frame.
Forcing compile=False in the tiled branch left performance on the table:
measured on the same 12-frame 2048px green-screen set (alpha output
bit-identical, IoU 0.9316):
  M3 Ultra: 3.64 -> 2.48 s/frame (1.47x)
  M1 Ultra: 4.65 -> 4.19 s/frame (1.11x)
Peak memory unchanged (~2.3 GB).
This commit is contained in:
modelbeast 2026-07-16 21:37:22 +10:00
parent 04503e7970
commit 4c660dff3c

View File

@ -100,10 +100,14 @@ class CorridorKeyMLXEngine:
self._overlap = overlap
if self._tiled:
# Tiled: model runs at tile_size, input stays full-res
# Tiled: model runs at tile_size, input stays full-res.
# Tiles are fixed-shape, so fused compilation applies to them the
# same as full-frame — honor the caller's ``compile`` flag rather
# than forcing it off (measured ~1.3-1.45x faster tiled inference
# on M-series Ultras at identical output).
self._img_size = self._tile_size
self._model: GreenFormer = load_model(
checkpoint, img_size=self._tile_size, compile=False, slim=True
checkpoint, img_size=self._tile_size, compile=compile, slim=True
)
logger.info(
"Tiled inference: tile_size=%d, overlap=%d", self._tile_size, self._overlap