[Mlir-commits] [mlir] [mlir][loops] Add getters for multi dim loop variables in `LoopLikeOpInterface` (PR #94516)
Ivan Butygin
llvmlistbot at llvm.org
Thu Jun 6 12:05:08 PDT 2024
Hardcode84 wrote:
> Initially, I used `optional<>`/empty list/setters returning a `LogicalResult` on all methods related to induction variables, but imo, having to do that is demonstrating that not all loops are equal (or all are, but some more equal than others) and that there is a distinction between loops with induction variables and ones without. By creating a new interface you don't need the surrounding logic everywhere these methods are used to evaluate the return value and check whether it was valid or not to use this method on that operation or not. Also, this let's you reuse the existing induction variable related methods inside `scf.Forall`. But mainly, I think the point of an interface is to have a contract on what functionality is available for operations implementing the interface. Using `optional<>` on a set of methods, not a one-off, defeats that purpose and breaks the contract imo.
Thanks for the explanation, this actually now makes sense to me to separate interfaces to cover the case when we cannot get the bounds. Both approaches can work, I won't block this PR is everyone else is fine with `optional<>`.
https://github.com/llvm/llvm-project/pull/94516
More information about the Mlir-commits
mailing list