empty _get_clause is True [PR] (#16975)

remove hack in GroupOp.Broadcastable in dtype_from_uop
This commit is contained in:
chenyu
2026-07-10 18:03:39 -04:00
committed by GitHub
parent 40de90ab19
commit 4234a9d727
2 changed files with 1 additions and 2 deletions
-1
View File
@@ -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
+1 -1
View File
@@ -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 ***