[Mlir-commits] [mlir] [mlir][linalg] Add more precise memory effects to linalg op (PR #92079)
Matthias Springer
llvmlistbot at llvm.org
Thu May 23 07:07:14 PDT 2024
================
@@ -289,6 +289,9 @@ def MapOp : LinalgStructuredBase_Op<"map", [
bool payloadUsesValueFromOperand(OpOperand * opOperand) {
if (isDpsInit(opOperand)) return false;
+ if (getOperation()->getRegion(0).empty()) {
+ return true;
+ }
----------------
matthias-springer wrote:
Oh, I see. The op is already inserted even though it was not fully constructed yet (region missing). Ideally, we would change the `BufferizableOpInterface` impl., so that we insert the op only when it is fully constructed.
I think it's important to keep the `LinalgOp` interface clean and we should have to account for edge cases in the bufferization there.
Could you change the implementation in `Linalg/Transforms/BufferizableOpInterfaceImpl.cpp` such that it clones the op without regions without a builder. Basically using `Operation::create(OpState)` (instead of `cloneOpWithoutRegions`). Then inline the region. Then `rewriter.insert`. Then the callback in the bufferization will be triggered on a fully constructed and valid op.
https://github.com/llvm/llvm-project/pull/92079
More information about the Mlir-commits
mailing list