[Mlir-commits] [mlir] [mlir][mesh, mpi] Lower allreduce (PR #144060)

Frank Schlimbach llvmlistbot at llvm.org
Mon Jun 16 06:48:42 PDT 2025


================
@@ -832,9 +924,10 @@ struct ConvertMeshToMPIPass
 
     patterns.add<ConvertUpdateHaloOp, ConvertNeighborsLinearIndicesOp,
                  ConvertProcessMultiIndexOp, ConvertGetShardingOp,
-                 ConvertShardingOp, ConvertShardShapeOp>(typeConverter, ctxt);
-    // ConvertProcessLinearIndexOp accepts an optional worldRank
-    patterns.add<ConvertProcessLinearIndexOp>(typeConverter, ctxt, worldRank);
+                 ConvertShardingOp, ConvertShardShapeOp, ConvertAllReduceOp,
+                 ConvertProcessLinearIndexOp>(typeConverter, ctxt);
+    SymbolTableCollection symbolTableCollection;
+    mlir::mesh::populateFoldingPatterns(patterns, symbolTableCollection);
----------------
fschlimb wrote:

The conversion requires the folding patterns. I had my own conversion patterns and later replaced them with the folders to avoid duplication of functionality.

I could refactor: outline the actual implementation and use that in the folder and a separate conversion pattern. However, this looks overly complicated, I would hope there is a better way to do this.

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


More information about the Mlir-commits mailing list