[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
+
+        if isinstance(lower_bound, int):
+            lower_bound = AffineMap.get_constant(lower_bound)
+        elif isinstance(lower_bound, (Operation, OpView, Value)):
----------------
ftynse wrote:

Nit: I like `_ResultValueT` in commons, some other dialects have local equivalents. Would it be possible to have `ResultValueTypeTuple = (_cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value)`, `ResultValueT = _Union[*ResultValueTypeTuple]` to avoid repetition here? Not sure if that works as I think it does.

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


More information about the Mlir-commits mailing list