-
Notifications
You must be signed in to change notification settings - Fork 83
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
core: Implement MemrefLayoutAttr base class and use in parser. #2718
Conversation
Support AffineMaps in layout :D But also opens up to mark other attributes as acceptable as memref layouts. Interface methods left for future work for now!
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2718 +/- ##
=======================================
Coverage 89.86% 89.86%
=======================================
Files 367 367
Lines 47465 47468 +3
Branches 7234 7234
=======================================
+ Hits 42654 42659 +5
+ Misses 3698 3697 -1
+ Partials 1113 1112 -1 ☔ View full report in Codecov by Sentry. |
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 have tested this on the snax side, and everything works beautifully. Thanks a lot for your help on this!
Somewhat unrelated: the changes mix the use of isinstance
and isa
. When should one use which?
|
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.
Thanks for implementing this!
I do remember not implementing it properly, and I do really HATE what MLIR is doing here, but that's life.
It is one of the rare case in MLIR where parsing depends on an interface, which means here that if you want to use a memory layout that is unregistered, then the parsing will fail even though we may want it to work (Just saying this so you know in case you encounter this).
Good point; but how do you know if your unregistered attribute is a memory space or layout then? |
This is a barebone mimic of the upstream MemrefLayoutAttrInterface, as it does not implement any of the methods; only mark attributes as acceptable by the parser. This solve the parser problem though, and allow the same extensibility on accepted layouts.
The uniplemented methods were not implemented on the existing layout attributes anyway, so I'm in favor of just merging, moving on, and think about implementing them in an interface style later.