[Mlir-commits] [mlir] [mlir] Initial patch to add an MPI dialect (PR #68892)

Anton Lydike llvmlistbot at llvm.org
Thu Oct 12 06:49:23 PDT 2023


https://github.com/AntonLydike created https://github.com/llvm/llvm-project/pull/68892

This patch introduces the new MPI dialect into MLIR. The Message Passing Interface (MPI) is a widely-used standard for distributed programs to exchange data. This PR goes together with a talk later at today's LLVM Dev Meeting.

This is just a first, small patch to get going and add the necessary base files, so that we can add more operations in further patches.

>From 8b2c0595210a03efcd1363827f73f5d31ad0f2f0 Mon Sep 17 00:00:00 2001
From: Anton Lydike <me at antonlydike.de>
Date: Fri, 18 Aug 2023 18:10:49 +0100
Subject: [PATCH 1/5] very initial MPI dialect

---
 flake.lock                                    | 104 ++++++++++++++++
 flake.nix                                     |  44 +++++++
 mlir/include/mlir/Dialect/CMakeLists.txt      |   1 +
 mlir/include/mlir/Dialect/MPI/CMakeLists.txt  |   1 +
 .../mlir/Dialect/MPI/IR/CMakeLists.txt        |   3 +
 mlir/include/mlir/Dialect/MPI/IR/MPI.h        |  34 ++++++
 mlir/include/mlir/Dialect/MPI/IR/MPIBase.td   |  29 +++++
 mlir/include/mlir/Dialect/MPI/IR/MPIOps.td    | 115 ++++++++++++++++++
 mlir/include/mlir/InitAllDialects.h           |   2 +
 mlir/lib/Dialect/CMakeLists.txt               |   1 +
 mlir/lib/Dialect/MPI/CMakeLists.txt           |   1 +
 mlir/lib/Dialect/MPI/IR/CMakeLists.txt        |  16 +++
 mlir/lib/Dialect/MPI/IR/MPIDialect.cpp        |  31 +++++
 mlir/lib/Dialect/MPI/IR/MPIOps.cpp            |  21 ++++
 mlir/test/Dialect/MPI/ops.mlir                |  21 ++++
 15 files changed, 424 insertions(+)
 create mode 100644 flake.lock
 create mode 100644 flake.nix
 create mode 100644 mlir/include/mlir/Dialect/MPI/CMakeLists.txt
 create mode 100644 mlir/include/mlir/Dialect/MPI/IR/CMakeLists.txt
 create mode 100644 mlir/include/mlir/Dialect/MPI/IR/MPI.h
 create mode 100644 mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
 create mode 100644 mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
 create mode 100644 mlir/lib/Dialect/MPI/CMakeLists.txt
 create mode 100644 mlir/lib/Dialect/MPI/IR/CMakeLists.txt
 create mode 100644 mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
 create mode 100644 mlir/lib/Dialect/MPI/IR/MPIOps.cpp
 create mode 100644 mlir/test/Dialect/MPI/ops.mlir

diff --git a/flake.lock b/flake.lock
new file mode 100644
index 000000000000000..1ec94d79a6ecb1e
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,104 @@
+{
+  "nodes": {
+    "flake-compat": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1681202837,
+        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nix-vscode-extensions": {
+      "inputs": {
+        "flake-compat": "flake-compat",
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      },
+      "locked": {
+        "lastModified": 1692235382,
+        "narHash": "sha256-T+mR2Jh9x2S94VzuRJxorRUcEIShuXtECCzvmbLRuyY=",
+        "owner": "nix-community",
+        "repo": "nix-vscode-extensions",
+        "rev": "953c8a9f3ecafdea6cdcd112d997f4a23cf50b7f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "nix-vscode-extensions",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1684570954,
+        "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": [
+          "nix-vscode-extensions",
+          "flake-utils"
+        ],
+        "nix-vscode-extensions": "nix-vscode-extensions",
+        "nixpkgs": [
+          "nix-vscode-extensions",
+          "nixpkgs"
+        ]
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 000000000000000..ac23c3fbb00be6e
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,44 @@
+{
+  inputs = {
+    nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
+    flake-utils.follows = "nix-vscode-extensions/flake-utils";
+    nixpkgs.follows = "nix-vscode-extensions/nixpkgs";
+  };
+
+  outputs = inputs:
+    inputs.flake-utils.lib.eachDefaultSystem
+      (system:
+        let
+          pkgs = inputs.nixpkgs.legacyPackages.${system};
+          extensions = inputs.nix-vscode-extensions.extensions.${system};
+          inherit (pkgs) vscode-with-extensions vscodium;
+          
+          packages.default =
+            vscode-with-extensions.override {
+              vscode = vscodium;
+              vscodeExtensions = with extensions.vscode-marketplace; [
+                # ms-vscode.cpptools
+                llvm-vs-code-extensions.vscode-clangd
+                llvm-vs-code-extensions.vscode-mlir
+                eamodio.gitlens
+              ]
+	      ++ [ pkgs.vscode-extensions.ms-vscode.cpptools ];
+            };
+
+          devShells.default = pkgs.mkShell {
+            buildInputs = [ 
+              packages.default 
+              pkgs.git pkgs.ripgrep pkgs.gdb
+              pkgs.cmake pkgs.ninja pkgs.clang pkgs.lld
+              pkgs.fish pkgs.neovim pkgs.git pkgs.mold pkgs.libclang
+            ];
+            shellHook = ''
+              printf "VSCodium with extensions:\n"
+            '';
+          };
+        in
+        {
+          inherit packages devShells;
+        });
+}
+
diff --git a/mlir/include/mlir/Dialect/CMakeLists.txt b/mlir/include/mlir/Dialect/CMakeLists.txt
index 1c4569ecfa58485..9788e24e4a1d91a 100644
--- a/mlir/include/mlir/Dialect/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/CMakeLists.txt
@@ -21,6 +21,7 @@ add_subdirectory(Math)
 add_subdirectory(MemRef)
 add_subdirectory(Mesh)
 add_subdirectory(MLProgram)
+add_subdirectory(MPI)
 add_subdirectory(NVGPU)
 add_subdirectory(OpenACC)
 add_subdirectory(OpenACCMPCommon)
diff --git a/mlir/include/mlir/Dialect/MPI/CMakeLists.txt b/mlir/include/mlir/Dialect/MPI/CMakeLists.txt
new file mode 100644
index 000000000000000..f33061b2d87cffc
--- /dev/null
+++ b/mlir/include/mlir/Dialect/MPI/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(IR)
diff --git a/mlir/include/mlir/Dialect/MPI/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/MPI/IR/CMakeLists.txt
new file mode 100644
index 000000000000000..3b7b76240d375f1
--- /dev/null
+++ b/mlir/include/mlir/Dialect/MPI/IR/CMakeLists.txt
@@ -0,0 +1,3 @@
+set(LLVM_TARGET_DEFINITIONS MPIOps.td)
+add_mlir_dialect(MPIOps mpi)
+add_mlir_doc(MPIOps MPIOps Dialects/ -gen-dialect-doc)
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPI.h b/mlir/include/mlir/Dialect/MPI/IR/MPI.h
new file mode 100644
index 000000000000000..e60ec6ec5940345
--- /dev/null
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPI.h
@@ -0,0 +1,34 @@
+//===- MPI.h - MPI dialect ----------------------------*- C++-*-==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef MLIR_DIALECT_MPI_IR_MPI_H_
+#define MLIR_DIALECT_MPI_IR_MPI_H_
+
+#include "mlir/IR/Dialect.h"
+#include "mlir/IR/FunctionInterfaces.h"
+#include "mlir/IR/OpDefinition.h"
+#include "mlir/IR/OpImplementation.h"
+#include "mlir/IR/RegionKindInterface.h"
+#include "mlir/IR/SymbolTable.h"
+#include "mlir/Interfaces/CallInterfaces.h"
+#include "mlir/Interfaces/ControlFlowInterfaces.h"
+#include "mlir/Interfaces/SideEffectInterfaces.h"
+
+//===----------------------------------------------------------------------===//
+// MPIDialect
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/MPI/IR/MPIOpsDialect.h.inc"
+
+//===----------------------------------------------------------------------===//
+// MPI Dialect Operations
+//===----------------------------------------------------------------------===//
+
+#define GET_OP_CLASSES
+#include "mlir/Dialect/MPI/IR/MPIOps.h.inc"
+
+#endif // MLIR_DIALECT_MPI_IR_MPI_H_
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
new file mode 100644
index 000000000000000..cc052f240738ad6
--- /dev/null
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
@@ -0,0 +1,29 @@
+//===- MPIBase.td - Base defs for mpi dialect --*- tablegen -*-==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MPI_BASE
+#define MPI_BASE
+
+include "mlir/IR/OpBase.td"
+
+def MPI_Dialect : Dialect {
+  let name = "mpi";
+  let cppNamespace = "::mlir::mpi";
+  let description = [{
+    TODO
+
+    This dialect is under active development, and while stability is an
+    eventual goal, it is not guaranteed at this juncture. Given the early state,
+    it is recommended to inquire further prior to using this dialect.
+  }];
+  let dependentDialects = ["arith::ArithDialect"];
+
+  let usePropertiesForAttributes = 1;
+}
+
+#endif // MPI_BASE
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
new file mode 100644
index 000000000000000..4e4f846b2b279a6
--- /dev/null
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
@@ -0,0 +1,115 @@
+//===- MPI.td - Message Passing Interface Ops ---------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MPI_OPS
+#define MPI_OPS
+
+include "mlir/Dialect/MPI/IR/MPIBase.td"
+include "mlir/Interfaces/CallInterfaces.td"
+include "mlir/Interfaces/ControlFlowInterfaces.td"
+include "mlir/Interfaces/SideEffectInterfaces.td"
+include "mlir/IR/FunctionInterfaces.td"
+include "mlir/IR/RegionKindInterface.td"
+include "mlir/IR/SymbolInterfaces.td"
+
+class MPI_Op<string mnemonic, list<Trait> traits = []> :
+    Op<MPI_Dialect, mnemonic, traits>;
+
+//===----------------------------------------------------------------------===//
+// InitOp
+//===----------------------------------------------------------------------===//
+
+def MPI_InitOp : MPI_Op<"init", [
+    
+  ]> {
+  let summary = "Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)`";
+  let description = [{
+    Passing &argc, &argv is not supported currently, also inspecting the return value is not supported.
+  }];
+
+  let assemblyFormat = "attr-dict";
+}
+
+//===----------------------------------------------------------------------===//
+// CommRankOp
+//===----------------------------------------------------------------------===//
+
+def MPI_CommRankOp : MPI_Op<"comm_rank", [
+    
+  ]> {
+  let summary = "Get the current rank, equivalent to `MPI_Comm_rank(MPI_COMM_WORLD, &rank)`";
+  let description = [{
+    Communicators other than `MPI_COMM_WORLD` are not supprted for now.
+  }];
+
+  let results = (outs
+    I32:$result
+  );
+
+  let assemblyFormat = "attr-dict `:` type($result)";
+}
+
+
+//===----------------------------------------------------------------------===//
+// SendOp
+//===----------------------------------------------------------------------===//
+
+def MPI_SendOp : MPI_Op<"send", [
+    
+  ]> {
+  let summary = "Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`";
+  let description = [{
+    Communicators other than `MPI_COMM_WORLD` are not supprted for now.
+  }];
+
+  let arguments = (ins
+    AnyMemRef:$ref,
+    I32:$tag,
+    I32:$rank
+  );
+
+  let assemblyFormat = "attr-dict $ref `:` type($ref) `,` $tag `:` type($tag) `,` $rank `:` type($rank)";
+}
+
+//===----------------------------------------------------------------------===//
+// RecvOp
+//===----------------------------------------------------------------------===//
+
+def MPI_RecvOp : MPI_Op<"recv", [
+    
+  ]> {
+  let summary = "Equivalent to `MPI_Recv(ptr, size, dtype, dest, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE)`";
+  let description = [{
+    Communicators other than `MPI_COMM_WORLD` are not supprted for now.
+  }];
+
+  let arguments = (ins
+    AnyMemRef:$ref,
+    I32:$tag,
+    I32:$rank
+  );
+
+  let assemblyFormat = "attr-dict $ref `:` type($ref) `,` $tag `:` type($tag) `,` $rank `:` type($rank)";
+}
+
+//===----------------------------------------------------------------------===//
+// FinalizeOp
+//===----------------------------------------------------------------------===//
+
+def MPI_FinalizeOp : MPI_Op<"finalize", [
+    
+  ]> {
+  let summary = "Finalize the MPI library, equivalent to `MPI_Finalize()`";
+  let description = [{
+    
+  }];
+
+  let assemblyFormat = "attr-dict";
+}
+
+#endif // MPI_OPS
diff --git a/mlir/include/mlir/InitAllDialects.h b/mlir/include/mlir/InitAllDialects.h
index 00f400aab5d50a0..42087994d0f0c89 100644
--- a/mlir/include/mlir/InitAllDialects.h
+++ b/mlir/include/mlir/InitAllDialects.h
@@ -48,6 +48,7 @@
 #include "mlir/Dialect/Linalg/Transforms/SubsetInsertionOpInterfaceImpl.h"
 #include "mlir/Dialect/Linalg/Transforms/TilingInterfaceImpl.h"
 #include "mlir/Dialect/MLProgram/IR/MLProgram.h"
+#include "mlir/Dialect/MPI/IR/MPI.h"
 #include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/MemRef/IR/MemRefMemorySlot.h"
@@ -120,6 +121,7 @@ inline void registerAllDialects(DialectRegistry &registry) {
                   memref::MemRefDialect,
                   mesh::MeshDialect,
                   ml_program::MLProgramDialect,
+                  mpi::MPIDialect,
                   nvgpu::NVGPUDialect,
                   NVVM::NVVMDialect,
                   omp::OpenMPDialect,
diff --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt
index 68776a695cac4d4..c72107939cf42bb 100644
--- a/mlir/lib/Dialect/CMakeLists.txt
+++ b/mlir/lib/Dialect/CMakeLists.txt
@@ -21,6 +21,7 @@ add_subdirectory(Math)
 add_subdirectory(MemRef)
 add_subdirectory(Mesh)
 add_subdirectory(MLProgram)
+add_subdirectory(MPI)
 add_subdirectory(NVGPU)
 add_subdirectory(OpenACC)
 add_subdirectory(OpenACCMPCommon)
diff --git a/mlir/lib/Dialect/MPI/CMakeLists.txt b/mlir/lib/Dialect/MPI/CMakeLists.txt
new file mode 100644
index 000000000000000..f33061b2d87cffc
--- /dev/null
+++ b/mlir/lib/Dialect/MPI/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(IR)
diff --git a/mlir/lib/Dialect/MPI/IR/CMakeLists.txt b/mlir/lib/Dialect/MPI/IR/CMakeLists.txt
new file mode 100644
index 000000000000000..870f034e5ccca73
--- /dev/null
+++ b/mlir/lib/Dialect/MPI/IR/CMakeLists.txt
@@ -0,0 +1,16 @@
+add_mlir_dialect_library(MLIRMPIDialect
+  MPIOps.cpp
+  MPIDialect.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/MPI
+
+  DEPENDS
+  MLIRMPIOpsIncGen
+
+  LINK_LIBS PUBLIC
+  MLIRDialect
+  MLIRIR
+  MLIRInferTypeOpInterface
+  MLIRSideEffectInterfaces
+  )
diff --git a/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp b/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
new file mode 100644
index 000000000000000..da4363725cde63c
--- /dev/null
+++ b/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
@@ -0,0 +1,31 @@
+//===- MPIDialect.cpp - MPI dialect implementation ------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/MPI/IR/MPI.h"
+#include "mlir/IR/DialectImplementation.h"
+#include "llvm/ADT/TypeSwitch.h"
+
+using namespace mlir;
+using namespace mlir::mpi;
+
+//===----------------------------------------------------------------------===//
+/// Tablegen Definitions
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/MPI/IR/MPIOpsDialect.cpp.inc"
+
+
+void mpi::MPIDialect::initialize() {
+
+  addOperations<
+#define GET_OP_LIST
+#include "mlir/Dialect/MPI/IR/MPIOps.cpp.inc"
+      >();
+
+}
diff --git a/mlir/lib/Dialect/MPI/IR/MPIOps.cpp b/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
new file mode 100644
index 000000000000000..789a9da70240069
--- /dev/null
+++ b/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
@@ -0,0 +1,21 @@
+//===- MPIOps.cpp - MPI dialect ops implementation ------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/MPI/IR/MPI.h"
+#include "mlir/IR/Builders.h"
+#include "mlir/IR/FunctionImplementation.h"
+
+using namespace mlir;
+using namespace mlir::mpi;
+
+//===----------------------------------------------------------------------===//
+// TableGen'd op method definitions
+//===----------------------------------------------------------------------===//
+
+#define GET_OP_CLASSES
+#include "mlir/Dialect/MPI/IR/MPIOps.cpp.inc"
diff --git a/mlir/test/Dialect/MPI/ops.mlir b/mlir/test/Dialect/MPI/ops.mlir
new file mode 100644
index 000000000000000..358c83ee48380d3
--- /dev/null
+++ b/mlir/test/Dialect/MPI/ops.mlir
@@ -0,0 +1,21 @@
+// RUN: mlir-opt %s | mlir-opt | FileCheck %s
+// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
+
+func.func @mpi_test(%ref : memref<100xf32>) -> () {
+    // CHECK: mpi.init
+    mpi.init
+
+    // CHECK: mpi.comm_rank
+    %rank = mpi.comm_rank : i32
+
+    // CHECK: mpi.send %arg0 : memref<100xf32>, %0 : i32, %0 : i32
+    mpi.send %ref : memref<100xf32>, %rank : i32, %rank : i32
+
+    // CHECK: mpi.recv %arg0 : memref<100xf32>, %0 : i32, %0 : i32
+    mpi.recv %ref : memref<100xf32>, %rank : i32, %rank : i32
+
+    // CHECK: mpi.finalize
+    mpi.finalize
+
+    func.return
+}

>From ed60fcc6c706bf198208e386bf87c4bb6e2b7b71 Mon Sep 17 00:00:00 2001
From: Anton Lydike <me at antonlydike.de>
Date: Tue, 29 Aug 2023 13:50:10 +0100
Subject: [PATCH 2/5] cleaned up a lot of loose ends

---
 flake.lock                                  | 104 --------------------
 flake.nix                                   |  44 ---------
 mlir/include/mlir/Dialect/MPI/IR/MPI.h      |   6 --
 mlir/include/mlir/Dialect/MPI/IR/MPIBase.td |   1 -
 mlir/include/mlir/Dialect/MPI/IR/MPIOps.td  |   6 --
 mlir/lib/Dialect/MPI/IR/MPIDialect.cpp      |   2 -
 mlir/lib/Dialect/MPI/IR/MPIOps.cpp          |   2 -
 mlir/test/Dialect/MPI/ops.mlir              |   2 +-
 8 files changed, 1 insertion(+), 166 deletions(-)
 delete mode 100644 flake.lock
 delete mode 100644 flake.nix

diff --git a/flake.lock b/flake.lock
deleted file mode 100644
index 1ec94d79a6ecb1e..000000000000000
--- a/flake.lock
+++ /dev/null
@@ -1,104 +0,0 @@
-{
-  "nodes": {
-    "flake-compat": {
-      "flake": false,
-      "locked": {
-        "lastModified": 1673956053,
-        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
-        "owner": "edolstra",
-        "repo": "flake-compat",
-        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
-        "type": "github"
-      },
-      "original": {
-        "owner": "edolstra",
-        "repo": "flake-compat",
-        "type": "github"
-      }
-    },
-    "flake-utils": {
-      "inputs": {
-        "systems": "systems"
-      },
-      "locked": {
-        "lastModified": 1681202837,
-        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
-        "owner": "numtide",
-        "repo": "flake-utils",
-        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
-        "type": "github"
-      },
-      "original": {
-        "owner": "numtide",
-        "repo": "flake-utils",
-        "type": "github"
-      }
-    },
-    "nix-vscode-extensions": {
-      "inputs": {
-        "flake-compat": "flake-compat",
-        "flake-utils": "flake-utils",
-        "nixpkgs": "nixpkgs"
-      },
-      "locked": {
-        "lastModified": 1692235382,
-        "narHash": "sha256-T+mR2Jh9x2S94VzuRJxorRUcEIShuXtECCzvmbLRuyY=",
-        "owner": "nix-community",
-        "repo": "nix-vscode-extensions",
-        "rev": "953c8a9f3ecafdea6cdcd112d997f4a23cf50b7f",
-        "type": "github"
-      },
-      "original": {
-        "owner": "nix-community",
-        "repo": "nix-vscode-extensions",
-        "type": "github"
-      }
-    },
-    "nixpkgs": {
-      "locked": {
-        "lastModified": 1684570954,
-        "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=",
-        "owner": "NixOS",
-        "repo": "nixpkgs",
-        "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3",
-        "type": "github"
-      },
-      "original": {
-        "owner": "NixOS",
-        "ref": "nixos-unstable",
-        "repo": "nixpkgs",
-        "type": "github"
-      }
-    },
-    "root": {
-      "inputs": {
-        "flake-utils": [
-          "nix-vscode-extensions",
-          "flake-utils"
-        ],
-        "nix-vscode-extensions": "nix-vscode-extensions",
-        "nixpkgs": [
-          "nix-vscode-extensions",
-          "nixpkgs"
-        ]
-      }
-    },
-    "systems": {
-      "locked": {
-        "lastModified": 1681028828,
-        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
-        "owner": "nix-systems",
-        "repo": "default",
-        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
-        "type": "github"
-      },
-      "original": {
-        "owner": "nix-systems",
-        "repo": "default",
-        "type": "github"
-      }
-    }
-  },
-  "root": "root",
-  "version": 7
-}
diff --git a/flake.nix b/flake.nix
deleted file mode 100644
index ac23c3fbb00be6e..000000000000000
--- a/flake.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{
-  inputs = {
-    nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
-    flake-utils.follows = "nix-vscode-extensions/flake-utils";
-    nixpkgs.follows = "nix-vscode-extensions/nixpkgs";
-  };
-
-  outputs = inputs:
-    inputs.flake-utils.lib.eachDefaultSystem
-      (system:
-        let
-          pkgs = inputs.nixpkgs.legacyPackages.${system};
-          extensions = inputs.nix-vscode-extensions.extensions.${system};
-          inherit (pkgs) vscode-with-extensions vscodium;
-          
-          packages.default =
-            vscode-with-extensions.override {
-              vscode = vscodium;
-              vscodeExtensions = with extensions.vscode-marketplace; [
-                # ms-vscode.cpptools
-                llvm-vs-code-extensions.vscode-clangd
-                llvm-vs-code-extensions.vscode-mlir
-                eamodio.gitlens
-              ]
-	      ++ [ pkgs.vscode-extensions.ms-vscode.cpptools ];
-            };
-
-          devShells.default = pkgs.mkShell {
-            buildInputs = [ 
-              packages.default 
-              pkgs.git pkgs.ripgrep pkgs.gdb
-              pkgs.cmake pkgs.ninja pkgs.clang pkgs.lld
-              pkgs.fish pkgs.neovim pkgs.git pkgs.mold pkgs.libclang
-            ];
-            shellHook = ''
-              printf "VSCodium with extensions:\n"
-            '';
-          };
-        in
-        {
-          inherit packages devShells;
-        });
-}
-
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPI.h b/mlir/include/mlir/Dialect/MPI/IR/MPI.h
index e60ec6ec5940345..0cffe8edda44312 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPI.h
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPI.h
@@ -9,14 +9,8 @@
 #define MLIR_DIALECT_MPI_IR_MPI_H_
 
 #include "mlir/IR/Dialect.h"
-#include "mlir/IR/FunctionInterfaces.h"
 #include "mlir/IR/OpDefinition.h"
 #include "mlir/IR/OpImplementation.h"
-#include "mlir/IR/RegionKindInterface.h"
-#include "mlir/IR/SymbolTable.h"
-#include "mlir/Interfaces/CallInterfaces.h"
-#include "mlir/Interfaces/ControlFlowInterfaces.h"
-#include "mlir/Interfaces/SideEffectInterfaces.h"
 
 //===----------------------------------------------------------------------===//
 // MPIDialect
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
index cc052f240738ad6..dad42ff65458dd1 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
@@ -21,7 +21,6 @@ def MPI_Dialect : Dialect {
     eventual goal, it is not guaranteed at this juncture. Given the early state,
     it is recommended to inquire further prior to using this dialect.
   }];
-  let dependentDialects = ["arith::ArithDialect"];
 
   let usePropertiesForAttributes = 1;
 }
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
index 4e4f846b2b279a6..e855946e5cc9874 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
@@ -10,12 +10,6 @@
 #define MPI_OPS
 
 include "mlir/Dialect/MPI/IR/MPIBase.td"
-include "mlir/Interfaces/CallInterfaces.td"
-include "mlir/Interfaces/ControlFlowInterfaces.td"
-include "mlir/Interfaces/SideEffectInterfaces.td"
-include "mlir/IR/FunctionInterfaces.td"
-include "mlir/IR/RegionKindInterface.td"
-include "mlir/IR/SymbolInterfaces.td"
 
 class MPI_Op<string mnemonic, list<Trait> traits = []> :
     Op<MPI_Dialect, mnemonic, traits>;
diff --git a/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp b/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
index da4363725cde63c..848f2dfe07dd9cf 100644
--- a/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
+++ b/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
@@ -6,10 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/MPI/IR/MPI.h"
 #include "mlir/IR/DialectImplementation.h"
-#include "llvm/ADT/TypeSwitch.h"
 
 using namespace mlir;
 using namespace mlir::mpi;
diff --git a/mlir/lib/Dialect/MPI/IR/MPIOps.cpp b/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
index 789a9da70240069..84b27c2dae419b2 100644
--- a/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
+++ b/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
@@ -7,8 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/MPI/IR/MPI.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/IR/FunctionImplementation.h"
 
 using namespace mlir;
 using namespace mlir::mpi;
diff --git a/mlir/test/Dialect/MPI/ops.mlir b/mlir/test/Dialect/MPI/ops.mlir
index 358c83ee48380d3..2ba77024d35a7f8 100644
--- a/mlir/test/Dialect/MPI/ops.mlir
+++ b/mlir/test/Dialect/MPI/ops.mlir
@@ -5,7 +5,7 @@ func.func @mpi_test(%ref : memref<100xf32>) -> () {
     // CHECK: mpi.init
     mpi.init
 
-    // CHECK: mpi.comm_rank
+    // CHECK: mpi.comm_rank : i32
     %rank = mpi.comm_rank : i32
 
     // CHECK: mpi.send %arg0 : memref<100xf32>, %0 : i32, %0 : i32

>From 8364efc8fb2c23dd9cfdb5c0de80741c8d753d7f Mon Sep 17 00:00:00 2001
From: Anton Lydike <me at antonlydike.de>
Date: Tue, 29 Aug 2023 13:58:07 +0100
Subject: [PATCH 3/5] add documentation

---
 mlir/include/mlir/Dialect/MPI/IR/MPIBase.td | 6 +++++-
 mlir/include/mlir/Dialect/MPI/IR/MPIOps.td  | 9 +++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
index dad42ff65458dd1..11b2ce4e3905ef2 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
@@ -15,7 +15,11 @@ def MPI_Dialect : Dialect {
   let name = "mpi";
   let cppNamespace = "::mlir::mpi";
   let description = [{
-    TODO
+    This dialect models the Message Passing Interface (MPI), version 4.0. It is meant
+    to serve as a targetable dialect, that can be lowered to multiple MPI implementations
+    and hide differences in ABI between these. The dialect models the functions of the MPI
+    specification as close to 1:1 as possible while preserving SSA value semantics where it
+    makes sense, and uses `memref` types instead of bare pointers.
 
     This dialect is under active development, and while stability is an
     eventual goal, it is not guaranteed at this juncture. Given the early state,
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
index e855946e5cc9874..6b43c261a0059ab 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
@@ -23,7 +23,8 @@ def MPI_InitOp : MPI_Op<"init", [
   ]> {
   let summary = "Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)`";
   let description = [{
-    Passing &argc, &argv is not supported currently, also inspecting the return value is not supported.
+    Passing &argc, &argv is not supported currently.
+    Inspecting the return value (error code) is also not supported.
   }];
 
   let assemblyFormat = "attr-dict";
@@ -39,6 +40,7 @@ def MPI_CommRankOp : MPI_Op<"comm_rank", [
   let summary = "Get the current rank, equivalent to `MPI_Comm_rank(MPI_COMM_WORLD, &rank)`";
   let description = [{
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
+    Inspecting the return value (error code) is also not supported.
   }];
 
   let results = (outs
@@ -59,6 +61,7 @@ def MPI_SendOp : MPI_Op<"send", [
   let summary = "Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`";
   let description = [{
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
+    Inspecting the return value (error code) is also not supported.
   }];
 
   let arguments = (ins
@@ -80,6 +83,8 @@ def MPI_RecvOp : MPI_Op<"recv", [
   let summary = "Equivalent to `MPI_Recv(ptr, size, dtype, dest, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE)`";
   let description = [{
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
+    The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object is not yet ported to MLIR.
+    Inspecting the return value (error code) is also not supported.
   }];
 
   let arguments = (ins
@@ -100,7 +105,7 @@ def MPI_FinalizeOp : MPI_Op<"finalize", [
   ]> {
   let summary = "Finalize the MPI library, equivalent to `MPI_Finalize()`";
   let description = [{
-    
+    Inspecting the return value (error code) is not supported.
   }];
 
   let assemblyFormat = "attr-dict";

>From 53e4a296f1c8eb88caee8692caa56e0a4c952d24 Mon Sep 17 00:00:00 2001
From: Anton Lydike <me at antonlydike.de>
Date: Wed, 30 Aug 2023 14:58:31 +0100
Subject: [PATCH 4/5] another pass on documentation

---
 mlir/include/mlir/Dialect/MPI/IR/MPIBase.td |  9 +++++++-
 mlir/include/mlir/Dialect/MPI/IR/MPIOps.td  | 25 ++++++++++++++++-----
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
index 11b2ce4e3905ef2..e3d0af069636a0f 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIBase.td
@@ -17,13 +17,20 @@ def MPI_Dialect : Dialect {
   let description = [{
     This dialect models the Message Passing Interface (MPI), version 4.0. It is meant
     to serve as a targetable dialect, that can be lowered to multiple MPI implementations
-    and hide differences in ABI between these. The dialect models the functions of the MPI
+    and hide differences in ABI. The dialect models the functions of the MPI
     specification as close to 1:1 as possible while preserving SSA value semantics where it
     makes sense, and uses `memref` types instead of bare pointers.
 
     This dialect is under active development, and while stability is an
     eventual goal, it is not guaranteed at this juncture. Given the early state,
     it is recommended to inquire further prior to using this dialect.
+
+    The current version of the dialect models a very limited part of the MPI Library,
+    often simplifying operations. This was a conscious decision that enables us to
+    incrementally add features as they are needed.
+
+    For an in-depth documentation of the MPI library interface, please refer to official documentation
+    such as the [OpenMPI online documentation](https://www.open-mpi.org/doc/current/).
   }];
 
   let usePropertiesForAttributes = 1;
diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
index 6b43c261a0059ab..eec7cfd5009ba43 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
@@ -23,8 +23,11 @@ def MPI_InitOp : MPI_Op<"init", [
   ]> {
   let summary = "Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)`";
   let description = [{
+    This operation must preceed most MPI calls (except for very few exceptions,
+    please consult with the MPI specification on these).
+
     Passing &argc, &argv is not supported currently.
-    Inspecting the return value (error code) is also not supported.
+    Inspecting the functions return value (error code) is also not supported.
   }];
 
   let assemblyFormat = "attr-dict";
@@ -40,7 +43,7 @@ def MPI_CommRankOp : MPI_Op<"comm_rank", [
   let summary = "Get the current rank, equivalent to `MPI_Comm_rank(MPI_COMM_WORLD, &rank)`";
   let description = [{
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
-    Inspecting the return value (error code) is also not supported.
+    Inspecting the functions return value (error code) is also not supported.
   }];
 
   let results = (outs
@@ -60,8 +63,12 @@ def MPI_SendOp : MPI_Op<"send", [
   ]> {
   let summary = "Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`";
   let description = [{
+    MPI_Send performs a blocking send of `size` elements of type `dtype` to rank `dest`.
+    The `tag` value and communicator enables the library to determine the matching of
+    multiple sends and receives between the same ranks.
+
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
-    Inspecting the return value (error code) is also not supported.
+    Inspecting the functions return value (error code) is also not supported.
   }];
 
   let arguments = (ins
@@ -82,9 +89,13 @@ def MPI_RecvOp : MPI_Op<"recv", [
   ]> {
   let summary = "Equivalent to `MPI_Recv(ptr, size, dtype, dest, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE)`";
   let description = [{
+    MPI_Recv performs a blocking receive of `size` elements of type `dtype` from rank `dest`.
+    The `tag` value and communicator enables the library to determine the matching of
+    multiple sends and receives between the same ranks.
+
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
     The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object is not yet ported to MLIR.
-    Inspecting the return value (error code) is also not supported.
+    Inspecting the functions return value (error code) is also not supported.
   }];
 
   let arguments = (ins
@@ -105,7 +116,11 @@ def MPI_FinalizeOp : MPI_Op<"finalize", [
   ]> {
   let summary = "Finalize the MPI library, equivalent to `MPI_Finalize()`";
   let description = [{
-    Inspecting the return value (error code) is not supported.
+    This function cleans up the MPI state. Afterwards, no MPI methods may be invoked
+    (excpet for MPI_Get_version, MPI_Initialized, and MPI_Finalized).
+    Notably, MPI_Init cannot be called again in the same program.
+
+    Inspecting the functions return value (error code) is not supported.
   }];
 
   let assemblyFormat = "attr-dict";

>From 7b3e9f5c8d9d8309b7f4b7340a2bde5e68a76dca Mon Sep 17 00:00:00 2001
From: Anton Lydike <me at antonlydike.de>
Date: Thu, 12 Oct 2023 14:14:04 +0100
Subject: [PATCH 5/5] apply coding styles

---
 mlir/include/mlir/Dialect/MPI/IR/MPIOps.td | 59 ++++++++++------------
 mlir/lib/Dialect/MPI/IR/MPIDialect.cpp     |  2 -
 2 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
index eec7cfd5009ba43..5618cf179df73b1 100644
--- a/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
+++ b/mlir/include/mlir/Dialect/MPI/IR/MPIOps.td
@@ -11,17 +11,18 @@
 
 include "mlir/Dialect/MPI/IR/MPIBase.td"
 
-class MPI_Op<string mnemonic, list<Trait> traits = []> :
-    Op<MPI_Dialect, mnemonic, traits>;
+class MPI_Op<string mnemonic, list<Trait> traits = []>
+    : Op<MPI_Dialect, mnemonic, traits>;
 
 //===----------------------------------------------------------------------===//
 // InitOp
 //===----------------------------------------------------------------------===//
 
 def MPI_InitOp : MPI_Op<"init", [
-    
-  ]> {
-  let summary = "Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)`";
+
+]> {
+  let summary =
+      "Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)`";
   let description = [{
     This operation must preceed most MPI calls (except for very few exceptions,
     please consult with the MPI specification on these).
@@ -38,30 +39,29 @@ def MPI_InitOp : MPI_Op<"init", [
 //===----------------------------------------------------------------------===//
 
 def MPI_CommRankOp : MPI_Op<"comm_rank", [
-    
-  ]> {
-  let summary = "Get the current rank, equivalent to `MPI_Comm_rank(MPI_COMM_WORLD, &rank)`";
+
+]> {
+  let summary = "Get the current rank, equivalent to "
+                "`MPI_Comm_rank(MPI_COMM_WORLD, &rank)`";
   let description = [{
     Communicators other than `MPI_COMM_WORLD` are not supprted for now.
     Inspecting the functions return value (error code) is also not supported.
   }];
 
-  let results = (outs
-    I32:$result
-  );
+  let results = (outs I32 : $result);
 
   let assemblyFormat = "attr-dict `:` type($result)";
 }
 
-
 //===----------------------------------------------------------------------===//
 // SendOp
 //===----------------------------------------------------------------------===//
 
 def MPI_SendOp : MPI_Op<"send", [
-    
-  ]> {
-  let summary = "Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`";
+
+]> {
+  let summary =
+      "Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`";
   let description = [{
     MPI_Send performs a blocking send of `size` elements of type `dtype` to rank `dest`.
     The `tag` value and communicator enables the library to determine the matching of
@@ -71,13 +71,10 @@ def MPI_SendOp : MPI_Op<"send", [
     Inspecting the functions return value (error code) is also not supported.
   }];
 
-  let arguments = (ins
-    AnyMemRef:$ref,
-    I32:$tag,
-    I32:$rank
-  );
+  let arguments = (ins AnyMemRef : $ref, I32 : $tag, I32 : $rank);
 
-  let assemblyFormat = "attr-dict $ref `:` type($ref) `,` $tag `:` type($tag) `,` $rank `:` type($rank)";
+  let assemblyFormat = "attr-dict $ref `:` type($ref) `,` $tag `:` type($tag) "
+                       "`,` $rank `:` type($rank)";
 }
 
 //===----------------------------------------------------------------------===//
@@ -85,9 +82,10 @@ def MPI_SendOp : MPI_Op<"send", [
 //===----------------------------------------------------------------------===//
 
 def MPI_RecvOp : MPI_Op<"recv", [
-    
-  ]> {
-  let summary = "Equivalent to `MPI_Recv(ptr, size, dtype, dest, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE)`";
+
+]> {
+  let summary = "Equivalent to `MPI_Recv(ptr, size, dtype, dest, tag, "
+                "MPI_COMM_WORLD, MPI_STATUS_IGNORE)`";
   let description = [{
     MPI_Recv performs a blocking receive of `size` elements of type `dtype` from rank `dest`.
     The `tag` value and communicator enables the library to determine the matching of
@@ -98,13 +96,10 @@ def MPI_RecvOp : MPI_Op<"recv", [
     Inspecting the functions return value (error code) is also not supported.
   }];
 
-  let arguments = (ins
-    AnyMemRef:$ref,
-    I32:$tag,
-    I32:$rank
-  );
+  let arguments = (ins AnyMemRef : $ref, I32 : $tag, I32 : $rank);
 
-  let assemblyFormat = "attr-dict $ref `:` type($ref) `,` $tag `:` type($tag) `,` $rank `:` type($rank)";
+  let assemblyFormat = "attr-dict $ref `:` type($ref) `,` $tag `:` type($tag) "
+                       "`,` $rank `:` type($rank)";
 }
 
 //===----------------------------------------------------------------------===//
@@ -112,8 +107,8 @@ def MPI_RecvOp : MPI_Op<"recv", [
 //===----------------------------------------------------------------------===//
 
 def MPI_FinalizeOp : MPI_Op<"finalize", [
-    
-  ]> {
+
+]> {
   let summary = "Finalize the MPI library, equivalent to `MPI_Finalize()`";
   let description = [{
     This function cleans up the MPI state. Afterwards, no MPI methods may be invoked
diff --git a/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp b/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
index 848f2dfe07dd9cf..19ed5d8207af459 100644
--- a/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
+++ b/mlir/lib/Dialect/MPI/IR/MPIDialect.cpp
@@ -18,12 +18,10 @@ using namespace mlir::mpi;
 
 #include "mlir/Dialect/MPI/IR/MPIOpsDialect.cpp.inc"
 
-
 void mpi::MPIDialect::initialize() {
 
   addOperations<
 #define GET_OP_LIST
 #include "mlir/Dialect/MPI/IR/MPIOps.cpp.inc"
       >();
-
 }



More information about the Mlir-commits mailing list