[Mlir-commits] [mlir] [mlir][tensor] Add check for indices of `tensor.gather` (PR #106894)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Sep 1 04:18:05 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 8c5d53f8deb26456432cc0459551cdd69754fea7 e501ccc98faa8a21f2a1e520bafd8a3cd0a6117a --extensions cpp -- mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index 12f0b9ae6f..603773c377 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -1288,8 +1288,9 @@ RankedTensorType GatherOp::inferResultType(RankedTensorType sourceType,
 }
 
 static LogicalResult
-verifyGatherOrScatterDims(Operation *op, ArrayRef<int64_t> dims, ArrayRef<int64_t> indices,
-                          int64_t rank, StringRef gatherOrScatter, StringRef sourceOrDest) {
+verifyGatherOrScatterDims(Operation *op, ArrayRef<int64_t> dims,
+                          ArrayRef<int64_t> indices, int64_t rank,
+                          StringRef gatherOrScatter, StringRef sourceOrDest) {
   if (dims.empty())
     return op->emitOpError(gatherOrScatter) << "_dims must be non-empty";
 
@@ -1319,8 +1320,9 @@ verifyGatherOrScatterDims(Operation *op, ArrayRef<int64_t> dims, ArrayRef<int64_
 LogicalResult GatherOp::verify() {
   int64_t sourceRank = getSourceType().getRank();
   ArrayRef<int64_t> gatherDims = getGatherDims();
-  if (failed(verifyGatherOrScatterDims(getOperation(), gatherDims, getIndicesType().getShape(),
-                                       sourceRank, "gather", "source")))
+  if (failed(verifyGatherOrScatterDims(getOperation(), gatherDims,
+                                       getIndicesType().getShape(), sourceRank,
+                                       "gather", "source")))
     return failure();
 
   RankedTensorType expectedResultType = GatherOp::inferResultType(
@@ -3533,8 +3535,9 @@ void ScatterOp::getAsmResultNames(
 LogicalResult ScatterOp::verify() {
   int64_t destRank = getDestType().getRank();
   ArrayRef<int64_t> scatterDims = getScatterDims();
-  if (failed(verifyGatherOrScatterDims(getOperation(), scatterDims, getIndicesType().getShape(),
-                                       destRank, "scatter", "dest")))
+  if (failed(verifyGatherOrScatterDims(getOperation(), scatterDims,
+                                       getIndicesType().getShape(), destRank,
+                                       "scatter", "dest")))
     return failure();
 
   if (!getUnique())

``````````

</details>


https://github.com/llvm/llvm-project/pull/106894


More information about the Mlir-commits mailing list