[Mlir-commits] [mlir] [mlir][sparse] move all COO related methods into SparseTensorType (PR #73881)
Yinying Li
llvmlistbot at llvm.org
Wed Nov 29 16:59:11 PST 2023
================
@@ -710,6 +710,29 @@ LogicalResult SparseTensorEncodingAttr::verifyEncoding(
// SparseTensorType Methods.
//===----------------------------------------------------------------------===//
+bool mlir::sparse_tensor::SparseTensorType::isCOOType(Level startLvl,
+ bool isUnique) const {
+ if (!hasEncoding())
+ return false;
+ if (!isCompressedLvl(startLvl) && !isLooseCompressedLvl(startLvl))
+ return false;
+ for (Level l = startLvl + 1; l < lvlRank; ++l)
+ if (!isSingletonLvl(l))
+ return false;
+ // If isUnique is true, then make sure that the last level is unique,
+ // that is, lvlRank == 1 (unique the only compressed) and lvlRank > 1
----------------
yinying-lisa-li wrote:
I found "(unique the only compressed)" a bit vague. Can we make it clearer?
https://github.com/llvm/llvm-project/pull/73881
More information about the Mlir-commits
mailing list