[Mlir-commits] [mlir] [mlir][sparse] Print new syntax (PR #68130)
Aart Bik
llvmlistbot at llvm.org
Tue Oct 3 16:23:41 PDT 2023
================
@@ -586,30 +586,56 @@ Attribute SparseTensorEncodingAttr::parse(AsmParser &parser, Type type) {
}
void SparseTensorEncodingAttr::print(AsmPrinter &printer) const {
- // Print the struct-like storage in dictionary fashion.
- printer << "<{ lvlTypes = [ ";
- llvm::interleaveComma(getLvlTypes(), printer, [&](DimLevelType dlt) {
- printer << "\"" << toMLIRString(dlt) << "\"";
- });
- printer << " ]";
+ auto map = static_cast<AffineMap>(getDimToLvl());
+ auto lvlTypes = getLvlTypes();
+ // Empty affine map indicates identity map
+ if (!map) {
+ map = AffineMap::getMultiDimIdentityMap(getLvlTypes().size(), getContext());
+ }
+ // Modified version of AsmPrinter::Impl::printAffineMap.
----------------
aartbik wrote:
I would remove this. This is diverged sufficiently to no longer refer to printAffineMap
https://github.com/llvm/llvm-project/pull/68130
More information about the Mlir-commits
mailing list