diff --git a/tinygrad/codegen/late/coalese.py b/tinygrad/codegen/late/coalese.py index a16098d91c..7962a3a367 100644 --- a/tinygrad/codegen/late/coalese.py +++ b/tinygrad/codegen/late/coalese.py @@ -37,7 +37,7 @@ def transform_to_image(ctx, buf:UOp, x:UOp) -> UOp|None: # if no candidates, we don't rewrite if len(cands) == 0: return None # and tiebreak with indexing complexity (ie. number of nodes) - h, w, cidx = cands[0] if len(cands) == 1 else min(cands, key=lambda cand: len(cand[2].gep(1).simplify().backward_slice)) + h, w, cidx = cands[0] if len(cands) == 1 else min(cands, key=lambda cand: len(cand[2].simplify().backward_slice)) buf = buf.replace(dtype=(dtypes.imageh if buf.dtype.itemsize == 2 else dtypes.imagef)((h, w, 4))) if valid.op is not Ops.CONST or valid.arg is not True: return buf.index(valid.where(cidx.src[1], cidx.src[1].const_like(Invalid)),