[Mlir-commits] [mlir] [NFC] Simplify the tiling implementation using cloning. (PR #72178)
Nicolas Vasilache
llvmlistbot at llvm.org
Wed Nov 15 04:34:09 PST 2023
================
@@ -624,46 +661,25 @@ mlir::scf::tileAndFuseProducerOfSlice(RewriterBase &rewriter,
//
// The untiled `linalg.fill` is still used as the `init_value` since it
// was originally a destination operand of the untiled `linalg.matmul`.
- // When fusing an operand that is a destination operand.
- // - Update the iter_arg of the outer most loop to use the destination
- // of the untiled producer.
- // - Update the destination of the slice of the tiled producer generated
- // to use the same basic block argument as the slice that was used to
- // generate inplace the tiled implementation of the producer.
- // With this the IR will be.
+ // When fusing an operand that is a destination operand, the iter_arg of
+ // the outer most loop should be changed to use the destination of the
+ // fused operation. With this the IR will be.
//
// ```
// %0 = linalg.init
// %1 = scf.for .. iter_args(%arg0 = %0 /* corrected value */ ) {
// %2 = scf.for .. iter_args(%arg1 = %arg0) {
- // %3 = tensor.extract_slice %arg1 /* corrected value */ [..]
+ // %3 = tensor.extract_slice %arg1[..]
// %4 = linalg.fill .. outs(%3 : )
// .. = linalg.matmul .. outs(%4 : )
// }
// }
// ```
- // TODO: This can be modeled better if the `DestinationStyleOpInterface`.
- // Update to use that when it does become available.
- scf::ForOp outerMostLoop = loops.front();
if (destinationInitArg &&
- (*destinationInitArg)->getOwner() == outerMostLoop) {
- unsigned iterArgNumber =
- outerMostLoop.getTiedLoopResult(*destinationInitArg).getResultNumber();
- int64_t resultNumber = fusableProducer.getResultNumber();
- if (auto dstOp =
- dyn_cast<DestinationStyleOpInterface>(fusableProducer.getOwner())) {
- (*destinationInitArg)
- ->set(dstOp.getTiedOpOperand(fusableProducer)->get());
- }
- for (auto tileAndFusedOp : tileAndFuseResult->tiledOps) {
- auto dstOp = dyn_cast<DestinationStyleOpInterface>(tileAndFusedOp);
- if (!dstOp)
- continue;
- scf::ForOp innerMostLoop = loops.back();
- updateDestinationOperandsForTiledOp(
----------------
nicolasvasilache wrote:
nice, +1 to better scoping.
https://github.com/llvm/llvm-project/pull/72178
More information about the Mlir-commits
mailing list