[Mlir-commits] [mlir] d26beb0 - [mlir][Linalg] Add method to check if LinalgTransformationFilter has been applied.
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 18 13:45:52 PST 2021
Author: MaheshRavishankar
Date: 2021-11-18T13:45:30-08:00
New Revision: d26beb0be22d3c4758712b6059400dcaf833e325
URL: https://github.com/llvm/llvm-project/commit/d26beb0be22d3c4758712b6059400dcaf833e325
DIFF: https://github.com/llvm/llvm-project/commit/d26beb0be22d3c4758712b6059400dcaf833e325.diff
LOG: [mlir][Linalg] Add method to check if LinalgTransformationFilter has been applied.
Differential Revision: https://reviews.llvm.org/D114170
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 8099fe9fed517..6c044bc26c934 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -437,6 +437,7 @@ struct LinalgTransformationFilter {
LogicalResult checkAndNotify(PatternRewriter &rewriter, Operation *op) const;
void replaceLinalgTransformationFilter(PatternRewriter &rewriter,
Operation *op) const;
+ bool hasReplacementFilter(Operation *op) const;
LinalgTransformationFilter &addFilter(FilterFunction f) {
if (f)
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
index 57cc48fd314c7..657f2b7605589 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
@@ -107,6 +107,15 @@ void mlir::linalg::LinalgTransformationFilter::
rewriter.getStringAttr(LinalgTransforms::kLinalgTransformMarker));
}
+bool mlir::linalg::LinalgTransformationFilter::hasReplacementFilter(
+ Operation *op) const {
+ if (!replacement)
+ return false;
+ auto attr = op->getAttr(LinalgTransforms::kLinalgTransformMarker)
+ .dyn_cast<StringAttr>();
+ return attr && attr == replacement.getValue();
+}
+
LinalgTilingOptions &
mlir::linalg::LinalgTilingOptions::setTileSizes(ArrayRef<int64_t> ts) {
assert(!tileSizeComputationFunction && "tile sizes already set");
More information about the Mlir-commits
mailing list