[Mlir-commits] [mlir] [mlir] Add loop bounds normalization pass (PR #93781)
Jorn Tuyls
llvmlistbot at llvm.org
Thu May 30 06:15:25 PDT 2024
================
@@ -375,6 +375,132 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
}];
}
+def LoopLikeWithInductionVarsOpInterface
+ : OpInterface<"LoopLikeWithInductionVarsOpInterface"> {
----------------
jtuyls wrote:
Initially, I updated the `LoopLikeOpInterface`, but I think it's better to create a new one. The `LoopLikeOpInterface` is meant for all loop-like operations and this includes ones that don't have induction variables. This results in not all loop-like operations being able to implement the new methods, which would make the interface too broad imo and complicates the respective logic to implement the method, in addition to the logic of transformations relying on the interface. For example, the `LoopLikeOpInterface` already specifies a few induction variable related methods, but return types have to become optional so operations implementing this interface can choose not to implement those methods: https://github.com/llvm/llvm-project/blob/1fe405faf6c09d0ff0d86875584b9dd864479e48/mlir/include/mlir/Interfaces/LoopLikeInterface.td#L123. Adding a new `setLowerBound` method to the `LoopLikeOpInterface`, would need some similar setup like returning a `LogicalResult` to make it possible for loop-like operations without induction variables to indicate that this method is not a valid one for them. I think that's stretching the purpose of the interface and warrants a new one dedicated to loop-like induction variable related methods.
https://github.com/llvm/llvm-project/pull/93781
More information about the Mlir-commits
mailing list