[Mlir-commits] [mlir] [mlir][sparse] Populate lvlToDim (PR #68937)

Yinying Li llvmlistbot at llvm.org
Tue Oct 17 11:52:06 PDT 2023


================
@@ -749,6 +749,74 @@ mlir::sparse_tensor::getSparseTensorEncoding(Type type) {
   return nullptr;
 }
 
+AffineMap mlir::sparse_tensor::inferLvlToDim(AffineMap dimToLvl,
+                                             MLIRContext *context) {
+  auto map = static_cast<AffineMap>(dimToLvl);
+  AffineMap lvlToDim;
+  // Return an empty lvlToDim when inference is not successful.
+  if (!map || map.getNumSymbols() != 0) {
+    lvlToDim = AffineMap();
+  } else if (map.isPermutation()) {
+    lvlToDim = inversePermutation(map);
+  } else {
----------------
yinying-lisa-li wrote:

Yes, I have that in the verification PR.

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


More information about the Mlir-commits mailing list