[Mlir-commits] [mlir] 60bd4dd - [mlir][affine] Add unroll-factor description for loop unroll pass (#172791)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Dec 22 04:27:21 PST 2025


Author: lonely eagle
Date: 2025-12-22T20:27:17+08:00
New Revision: 60bd4dd0009711420d605049b1a93f3ca632d0fd

URL: https://github.com/llvm/llvm-project/commit/60bd4dd0009711420d605049b1a93f3ca632d0fd
DIFF: https://github.com/llvm/llvm-project/commit/60bd4dd0009711420d605049b1a93f3ca632d0fd.diff

LOG: [mlir][affine] Add unroll-factor description for loop unroll pass (#172791)

Add the description that unroll-factor equals -1 for loop unroll pass.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Affine/Passes.td
    mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Affine/Passes.td b/mlir/include/mlir/Dialect/Affine/Passes.td
index bb6b41c0bba35..1ad5344121d4e 100644
--- a/mlir/include/mlir/Dialect/Affine/Passes.td
+++ b/mlir/include/mlir/Dialect/Affine/Passes.td
@@ -204,7 +204,8 @@ def AffineLoopUnroll : InterfacePass<"affine-loop-unroll", "FunctionOpInterface"
   let constructor = "mlir::affine::createLoopUnrollPass()";
   let options = [
     Option<"unrollFactor", "unroll-factor", "int64_t", /*default=*/"4",
-           "Use this unroll factor for all loops being unrolled">,
+           "Use this unroll factor for all loops being unrolled, "
+           "set it to -1, and it will fully unroll.">,
     Option<"unrollUpToFactor", "unroll-up-to-factor", "bool",
            /*default=*/"false", "Allow unrolling up to the factor specified">,
     Option<"numRepetitions", "unroll-num-reps", "unsigned", /*default=*/"1",

diff  --git a/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp b/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp
index 2470380682318..e2d6996e435bb 100644
--- a/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp
+++ b/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp
@@ -76,9 +76,11 @@ struct TestLoopUnrollingPass
         (void)loopUnrollByFactor(loop, unrollFactor, annotateFn);
     }
   }
-  Option<int64_t> unrollFactor{*this, "unroll-factor",
-                               llvm::cl::desc("Loop unroll factor."),
-                               llvm::cl::init(1)};
+  Option<int64_t> unrollFactor{
+      *this, "unroll-factor",
+      llvm::cl::desc(
+          "Loop unroll factor, set it to -1, and it will fully unroll."),
+      llvm::cl::init(1)};
   Option<bool> annotateLoop{*this, "annotate",
                             llvm::cl::desc("Annotate unrolled iterations."),
                             llvm::cl::init(false)};


        


More information about the Mlir-commits mailing list