-
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
dialects: (memref) add custom syntax for memref_subview #2840
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2840 +/- ##
=======================================
Coverage 89.88% 89.89%
=======================================
Files 398 398
Lines 49609 49656 +47
Branches 7623 7630 +7
=======================================
+ Hits 44590 44636 +46
Misses 3824 3824
- Partials 1195 1196 +1 ☔ View full report in Codecov by Sentry. |
@@ -591,6 +595,9 @@ def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]: | |||
|
|||
@irdl_op_definition | |||
class Subview(IRDLOperation): | |||
|
|||
DYNAMIC_INDEX: ClassVar[int] = -9223372036854775808 |
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.
Obviously
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.
🔢
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.
Lovely, thanks!
I would be extra glad if you could get rid of the extra space between space brackets? But if it's more than 5 minutes of thinking, please just merge, it's obviously 100X better already 🙏
So I initially did it without the space, and then added it back in to be 1:1 conformant with MLIR syntax. |
// CHECK-NEXT: %{{.*}} = memref.subview %{{.*}}[0, 0] [1, 3] [1, 1] : memref<10x3xi32> to memref<3xi32> | ||
// CHECK-NEXT: %{{.*}} = memref.subview %{{.*}}[%{{.*}}, 0] [1, 3] [1, 1] : memref<10x3xi32> to memref<3xi32, strided<[1], offset: ?>> |
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.
@PapyChacal, this is the output from MLIR. It looks like the doc online disagrees, but I'd rather go with the MLIR we have as source of truth.
I tried to match MLIR exactly in the syntax, and found a bug in the stencil lowering, which lowers to an invalid memref subview. My understanding is that the subview must be a subview, and so negative offsets are not allowed.
I won't merge without someone from the stencil side of things approving the PR, but also I'd love to use this for the linalg to snitch project, so I'm hoping that we can resolve this soonish.