[Mlir-commits] [mlir] d47a0ac - [mlir][Linalg] fix comparison of integers with different signs

Tom Eccles llvmlistbot at llvm.org
Fri Jan 20 07:11:55 PST 2023


Author: Tom Eccles
Date: 2023-01-20T15:10:28Z
New Revision: d47a0ace5d39cb1abf71b9778c3cde003f0a2e37

URL: https://github.com/llvm/llvm-project/commit/d47a0ace5d39cb1abf71b9778c3cde003f0a2e37
DIFF: https://github.com/llvm/llvm-project/commit/d47a0ace5d39cb1abf71b9778c3cde003f0a2e37.diff

LOG: [mlir][Linalg] fix comparison of integers with different signs

Since https://reviews.llvm.org/D142053, building mlir with clang using -Werror
fails reporting comparison of integers with different signs.

Fix this by using unsigned return types for
RelayoutOp::getSourceRank,getDestRank

Differential Revision: https://reviews.llvm.org/D142201

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
    mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
index 1b7b17749b84a..209e70f53123b 100644
--- a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
+++ b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
@@ -1667,8 +1667,8 @@ class Tensor_RelayoutOp<string mnemonic, list<Trait> traits = []> :
                    "$_self">])> {
 
   code commonExtraClassDeclaration = [{
-    int64_t getSourceRank() { return getSource().getType().getRank(); };
-    int64_t getDestRank() { return getDest().getType().getRank(); };
+    size_t getSourceRank() { return getSource().getType().getRank(); };
+    size_t getDestRank() { return getDest().getType().getRank(); };
     RankedTensorType getSourceType() {
       return getSource().getType().cast<RankedTensorType>(); };
     RankedTensorType getDestType() {

diff  --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 4247a6c5fda36..9af3ed7d2b5f4 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -1221,7 +1221,7 @@ bool isValidPackingPermutation(
       "applies to only pack or unpack operations");
   if (!op || permutation.empty())
     return true;
-  int64_t innerRank = op.getInnerDimsPos().size();
+  size_t innerRank = op.getInnerDimsPos().size();
   if (outerOrInnerPerm == OuterOrInnerPerm::Inner)
     return permutation.size() == innerRank && isPermutationVector(permutation);
   // op.getOuterDimsPerm() may be empty, in which case it is identity.


        


More information about the Mlir-commits mailing list