[Mlir-commits] [mlir] [mlir][vector] Refine vectorisation of tensor.extract (PR #109580)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Sep 23 10:13:02 PDT 2024
================
@@ -1012,7 +1019,10 @@ getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
bool foundIndexOp = false;
bool isContiguousLoad = isContiguousLoadIdx(linalgOp, extractOpTrailingIdx,
foundIndexOp, resType);
- isContiguousLoad &= foundIndexOp;
+ // TODO: Support generating contiguous loads for column vectors - that will
+ // require adding a permutation map to tranfer_read Ops.
+ bool isRowVector = resType.getShape().back() != 1;
+ isContiguousLoad &= (foundIndexOp && isRowVector);
----------------
banach-space wrote:
Are you referring to `@index_from_output_column_vector_contiguous_load`?
This access is extracted from that test. The 1st idx is loop invariant (it's a constant) and the 2nd increments by 1:
```mlir
%extracted = tensor.extract %src[%c0, %1] : tensor<8x128xf32>
```
And this is not a row vector:
```mlir
vector<8x1xf32>
```
So, without this condition (`... && isRowVector`), we'd be generated a contiguous load. Provided I didn't miss sth myself! :)
https://github.com/llvm/llvm-project/pull/109580
More information about the Mlir-commits
mailing list