[mlir][sparse] Implement parsing n out of m (#79935)

1. Add parsing methods for block[n, m].
2. Encode n and m with the newly extended 64-bit LevelType enum.
3. Update 2:4 methods names/comments to n:m.
This commit is contained in:
Yinying Li
2024-02-08 19:38:42 +00:00
committed by GitHub
parent 3b57b647a9
commit e5924d6499
26 changed files with 302 additions and 174 deletions

View File

@@ -130,7 +130,7 @@ static void allocSchemeForRank(OpBuilder &builder, Location loc,
createPushback(builder, loc, desc, SparseTensorFieldKind::PosMemRef, lvl,
/*value=*/posZero, /*repeat=*/linear);
return;
} else if (isSingletonLT(lt) || is2OutOf4LT(lt)) {
} else if (isSingletonLT(lt) || isNOutOfMLT(lt)) {
return; // nothing to do
}
// Keep compounding the size, but nothing needs to be initialized
@@ -409,7 +409,7 @@ static void genEndInsert(OpBuilder &builder, Location loc,
}
} else {
assert(isDenseLT(lt) || isLooseCompressedLT(lt) || isSingletonLT(lt) ||
is2OutOf4LT(lt));
isNOutOfMLT(lt));
}
}
}
@@ -488,7 +488,7 @@ public:
}
parentPos =
genCompressed(builder, loc, desc, coords, value, parentPos, lvl);
} else if (isSingletonLT(lt) || is2OutOf4LT(lt)) {
} else if (isSingletonLT(lt) || isNOutOfMLT(lt)) {
// Create:
// coordinates[lvl].push_back(coords[lvl])
// positions[lvl] = positions[lvl-1]