[Mlir-commits] [mlir] [mlir][sparse] Update verifier for block sparsity and singleton (PR #69389)
Mehdi Amini
llvmlistbot at llvm.org
Tue Oct 17 16:35:42 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";
----------------
joker-eph wrote:
Just a nit but the guideline is "Similarly, braces should be used when a single-statement body is complex enough that it becomes difficult to see where the block containing the following statement began", which leave some judgement (it's not automatically "multiple lines" I believe?)
https://github.com/llvm/llvm-project/pull/69389
More information about the Mlir-commits
mailing list