-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[mlir][linalg]-Fix wrong assertion in the getMatchingYieldValue inter… #89590
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-linalg Author: Amir Bishara (amirBish) Changes…face In order to have a consistent implementation for getMatchingYieldValue for linalg generic with buffer/tensor semantics, we should assert the opOperand index based on the numDpsInits and not numOfResults which may be zero in the buffer semantics. Full diff: https://github.com/llvm/llvm-project/pull/89590.diff 1 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
index fbf3f19cde0e9b..d20925da778e0a 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
@@ -486,7 +486,7 @@ def LinalgStructuredInterface
int64_t resultIndex =
opOperand->getOperandNumber() - $_op.getNumDpsInputs();
assert(resultIndex >= 0 &&
- resultIndex < this->getOperation()->getNumResults());
+ resultIndex < $_op.getNumDpsInits());
Operation *yieldOp = getBlock()->getTerminator();
return &yieldOp->getOpOperand(resultIndex);
}]
|
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.
Could you please add a test that would trigger the wrong assert?
Sure, should it be added as a unit test under |
If it's possible to trigger this with on some input IR with |
Thanks for the suggestion, just checked/searched there is no usage for this method in mlir sources. any insights about how to test the change? |
@ftynse ping :) |
d49e0c4
to
ae50df9
Compare
…face In order to have a consistent implementation for getMatchingYieldValue for linalg generic with buffer/tensor semantics, we should assert the opOperand index based on the numDpsInits and not numOfResults which may be zero in the buffer semantics.
7f51661
to
2cd284e
Compare
…face
In order to have a consistent implementation for getMatchingYieldValue for linalg generic with buffer/tensor semantics, we should assert the opOperand index based on the numDpsInits and not numOfResults which may be zero in the buffer semantics.