@@ -59,6 +59,28 @@ def MPI_CommRankOp : MPI_Op<"comm_rank", []> {
59
59
let assemblyFormat = "attr-dict `:` type(results)";
60
60
}
61
61
62
+ //===----------------------------------------------------------------------===//
63
+ // CommSizeOp
64
+ //===----------------------------------------------------------------------===//
65
+
66
+ def MPI_CommSizeOp : MPI_Op<"comm_size", []> {
67
+ let summary = "Get the size of the group associated to the communicator, "
68
+ "equivalent to `MPI_Comm_size(MPI_COMM_WORLD, &size)`";
69
+ let description = [{
70
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
71
+
72
+ This operation can optionally return an `!mpi.retval` value that can be used
73
+ to check for errors.
74
+ }];
75
+
76
+ let results = (
77
+ outs Optional<MPI_Retval> : $retval,
78
+ I32 : $size
79
+ );
80
+
81
+ let assemblyFormat = "attr-dict `:` type(results)";
82
+ }
83
+
62
84
//===----------------------------------------------------------------------===//
63
85
// SendOp
64
86
//===----------------------------------------------------------------------===//
@@ -71,13 +93,17 @@ def MPI_SendOp : MPI_Op<"send", []> {
71
93
`dest`. The `tag` value and communicator enables the library to determine
72
94
the matching of multiple sends and receives between the same ranks.
73
95
74
- Communicators other than `MPI_COMM_WORLD` are not supprted for now.
96
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
75
97
76
98
This operation can optionally return an `!mpi.retval` value that can be used
77
99
to check for errors.
78
100
}];
79
101
80
- let arguments = (ins AnyMemRef : $ref, I32 : $tag, I32 : $rank);
102
+ let arguments = (
103
+ ins AnyMemRef : $ref,
104
+ I32 : $tag,
105
+ I32 : $rank
106
+ );
81
107
82
108
let results = (outs Optional<MPI_Retval>:$retval);
83
109
@@ -87,6 +113,42 @@ def MPI_SendOp : MPI_Op<"send", []> {
87
113
let hasCanonicalizer = 1;
88
114
}
89
115
116
+ //===----------------------------------------------------------------------===//
117
+ // ISendOp
118
+ //===----------------------------------------------------------------------===//
119
+
120
+ def MPI_ISendOp : MPI_Op<"isend", []> {
121
+ let summary =
122
+ "Equivalent to `MPI_Isend(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`";
123
+ let description = [{
124
+ MPI_Isend begins a non-blocking send of `size` elements of type `dtype` to
125
+ rank `dest`. The `tag` value and communicator enables the library to
126
+ determine the matching of multiple sends and receives between the same
127
+ ranks.
128
+
129
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
130
+
131
+ This operation can optionally return an `!mpi.retval` value that can be used
132
+ to check for errors.
133
+ }];
134
+
135
+ let arguments = (
136
+ ins AnyMemRef : $ref,
137
+ I32 : $tag,
138
+ I32 : $rank
139
+ );
140
+
141
+ let results = (
142
+ outs Optional<MPI_Retval>:$retval,
143
+ MPI_Request : $req
144
+ );
145
+
146
+ let assemblyFormat = "`(` $ref `,` $tag `,` $rank `)` attr-dict "
147
+ "`:` type($ref) `,` type($tag) `,` type($rank) "
148
+ "`->` type(results)";
149
+ let hasCanonicalizer = 1;
150
+ }
151
+
90
152
//===----------------------------------------------------------------------===//
91
153
// RecvOp
92
154
//===----------------------------------------------------------------------===//
@@ -100,24 +162,142 @@ def MPI_RecvOp : MPI_Op<"recv", []> {
100
162
determine the matching of multiple sends and receives between the same
101
163
ranks.
102
164
103
- Communicators other than `MPI_COMM_WORLD` are not supprted for now.
165
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
104
166
The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object
105
167
is not yet ported to MLIR.
106
168
107
169
This operation can optionally return an `!mpi.retval` value that can be used
108
170
to check for errors.
109
171
}];
110
172
111
- let arguments = (ins AnyMemRef : $ref, I32 : $tag, I32 : $rank);
173
+ let arguments = (
174
+ ins AnyMemRef : $ref,
175
+ I32 : $tag, I32 : $rank
176
+ );
112
177
113
178
let results = (outs Optional<MPI_Retval>:$retval);
114
179
115
- let assemblyFormat = "`(` $ref `,` $tag `,` $rank `)` attr-dict `:` "
180
+ let assemblyFormat = "`(` $ref `,` $tag `,` $rank `)` attr-dict `:`"
116
181
"type($ref) `,` type($tag) `,` type($rank)"
117
182
"(`->` type($retval)^)?";
118
183
let hasCanonicalizer = 1;
119
184
}
120
185
186
+ //===----------------------------------------------------------------------===//
187
+ // IRecvOp
188
+ //===----------------------------------------------------------------------===//
189
+
190
+ def MPI_IRecvOp : MPI_Op<"irecv", []> {
191
+ let summary = "Equivalent to `MPI_Irecv(ptr, size, dtype, dest, tag, "
192
+ "MPI_COMM_WORLD, &req)`";
193
+ let description = [{
194
+ MPI_Irecv begins a non-blocking receive of `size` elements of type `dtype`
195
+ from rank `dest`. The `tag` value and communicator enables the library to
196
+ determine the matching of multiple sends and receives between the same
197
+ ranks.
198
+
199
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
200
+
201
+ This operation can optionally return an `!mpi.retval` value that can be used
202
+ to check for errors.
203
+ }];
204
+
205
+ let arguments = (
206
+ ins AnyMemRef : $ref,
207
+ I32 : $tag,
208
+ I32 : $rank
209
+ );
210
+
211
+ let results = (
212
+ outs Optional<MPI_Retval>:$retval,
213
+ MPI_Request : $req
214
+ );
215
+
216
+ let assemblyFormat = "`(` $ref `,` $tag `,` $rank `)` attr-dict `:`"
217
+ "type($ref) `,` type($tag) `,` type($rank) `->`"
218
+ "type(results)";
219
+ let hasCanonicalizer = 1;
220
+ }
221
+
222
+ //===----------------------------------------------------------------------===//
223
+ // AllReduceOp
224
+ //===----------------------------------------------------------------------===//
225
+
226
+ def MPI_AllReduceOp : MPI_Op<"allreduce", []> {
227
+ let summary = "Equivalent to `MPI_Allreduce(sendbuf, recvbuf, op, "
228
+ "MPI_COMM_WORLD)`";
229
+ let description = [{
230
+ MPI_Allreduce performs a reduction operation on the values in the sendbuf
231
+ array and stores the result in the recvbuf array. The operation is
232
+ performed across all processes in the communicator.
233
+
234
+ The `op` attribute specifies the reduction operation to be performed.
235
+ Currently only the `MPI_Op` predefined in the standard (e.g. `MPI_SUM`) are
236
+ supported.
237
+
238
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
239
+
240
+ This operation can optionally return an `!mpi.retval` value that can be used
241
+ to check for errors.
242
+ }];
243
+
244
+ let arguments = (
245
+ ins AnyMemRef : $sendbuf,
246
+ AnyMemRef : $recvbuf,
247
+ MPI_OpClassAttr : $op
248
+ );
249
+
250
+ let results = (outs Optional<MPI_Retval>:$retval);
251
+
252
+ let assemblyFormat = "`(` $sendbuf `,` $recvbuf `,` $op `)` attr-dict `:`"
253
+ "type($sendbuf) `,` type($recvbuf)"
254
+ "(`->` type($retval)^)?";
255
+ }
256
+
257
+ //===----------------------------------------------------------------------===//
258
+ // BarrierOp
259
+ //===----------------------------------------------------------------------===//
260
+
261
+ def MPI_Barrier : MPI_Op<"barrier", []> {
262
+ let summary = "Equivalent to `MPI_Barrier(MPI_COMM_WORLD)`";
263
+ let description = [{
264
+ MPI_Barrier blocks execution until all processes in the communicator have
265
+ reached this routine.
266
+
267
+ Communicators other than `MPI_COMM_WORLD` are not supported for now.
268
+
269
+ This operation can optionally return an `!mpi.retval` value that can be used
270
+ to check for errors.
271
+ }];
272
+
273
+ let results = (outs Optional<MPI_Retval>:$retval);
274
+
275
+ let assemblyFormat = "attr-dict (`:` type($retval) ^)?";
276
+ }
277
+
278
+ //===----------------------------------------------------------------------===//
279
+ // WaitOp
280
+ //===----------------------------------------------------------------------===//
281
+
282
+ def MPI_Wait : MPI_Op<"wait", []> {
283
+ let summary = "Equivalent to `MPI_Wait(req, MPI_STATUS_IGNORE)`";
284
+ let description = [{
285
+ MPI_Wait blocks execution until the request has completed.
286
+
287
+ The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object
288
+ is not yet ported to MLIR.
289
+
290
+ This operation can optionally return an `!mpi.retval` value that can be used
291
+ to check for errors.
292
+ }];
293
+
294
+ let arguments = (ins MPI_Request : $req);
295
+
296
+ let results = (outs Optional<MPI_Retval>:$retval);
297
+
298
+ let assemblyFormat = "`(` $req `)` attr-dict `:` type($req) "
299
+ "(`->` type($retval) ^)?";
300
+ }
121
301
122
302
//===----------------------------------------------------------------------===//
123
303
// FinalizeOp
@@ -139,7 +319,6 @@ def MPI_FinalizeOp : MPI_Op<"finalize", []> {
139
319
let assemblyFormat = "attr-dict (`:` type($retval)^)?";
140
320
}
141
321
142
-
143
322
//===----------------------------------------------------------------------===//
144
323
// RetvalCheckOp
145
324
//===----------------------------------------------------------------------===//
@@ -163,10 +342,8 @@ def MPI_RetvalCheckOp : MPI_Op<"retval_check", []> {
163
342
let assemblyFormat = "$val `=` $errclass attr-dict `:` type($res)";
164
343
}
165
344
166
-
167
-
168
345
//===----------------------------------------------------------------------===//
169
- // RetvalCheckOp
346
+ // ErrorClassOp
170
347
//===----------------------------------------------------------------------===//
171
348
172
349
def MPI_ErrorClassOp : MPI_Op<"error_class", []> {
0 commit comments