Skip to content
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

Merged
merged 10 commits into from
Jul 5, 2024

Conversation

superlopuh
Copy link
Member

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.

@superlopuh superlopuh added the dialects Changes on the dialects label Jul 4, 2024
@superlopuh superlopuh self-assigned this Jul 4, 2024
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.89%. Comparing base (1f7b306) to head (131152d).

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.
📢 Have feedback on the report? Share it here.

Base automatically changed from sasha/ir/dynamic-lists to main July 5, 2024 10:53
@@ -591,6 +595,9 @@ def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:

@irdl_op_definition
class Subview(IRDLOperation):

DYNAMIC_INDEX: ClassVar[int] = -9223372036854775808
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔢

Copy link
Collaborator

@PapyChacal PapyChacal left a 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 🙏

@superlopuh
Copy link
Member Author

So I initially did it without the space, and then added it back in to be 1:1 conformant with MLIR syntax.

Comment on lines +51 to +52
// 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: ?>>
Copy link
Member Author

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.

@superlopuh superlopuh merged commit 4fb30cf into main Jul 5, 2024
10 checks passed
@superlopuh superlopuh deleted the sasha/memref-subview branch July 5, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants