-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add CheckedOpRewritePattern
& CheckedOpTraitRewritePattern
#960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c9d0521
to
a935b8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't check all the patterns, but seems fine otherwise.
I'll note that it seems like a lot of the patterns already ought support dynamic, but we can follow up on that in a subsequent PR
if (res.failed()) | ||
return res; | ||
|
||
if (!((Child *)this)->supportsDynamicShapes()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see much value in CRTP here. The classes already have a vtable and we get to patterns through a vitrual call. A couple more won't change much, and I don't think the pattern infra cost is dominated by virtual calls. Maintainability-wise, it will be easier without.
Also, it may be worth it to declare matchAndRewrite
final.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wsmoses what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay either way, slight pref to leave as CRTP for ease/perf [esp since we already have]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case we can probably merge. All the other comments should have been addressed
supportsDynamicShapes()
-- opt in for patterns that support dynamic shapes. Once all patterns do we can switch the defaultdisablePatternAttrName()
-- allows providing a UnitAttr to the enclosing funcOpInterface to disable patterns. defaults to"enzymexla.disable_hlo_opts"