There's a pass we run --canonicalize-vector-for-aievec which (as the name suggests) massages vector dialect operations to make them lowerable to aievec. One of the things the pass does is 'flatten' vector.transfer_reads. For example it converts
Subsequent compiler passes fail if there are any transfer_reads (or transfer_writes) which have a vector operand of rank > 1.
With my current convolution pipeline (using the linalg-fold-unit-extent-dims pass with useRankReducingSlices = true as suggested by @MaheshRavishankar to simplify the compiler by avoiding collapse_shape/expand_shape) we get a transfer_read like
Before this PR, the pass --canonicalize-vector-for-aievec failed to convert this into a transfer_read with a rank-1 vector. This is because the map #map is not a "minor identity" affine map which the pattern previously required. So this PR relaxes the constraint that the map must be a minor identity map, allowing unit dimensions to slip through.
It uses the upstream pass to flatten reads and writes, and adds a new pattern to make unflatten (unsqueeze) reads and writes whose permutation maps are not minor identity.
Unfortunately @jsetoain is going to be away for a while, so @makslevental would you mind reviewing this?
There's a pass we run
--canonicalize-vector-for-aievec
which (as the name suggests) massages vector dialect operations to make them lowerable to aievec. One of the things the pass does is 'flatten'vector.transfer_read
s. For example it convertswhich has a rank-2 vector operand to
Subsequent compiler passes fail if there are any
transfer_read
s (ortransfer_write
s) which have a vector operand of rank > 1.With my current convolution pipeline (using the
linalg-fold-unit-extent-dims
pass withuseRankReducingSlices = true
as suggested by @MaheshRavishankar to simplify the compiler by avoiding collapse_shape/expand_shape) we get atransfer_read
likewhere
Before this PR, the pass
--canonicalize-vector-for-aievec
failed to convert this into a transfer_read with a rank-1 vector. This is because the map#map
is not a "minor identity" affine map which the pattern previously required. So this PR relaxes the constraint that the map must be a minor identity map, allowing unit dimensions to slip through.It uses the upstream pass to flatten reads and writes, and adds a new pattern to make unflatten (unsqueeze) reads and writes whose permutation maps are not minor identity.
Unfortunately @jsetoain is going to be away for a while, so @makslevental would you mind reviewing this?