[Mlir-commits] [mlir] [mlir] Allow unroll & jam on SCF loops with results (PR #98887)
Javier Setoain
llvmlistbot at llvm.org
Mon Jul 15 14:36:33 PDT 2024
================
@@ -500,6 +503,8 @@ static bool areInnerBoundsInvariant(scf::ForOp forOp) {
}
/// Unrolls and jams this loop by the specified factor.
+/// This function doesn't verify that the loop is parallel, if there are true
+/// loop carried dependencies, this function will produce invalid code.
LogicalResult mlir::loopUnrollJamByFactor(scf::ForOp forOp,
----------------
jsetoain wrote:
In the typical use case, I believe the user will be in a better position to decide whether the loop is parallel or not. For instance, because the loop comes from a `parallel` iterator in a `linalg` op, or because it's the result of a tiling operation. We could try to detect some individual cases with ad-hoc checks, but we'd be introducing overhead for arguably little to no utility beyond avoiding an easy to notice typo (or "temporary lapse in judgement"), and the transformation would still not be safe.
If somebody else wants to start adding analysis to filter-out invalid cases, I won't stop them, but I think at least we should match functionality with the source counterpart in `affine`.
https://github.com/llvm/llvm-project/pull/98887
More information about the Mlir-commits
mailing list