diff options
author | James Newling <james.newling@gmail.com> | 2025-06-05 10:18:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-05 10:18:38 -0700 |
commit | 7ce315d14aa5c084574cc3a17552625f322e1d16 (patch) | |
tree | 49e086d806e81fc02395f15161050d94447e0c4f /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 599b2a3475f1c40b34f2414e55de68c67ebe9d21 (diff) | |
download | llvm-7ce315d14aa5c084574cc3a17552625f322e1d16.zip llvm-7ce315d14aa5c084574cc3a17552625f322e1d16.tar.gz llvm-7ce315d14aa5c084574cc3a17552625f322e1d16.tar.bz2 |
[mlir][vector] Improve shape_cast lowering (#140800)
Before this PR, a rank-m -> rank-n vector.shape_cast with m,n>1 was
lowered to extracts/inserts of single elements, so that a shape_cast on
a vector with N elements would always require N extracts/inserts. While
this is necessary in the worst case scenario it is sometimes possible to
use fewer, larger extracts/inserts. Specifically, the largest common
suffix on the shapes of the source and result can be extracted/inserted.
For example:
```mlir
%0 = vector.shape_cast %arg0 : vector<10x2x3xf32> to vector<2x5x2x3xf32>
```
has common suffix of shape `2x3`. Before this PR, this would be lowered
to 60 extract/insert pairs with extracts of the form
`vector.extract %arg0 [a, b, c] : f32 from vector<10x2x3xf32>`. With
this PR it is 10 extract/insert pairs with extracts of the form
`vector.extract %arg0 [a] : vector<2x3xf32> from vector<10x2x3xf32>`.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions