early view simplify (#10974)

* shape const if it has a device [pr]

* early view simplify
This commit is contained in:
George Hotz
2025-06-24 20:52:45 -07:00
committed by GitHub
parent 77fff73295
commit 306dbc76f6
+2
View File
@@ -415,6 +415,8 @@ finalize_gbarrier = PatternMatcher([
(UPat(Ops.GBARRIER, src=(UPat(Ops.VIEW,),), name="x"), lambda x: x.src[0].contiguous().gbarrier()),
# remove gbarrier on constants without a contiguous
(UPat(Ops.GBARRIER, src=(UPat(Ops.CONST),), name="x"), lambda x: x.src[0]),
# simplify views
(UPat(Ops.VIEW, src=(UPat.var('x')), name="v"), lambda x,v: x.view(new_st) if (new_st:=v.arg.simplify()) != v.arg else None),
])
remove_tags = PatternMatcher([(UPat(GroupOp.All, name="x"), lambda x: x.replace(tag=None) if x.tag is not None else None)])