Skip to content

Commit 32a5adb

Browse files
authored
[MLIR][Linalg] Rename convolution pass (#154400)
Rename the pass `LinalgNamedOpConversionPass` to `SimplifyDepthwiseConvPass` to avoid conflating it with the new morphisms we are creating between the norms.
1 parent a53e73e commit 32a5adb

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

mlir/include/mlir/Dialect/Linalg/Passes.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ def LinalgSpecializeGenericOpsPass : Pass<"linalg-specialize-generic-ops">,
8686
let dependentDialects = ["linalg::LinalgDialect"];
8787
}
8888

89-
def LinalgNamedOpConversionPass: Pass<"linalg-named-op-conversion"> {
90-
let summary = "Convert from one named linalg op to another.";
89+
// ------------------ End of "form" conversions
90+
91+
def SimplifyDepthwiseConvPass: Pass<"simplify-depthwise-conv"> {
92+
let summary = "Simplify depthwise convolution.";
9193
let dependentDialects = ["linalg::LinalgDialect", "tensor::TensorDialect"];
9294
}
9395

94-
// ------------------ End of "form" conversions
95-
9696
def ConvertElementwiseToLinalgPass : Pass<"convert-elementwise-to-linalg", ""> {
9797
let summary = "Convert ElementwiseMappable ops to linalg";
9898
let description = [{

mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,9 +1962,8 @@ void populateFoldAddIntoDestPatterns(RewritePatternSet &patterns);
19621962
void populateFuseTensorPadWithProducerLinalgOpPatterns(
19631963
RewritePatternSet &patterns);
19641964

1965-
/// Patterns to convert from one named op to another. These can be seen as
1966-
/// canonicalizations of named ops into another named op.
1967-
void populateLinalgNamedOpConversionPatterns(RewritePatternSet &patterns);
1965+
/// Patterns to simplify depthwise convolutions.
1966+
void populateSimplifyDepthwiseConvPatterns(RewritePatternSet &patterns);
19681967

19691968
/// Patterns to fold unit-extent dimensions in operands/results of linalg ops on
19701969
/// tensors via reassociative reshape ops.

mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ add_mlir_dialect_library(MLIRLinalgTransforms
2626
MorphOps.cpp
2727
TransposeMatmul.cpp
2828
ShardingInterfaceImpl.cpp
29-
NamedOpConversions.cpp
29+
SimplifyDepthwiseConv.cpp
3030
NamedToElementwise.cpp
3131
BlockPackMatmul.cpp
3232
PackAndUnpackPatterns.cpp

mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp renamed to mlir/lib/Dialect/Linalg/Transforms/SimplifyDepthwiseConv.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "llvm/ADT/TypeSwitch.h"
2222

2323
namespace mlir {
24-
#define GEN_PASS_DEF_LINALGNAMEDOPCONVERSIONPASS
24+
#define GEN_PASS_DEF_SIMPLIFYDEPTHWISECONVPASS
2525
#include "mlir/Dialect/Linalg/Passes.h.inc"
2626
} // namespace mlir
2727

@@ -143,23 +143,22 @@ struct SimplifyDepthwiseConvQOp
143143
}
144144
};
145145

146-
struct LinalgNamedOpConversionPass
147-
: public impl::LinalgNamedOpConversionPassBase<
148-
LinalgNamedOpConversionPass> {
149-
using impl::LinalgNamedOpConversionPassBase<
150-
LinalgNamedOpConversionPass>::LinalgNamedOpConversionPassBase;
146+
struct SimplifyDepthwiseConvPass
147+
: public impl::SimplifyDepthwiseConvPassBase<SimplifyDepthwiseConvPass> {
148+
using impl::SimplifyDepthwiseConvPassBase<
149+
SimplifyDepthwiseConvPass>::SimplifyDepthwiseConvPassBase;
151150

152151
void runOnOperation() override {
153152
Operation *op = getOperation();
154153
RewritePatternSet patterns(op->getContext());
155-
populateLinalgNamedOpConversionPatterns(patterns);
154+
populateSimplifyDepthwiseConvPatterns(patterns);
156155
if (failed(applyPatternsGreedily(op, std::move(patterns))))
157156
return signalPassFailure();
158157
}
159158
};
160159
} // namespace
161160

162-
void mlir::linalg::populateLinalgNamedOpConversionPatterns(
161+
void mlir::linalg::populateSimplifyDepthwiseConvPatterns(
163162
RewritePatternSet &patterns) {
164163
patterns.add<SimplifyDepthwiseConvOp, SimplifyDepthwiseConvQOp>(
165164
patterns.getContext());

mlir/test/Dialect/Linalg/namedop_conversion.mlir renamed to mlir/test/Dialect/Linalg/simplify-depthwise-conv.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt %s -linalg-named-op-conversion -split-input-file | FileCheck %s
1+
// RUN: mlir-opt %s --simplify-depthwise-conv -split-input-file | FileCheck %s
22

33
// CHECK-LABEL: @depthwise_conv
44
func.func @depthwise_conv(%arg0: tensor<?x?x?x?xf32>, %arg1: tensor<?x?x?x1xf32>, %arg2: tensor<?x?x?x?x1xf32>) -> tensor<?x?x?x?x1xf32> {

0 commit comments

Comments
 (0)