Rewrites reshapes that are adding 1-sized dims and are followed by a tile on the one-sized dim to a tile on the original shape followed by a reshape.#637
Conversation
b8ee462 to
e11eb99
Compare
| /* Rewrites reshapes that are adding 1-sized dims and are followed by a tile on | ||
| * the one-sized dim to a tile on the original shape followed by a reshape. This | ||
| * is done to reduce the rank of tile ops. */ |
There was a problem hiding this comment.
Is the core canonicalization to minimize the dimensions needed to express the tile operation? If so it would be better to do so regardless of a directly connected reshape or not and instead insert reshape before and after as appropriate.
If this is not the core goal then I question having this as a canonicalization as matching tile will still have a guarantee that the tile op is in canonicalized form.
There was a problem hiding this comment.
I do not think its a good idea to always do the tile rank reduction, as the inserted reshapes may prevent other patterns from matching.
I originally wrote this to target a specific case:
reshape 1x2x3 to 1x2x1x3
tile 1x2x1x3 to 1x2x4x3
reshape to 1x2x12
this could be canonicalized to :
tile 1x2x3 to 1x2x12
In this case the rank of the tile would be reduced and the reshapes completely canceled.
I marked this Pr as draft, as I think it generally needs more investigation when it makes sense to do this and when not
…tile on the one-sized dim to a tile on the original shape followed by a reshape. This is done to reduce the rank of tile ops.
e11eb99 to
7276ee6
Compare
This is done to reduce the rank of tile ops to make downstream consumption easier