[mlir][sparse] support sparse tensor element type conversion in codegen path

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D144578
This commit is contained in:
Peiming Liu
2023-02-22 19:04:02 +00:00
parent 230e61658b
commit 85dbb3fc4b
8 changed files with 265 additions and 22 deletions

View File

@@ -135,6 +135,12 @@ SparseTensorEncodingAttr SparseTensorEncodingAttr::withoutOrdering() const {
getPointerBitWidth(), getIndexBitWidth());
}
SparseTensorEncodingAttr SparseTensorEncodingAttr::withoutBitWidths() const {
return SparseTensorEncodingAttr::get(getContext(), getDimLevelType(),
getDimOrdering(), getHigherOrdering(), 0,
0);
}
bool SparseTensorEncodingAttr::isAllDense() const {
return !getImpl() || llvm::all_of(getDimLevelType(), isDenseDLT);
}