From deb6fb61844f31f27810679bbe948fe6574998bf Mon Sep 17 00:00:00 2001 From: wren romano <2998727+wrengr@users.noreply.github.com> Date: Mon, 6 Mar 2023 13:46:12 -0800 Subject: [PATCH] [mlir][sparse] Fixing -Wsign-compare error in D144773 Reviewed By: aartbik, Peiming Differential Revision: https://reviews.llvm.org/D145420 --- mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp index 9485d94..5220e4d 100644 --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -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(tensorRank)) return op->emitError("input/output level-ranks don't match"); return success(); -- 2.7.4