From ee5e8cea68f790c1b8ea7d02206bf9a5f51cf767 Mon Sep 17 00:00:00 2001 From: chenyu Date: Fri, 3 Jul 2026 13:19:12 -0400 Subject: [PATCH] no dtype.vec in select_dtype [PR] (#16845) --- tinygrad/uop/ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tinygrad/uop/ops.py b/tinygrad/uop/ops.py index c6fc303809..bbdf6ad379 100644 --- a/tinygrad/uop/ops.py +++ b/tinygrad/uop/ops.py @@ -1630,7 +1630,7 @@ def graph_rewrite(sink:UOp, pm:PatternMatcher, ctx=None, bottom_up=False, name=N def sint_to_uop(x:sint, dtype=dtypes.weakint) -> UOp: return UOp.const(dtype, x) if isinstance(x, int) else x.cast(dtype) def to_max_shape(shape:tuple[sint, ...]) -> tuple[int, ...]: return tuple(int(x.vmax) if isinstance(x, UOp) else x for x in shape) -def select_dtype(u): return (dtypes.long if u.overflows(dtypes.int32) else dtypes.int).vec(u.dtype.count) +def select_dtype(u): return dtypes.long if u.overflows(dtypes.int32) else dtypes.int pm_lower_index_dtype = PatternMatcher([ # There are no Unary ops at this point in symbolic, those are introduced later (UPat(GroupOp.Binary, name="u", src=(UPat.var("x").cast(dtypes.weakint), UPat.var("y").cast(dtypes.weakint))), lambda u,x,y: @@ -1640,7 +1640,7 @@ pm_lower_index_dtype = PatternMatcher([ cond.where(x.cast(dt:=least_upper_dtype(x.dtype, y.dtype)), y.cast(dt)).cast(dtypes.weakint)), (UPat(Ops.RANGE, src=(UPat.var("end").cast(dtypes.weakint)), name="r"), lambda r,end: r.replace(dtype=end.dtype, src=(end,)).cast(dtypes.weakint)), (UPat(Ops.STACK, src=UPat().cast(dtypes.weakint), name="v"), - lambda v: v.replace(dtype=(dt:=select_dtype(v)), src=tuple(s.src[0].cast(dt.scalar()) for s in v.src)).cast(dtypes.weakint)), + lambda v: v.replace(dtype=(dt:=select_dtype(v)), src=tuple(s.src[0].cast(dt) for s in v.src)).cast(dtypes.weakint)), # special can only be int32 (UPat(Ops.SPECIAL, src=(UPat.var("var").cast(dtypes.weakint),), name="u"), lambda u,var: u.replace(dtype=dtypes.int, src=(var,)).cast(dtypes.weakint)),