castAwayContractionLeadingOneDim
introduces unnecessary transposes on outer unit dims
#85691
Labels
castAwayContractionLeadingOneDim
introduces unnecessary transposes on outer unit dims
#85691
During IREE's mmt4d lowering, we have a vector to matrix product represented by
vector.contract
in transit of the following form:Passing this through
castAwayContractionLeadingOneDim
pattern produces the following:The
vector.transpose
introduced adds additional leading dimensionality to the overall flow and cannot be trivially reduced further down. This is adding a challenge for subsequent patterns to process vec_x_matrix contracts properly.The cause is the pattern requiring the cast away dimensions to be outermost for all operands while being driven by the accumulator of the contract.
Thoughts
In practice, transposing outer unit dimensions in this instance does not affect the underlying data layout. This transpose could be omitted before the patterns final output. Alternatively, a transpose canonicalizer that can fold transposes for outer leading unit dimensions could also apply here.
The text was updated successfully, but these errors were encountered: