[Mlir-commits] [mlir] [mlir][sparse] Update verifier for block sparsity and singleton (PR #69389)

Yinying Li llvmlistbot at llvm.org
Wed Oct 18 08:53:11 PDT 2023


================
@@ -663,6 +666,17 @@ SparseTensorEncodingAttr::verify(function_ref<InFlightDiagnostic()> emitError,
     return emitError() << "unexpected position bitwidth: " << posWidth;
   if (!acceptBitWidth(crdWidth))
     return emitError() << "unexpected coordinate bitwidth: " << crdWidth;
+  if (auto it = std::find_if(lvlTypes.begin(), lvlTypes.end(), isSingletonDLT);
+      it != std::end(lvlTypes)) {
+    if (it == lvlTypes.begin() ||
+        (!isCompressedDLT(*(it - 1)) && !isLooseCompressedDLT(*(it - 1))))
+      return emitError() << "expected compressed or loose_compressed level "
+                            "before singleton level";
----------------
yinying-lisa-li wrote:

I see! Thanks for chiming in, Mehdi. Then in this case, I think it's clear to see where the next block starts, so I will keep it as it is.

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


More information about the Mlir-commits mailing list