[Mlir-commits] [mlir] [mlir][TilingInterface] Use `LoopLikeOpInterface` in tiling using SCF to unify tiling with `scf.for` and `scf.forall`. (PR #77874)
Mehdi Amini
llvmlistbot at llvm.org
Wed Jan 17 23:53:32 PST 2024
================
@@ -218,6 +221,53 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
return ::mlir::failure();
}]
>,
+ InterfaceMethod<[{
+ Append the specified additional "init" operands: replace this loop with
+ a new loop that has the additional init operands. The loop body of
+ this loop is moved over to the new loop.
+
+ This method is similar to `replaceWithAdditionalYields` but instead of
+ returning the value that is actually yielded, this returns the tiles of
+ the values that are yielded. This allows for unified handling of opreations
+ like `scf.forall` which dont yield a value from the loop, but instead
+ the terminator specifies where to insert the tile yielded by the body of
+ the loop. For example,
+
+ ```mlir
+ %0 = scf.forall ... shared_outs(%arg0 = %arg1) {
+ ...
+ %tiled_value
+ scf.forall.in_parallel {
+ tensor.parallel_insert_slice %tiled_value into %arg0[%o1, %o2]...
+ }
+ }
+ ```
+
+ For an `scf.for` the same computation would be represented as
+ ```mlir
+ %0 = scf.for ... iter_args(%arg0 = %arg1) {
+ ...
+ %tiled_value
+ %insert = tensor.insert_slice %tiled_value into %arg0[%o1, %o2]...
+ scf.yield %insert
+ }
+ ```
+
+ So for the caller, the tiled value (`%tiled_values`) and the offsets
----------------
joker-eph wrote:
```suggestion
So for the caller, the tiled value (`%tiled_value`) and the offsets
```
https://github.com/llvm/llvm-project/pull/77874
More information about the Mlir-commits
mailing list