[Mlir-commits] [mlir] [MLIR][SCF] Fold dim ops of iter_args to respective init_args (PR #109973)
Prashant Kumar
llvmlistbot at llvm.org
Wed Sep 25 12:02:37 PDT 2024
================
@@ -1478,6 +1478,45 @@ struct DimOfForallOp : public OpRewritePattern<tensor::DimOp> {
}
};
+/// Fold dim ops of iter_args to dim ops of their respective init args. E.g.:
+///
+/// ```
+/// %0 = ... : tensor<?x?xf32>
+/// scf.forall ... shared_outs(%arg0 = %0) -> (tensor<?x?xf32>) {
+/// %1 = tensor.dim %arg0, %c0 : tensor<?x?xf32>
+/// ...
+/// }
+/// ```
+///
+/// is folded to:
+///
+/// ```
+/// %0 = ... : tensor<?x?xf32>
+/// scf.forall ... shared_outs(%arg0 = %0) -> (tensor<?x?xf32>) {
+/// %1 = tensor.dim %0, %c0 : tensor<?x?xf32>
+/// ...
+/// }
+/// ```
+struct DimOfForallIterArg : public OpRewritePattern<tensor::DimOp> {
----------------
pashu123 wrote:
How about adding here: https://github.com/llvm/llvm-project/blob/6786928c4fe1f9daf720d3b604987de2b013e70b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp#L132 the same pattern exist for `forop`?
https://github.com/llvm/llvm-project/pull/109973
More information about the Mlir-commits
mailing list