[Mlir-commits] [mlir] 3af1c48 - Changes to `SCFFuseProducerOfSliceResult` to also return the operations created during fusion.
Mahesh Ravishankar
llvmlistbot at llvm.org
Mon Mar 20 13:56:02 PDT 2023
Author: Mahesh Ravishankar
Date: 2023-03-20T20:55:48Z
New Revision: 3af1c48c66a3cf906bd35c2a6e9d96b28ad19438
URL: https://github.com/llvm/llvm-project/commit/3af1c48c66a3cf906bd35c2a6e9d96b28ad19438
DIFF: https://github.com/llvm/llvm-project/commit/3af1c48c66a3cf906bd35c2a6e9d96b28ad19438.diff
LOG: Changes to `SCFFuseProducerOfSliceResult` to also return the operations created during fusion.
This is follow up to https://reviews.llvm.org/D145133 that allows
propogating information about ops that are fused back to the caller.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D146254
Added:
Modified:
mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h b/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
index 5e03eccfc2f3a..e7bcd062d9652 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
@@ -96,6 +96,7 @@ struct SCFTileAndFuseOptions {
struct SCFFuseProducerOfSliceResult {
OpResult origProducer; // Original untiled producer.
Value tiledAndFusedProducer; // Tile and fused producer value.
+ SmallVector<Operation *> tiledOps;
};
std::optional<SCFFuseProducerOfSliceResult>
tileAndFuseProducerOfSlice(RewriterBase &rewriter,
diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
index 6706f54662839..ec116df700aae 100644
--- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
@@ -604,7 +604,8 @@ mlir::scf::tileAndFuseProducerOfSlice(RewriterBase &rewriter,
}
}
return scf::SCFFuseProducerOfSliceResult{fusableProducer,
- tileAndFuseResult->tiledValues[0]};
+ tileAndFuseResult->tiledValues[0],
+ tileAndFuseResult->tiledOps};
}
/// Reconstruct the fused producer from within the tiled-and-fused code.
@@ -612,7 +613,8 @@ void mlir::scf::yieldReplacementForFusedProducer(
RewriterBase &rewriter, tensor::ExtractSliceOp sliceOp,
scf::SCFFuseProducerOfSliceResult fusedProducerInfo,
MutableArrayRef<scf::ForOp> loops) {
- auto [fusableProducer, fusedProducerValue] = fusedProducerInfo;
+ auto [fusableProducer, fusedProducerValue, tileAndFusedOps] =
+ fusedProducerInfo;
SmallVector<Value> initValues;
FailureOr<Value> initValue = tensor::getOrCreateDestination(
rewriter, fusableProducer.getOwner()->getLoc(), fusableProducer);
@@ -623,8 +625,11 @@ void mlir::scf::yieldReplacementForFusedProducer(
yieldTiledValues(rewriter, initValue.value(), fusedProducerValue,
resultOffsets, resultSizes, loops);
}
- if (auto dstStyleProducer =
- fusedProducerValue.getDefiningOp<DestinationStyleOpInterface>()) {
+ for (auto tileAndFusedOp : tileAndFusedOps) {
+ auto dstStyleProducer =
+ dyn_cast<DestinationStyleOpInterface>(tileAndFusedOp);
+ if (!dstStyleProducer)
+ continue;
Value dstValue =
dstStyleProducer.getDpsInitOperand(fusableProducer.getResultNumber())
->get();
More information about the Mlir-commits
mailing list