[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 11:37:40 PDT 2025


================
@@ -271,3 +349,907 @@ void IterationGraphSorter::addConstraints(Value t, AffineMap loop2LvlMap) {
     }
   }
 }
+
+// get encoding info (storage format, level types, etc)
+SparseTensorEncodingAttr getEncodingInfo(Value tensor) {
+  auto tensorType = dyn_cast<RankedTensorType>(tensor.getType());
+  if (!tensorType)
+    return nullptr; // Not a ranked tensor type
+  return getSparseTensorEncoding(tensorType);
+}
+
+void IterationGraphSorter::analyzeMemoryPatterns() {
----------------
aartbik wrote:

And +1 on Peiming's suggestion of breaking the PR up. The very first could introduce just the flag and some basic infrastructure (to get the boilerplate out of the way). Then each next one could add more and more strategies.

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


More information about the Mlir-commits mailing list