From 77ec836420db438b5fe4e9aa9de78cb6fabb0e8a Mon Sep 17 00:00:00 2001 From: Peiming Liu Date: Wed, 11 Oct 2023 17:30:46 +0000 Subject: [PATCH] [mlir][sparse] fix unused variable warning on release build --- .../lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp | 2 ++ .../Dialect/SparseTensor/Transforms/StageSparseOperations.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp index fdecfe303d313..78f5562b392a6 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp @@ -710,6 +710,8 @@ struct SparseSortCOOConverter : public OpConversionPattern { // Otherwise we need another data shuffle and a non-identity map. assert(dstStt.hasSameDimToLvl(srcStt)); + (void)dstStt; // to silence warning when assertion is disabled + auto id = AffineMap::getMultiDimIdentityMap(srcStt.getLvlRank(), ctx); rewriter.create(loc, nnz, crd, ValueRange{val}, id, diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp index 60ac71de4dd71..4ab4b05a7a420 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp @@ -36,6 +36,8 @@ struct StageUnorderedConvert : public OpRewritePattern { // source -> coo // The tmp COO must be unordered, otherwise it is a direct conversion. assert(!(srcStt.hasSameDimToLvl(dstStt) && srcStt.isAllOrdered())); + (void)srcStt; // to silence warning when assertion is disabled + Type srcCOOTp = getCOOFromTypeWithOrdering( dstStt.getRankedTensorType(), dstStt.getDimToLvl(), /*ordered=*/false); Value srcCOO = rewriter.create(loc, srcCOOTp, op.getSource());