Currently the getTiledImplementation and generateResultTileValue
return just SmallVector<Operation *> and FailureOr<Value>.
- For getTiledImplementation returning empty implies tiling wasnt done. There is also an implicit assumption that the tiled operation results correspond to the tiled values of the result of the original operation. This cannot handle cases where the tiled implementation might use multiple operations to compute the tiled value for the results of the untiled operation. Sometimes, the tiled operation might not directly give the tiled values, and might require casts, etc to get a replacement.
- For generateResultTileValue, it is assumed that the op defining the returned Value is the operation that represents the tiled computation. Again presence of casts, etc violate this.
Instead make these methods return
struct TilingResult { SmallVector<Operation *> tiledOps; SmallVector<Value> tiledValues; };
The tiledOps represent the operations generated that are relevant
for subsequent transformations. The tiledValues represent the tiled
values for the results of the original operation. This better
transmits the state of the transformed IR.
As a consequence the following methods also return FailureOr<TilingResult>
- tensor::replaceExtractSliceWithTiledProducer
- tensor::bubbleUpPadSlice
Can we add a document about the order in tiledOps? In SCFTilingResult, we have the doc about the order: