[Mlir-commits] [mlir] [mlir][TilingInterface] Use `LoopLikeOpInterface` in tiling using SCF to unify tiling with `scf.for` and `scf.forall`. (PR #77874)
Matthias Springer
llvmlistbot at llvm.org
Sun Jan 14 05:15:08 PST 2024
================
@@ -622,6 +626,47 @@ LogicalResult scf::ForallOp::promoteIfSingleIteration(RewriterBase &rewriter) {
return success();
}
+Block::BlockArgListType ForallOp::getRegionIterArgs() {
+ return getBody()->getArguments().drop_front(getRank());
+}
+
+MutableArrayRef<OpOperand> ForallOp::getInitsMutable() {
----------------
matthias-springer wrote:
I think you are missing a `getYieldedValuesMutable` implementation for `ForallOp`.
This is what the interface documentation says:
```
Loop-carried variables can be exposed through this interface. There are
3 components to a loop-carried variable.
- The "region iter_arg" is the block argument of the entry block that
represents the loop-carried variable in each iteration.
- The "init value" is an operand of the loop op that serves as the initial
region iter_arg value for the first iteration (if any).
- The "yielded" value is the value that is forwarded from one iteration to
serve as the region iter_arg of the next iteration.
If one of the respective interface methods is implemented, so must the other
two. The interface verifier ensures that the number of types of the region
iter_args, init values and yielded values match.
```
This is checked by the op verifier, so you should be seeing verification failures.
We could have `getYieldedValuesMutable` return a `std::optional<::llvm::MutableArrayRef<::mlir::OpOperand>>` to account for the fact that some loops do not have yielding semantics. (Same as we do for `getLoopResults`.)
https://github.com/llvm/llvm-project/pull/77874
More information about the Mlir-commits
mailing list