diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -670,9 +670,11 @@ // 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) && coordsRank != tensorRank) + const DynamicSize 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();