[Mlir-commits] [mlir] [mlir][linalg] Upgrade vectorisation of tensor.extract (PR #100582)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 25 07:55:59 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 2ba3fe7356f065757a2279f65e4ef5c8f1476293 aae7571a8213a429a64f7918c0d0c560d5efdead --extensions cpp -- mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
index 5c8d4a00bc..095fc68eca 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
@@ -809,7 +809,8 @@ static Value calculateGatherOffset(RewriterBase &rewriter,
enum VectorMemoryAccessKind { ScalarBroadcast, Contiguous, Gather };
/// Checks whether `val` can be used for calculating a loop invariant index.
-static bool isLoopInvariantIdx(LinalgOp &linalgOp, Value &val, VectorType resType) {
+static bool isLoopInvariantIdx(LinalgOp &linalgOp, Value &val,
+ VectorType resType) {
assert(((llvm::count_if(resType.getShape(),
[](int64_t dimSize) { return dimSize > 1; }) == 1)) &&
@@ -939,7 +940,8 @@ getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
// 1. Assume that it's a gather load when reading _into_:
// * an n-D "vector", like `vector<1x2x4xi32` or `vector<2x1x4xi32>`, or
- // * a 1-D "vector" with the trailing dim equal 1, e.g. `vector<1x4x1xi32>`.
+ // * a 1-D "vector" with the trailing dim equal 1, e.g.
+ // `vector<1x4x1xi32>`.
// TODO: Relax these conditions.
if ((llvm::count_if(resType.getShape(),
[](int64_t dimSize) { return dimSize > 1; }) != 1) ||
@@ -992,8 +994,8 @@ getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
// This effectively means that it must be based on the trailing loop index.
// This is what the following bool captures.
bool foundIndexOp = false;
- bool isContiguousLoad =
- isContiguousLoadIdx(linalgOp, extractOpTrailingIdx, foundIndexOp, resType);
+ bool isContiguousLoad = isContiguousLoadIdx(linalgOp, extractOpTrailingIdx,
+ foundIndexOp, resType);
isContiguousLoad &= foundIndexOp;
if (isContiguousLoad) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/100582
More information about the Mlir-commits
mailing list