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

Christian Ulmann llvmlistbot at llvm.org
Fri Jan 5 09:03:08 PST 2024


================
@@ -0,0 +1,196 @@
+//===- MPIops.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_MLIR_IR_MPIOPS_TD
+#define MPI_MLIR_IR_MPIOPS_TD
+
+include "mlir/Dialect/MPI/IR/MPI.td"
+include "mlir/Dialect/MPI/IR/MPITypes.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 = [{
+    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.
+
+    This operation can optionally return an `!mpi.retval` value that can be used
+    to check for errors.
+  }];
+
+  let results = (outs Optional<MPI_Retval>:$retval);
+
+  let assemblyFormat = "attr-dict (`:` type($retval)^)?";
+}
+
+//===----------------------------------------------------------------------===//
+// CommRankOp
+//===----------------------------------------------------------------------===//
+
+def MPI_CommRankOp : MPI_Op<"comm_rank", [
+
+]> {
----------------
Dinistro wrote:

```suggestion
def MPI_CommRankOp : MPI_Op<"comm_rank", []> {
```
Same applies to other operations.

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


More information about the Mlir-commits mailing list