diff --git a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td --- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td +++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td @@ -1957,8 +1957,9 @@ def HoistRedundantTensorSubsetsOp : Op { + [DeclareOpInterfaceMethods, + TransformEachOpTrait, + TransformOpInterface]> { let description = [{ Hoists supported tensor subset extract/insert operation pairs out of immediately enclosing loop iteratively, if the following conditions @@ -1978,18 +1979,18 @@ #### Return modes: - The operation always succeeds and returns a handle to the transformed - function op. + The operation always succeeds and returns nothing. }]; let arguments = (ins TransformHandleTypeInterface:$target); - let results = (outs TransformHandleTypeInterface:$transformed); + let results = (outs); - let assemblyFormat = "$target attr-dict `:` functional-type(operands, results) "; + let assemblyFormat = [{ + $target + attr-dict + `:` functional-type(operands, results) + }]; - let builders = [ - OpBuilder<(ins "Value":$target)>, - ]; let extraClassDeclaration = [{ ::mlir::DiagnosedSilenceableFailure applyToOne( ::mlir::Operation *target, diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp --- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp @@ -3197,9 +3197,7 @@ IRRewriter rewriter(target->getContext()); auto forOp = dyn_cast(target); if (forOp) { - scf::ForOp newForOp = - linalg::hoistRedundantSubsetExtractInsert(rewriter, forOp); - results.push_back(newForOp); + linalg::hoistRedundantSubsetExtractInsert(rewriter, forOp); return DiagnosedSilenceableFailure::success(); } @@ -3208,10 +3206,15 @@ target->walk([&](scf::ForOp forOp) { hoistRedundantSubsetExtractInsert(rewriter, forOp); }); - results.push_back(target); return DiagnosedSilenceableFailure::success(); } +void transform::HoistRedundantTensorSubsetsOp::getEffects( + SmallVectorImpl &effects) { + transform::onlyReadsHandle(getTarget(), effects); + transform::modifiesPayload(effects); +} + //===----------------------------------------------------------------------===// // InsertSliceToCopyOp //===----------------------------------------------------------------------===//