[Mlir-commits] [mlir] [mlir][affine] Add unroll-factor description for loop unroll pass (PR #172791)
lonely eagle
llvmlistbot at llvm.org
Wed Dec 17 21:39:08 PST 2025
https://github.com/linuxlonelyeagle created https://github.com/llvm/llvm-project/pull/172791
Add the description that unroll factor equals -1 for loop unroll pass.
>From e23c8e0565fa63930c097cc32749d8338b2c13c2 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Thu, 18 Dec 2025 05:36:53 +0000
Subject: [PATCH] add unroll-factor description for loop unroll pass.
---
mlir/include/mlir/Dialect/Affine/Passes.td | 3 ++-
mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp | 8 +++++---
2 files changed, 7 insertions(+), 4 deletions(-)
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