[Mlir-commits] [mlir] [mlir][mesh, mpi] Lower allreduce (PR #144060)
Frank Schlimbach
llvmlistbot at llvm.org
Mon Jun 16 07:11:09 PDT 2025
================
@@ -41,6 +42,38 @@ struct FoldCast final : public mlir::OpRewritePattern<OpT> {
return mlir::success();
}
};
+
+struct FoldRank final : public mlir::OpRewritePattern<mlir::mpi::CommRankOp> {
+ using mlir::OpRewritePattern<mlir::mpi::CommRankOp>::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(mlir::mpi::CommRankOp op,
+ mlir::PatternRewriter &b) const override {
+ auto comm = op.getComm();
+ if (!comm.getDefiningOp<mlir::mpi::CommWorldOp>()) {
+ return mlir::failure();
+ }
+
+ // Try to get DLTI attribute for MPI:comm_world_rank
+ // If found, set worldRank to the value of the attribute.
+ {
----------------
fschlimb wrote:
done
https://github.com/llvm/llvm-project/pull/144060
More information about the Mlir-commits
mailing list