[mlir][sparse] Fixing -Wsign-compare error in D144773
authorwren romano <2998727+wrengr@users.noreply.github.com>
Mon, 6 Mar 2023 21:46:12 +0000 (13:46 -0800)
committerwren romano <2998727+wrengr@users.noreply.github.com>
Mon, 6 Mar 2023 22:14:28 +0000 (14:14 -0800)
Reviewed By: aartbik, Peiming

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

mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp

index 9485d94..5220e4d 100644 (file)
@@ -670,9 +670,11 @@ static LogicalResult verifyPackUnPack(Operation *op, bool requiresStaticShape,
 
   // NOTE: We use `getLvlRank` because the `coordinatesTp` is for
   // level-coordinates (cf., the op documentation).
-  const auto coordsRank = coordinatesTp.getShape()[1];
-  const auto tensorRank = tensorTp.getLvlRank();
-  if (!ShapedType::isDynamic(coordsRank) && (unsigned)coordsRank != tensorRank)
+  const DynSize coordsRank = coordinatesTp.getShape()[1];
+  const Level tensorRank = tensorTp.getLvlRank();
+  // FIXME: replace the `operator!=` with our backported `safelyNE`.
+  if (!ShapedType::isDynamic(coordsRank) &&
+      coordsRank != static_cast<DynSize>(tensorRank))
     return op->emitError("input/output level-ranks don't match");
 
   return success();