remove gbarrier on const (#10656)

This commit is contained in:
qazal
2025-06-06 02:36:52 +03:00
committed by GitHub
parent ff1aad7b69
commit 884b6cf288

View File

@@ -537,6 +537,8 @@ finalize_gbarrier = PatternMatcher([
(UPat((Ops.GBARRIER, Ops.CONTIGUOUS), src=(UPat(Ops.GBARRIER),), name="x"), lambda x: x.src[0]),
# add contiguous to VIEW before GBARRIER
(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]),
])
remove_tags = PatternMatcher([(UPat(GroupOp.All, name="x"), lambda x: x.replace(tag=None) if x.tag is not None else None)])