-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[MLIR] Add missing memory read effect on memref.reshape #117130
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
[MLIR] Add missing memory read effect on memref.reshape #117130
Conversation
Add missing memory read effect on memref.reshape. This in turn leads to analyses relying on memory effects making incorrect conclusions.
@llvm/pr-subscribers-mlir Author: Uday Bondhugula (bondhugula) ChangesAdd missing memory read effect on memref.reshape. This in turn leads to Full diff: https://github.com/llvm/llvm-project/pull/117130.diff 1 Files Affected:
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index c50df6ccd9aa56..a0d8d34f38237a 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -1529,7 +1529,8 @@ def MemRef_ReshapeOp: MemRef_Op<"reshape", [
}];
let arguments = (ins AnyRankedOrUnrankedMemRef:$source,
- MemRefRankOf<[AnySignlessInteger, Index], [1]>:$shape);
+ Arg<MemRefRankOf<[AnySignlessInteger, Index], [1]>,
+ "dynamically-sized shape", [MemRead]>:$shape);
let results = (outs AnyRankedOrUnrankedMemRef:$result);
let builders = [OpBuilder<
|
@llvm/pr-subscribers-mlir-memref Author: Uday Bondhugula (bondhugula) ChangesAdd missing memory read effect on memref.reshape. This in turn leads to Full diff: https://github.com/llvm/llvm-project/pull/117130.diff 1 Files Affected:
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index c50df6ccd9aa56..a0d8d34f38237a 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -1529,7 +1529,8 @@ def MemRef_ReshapeOp: MemRef_Op<"reshape", [
}];
let arguments = (ins AnyRankedOrUnrankedMemRef:$source,
- MemRefRankOf<[AnySignlessInteger, Index], [1]>:$shape);
+ Arg<MemRefRankOf<[AnySignlessInteger, Index], [1]>,
+ "dynamically-sized shape", [MemRead]>:$shape);
let results = (outs AnyRankedOrUnrankedMemRef:$result);
let builders = [OpBuilder<
|
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 fixing this.
That should be testable I think? We don't have a transformation where this can be visible? |
Yes, this should be testable. There are multiple affine analysis utilities that check for ops with mem read effects:
Any of the passes relying on these utilities (affine-scalrep and affine-licm) will be able to exercise this. I can construct a test case.
Now, S1 should not be dead if the read effect is properly defined on |
I suppose the intent of the question was to say that we should have a test to avoid regressing this behavior. |
Yes: @bondhugula can you actually add a test for this change? |
The memory read effect on a memref.reshape argument was missing. This in turn led to
analyses relying on memory effects making incorrect conclusions.