Masking hasn't been widely used in vector transfer ops and the semantics
of the mask operand were a bit loose. This patch states that the mask
operand in a vector transfer op is applied to the read/write part of the
operation and, therefore, its shape should match the shape of the
elements read/written from/into the memref/tensor regardless of any
permutation/broadcasting also applied by the transfer operation.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Nice, thanks for tightening this up @dcaballe !
Now that you are looking more seriously at this, do you have a recommendation on whether the op should be simplified (or even split into multiple ops) ?
I am thinking in particular about the interaction between the required scalar padding value, inbounds attribute and the mask.
Thoughts?
Now that you are looking more seriously at this, do you have a recommendation on whether the op should be simplified (or even split into multiple ops) ?
I am thinking in particular about the interaction between the required scalar padding value, inbounds attribute and the mask.
Yes, definitely. I think at this point vector transfer ops are conflating far too many things and the complexity outweighs the benefits. The most challenging part, imo, is the permutation map as we are mixing memory ops with "in-register" data manipulation. It gets even worse with masking as the masking action happens only on the memory part of the transfer op, so there is a little dance of affine maps needed to actually know what we really have to mask. As a first step, I think we should decouple data manipulation (permutation map) from the load operation and generate independent transpose/broadcast ops. Regarding the inbounds attribute, it doesn't make sense for masked operations as the point of using a mask is to make the accesses always inbounds. The padding value should also be aligned with the padding value needed for masking.
I think the last two tasks are good starter tasks. Decoupling the permutation map part is going to be painful, though.