diff options
author | Andrzej WarzyĆski <andrzej.warzynski@arm.com> | 2024-08-06 10:57:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 10:57:10 +0100 |
commit | 8868c02cda875d1efe1646affa01656ef268ffed (patch) | |
tree | 76c8de07ca2e7bbbce3108916c901c588c38a51e /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | b1234ddbe2652aa7948242a57107ca7ab12fd2f8 (diff) | |
download | llvm-8868c02cda875d1efe1646affa01656ef268ffed.zip llvm-8868c02cda875d1efe1646affa01656ef268ffed.tar.gz llvm-8868c02cda875d1efe1646affa01656ef268ffed.tar.bz2 |
[mlir][linalg] Relax tensor.extract vectorization (#99299)
Simplifies the vectorization of tensor.extract so that:
* all cases that read into a genuinely multi-dim vector (*) are
considered a gather load,
* all other cases are considered as potential contiguous loads.
This change means that the following extraction from a "column" tensor
will be correctly identified as a scalar load followed by a broadcast (rather
than a gather load).
```mlir
func.func @vectorize_scalar_broadcast_column_tensor(%in: tensor<1x1x4xi32>) -> tensor<1x1x4xi32> {
%c4 = arith.constant 4 : index
%c0 = arith.constant 0 : index
%cst = arith.constant dense<[...]> : tensor<15x1xi32>
%out = linalg.generic {
indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>],
iterator_types = ["parallel", "parallel", "parallel"]}
outs(%in : tensor<1x1x4xi32>) {
^bb0(%out: i32):
%idx_0 = linalg.index 0 : index
%extracted = tensor.extract %cst[%idx_0, %c0] : tensor<15x1xi32>
linalg.yield %extracted : i32
} -> tensor<1x1x4xi32>
return %out:tensor<1x1x4xi32>
}
```
(*) `vector<1x4x1xf32>` is considered as 1D vector in this context.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions