Rename PadTensorToSubTensorInsert to more representative PadTensorToInsertSlice (#9616)
subtensor_insert has been replaced by tensor.insert_slice, so
renaming the pass to make it more representative of current op naming.
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/BUILD b/compiler/src/iree/compiler/Dialect/Flow/Transforms/BUILD
index b4f9fdd..55409ba 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/BUILD
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/BUILD
@@ -54,7 +54,7 @@
"OptimizeNumerics.cpp",
"OutlineDispatchRegions.cpp",
"PadLinalgOps.cpp",
- "PadTensorToSubTensorInsert.cpp",
+ "PadTensorToTensorInsertSlice.cpp",
"PassDetail.h",
"Passes.cpp",
"SplitReduction.cpp",
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/CMakeLists.txt b/compiler/src/iree/compiler/Dialect/Flow/Transforms/CMakeLists.txt
index 5c9060a..e898e01 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/CMakeLists.txt
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/CMakeLists.txt
@@ -50,7 +50,7 @@
"OptimizeNumerics.cpp"
"OutlineDispatchRegions.cpp"
"PadLinalgOps.cpp"
- "PadTensorToSubTensorInsert.cpp"
+ "PadTensorToTensorInsertSlice.cpp"
"PassDetail.h"
"Passes.cpp"
"SplitReduction.cpp"
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/PadTensorToSubTensorInsert.cpp b/compiler/src/iree/compiler/Dialect/Flow/Transforms/PadTensorToTensorInsertSlice.cpp
similarity index 89%
rename from compiler/src/iree/compiler/Dialect/Flow/Transforms/PadTensorToSubTensorInsert.cpp
rename to compiler/src/iree/compiler/Dialect/Flow/Transforms/PadTensorToTensorInsertSlice.cpp
index c60f88b..787257b 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/PadTensorToSubTensorInsert.cpp
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/PadTensorToTensorInsertSlice.cpp
@@ -4,9 +4,9 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//===- PadTensorToSubTensorInsert.cpp - Pass to legalize linalg.pad_tensor-===//
+//===- PadTensorToInsertSlice.cpp - Pass to legalize linalg.pad_tensor-===//
//
-// Pass to convert linalg.pad_tensor to linalg.fill + subtensor_insert
+// Pass to convert linalg.pad_tensor to linalg.fill + tensor.insert_slice
// operations which is the only way Vulkan backend can lower it to a single
// kernel.
//
@@ -31,8 +31,9 @@
namespace Flow {
namespace {
-/// Pattern to convert a linalg.pad_tensor operation into a fill + subtensor
-/// insert. This is needed till pad_tensor op can be fused with its consumers.
+/// Pattern to convert a linalg.pad_tensor operation into a fill + tensor
+/// insert_slice. This is needed till pad_tensor op can be fused with its
+/// consumers.
struct PadTensorOpConversion : public OpRewritePattern<tensor::PadOp> {
using OpRewritePattern<tensor::PadOp>::OpRewritePattern;
@@ -102,8 +103,9 @@
}
};
-struct PadTensorToSubTensorInsertPass
- : public PadTensorToSubTensorInsertBase<PadTensorToSubTensorInsertPass> {
+struct PadTensorToTensorInsertSlicePass
+ : public PadTensorToTensorInsertSliceBase<
+ PadTensorToTensorInsertSlicePass> {
void getDependentDialects(DialectRegistry ®istry) const override {
registry
.insert<linalg::LinalgDialect, memref::MemRefDialect, func::FuncDialect,
@@ -123,8 +125,8 @@
} // namespace
-std::unique_ptr<Pass> createPadTensorToSubTensorInsertPass() {
- return std::make_unique<PadTensorToSubTensorInsertPass>();
+std::unique_ptr<Pass> createPadTensorToTensorInsertSlicePass() {
+ return std::make_unique<PadTensorToTensorInsertSlicePass>();
}
} // namespace Flow
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.cpp b/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.cpp
index 81452d0..b12d685 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.cpp
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.cpp
@@ -214,7 +214,7 @@
FunctionLikeNest(passManager)
// Pad tensors.
.addPredicatedPass((!clEnableFusePaddingIntoConsumerOps),
- IREE::Flow::createPadTensorToSubTensorInsertPass)
+ IREE::Flow::createPadTensorToTensorInsertSlicePass)
// Preprocess the input to a form more amenable for fusion
// - Convert all elementwise ops to Linalg
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.h b/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.h
index 7483156..429af12 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.h
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.h
@@ -81,7 +81,7 @@
// Pass to convert a linalg.pad_tensor operation into a linalg.fill +
// subtensor_insert. This allows lowering the operation into a single kernel.
-std::unique_ptr<Pass> createPadTensorToSubTensorInsertPass();
+std::unique_ptr<Pass> createPadTensorToTensorInsertSlicePass();
// Pass to convert a linalg.matmul into linalg.mmt4d given some target ISA
// information currently passed as pass options.
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.td b/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.td
index 523f3c6..d8a4e90 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.td
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.td
@@ -155,10 +155,10 @@
];
}
-def PadTensorToSubTensorInsert :
- Pass<"iree-flow-pad-tensor-to-subtensor-insert", ""> {
- let summary = "Convert linalg.pad_tensor into linalg.fill + subtensor_insert";
- let constructor = "mlir::iree_compiler::IREE::Flow::createPadTensorToSubTensorInsertPass()";
+def PadTensorToTensorInsertSlice :
+ Pass<"iree-flow-pad-tensor-to-tensor-insert-slice", ""> {
+ let summary = "Convert linalg.pad_tensor into linalg.fill + tensor.insert_slice";
+ let constructor = "mlir::iree_compiler::IREE::Flow::createPadTensorToTensorInsertSlicePass()";
}
def DumpDispatchGraph : Pass<"iree-flow-dump-dispatch-graph-pass"> {
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/test/pad_tensor_to_tensor.mlir b/compiler/src/iree/compiler/Dialect/Flow/Transforms/test/pad_tensor_to_tensor.mlir
index 0d59859..bda35ad 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/test/pad_tensor_to_tensor.mlir
+++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/test/pad_tensor_to_tensor.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-opt --split-input-file --iree-flow-pad-tensor-to-subtensor-insert --canonicalize %s | FileCheck %s
+// RUN: iree-opt --split-input-file --iree-flow-pad-tensor-to-tensor-insert-slice --canonicalize %s | FileCheck %s
module {
func.func @pad_tensor(%arg0 : tensor<?x?xf32>, %arg1 : tensor<f32>, %arg2 : index, %arg3 : index) -> tensor<?x?xf32> {