[Mlir-commits] [mlir] [mlir][sparse] minor edits in runtime lib Cpp files (PR #68165)

Peiming Liu llvmlistbot at llvm.org
Tue Oct 3 16:01:38 PDT 2023


================
@@ -44,15 +33,11 @@ SparseTensorStorageBase::SparseTensorStorageBase( // NOLINT
   assert(dimRank > 0 && "Trivial shape is unsupported");
   for (uint64_t d = 0; d < dimRank; ++d)
     assert(dimSizes[d] > 0 && "Dimension size zero has trivial storage");
-  // Validate level-indexed parameters.
+  // Validate lvl-indexed parameters.
   assert(lvlRank > 0 && "Trivial shape is unsupported");
   for (uint64_t l = 0; l < lvlRank; ++l) {
     assert(lvlSizes[l] > 0 && "Level size zero has trivial storage");
-    const auto dlt = lvlTypes[l]; // Avoid redundant bounds checking.
-    // We use `MLIR_SPARSETENSOR_FATAL` here instead of `assert` so that
-    // when this ctor is successful then all the methods can rely on the
-    // fact that each level-type satisfies one of these options (even
-    // when `NDEBUG` is true), thereby reducing the need to re-assert things.
+    const auto dlt = lvlTypes[l];
     if (!(isDenseDLT(dlt) || isCompressedDLT(dlt) || isSingletonDLT(dlt)))
----------------
PeimingLiu wrote:

I think you will need a `{}` around the `if` body the single statement spans over two lines.

https://github.com/llvm/llvm-project/pull/68165


More information about the Mlir-commits mailing list