[Lldb-commits] [lldb] [mlir][sparse] Update Enum name for CompressedWithHigh (PR #67845)
@@ -26,20 +26,20 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(SparseTensor, sparse_tensor); /// If updating, keep them in sync and update the static_assert in the impl /// file. enum MlirSparseTensorDimLevelType { - MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4, // 0b1_00 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED = 8,// 0b00010_00 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU = 9, // 0b00010_01 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NO = 10,// 0b00010_10 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_NU_NO = 11, // 0b00010_11 - MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON = 16,// 0b00100_00 - MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU = 17, // 0b00100_01 - MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NO = 18, // 0b00100_10 - MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON_NU_NO = 19, // 0b00100_11 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI = 32, // 0b01000_00 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU = 33,// 0b01000_01 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NO = 34,// 0b01000_10 - MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED_WITH_HI_NU_NO = 35, // 0b01000_11 - MLIR_SPARSE_TENSOR_DIM_LEVEL_TWO_OUT_OF_FOUR = 64, // 0b1_00 + MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE = 4, // 0b1_00 PeimingLiu wrote: Not directly related to this PR, but can we get rid of this enum completely? We can have a `class LevelType` that stores an integer (which encodes level format/property). https://github.com/llvm/llvm-project/pull/67845 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [mlir][sparse] Print new syntax (PR #68130)
@@ -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(getDimToLvl()); + auto lvlTypes = getLvlTypes(); + // Empty affine map indicates identity map + if (!map) { +map = AffineMap::getMultiDimIdentityMap(getLvlTypes().size(), getContext()); + } + // Modified version of AsmPrinter::Impl::printAffineMap. + printer << "<{ map = "; + // Symbolic identifiers. + if (map.getNumSymbols() != 0) { +printer << '['; +for (unsigned i = 0; i < map.getNumSymbols() - 1; ++i) + printer << 's' << i << ", "; +if (map.getNumSymbols() >= 1) + printer << 's' << map.getNumSymbols() - 1; +printer << ']'; + } + // Dimension identifiers. + printer << '('; + auto dimSlices = getDimSlices(); + if (!dimSlices.empty()) { +for (unsigned i = 0; i < map.getNumDims() - 1; ++i) + printer << 'd' << i << " : " << dimSlices[i] << ", "; +if (map.getNumDims() >= 1) + printer << 'd' << map.getNumDims() - 1 << " : " + << dimSlices[map.getNumDims() - 1]; + } else { +for (unsigned i = 0; i < map.getNumDims() - 1; ++i) + printer << 'd' << i << ", "; +if (map.getNumDims() >= 1) + printer << 'd' << map.getNumDims() - 1; + } + printer << ')'; + // Level format and properties. + printer << " -> ("; + for (unsigned i = 0; i < map.getNumResults() - 1; ++i) { +map.getResult(i).print(printer.getStream()); +printer << " : " << toMLIRString(lvlTypes[i]) << ", "; + } + if (map.getNumResults() >= 1) { +auto lastIndex = map.getNumResults() - 1; +map.getResult(lastIndex).print(printer.getStream()); +printer << " : " << toMLIRString(lvlTypes[lastIndex]); + } + printer << ')'; PeimingLiu wrote: I would suggest you break these into smaller functions. https://github.com/llvm/llvm-project/pull/68130 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [mlir][sparse] introduce MapRef, unify conversion/codegen for reader (PR #68360)
https://github.com/PeimingLiu approved this pull request. https://github.com/llvm/llvm-project/pull/68360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [mlir][sparse] add a forwarding insertion to SparseTensorStorage (PR #68939)
https://github.com/PeimingLiu approved this pull request. https://github.com/llvm/llvm-project/pull/68939 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [mlir][sparse] remove unused sparse tensor iterator (PR #68951)
https://github.com/PeimingLiu approved this pull request. https://github.com/llvm/llvm-project/pull/68951 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits