[Mlir-commits] [mlir] [MLIR][mesh] Mesh fixes (PR #124724)

Renato Golin llvmlistbot at llvm.org
Tue Feb 11 09:13:58 PST 2025


================
@@ -608,14 +609,39 @@ class FoldDynamicLists final : public OpRewritePattern<ShardingOp> {
                                     op.getDynamicShardedDimsOffsets(), b);
 
     // No constant operands were folded, just return;
-    if (failed(foldDynamicIndexList(mixedHalos, /*onlyNonNegative=*/true)) &&
-        failed(foldDynamicIndexList(mixedOffs, /*onlyNonNegative=*/true))) {
-      return failure();
-    }
+    bool modified = succeeded(foldDynamicIndexList(mixedHalos, true)) ||
+                    succeeded(foldDynamicIndexList(mixedOffs, true));
 
     auto halos = decomposeMixedValues(mixedHalos);
     auto offs = decomposeMixedValues(mixedOffs);
 
+    if (halos.second.empty() && !halos.first.empty()) {
+      if (halos.first[0] == 0 && llvm::all_equal(halos.first)) {
+        halos.first.clear();
+        modified = true;
+      }
+    }
+
+    if (offs.second.empty() && !offs.first.empty()) {
----------------
rengolin wrote:

Some comments here to explain what's going on would be helpful.

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


More information about the Mlir-commits mailing list