[all-commits] [llvm/llvm-project] 1a44f3: [mlir][vector] Canonicalize/fold 'order preserving...
James Newling via All-commits
all-commits at lists.llvm.org
Thu May 1 15:51:17 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1a44f38d2af8724e9819f03d4b76a50615217a8d
https://github.com/llvm/llvm-project/commit/1a44f38d2af8724e9819f03d4b76a50615217a8d
Author: James Newling <james.newling at gmail.com>
Date: 2025-05-01 (Thu, 01 May 2025)
Changed paths:
M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
M mlir/test/Dialect/Vector/canonicalize.mlir
M mlir/test/Dialect/Vector/canonicalize/vector-transpose.mlir
Log Message:
-----------
[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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list