[Mlir-commits] [mlir] [mlir][sparse] Fix mixed sparse-dense iterator lowering (PR #219753)

Peiming Liu llvmlistbot at llvm.org
Fri Oct 30 18:57:45 PDT 2026


================
@@ -1190,14 +1198,18 @@ static void genInitConstantDenseAddress(CodegenEnv &env,
 static bool translateBitsToTidLvlPairs(
     CodegenEnv &env, LatPointId li, LoopId curr,
     SmallVectorImpl<TensorLevel> &tidLvls,
+    SmallVectorImpl<TensorLevel> &condTidLvls,
     SmallVectorImpl<std::pair<TensorLevel, AffineExpr>> &affineTidLvls) {
-  return getAllTidLvlsInLatPoints(env, li, curr,
-                                  [&](TensorLevel tl, AffineExpr exp) {
-                                    if (exp)
-                                      affineTidLvls.emplace_back(tl, exp);
-                                    else
-                                      tidLvls.emplace_back(tl);
-                                  });
+  return getAllTidLvlsInLatPoints(
+      env, li, curr, [&](TensorLevel tl, AffineExpr exp, bool isLoopCond) {
+        if (exp)
+          affineTidLvls.emplace_back(tl, exp);
+        else {
+          tidLvls.emplace_back(tl);
+          if (isLoopCond)
+            condTidLvls.emplace_back(tl);
----------------
PeimingLiu wrote:

This extra flag does not make sense to me. You should still be able to tell that multiple tid lvl pair can be iterated by a IterateOp if there is only one sparse level among those.

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


More information about the Mlir-commits mailing list