[Mlir-commits] [mlir] [mlir][python] fix up affine for (PR #74495)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed Dec 6 02:07:07 PST 2023


================
@@ -45,23 +46,50 @@ def __init__(
         - `lower_bound_operands` is the list of arguments to substitute the dimensions,
           then symbols in the `lower_bound` affine map, in an increasing order
         - `upper_bound_operands` is the list of arguments to substitute the dimensions,
-          then symbols in the `upper_bound` affine map, in an increasing order
+          then symbols in the `upper_bound` affine map, in an increasing order.
         """
 
+        if lower_bound_operands is None:
+            lower_bound_operands = []
+        if upper_bound_operands is None:
+            upper_bound_operands = []
+
+        if step is None:
+            step = 1
+        if upper_bound is None:
+            upper_bound, lower_bound = lower_bound, 0
----------------
ftynse wrote:

This will be a big surprise for whoever tries to write an "infinite" loop with explicit parameter naming `affine.ForOp(lower_bound=2)` in fact constructs a loop with `lower_bound=0` and `upper_bound=2`. Let's just always require both bounds, it's not that verbose.

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


More information about the Mlir-commits mailing list