[Mlir-commits] [mlir] 659586b - [mlir][linalg] Remove padding test pass (NFC).

Tobias Gysi llvmlistbot at llvm.org
Wed Nov 10 07:34:06 PST 2021


Author: Tobias Gysi
Date: 2021-11-10T15:33:26Z
New Revision: 659586bf1986e08a371defa25b95be2a35bb960b

URL: https://github.com/llvm/llvm-project/commit/659586bf1986e08a371defa25b95be2a35bb960b
DIFF: https://github.com/llvm/llvm-project/commit/659586bf1986e08a371defa25b95be2a35bb960b.diff

LOG: [mlir][linalg] Remove padding test pass (NFC).

Remove padding test pass that was replaced by CodegenStrategy.

Depends On D113411

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D113412

Added: 
    

Modified: 
    mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
index 863ac1693d6a5..e394d3f0c4528 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
@@ -93,9 +93,6 @@ struct TestLinalgTransforms
       *this, "test-tile-scalarize-dynamic-dims",
       llvm::cl::desc("Test tiling of dynamic dims by 1"),
       llvm::cl::init(false)};
-  Option<bool> testPadPattern{*this, "test-pad-pattern",
-                              llvm::cl::desc("Test pad pattern"),
-                              llvm::cl::init(false)};
   Option<bool> testTransformPadTensor{
       *this, "test-transform-pad-tensor",
       llvm::cl::desc("Test transform pad tensor by copying with generic ops"),
@@ -109,14 +106,6 @@ struct TestLinalgTransforms
       llvm::cl::desc("Test rewrite of subtensor(pad_tensor) into "
                      "pad_tensor(subtensor)"),
       llvm::cl::init(false)};
-  ListOption<int64_t> packPaddings{
-      *this, "pack-paddings",
-      llvm::cl::desc("Operand packing flags when test-pad-pattern"),
-      llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated};
-  ListOption<int64_t> hoistPaddings{
-      *this, "hoist-paddings",
-      llvm::cl::desc("Operand hoisting depths when test-pad-pattern"),
-      llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated};
   ListOption<int64_t> peeledLoops{
       *this, "peeled-loops",
       llvm::cl::desc("Loops to be peeled when test-tile-pattern"),
@@ -594,14 +583,6 @@ static void applyExtractSliceOfPadTensorSwapPattern(FuncOp funcOp) {
   (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
 }
 
-// For now, just assume it is the zero of type.
-// In the future, it should be the zero of type + op.
-static Value getNeutralOfLinalgOp(OpBuilder &b, OpOperand &op) {
-  auto t = getElementTypeOrSelf(op.get());
-  return b.create<arith::ConstantOp>(op.getOwner()->getLoc(), t,
-                                     b.getZeroAttr(t));
-}
-
 static void applyTilePattern(FuncOp funcOp, std::string loopType,
                              ArrayRef<int64_t> tileSizes,
                              ArrayRef<int64_t> peeledLoops,
@@ -631,30 +612,6 @@ static void applyTilePattern(FuncOp funcOp, std::string loopType,
   (void)applyPatternsAndFoldGreedily(funcOp, std::move(tilingPattern));
 }
 
-static void applyPadPattern(FuncOp funcOp, ArrayRef<int64_t> packPaddings,
-                            ArrayRef<int64_t> hoistPaddings) {
-  MLIRContext *context = funcOp.getContext();
-  RewritePatternSet padPattern(context);
-  auto linalgPaddingOptions = linalg::LinalgPaddingOptions();
-  auto packFunc = [&](OpOperand &opOperand) {
-    return opOperand.getOperandNumber() < packPaddings.size()
-               ? packPaddings[opOperand.getOperandNumber()]
-               : false;
-  };
-  auto hoistingFunc = [&](OpOperand &opOperand) {
-    return opOperand.getOperandNumber() < hoistPaddings.size()
-               ? hoistPaddings[opOperand.getOperandNumber()]
-               : 0;
-  };
-  linalgPaddingOptions.setPaddingValueComputationFunction(getNeutralOfLinalgOp);
-  linalgPaddingOptions.setPaddingNoFoldComputationFunction(packFunc);
-  linalgPaddingOptions.setPaddingHoistComputationFunction(hoistingFunc);
-  padPattern.add<LinalgPaddingPattern>(
-      context, linalgPaddingOptions,
-      LinalgTransformationFilter(Identifier::get("pad", context)));
-  (void)applyPatternsAndFoldGreedily(funcOp, std::move(padPattern));
-}
-
 static void applyInterchangePattern(FuncOp funcOp,
                                     ArrayRef<unsigned> interchangeVector) {
   MLIRContext *context = funcOp.getContext();
@@ -785,8 +742,6 @@ void TestLinalgTransforms::runOnFunction() {
   if (testTileScalarizeDynamicDims)
     return applyTilePattern(getFunction(), loopType, tileSizes,
                             /*peeledLoops=*/{}, /*scalarizeDynamicDims=*/true);
-  if (testPadPattern)
-    return applyPadPattern(getFunction(), packPaddings, hoistPaddings);
   if (testInterchangePattern.hasValue())
     return applyInterchangePattern(getFunction(), testInterchangePattern);
   if (testDecomposeConvolutionPattern)


        


More information about the Mlir-commits mailing list