spec.py cleanups (#16140)

removed END from shared_spec and NOOP from full_spec
This commit is contained in:
chenyu
2026-05-11 15:59:49 -04:00
committed by GitHub
parent 692257dd70
commit f65e343fb3
-7
View File
@@ -57,9 +57,6 @@ shared_spec = PatternMatcher([
all(isinstance(ra, int) for ra in rng.arg[0:-1]) and isinstance(rng.arg[-1], AxisType)),
(UPat(Ops.INDEX, src=(UPat(),), allow_any_len=True, name="x"), lambda x: all(y.dtype == dtypes.weakint for y in x.src[1:]) or None),
# RANGE/SPECIAL define loops, END closes them
(UPat(Ops.END, src=(UPat(), UPat(Ops.RANGE))), lambda: True),
# STORE in tensor graph: store a value into a target
(UPat(Ops.STORE, dtypes.void, (UPat(), UPat())), lambda: True),
@@ -127,7 +124,6 @@ _tensor_spec = PatternMatcher([
(UPat(Ops.ALLREDUCE, name="red", src=(UPat.var("x"), UPat(Ops.DEVICE))), lambda red,x: red.dtype == x.dtype and isinstance(red.arg, Ops)),
(UPat(Ops.MULTI, name="multi"), lambda multi: all(x.dtype == multi.dtype for x in multi.src) and isinstance(multi.arg, int)),
# AFTER if things were kernelized
(UPat(Ops.AFTER, src=(UPat((Ops.BUFFER, Ops.AFTER)),), allow_any_len=True), lambda: True),
@@ -254,9 +250,6 @@ program_spec = PatternMatcher([
# *** this spec should match all UOps ever created ***
full_spec = PatternMatcher([
# NOOP in the full spec
(UPat(Ops.NOOP), lambda: True),
# all rewrite error are okay
(UPat(Ops.REWRITE_ERROR), lambda: True),