[mlir][Linalg] Add method to check if LinalgTransformationFilter has been applied.

Differential Revision: https://reviews.llvm.org/D114170
This commit is contained in:
MaheshRavishankar 2021-11-18 13:42:23 -08:00
parent 27ea67136e
commit d26beb0be2
2 changed files with 10 additions and 0 deletions

View File

@ -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)

View File

@ -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");