-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir] fix affine-loop-fusion crash #76351
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
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-affine Author: long.chen (lipracer) ChangesFull diff: https://github.com/llvm/llvm-project/pull/76351.diff 1 Files Affected:
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
index 66d921b4889f59..2140ff66b1a676 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -205,7 +205,8 @@ static bool isEscapingMemref(Value memref, Block *block) {
// (e.g., call ops, alias creating ops, etc.).
return llvm::any_of(memref.getUsers(), [&](Operation *user) {
// Ignore users outside of `block`.
- if (block->getParent()->findAncestorOpInRegion(*user)->getBlock() != block)
+ auto ancestorOp = block->getParent()->findAncestorOpInRegion(*user);
+ if (!ancestorOp || ancestorOp->getBlock() != block)
return false;
return !isa<AffineMapAccessInterface>(*user);
});
|
Can you add a test which shows that #76281 is fixed? Preferably, also simplify the code from #76281 a bit so that the test is relatively simple. Without such a test, we might need to fix this issue again in the future. Also, add |
8417aac
to
7d7addb
Compare
7d7addb
to
79a7625
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.
Apart from the suggestion and assuming the buildkite tests pass, this LGTM. Thanks for fixing the bug.
I've added |
7691532
to
0fc71ce
Compare
…0dd27ca83 Local branch amd-gfx 7be0dd2 Merged main:52770d83bf00fc56e9496e32f083f0f940bf7315 into amd-gfx:a59cc49ff7ab Remote branch main eaa32d2 [mlir] fix affine-loop-fusion crash (llvm#76351)
If
user
not lies inRegion
findAncestorOpInRegion
will returnnullptr
.Fixes #76281.