mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-08-29 12:16:08 +00:00
empty _get_clause is True [PR] (#16975)
remove hack in GroupOp.Broadcastable in dtype_from_uop
This commit is contained in:
@@ -158,7 +158,6 @@ def dtype_from_uop(op:Ops, src:tuple[UOp,...], arg:Any) -> DType|None:
|
||||
# NOTE: CMPLT, CMPNE, CMPEQ, WHERE, SHL, SHR are handled above
|
||||
if op in GroupOp.Broadcastable:
|
||||
# TODO: support dtype broadcasting (promotion)
|
||||
if len(src) == 0: return dtypes.void
|
||||
if not all_same([x.dtype for x in src]): raise RuntimeError(f"dtype mismatch in {op}")
|
||||
return src[0].dtype
|
||||
if op in GroupOp.Movement: return src[0].dtype
|
||||
|
||||
@@ -51,7 +51,7 @@ def _get_clause(self:UPat, base:UOp, depth=0) -> UOp:
|
||||
fork_cond = [UOp(Ops.AND, src=tuple([_get_clause(s, base.index(i), depth) for i,s in enumerate(ss)])) for ss in self.src]
|
||||
and_clause.append(UOp(Ops.OR, src=tuple(fork_cond)))
|
||||
else: raise RuntimeError("broken")
|
||||
return UOp(Ops.AND, src=tuple(and_clause))
|
||||
return UOp(Ops.AND, src=tuple(and_clause)) if and_clause else UOp(Ops.CUSTOMI, arg="True")
|
||||
|
||||
# *** pattern matcher ***
|
||||
|
||||
|
||||
Reference in New Issue
Block a user