[Mlir-commits] [mlir] 2c3ba9f - [mlir][Linalg] Unrestrict redundant transfer hoisting from func.func (#79516)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Feb 10 20:01:18 PST 2024
Author: Quinn Dawkins
Date: 2024-02-10T23:01:14-05:00
New Revision: 2c3ba9f6225612caf7d2d5ba6613ba1454d52dc3
URL: https://github.com/llvm/llvm-project/commit/2c3ba9f6225612caf7d2d5ba6613ba1454d52dc3
DIFF: https://github.com/llvm/llvm-project/commit/2c3ba9f6225612caf7d2d5ba6613ba1454d52dc3.diff
LOG: [mlir][Linalg] Unrestrict redundant transfer hoisting from func.func (#79516)
All the hoistRedundantVectorTransfers op does is walk the target
operation, which does not have to be restricted to func.func.
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
index 921c3c3e8c7db6..186e83a57580f3 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
@@ -10,10 +10,8 @@
#define MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_
namespace mlir {
+class Operation;
class RewriterBase;
-namespace func {
-class FuncOp;
-} // namespace func
namespace scf {
class ForOp;
} // namespace scf
@@ -43,7 +41,7 @@ namespace linalg {
///
/// WARNING: This hoisting does not model parallelism and is generally incorrect
/// when used on distributed loops with memref semantics!
-void hoistRedundantVectorTransfers(func::FuncOp func);
+void hoistRedundantVectorTransfers(Operation *root);
} // namespace linalg
} // namespace mlir
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
index 80ce97ee3437a5..34c9b2c282965c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
@@ -73,16 +73,16 @@ static bool noAliasingUseInLoop(vector::TransferReadOp transferRead,
return true;
}
-void mlir::linalg::hoistRedundantVectorTransfers(func::FuncOp func) {
+void mlir::linalg::hoistRedundantVectorTransfers(Operation *root) {
bool changed = true;
while (changed) {
changed = false;
// First move loop invariant ops outside of their loop. This needs to be
// done before as we cannot move ops without interrupting the function walk.
- func.walk(
+ root->walk(
[&](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); });
- func.walk([&](vector::TransferReadOp transferRead) {
+ root->walk([&](vector::TransferReadOp transferRead) {
if (!isa<MemRefType>(transferRead.getShapedType()))
return WalkResult::advance();
More information about the Mlir-commits
mailing list