[Mlir-commits] [mlir] [mlir][sparse] support type conversion from SoA COO to memrefs. (PR #82398)

Aart Bik llvmlistbot at llvm.org
Tue Feb 20 10:55:56 PST 2024


================
@@ -74,11 +74,13 @@ void StorageLayout::foreachField(
         callback) const {
   const auto lvlTypes = enc.getLvlTypes();
   const Level lvlRank = enc.getLvlRank();
-  const Level cooStart = SparseTensorType(enc).getCOOStart();
-  const Level end = cooStart == lvlRank ? cooStart : cooStart + 1;
+  SmallVector<COOSegment> cooSegs = SparseTensorType(enc).getCOOSegments();
   FieldIndex fieldIdx = kDataFieldStartingIdx;
+
+  Level l = 0;
+  ArrayRef cooSegsRef = cooSegs;
   // Per-level storage.
-  for (Level l = 0; l < end; l++) {
+  while (l < lvlRank) {
----------------
aartbik wrote:

can't we keep it a 

for (Level l = 0; l < lvlRank; ) {

just to keep scope of counter smaller?

https://github.com/llvm/llvm-project/pull/82398


More information about the Mlir-commits mailing list