[all-commits] [llvm/llvm-project] a38381: [mlir][Vector] Add a rewrite pattern for gather ov...
Andrzej Warzyński via All-commits
all-commits at lists.llvm.org
Thu Nov 30 08:33:35 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a383817b7e24d948dd5e342e8df8d12d0f15d536
https://github.com/llvm/llvm-project/commit/a383817b7e24d948dd5e342e8df8d12d0f15d536
Author: Andrzej Warzyński <andrzej.warzynski at arm.com>
Date: 2023-11-30 (Thu, 30 Nov 2023)
Changed paths:
M mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp
M mlir/test/Dialect/Vector/vector-gather-lowering.mlir
Log Message:
-----------
[mlir][Vector] Add a rewrite pattern for gather over a strided memref (#72991)
This patch adds a rewrite pattern for `vector.gather` over a strided
memref like the following:
```mlir
%subview = memref.subview %arg0[0, 0] [100, 1] [1, 1] :
memref<100x3xf32> to memref<100xf32, strided<[3]>>
%gather = vector.gather %subview[%c0] [%idxs], %cst_0, %cst :
memref<100xf32, strided<[3]>>, vector<4xindex>, vector<4xi1>, vector<4xf32>
into vector<4xf32>
```
After the pattern added in this patch:
```mlir
%collapse_shape = memref.collapse_shape %arg0 [[0, 1]] :
memref<100x3xf32> into memref<300xf32>
%1 = arith.muli %arg3, %cst : vector<4xindex>
%gather = vector.gather %collapse_shape[%c0] [%1], %cst_1, %cst_0 :
memref<300xf32>, vector<4xindex>, vector<4xi1>, vector<4xf32>
into vector<4xf32>
```
Fixes https://github.com/openxla/iree/issues/15364.
More information about the All-commits
mailing list