[Mlir-commits] [mlir] 0eeaad3 - [mlir][Linalg] Fix insertion point in comprehensive bufferization
Nicolas Vasilache
llvmlistbot at llvm.org
Thu Oct 14 08:24:31 PDT 2021
Author: Nicolas Vasilache
Date: 2021-10-14T15:24:09Z
New Revision: 0eeaad3012afbd3b479a8201aa67eefee137804e
URL: https://github.com/llvm/llvm-project/commit/0eeaad3012afbd3b479a8201aa67eefee137804e
DIFF: https://github.com/llvm/llvm-project/commit/0eeaad3012afbd3b479a8201aa67eefee137804e.diff
LOG: [mlir][Linalg] Fix insertion point in comprehensive bufferization
Added:
Modified:
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
index 4533928ace609..92337cae41136 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
@@ -1369,7 +1369,7 @@ createNewAllocDeallocPairForShapedValue(OpBuilder &b, Location loc,
b.setInsertionPointToStart(bbArg.getOwner());
loc = bbArg.getOwner()->getParentOp()->getLoc();
} else {
- b.setInsertionPointAfter(shapedValue.getDefiningOp());
+ b.setInsertionPoint(shapedValue.getDefiningOp());
loc = shapedValue.getDefiningOp()->getLoc();
}
diff --git a/mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir b/mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir
index 6d300e5cde368..07966f57255ea 100644
--- a/mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir
+++ b/mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir
@@ -755,3 +755,24 @@ func @tensor_cast_not_in_place(
return %r1 : tensor<?xf32>
}
+// -----
+
+//===----------------------------------------------------------------------===//
+// Insertion point cases.
+//===----------------------------------------------------------------------===//
+
+/// These tests just check the produced IR is valid and does not have dominance
+/// errors in the def-use chains.
+
+// CHECK-LABEL: func @dominance_violation_bug_1
+func @dominance_violation_bug_1(%A : tensor<?x?xf32>, %idx : index) -> tensor<?x?xf32> {
+ %f0 = arith.constant 0.0 : f32
+
+ %sA = tensor.extract_slice %A[0, 0][%idx, %idx][1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
+ %ssA = tensor.extract_slice %sA[0, 0][4, 4][1, 1] : tensor<?x?xf32> to tensor<4x4xf32>
+ %FA = linalg.fill(%f0, %ssA) : f32, tensor<4x4xf32> -> tensor<4x4xf32>
+ %rsA = tensor.insert_slice %FA into %sA[0, 0][4, 4][1, 1] : tensor<4x4xf32> into tensor<?x?xf32>
+ %rA = tensor.insert_slice %rsA into %A[0, 0][%idx, %idx][1, 1] : tensor<?x?xf32> into tensor<?x?xf32>
+
+ return %rA : tensor<?x?xf32>
+}
More information about the Mlir-commits
mailing list