diff --git a/mlir/include/mlir/Interfaces/TilingInterface.td b/mlir/include/mlir/Interfaces/TilingInterface.td --- a/mlir/include/mlir/Interfaces/TilingInterface.td +++ b/mlir/include/mlir/Interfaces/TilingInterface.td @@ -72,19 +72,12 @@ `getIterationDomain`. The caller provides the information of the tile within this iteration space whose implementation the caller needs. - - `dest` are the Value into which the result of the tiled - operation is to be inserted into. The type of the `dest` - Values is same as the types returned by - `getDestinationOperands` method. - `offsets` provides the offset of the tile in the coordinate system of the original iteration space, i.e., if an iteration space dimension had non-zero offset, it must be included in the offset provided here (as opposed to zero-based offset "relative" to the iteration space). - `sizes` provides the size of the tile. - - `tileDestOperands` specifies whether to also tile `dest` operands - or not. Avoiding tiling `dest` operands can be useful for - composition with various looping container ops. The method returns the operation that is the tiled implementation. @@ -93,10 +86,8 @@ /*methodName=*/"getTiledImplementation", /*args=*/(ins "OpBuilder &":$b, - "ValueRange ":$dest, "ArrayRef ":$offsets, - "ArrayRef ":$sizes, - "bool ":$tileDestOperands), + "ArrayRef ":$sizes), /*methodBody=*/"", /*defaultImplementation=*/[{ return {}; @@ -140,29 +131,20 @@ tiled to generate the result tile. In practical terms this implies it cannot be tiled and fused with its consumers. - - `dest` are the Value into which the result of the tiled - operation is to be inserted into. The type of the `dest` - Values is same as the types returned by - `getDestinationOperands` method. - `offsets` provides the offset of the tile in the coordinate system of the original iteration space, i.e., if an iteration space dimension had non-zero offset, it must be included in the offset provided here (as opposed to zero-based offset "relative" to the iteration space). - `sizes` provides the size of the tile. - - `tileDestOperands` specifies whether to also tile `dest` operands - or not. Avoiding tiling `dest` operands can be useful for - composition with various looping container ops. }], /*retType=*/"FailureOr", /*methodName=*/"generateResultTileValue", /*args=*/(ins "OpBuilder &":$b, "unsigned":$resultNumber, - "ValueRange":$dest, "ArrayRef":$offsets, - "ArrayRef":$sizes, - "bool":$tileDestOperands), + "ArrayRef":$sizes), /*methodBody=*/"", /*defaultImplementation=*/[{ return failure(); 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 @@ -242,9 +242,6 @@ if (sliceOps.empty()) return failure(); - SmallVector destinationOperands = - tileableProducer.getDestinationOperands(rewriter); - // Try to fuse the producer in-place. SmallVector fusedOps; for (tensor::ExtractSliceOp sliceOp : sliceOps) { @@ -253,8 +250,8 @@ // Tile the producer. FailureOr tiledProducer = tileableProducer.generateResultTileValue( - rewriter, /*resultNumber=*/0, destinationOperands, - sliceOp.getMixedOffsets(), sliceOp.getMixedSizes(), true); + rewriter, /*resultNumber=*/0, sliceOp.getMixedOffsets(), + sliceOp.getMixedSizes()); if (failed(tiledProducer)) return failure(); fusedOps.push_back(tiledProducer->getDefiningOp()); diff --git a/mlir/lib/Dialect/Linalg/Transforms/Split.cpp b/mlir/lib/Dialect/Linalg/Transforms/Split.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Split.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Split.cpp @@ -42,8 +42,7 @@ // Create the part as it it were a single tile. SmallVector tiled = - op.getTiledImplementation(b, resultOperands, offsetsCopy, sizesCopy, - /*tileDestOperands=*/true); + op.getTiledImplementation(b, offsetsCopy, sizesCopy); assert(tiled.size() == 1 && "expected a single result from tiling"); auto part = cast(tiled.front()); diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -318,8 +318,7 @@ } SmallVector tiledOps = - op.getTiledImplementation(b, destOperands, tiledOffsets, tiledSizes, - /*tileDestOperands=*/true); + op.getTiledImplementation(b, tiledOffsets, tiledSizes); assert(tiledOps.size() == 1 && "expected a single produced tiled op"); tiledOp = tiledOps.front(); diff --git a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp @@ -118,10 +118,9 @@ // Instantiate the tiled implementation of the operation. SmallVector - getTiledImplementation(Operation *op, OpBuilder &b, ValueRange dest, + getTiledImplementation(Operation *op, OpBuilder &b, ArrayRef offsets, - ArrayRef sizes, - bool tileDestOperands) const { + ArrayRef sizes) const { // Leave the `sizeBounds` value empty. That is only needed when the `sizes` // specified could lead to out of bounds accesses. Location loc = op->getLoc(); @@ -172,10 +171,8 @@ FailureOr generateResultTileValue(Operation *op, OpBuilder &b, unsigned resultNumber, - ValueRange dest, ArrayRef offsets, - ArrayRef sizes, - bool tileDestOperands) const { + ArrayRef sizes) const { auto linalgOp = cast(op); // Check that the indexing map used for the output is a projected @@ -210,7 +207,7 @@ } SmallVector tiledOp = tilingInterfaceOp.getTiledImplementation( - b, dest, iterationTileOffsets, iterationTileSizes, tileDestOperands); + b, iterationTileOffsets, iterationTileSizes); if (tiledOp.size() != 1) return op->emitOpError("failed to generate tiled implementation"); diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp --- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp @@ -257,8 +257,8 @@ if (!tilingResult.loops.empty()) rewriter.setInsertionPoint( tilingResult.loops.back().getBody()->getTerminator()); - SmallVector tiledImplementation = op.getTiledImplementation( - rewriter, op.getDestinationOperands(rewriter), offsets, sizes, true); + SmallVector tiledImplementation = + op.getTiledImplementation(rewriter, offsets, sizes); if (tiledImplementation.size() != 1) { return rewriter.notifyMatchFailure( op, "expected tiled implementation to return a single op"); diff --git a/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp --- a/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp @@ -61,10 +61,9 @@ } SmallVector - getTiledImplementation(Operation *op, OpBuilder &b, ValueRange dest, + getTiledImplementation(Operation *op, OpBuilder &b, ArrayRef offsets, - ArrayRef sizes, - bool /*tileDestOperands*/) const { + ArrayRef sizes) const { Operation *result = tensor::bubbleUpPadSlice(b, cast(op), offsets, sizes); if (!result) diff --git a/mlir/lib/Dialect/Tensor/Transforms/SwapExtractSliceWithProducer.cpp b/mlir/lib/Dialect/Tensor/Transforms/SwapExtractSliceWithProducer.cpp --- a/mlir/lib/Dialect/Tensor/Transforms/SwapExtractSliceWithProducer.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/SwapExtractSliceWithProducer.cpp @@ -33,9 +33,8 @@ return failure(); FailureOr tiledResult = producerOp.generateResultTileValue( - builder, producer.getResultNumber(), - producerOp.getDestinationOperands(builder), sliceOp.getMixedOffsets(), - sliceOp.getMixedSizes(), true); + builder, producer.getResultNumber(), sliceOp.getMixedOffsets(), + sliceOp.getMixedSizes()); if (failed(tiledResult)) return failure();