llvm-project
1a44f38d - [mlir][vector] Canonicalize/fold 'order preserving' transposes (#135841)

Commit
358 days ago
[mlir][vector] Canonicalize/fold 'order preserving' transposes (#135841) Handles special case where transpose doesn't permute any non-1 dimensions (and so is effectively a shape_cast) and is adjacent to a shape_cast that it can fold into. For example ``` %1 = vector.transpose %0, [1, 0, 3, 2] : vector<4x1x1x6xf32> to vector<1x4x6x1xf32> ``` can be folded into an adjacent shape_cast. An alternative to this PR would be to canonicalize such transposes to shape_casts directly, but I think it'll be difficult getting consensus that shape_cast is 'more canonical' than transpose, so this PR compromises with the less opinionated claim that 1) shape_cast is more canonical than shape_cast(transpose) 2) shape_cast is more canonical than transpose(shape_cast) The pattern `ConvertIllegalShapeCastOpsToTransposes` that is specific to transposes with scalable dimensions reverses the canonicalization added here, so I've I've disabled this canonicalization for scalable vectors
Author
Parents
Loading