I am confused with the Promotion pass in mlir. I don’t know the high-level concepts of Promotion, and I can hardly find some material of promotion. Could someone help me to understand what Promotion is?
The idea of this transformation is to move the inputs and/or outputs of a linalg op into their own allocation.
In general it is used on linalg op that has been tiled and this allow to move a tile of the op into a contiguous piece of memory.
There are several cases where it is useful to do that, for instance for large operations having the whole tile in contiguous memory allow closer memory accesses. Another case it is useful is for targets with different memory that may have different speed (for instance GPUs tend to have shared memory with higher bandwidth than main memory), this allow doing a DMA of a tile of data into faster memory than can then be loaded several times with high bandwidth.
Another reason it can be useful is to handle some padding on the fly, since a new allocation is created it could pad out the tile size in order to avoid border effects.
The unit test for this transform should help understand how the transformation look like in practice:
Thanks, it helps me a lot!
It is a perfect instruction for understanding Promotion concept.