[Mlir-commits] [mlir] [NFC] Simplify the tiling implementation using cloning. (PR #72178)

Han-Chung Wang llvmlistbot at llvm.org
Tue Nov 14 10:14:52 PST 2023


================
@@ -583,17 +583,54 @@ mlir::scf::tileAndFuseProducerOfSlice(RewriterBase &rewriter,
                                         loops);
   if (!fusableProducer)
     return std::nullopt;
+  unsigned resultNumber = fusableProducer.getResultNumber();
 
-  // 2. Generate the tiled implementation of the producer of the source
   OpBuilder::InsertionGuard g(rewriter);
   rewriter.setInsertionPoint(candidateSliceOp);
+
+  // 2. Clone the fused producer
+  // 2a. Compute the destination operands to use for the cloned operation.
+  SmallVector<Value> origDestinationTensors, clonedOpDestinationTensors;
+  Operation *fusableProducerOp = fusableProducer.getOwner();
+  if (isa<DestinationStyleOpInterface>(fusableProducerOp)) {
+    if (failed(tensor::getOrCreateDestinations(
+            rewriter, fusableProducerOp->getLoc(), fusableProducerOp,
+            origDestinationTensors))) {
----------------
hanhanW wrote:

maybe we can just merge them into a single `if`?

https://github.com/llvm/llvm-project/pull/72178


More information about the Mlir-commits mailing list