[Mlir-commits] [mlir] [MLIR] [SparseTensor] Implement multiple loop ordering heuristics for sparse tensor dialect (PR #151885)

Aart Bik llvmlistbot at llvm.org
Fri Aug 8 10:50:53 PDT 2025


================
@@ -76,14 +89,124 @@ class IterationGraphSorter {
   Value out;
   AffineMap loop2OutLvl;
 
-  // Loop itation types;
+  // Loop iteration types;
   SmallVector<utils::IteratorType> iterTypes;
 
   // Adjacency matrix that represents the iteration graph.
   std::vector<std::vector<bool>> itGraph;
 
   // InDegree used for topo sort.
   std::vector<unsigned> inDegree;
+
+public:
+  enum class SparseAccessType {
+    kCompressedSequential,
+    kSingletonScan,
+    kRandomSparse,
+    kDenseSubtensor
+  };
+
+  struct SparseAccessPattern {
+    SparseAccessType type;
+    double expectedSparsity;
+    unsigned memoryIndirections;
+    bool hasGoodLocality;
+  };
+
+private:
+
+  // Add these fields to your LoopMemoryInfo struct:
----------------
aartbik wrote:

who is this a note to?!

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


More information about the Mlir-commits mailing list