[Mlir-commits] [mlir] [mlir] Extend SCF loopUnrollByFactor to return the result loops (PR #114573)

Hongtao Yu llvmlistbot at llvm.org
Fri Nov 1 10:48:57 PDT 2024


================
@@ -111,11 +111,13 @@ LogicalResult coalescePerfectlyNestedSCFForLoops(scf::ForOp op);
 void collapseParallelLoops(RewriterBase &rewriter, scf::ParallelOp loops,
                            ArrayRef<std::vector<unsigned>> combinedDimensions);
 
-/// Unrolls this for operation by the specified unroll factor. Returns failure
-/// if the loop cannot be unrolled either due to restrictions or due to invalid
-/// unroll factors. Requires positive loop bounds and step. If specified,
-/// annotates the Ops in each unrolled iteration by applying `annotateFn`.
-LogicalResult loopUnrollByFactor(
+/// Unrolls this for operation by the specified unroll factor. Returns the
+/// unrolled main loop and the eplilog loop in sequence, if the loop is
+/// unrolled. Otherwise returns an empty vector if the loop cannot be unrolled
+/// either due to restrictions or due to invalid unroll factors. Requires
+/// positive loop bounds and step. If specified, annotates the Ops in each
+/// unrolled iteration by applying `annotateFn`.
+SmallVector<scf::ForOp> loopUnrollByFactor(
----------------
htyu wrote:

Maybe I didn't make it clear in the comment. I meant to store the result main loop and the epilog loop in order. The main loop goes first. Do you think we can just tweak the comment to be more explicit?

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


More information about the Mlir-commits mailing list