[mlir][sparse] remove COO test from trait and encoding (#73733)

This is a minor step towards moving ALL COO related tests into the
SparseTensorType class rather than
having it all over the place (with risk of becoming inconsistent). Next
revision will move ALL COO related methods into this class.
This commit is contained in:
Aart Bik
2023-11-28 17:46:02 -08:00
committed by GitHub
parent 83305faeb5
commit 98f8b1afb4
3 changed files with 13 additions and 29 deletions

View File

@@ -316,10 +316,6 @@ bool SparseTensorEncodingAttr::isAllDense() const {
return !getImpl() || llvm::all_of(getLvlTypes(), isDenseLT);
}
bool SparseTensorEncodingAttr::isCOO() const {
return getImpl() && isCOOType(*this, 0, true);
}
bool SparseTensorEncodingAttr::isAllOrdered() const {
return !getImpl() || llvm::all_of(getLvlTypes(), isOrderedLT);
}
@@ -1664,14 +1660,18 @@ LogicalResult ReorderCOOOp::verify() {
SparseTensorType srcStt = getSparseTensorType(getInputCoo());
SparseTensorType dstStt = getSparseTensorType(getResultCoo());
if (!isCOOType(srcStt.getEncoding(), 0, /*isUnique=*/true) ||
!isCOOType(dstStt.getEncoding(), 0, /*isUnique=*/true))
emitError("Unexpected non-COO sparse tensors");
if (!srcStt.hasSameDimToLvl(dstStt))
emitError("Unmatched dim2lvl map between input and result COO");
if (srcStt.getPosType() != dstStt.getPosType() ||
srcStt.getCrdType() != dstStt.getCrdType() ||
srcStt.getElementType() != dstStt.getElementType()) {
srcStt.getElementType() != dstStt.getElementType())
emitError("Unmatched storage format between input and result COO");
}
return success();
}