[Mlir-commits] [mlir] [MLIR][SparseTensor] Dense Outer Loop Ordering Strategy (PR #160168)
Aart Bik
llvmlistbot at llvm.org
Tue Oct 28 16:19:13 PDT 2025
================
@@ -80,6 +80,52 @@ inline static bool includesDenseOutput(SortMask mask) {
return includesAny(mask, SortMask::kIncludeDenseOutput);
}
+/// Returns a sparsity rank for loop ordering: lower values indicate
+/// dimensions that should be placed in outer loops.
+/// 0 = Dense, 1 = Compressed, 2 = Singleton, 3 = Other/Unknown.
+static unsigned getLoopSparsityRank(unsigned loop, ArrayRef<Value> allTensors,
+ ArrayRef<AffineMap> allMaps) {
+ unsigned bestRank = 3; // Default: most sparse (unknown/singleton-like).
----------------
aartbik wrote:
I think minRank is a bit more in line with computing the minimum of all ranks seen. Perhaps a bit nitty, but "best" is less informative
also default: seems to imply a choice, I would just say we start with highest rank assuming nothing else is known on loop
https://github.com/llvm/llvm-project/pull/160168
More information about the Mlir-commits
mailing list