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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu May 30 02:24:13 PDT 2024


Yun-Fly wrote:

> Which specific concerns?

The direction of how to refactor `getTiledImplementation` and other related interface. For instance, what `getTiledImplementation` is responsible for, the definition of which becomes a little confusing and muddled since we introduce consumer fusion. 

> My thinking here is that getTiledImplementation does too much. It should not be emitting IR that computes a slice of each operand. Instead, it should be given such slices. 

I guess you mean that preparing tiled operand by caller in advance and than calling `getTiledImplementationGivenOperandTiles` as you mentioned. In this way, it looks more like a clone operation wrapper specially with given tiled operand. 

> I have strong concerns with this. getTiledImplementation is necessarily black boxed. I would not want to assume that you can produce an implementation of tile from the slice. Also it seems backwards to me to compute the slice of the operands, then pass it to the tiling implementation to say produce the tile.  

In another side, I guess @MaheshRavishankar insist that how to take slice is also one component of how to do tiling on on an operation, which should not be hand over to the caller to deal with tiled operand. BTW, I think anyway we can create a dummy `insert_slice` as he suggested to pass dummy operand with original size to tiling implementation.

```
%tiled_v = tiledProducer ...

// create dummy `insert_slice` to align with what current `getTiledImplementation` expect for
%dummy_insert = tensor.insert_slice %tiled_v into %?  [OFFSET] [SIZE]: tensor<tiled_shape> into tensor<original_shape>

// clonedConsumer should use %dummy_insert as its new operand
```


It is really hard to stand by which one(or even any other new proposal) is general solution before we have much clear definition of responsibility taken by `getTiledImplementation`, and that is the direction what I mean at the beginning.


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


More information about the Mlir-commits mailing list