[Mlir-commits] [mlir] [mlir][sparse]Make isBlockSparsity more robust (PR #75113)

Aart Bik llvmlistbot at llvm.org
Mon Dec 11 15:17:36 PST 2023


================
@@ -881,6 +886,14 @@ bool mlir::sparse_tensor::isBlockSparsity(AffineMap dimToLvl) {
       } else {
         return false;
       }
+    } else if (auto dimOp = dyn_cast<AffineDimExpr>(result)) {
+      auto pos = dimOp.getPosition();
+      isDimSet[pos] = 1;
----------------
aartbik wrote:

technically, you also need to check isDimSet here to make sure that (i,i) does not happen
also, you could make the code simpler if you use coeffientMap for this purpose (ie.. put a zero value in the map for plain index, all the other tests will then do the right thing!)

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


More information about the Mlir-commits mailing list