[Mlir-commits] [mlir] [MLIR][SCF] Add an API to fuse consumer to a producer within scf loop (PR #88712)

Abhishek Varma llvmlistbot at llvm.org
Mon May 20 04:04:07 PDT 2024


================
@@ -131,6 +150,42 @@ def TilingInterface : OpInterface<"TilingInterface"> {
           return failure();
         }]
       >,
+      InterfaceMethod<
+        /*desc=*/[{
+          Method to generate the tiled implementation of an operation from
+          operand tile position.
+
+          Generates the IR that computes the tiled implementation of an
+          operation from operand tile.  The `offsets` and `sizes`
+          describe the tile of the operand required. This is different from
+          `getTiledImplementation` which generates the tiled
+          implementation of the operation given a tile of the
+          iteration space. This method generates a tiled
+          implementation of the operation based on the tile of the
+          operand required. This method enables consumer fusion by using
+          tile and fuse. The method returns failure if the operation
+          can't be tiled to generate the operand tile. In practical terms
+          this implies it cannot be tiled and fused with its producers.
+
+          - `offsets` provides the offset of the tile in the coordinate system
+            of the original iteration space, i.e., if an iteration space
+            dimension had non-zero offset, it must be included in the offset
+            provided here (as opposed to zero-based offset "relative" to the
+            iteration space).
----------------
Abhishek-Varma wrote:

I guess this seems to have been copy-pasted from [generateResultTileValue](https://github.com/llvm/llvm-project/blob/8bde51492235e1bfe81b527414c19743ec987a62/mlir/include/mlir/Interfaces/TilingInterface.td#L134-L138) interface method description above.

Yes, "iteration space" does seem to be referring the coordinate space of the operand here.

>From what I understand the non-zero offsets perhaps mean to account for, as an example, the following :
`%iv0` and `%iv1` loop induction variables in `%source [%iv0, %iv1] [32, 32] [1, 1]`.

Pinging @cxy-1993 for a collaborative/better response here.

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


More information about the Mlir-commits mailing list