| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Op Declarations *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* From: MPIOps.td *| |
| 7 | |* *| |
| 8 | \*===----------------------------------------------------------------------===*/ |
| 9 | |
| 10 | namespace mlir::mpi { |
| 11 | |
| 12 | /// Equivalent to `MPI_Allgather(sendbuf, sendcount, sendtype, |
| 13 | /// recvbuf, recvcount, recvtype, |
| 14 | /// comm)`. |
| 15 | /// MPI_Allgather collects data from all processes in a given communicator and |
| 16 | /// stores the gathered data in the receive buffer of each process. |
| 17 | /// |
| 18 | /// Each process contributes the same amount of data defined by `sendbuf`. |
| 19 | /// The MPI call specifies the number of elements contributed by each process |
| 20 | /// via the `recvcount` parameter. However, this operation, assumes `recvbuf` |
| 21 | /// to be sufficiently large to hold the data contributed by all processes. |
| 22 | /// Therefore, `recvcount` is implicitly defined as |
| 23 | /// `num_elements(recvbuf) / MPI_Comm_size(comm)`. |
| 24 | /// |
| 25 | /// This operation may optionally return an !mpi.retval value, which can be |
| 26 | /// used for error checking. |
| 27 | class AllGatherOp; |
| 28 | |
| 29 | } // namespace mlir::mpi |
| 30 | namespace mlir::mpi { |
| 31 | |
| 32 | /// Equivalent to `MPI_Allreduce(sendbuf, recvbuf, op, comm)` |
| 33 | /// MPI_Allreduce performs a reduction operation on the values in the sendbuf |
| 34 | /// array and stores the result in the recvbuf array. The operation is |
| 35 | /// performed across all processes in the communicator. |
| 36 | /// |
| 37 | /// The `op` attribute specifies the reduction operation to be performed. |
| 38 | /// Currently only the `MPI_Op` predefined in the standard (e.g. `MPI_SUM`) are |
| 39 | /// supported. |
| 40 | /// |
| 41 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 42 | /// to check for errors. |
| 43 | class AllReduceOp; |
| 44 | |
| 45 | } // namespace mlir::mpi |
| 46 | namespace mlir::mpi { |
| 47 | |
| 48 | /// Equivalent to `MPI_Barrier(comm)` |
| 49 | /// MPI_Barrier blocks execution until all processes in the communicator have |
| 50 | /// reached this routine. |
| 51 | /// |
| 52 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 53 | /// to check for errors. |
| 54 | class Barrier; |
| 55 | |
| 56 | } // namespace mlir::mpi |
| 57 | namespace mlir::mpi { |
| 58 | |
| 59 | /// Get the current rank, equivalent to `MPI_Comm_rank(comm, &rank)` |
| 60 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 61 | /// to check for errors. |
| 62 | class CommRankOp; |
| 63 | |
| 64 | } // namespace mlir::mpi |
| 65 | namespace mlir::mpi { |
| 66 | |
| 67 | /// Get the size of the group associated to the communicator, equivalent to `MPI_Comm_size(comm, &size)` |
| 68 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 69 | /// to check for errors. |
| 70 | class CommSizeOp; |
| 71 | |
| 72 | } // namespace mlir::mpi |
| 73 | namespace mlir::mpi { |
| 74 | |
| 75 | /// Partition the group associated with the given communicator into disjoint subgroups |
| 76 | /// This operation splits the communicator into multiple sub-communicators. |
| 77 | /// The color value determines the group of processes that will be part of the |
| 78 | /// new communicator. The key value determines the rank of the calling process |
| 79 | /// in the new communicator. |
| 80 | /// |
| 81 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 82 | /// to check for errors. |
| 83 | class CommSplitOp; |
| 84 | |
| 85 | } // namespace mlir::mpi |
| 86 | namespace mlir::mpi { |
| 87 | |
| 88 | /// Get the World communicator, equivalent to `MPI_COMM_WORLD` |
| 89 | /// This operation returns the predefined MPI_COMM_WORLD communicator. |
| 90 | class CommWorldOp; |
| 91 | |
| 92 | } // namespace mlir::mpi |
| 93 | namespace mlir::mpi { |
| 94 | |
| 95 | /// Get the error class from an error code, equivalent to the `MPI_Error_class` function |
| 96 | /// `MPI_Error_class` maps return values from MPI calls to a set of well-known |
| 97 | /// MPI error classes. |
| 98 | class ErrorClassOp; |
| 99 | |
| 100 | } // namespace mlir::mpi |
| 101 | namespace mlir::mpi { |
| 102 | |
| 103 | /// Finalize the MPI library, equivalent to `MPI_Finalize()` |
| 104 | /// This function cleans up the MPI state. Afterwards, no MPI methods may |
| 105 | /// be invoked (excpet for MPI_Get_version, MPI_Initialized, and MPI_Finalized). |
| 106 | /// Notably, MPI_Init cannot be called again in the same program. |
| 107 | /// |
| 108 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 109 | /// to check for errors. |
| 110 | class FinalizeOp; |
| 111 | |
| 112 | } // namespace mlir::mpi |
| 113 | namespace mlir::mpi { |
| 114 | |
| 115 | /// Equivalent to `MPI_Irecv(ptr, size, dtype, source, tag, comm, &req)` |
| 116 | /// MPI_Irecv begins a non-blocking receive of `size` elements of type `dtype` |
| 117 | /// from rank `source`. The `tag` value and communicator enables the library to |
| 118 | /// determine the matching of multiple sends and receives between the same |
| 119 | /// ranks. |
| 120 | /// |
| 121 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 122 | /// to check for errors. |
| 123 | class IRecvOp; |
| 124 | |
| 125 | } // namespace mlir::mpi |
| 126 | namespace mlir::mpi { |
| 127 | |
| 128 | /// Equivalent to `MPI_Isend(ptr, size, dtype, dest, tag, comm)` |
| 129 | /// MPI_Isend begins a non-blocking send of `size` elements of type `dtype` to |
| 130 | /// rank `dest`. The `tag` value and communicator enables the library to |
| 131 | /// determine the matching of multiple sends and receives between the same |
| 132 | /// ranks. |
| 133 | /// |
| 134 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 135 | /// to check for errors. |
| 136 | class ISendOp; |
| 137 | |
| 138 | } // namespace mlir::mpi |
| 139 | namespace mlir::mpi { |
| 140 | |
| 141 | /// Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)` |
| 142 | /// This operation must preceed most MPI calls (except for very few exceptions, |
| 143 | /// please consult with the MPI specification on these). |
| 144 | /// |
| 145 | /// Passing &argc, &argv is not supported currently. |
| 146 | /// |
| 147 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 148 | /// to check for errors. |
| 149 | class InitOp; |
| 150 | |
| 151 | } // namespace mlir::mpi |
| 152 | namespace mlir::mpi { |
| 153 | |
| 154 | /// Equivalent to `MPI_Recv(ptr, size, dtype, source, tag, comm, MPI_STATUS_IGNORE)` |
| 155 | /// MPI_Recv performs a blocking receive of `size` elements of type `dtype` |
| 156 | /// from rank `source`. The `tag` value and communicator enables the library to |
| 157 | /// determine the matching of multiple sends and receives between the same |
| 158 | /// ranks. |
| 159 | /// |
| 160 | /// The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object |
| 161 | /// is not yet ported to MLIR. |
| 162 | /// |
| 163 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 164 | /// to check for errors. |
| 165 | class RecvOp; |
| 166 | |
| 167 | } // namespace mlir::mpi |
| 168 | namespace mlir::mpi { |
| 169 | |
| 170 | /// Equivalent to `MPI_Reduce_scatter_block(sendbuf, recvbuf, recvcount, dtype, op, comm)` |
| 171 | /// MPI_Reduce_scatter_block first performs an element-wise reduction on the |
| 172 | /// sendbuf across all processes in the communicator, then scatters the result |
| 173 | /// by distributing equal-sized blocks to each process into recvbuf. |
| 174 | /// |
| 175 | /// The `op` attribute specifies the reduction operation to be performed. |
| 176 | /// Currently only the `MPI_Op` predefined in the standard (e.g. `MPI_SUM`) are |
| 177 | /// supported. |
| 178 | /// |
| 179 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 180 | /// to check for errors. |
| 181 | class ReduceScatterBlockOp; |
| 182 | |
| 183 | } // namespace mlir::mpi |
| 184 | namespace mlir::mpi { |
| 185 | |
| 186 | /// Check an MPI return value against an error class |
| 187 | /// This operation compares MPI status codes to known error class |
| 188 | /// constants such as `MPI_SUCCESS`, or `MPI_ERR_COMM`. |
| 189 | class RetvalCheckOp; |
| 190 | |
| 191 | } // namespace mlir::mpi |
| 192 | namespace mlir::mpi { |
| 193 | |
| 194 | /// Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, comm)` |
| 195 | /// MPI_Send performs a blocking send of `size` elements of type `dtype` to rank |
| 196 | /// `dest`. The `tag` value and communicator enables the library to determine |
| 197 | /// the matching of multiple sends and receives between the same ranks. |
| 198 | /// |
| 199 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 200 | /// to check for errors. |
| 201 | class SendOp; |
| 202 | |
| 203 | } // namespace mlir::mpi |
| 204 | namespace mlir::mpi { |
| 205 | |
| 206 | /// Equivalent to `MPI_Wait(req, MPI_STATUS_IGNORE)` |
| 207 | /// MPI_Wait blocks execution until the request has completed. |
| 208 | /// |
| 209 | /// The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object |
| 210 | /// is not yet ported to MLIR. |
| 211 | /// |
| 212 | /// This operation can optionally return an `!mpi.retval` value that can be used |
| 213 | /// to check for errors. |
| 214 | class Wait; |
| 215 | |
| 216 | } // namespace mlir::mpi |
| 217 | #ifdef GET_OP_CLASSES |
| 218 | #undef GET_OP_CLASSES |
| 219 | |
| 220 | #include "mlir/Bytecode/BytecodeOpInterface.h" |
| 221 | #include "mlir/Dialect/MPI/IR/MPI.h" |
| 222 | #include "mlir/IR/Attributes.h" |
| 223 | #include "mlir/IR/BuiltinTypes.h" |
| 224 | #include "mlir/IR/OpDefinition.h" |
| 225 | #include "mlir/IR/OpImplementation.h" |
| 226 | #include "mlir/Interfaces/SideEffectInterfaces.h" |
| 227 | |
| 228 | namespace mlir::mpi { |
| 229 | |
| 230 | |
| 231 | //===----------------------------------------------------------------------===// |
| 232 | // ::mlir::mpi::AllGatherOp declarations |
| 233 | //===----------------------------------------------------------------------===// |
| 234 | |
| 235 | namespace detail { |
| 236 | |
| 237 | class AllGatherOpGenericAdaptorBase { |
| 238 | public: |
| 239 | using Properties = ::mlir::EmptyProperties; |
| 240 | protected: |
| 241 | ::mlir::DictionaryAttr odsAttrs; |
| 242 | ::std::optional<::mlir::OperationName> odsOpName; |
| 243 | Properties properties; |
| 244 | ::mlir::RegionRange odsRegions; |
| 245 | public: |
| 246 | AllGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 247 | odsOpName.emplace(args: "mpi.allgather" , args: odsAttrs.getContext()); |
| 248 | } |
| 249 | |
| 250 | AllGatherOpGenericAdaptorBase(AllGatherOp op); |
| 251 | |
| 252 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 253 | return {index, 1}; |
| 254 | } |
| 255 | |
| 256 | const Properties &getProperties() { |
| 257 | return properties; |
| 258 | } |
| 259 | |
| 260 | ::mlir::DictionaryAttr getAttributes() { |
| 261 | return odsAttrs; |
| 262 | } |
| 263 | |
| 264 | }; |
| 265 | |
| 266 | } // namespace detail |
| 267 | template <typename RangeT> |
| 268 | class AllGatherOpGenericAdaptor : public detail::AllGatherOpGenericAdaptorBase { |
| 269 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 270 | using Base = detail::AllGatherOpGenericAdaptorBase; |
| 271 | static constexpr int odsIndex_sendbuf = 0; |
| 272 | static constexpr int odsIndex_recvbuf = 1; |
| 273 | static constexpr int odsIndex_comm = 2; |
| 274 | public: |
| 275 | AllGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 276 | |
| 277 | AllGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AllGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 278 | |
| 279 | AllGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AllGatherOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 280 | |
| 281 | AllGatherOpGenericAdaptor(RangeT values, const AllGatherOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 282 | |
| 283 | template <typename LateInst = AllGatherOp, typename = std::enable_if_t<std::is_same_v<LateInst, AllGatherOp>>> |
| 284 | AllGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 285 | |
| 286 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 287 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 288 | } |
| 289 | |
| 290 | RangeT getODSOperands(unsigned index) { |
| 291 | auto valueRange = getODSOperandIndexAndLength(index); |
| 292 | return {std::next(odsOperands.begin(), valueRange.first), |
| 293 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 294 | } |
| 295 | |
| 296 | ValueT getSendbuf() { |
| 297 | return (*getODSOperands(index: 0).begin()); |
| 298 | } |
| 299 | |
| 300 | ValueT getRecvbuf() { |
| 301 | return (*getODSOperands(index: 1).begin()); |
| 302 | } |
| 303 | |
| 304 | ValueT getComm() { |
| 305 | return (*getODSOperands(index: 2).begin()); |
| 306 | } |
| 307 | |
| 308 | RangeT getOperands() { |
| 309 | return odsOperands; |
| 310 | } |
| 311 | |
| 312 | private: |
| 313 | RangeT odsOperands; |
| 314 | }; |
| 315 | class AllGatherOpAdaptor : public AllGatherOpGenericAdaptor<::mlir::ValueRange> { |
| 316 | public: |
| 317 | using AllGatherOpGenericAdaptor::AllGatherOpGenericAdaptor; |
| 318 | AllGatherOpAdaptor(AllGatherOp op); |
| 319 | |
| 320 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 321 | }; |
| 322 | class AllGatherOp : public ::mlir::Op<AllGatherOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 323 | public: |
| 324 | using Op::Op; |
| 325 | using Op::print; |
| 326 | using Adaptor = AllGatherOpAdaptor; |
| 327 | template <typename RangeT> |
| 328 | using GenericAdaptor = AllGatherOpGenericAdaptor<RangeT>; |
| 329 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 330 | static constexpr int odsIndex_sendbuf = 0; |
| 331 | static constexpr int odsIndex_recvbuf = 1; |
| 332 | static constexpr int odsIndex_comm = 2; |
| 333 | static constexpr int odsIndex_retval = 0; |
| 334 | using Properties = FoldAdaptor::Properties; |
| 335 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 336 | return {}; |
| 337 | } |
| 338 | |
| 339 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 340 | return ::llvm::StringLiteral("mpi.allgather" ); |
| 341 | } |
| 342 | |
| 343 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 344 | return {index, 1}; |
| 345 | } |
| 346 | |
| 347 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 348 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 349 | return getOperation()->getOperands().slice(n: start, m: length); |
| 350 | } |
| 351 | |
| 352 | ::mlir::TypedValue<::mlir::MemRefType> getSendbuf() { |
| 353 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 354 | } |
| 355 | |
| 356 | ::mlir::TypedValue<::mlir::MemRefType> getRecvbuf() { |
| 357 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 1).begin()); |
| 358 | } |
| 359 | |
| 360 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 361 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 2).begin()); |
| 362 | } |
| 363 | |
| 364 | ::mlir::OpOperand &getSendbufMutable() { |
| 365 | auto range = getODSOperandIndexAndLength(index: 0); |
| 366 | return getOperation()->getOpOperand(idx: range.first); |
| 367 | } |
| 368 | |
| 369 | ::mlir::OpOperand &getRecvbufMutable() { |
| 370 | auto range = getODSOperandIndexAndLength(index: 1); |
| 371 | return getOperation()->getOpOperand(idx: range.first); |
| 372 | } |
| 373 | |
| 374 | ::mlir::OpOperand &getCommMutable() { |
| 375 | auto range = getODSOperandIndexAndLength(index: 2); |
| 376 | return getOperation()->getOpOperand(idx: range.first); |
| 377 | } |
| 378 | |
| 379 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 380 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 381 | auto valueRange = getODSResultIndexAndLength(index); |
| 382 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 383 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 384 | } |
| 385 | |
| 386 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 387 | auto results = getODSResults(index: 0); |
| 388 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 389 | } |
| 390 | |
| 391 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 392 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 393 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 394 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 395 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 396 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 397 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 398 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm); |
| 399 | static AllGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm); |
| 400 | static AllGatherOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm); |
| 401 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm); |
| 402 | static AllGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm); |
| 403 | static AllGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm); |
| 404 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 405 | static AllGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 406 | static AllGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 407 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 408 | static AllGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 409 | static AllGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 410 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 411 | ::llvm::LogicalResult verifyInvariants(); |
| 412 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 413 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 414 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 415 | public: |
| 416 | }; |
| 417 | |
| 418 | } // namespace mlir::mpi |
| 419 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::AllGatherOp) |
| 420 | |
| 421 | namespace mlir::mpi { |
| 422 | |
| 423 | |
| 424 | //===----------------------------------------------------------------------===// |
| 425 | // ::mlir::mpi::AllReduceOp declarations |
| 426 | //===----------------------------------------------------------------------===// |
| 427 | |
| 428 | namespace detail { |
| 429 | |
| 430 | class AllReduceOpGenericAdaptorBase { |
| 431 | public: |
| 432 | struct Properties { |
| 433 | using opTy = ::mlir::mpi::MPI_ReductionOpEnumAttr; |
| 434 | opTy op; |
| 435 | |
| 436 | auto getOp() const { |
| 437 | auto &propStorage = this->op; |
| 438 | return ::llvm::cast<::mlir::mpi::MPI_ReductionOpEnumAttr>(Val: propStorage); |
| 439 | } |
| 440 | void setOp(const ::mlir::mpi::MPI_ReductionOpEnumAttr &propValue) { |
| 441 | this->op = propValue; |
| 442 | } |
| 443 | bool operator==(const Properties &rhs) const { |
| 444 | return |
| 445 | rhs.op == this->op && |
| 446 | true; |
| 447 | } |
| 448 | bool operator!=(const Properties &rhs) const { |
| 449 | return !(*this == rhs); |
| 450 | } |
| 451 | }; |
| 452 | protected: |
| 453 | ::mlir::DictionaryAttr odsAttrs; |
| 454 | ::std::optional<::mlir::OperationName> odsOpName; |
| 455 | Properties properties; |
| 456 | ::mlir::RegionRange odsRegions; |
| 457 | public: |
| 458 | AllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 459 | odsOpName.emplace(args: "mpi.allreduce" , args: odsAttrs.getContext()); |
| 460 | } |
| 461 | |
| 462 | AllReduceOpGenericAdaptorBase(AllReduceOp op); |
| 463 | |
| 464 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 465 | return {index, 1}; |
| 466 | } |
| 467 | |
| 468 | const Properties &getProperties() { |
| 469 | return properties; |
| 470 | } |
| 471 | |
| 472 | ::mlir::DictionaryAttr getAttributes() { |
| 473 | return odsAttrs; |
| 474 | } |
| 475 | |
| 476 | ::mlir::mpi::MPI_ReductionOpEnumAttr getOpAttr() { |
| 477 | auto attr = ::llvm::cast<::mlir::mpi::MPI_ReductionOpEnumAttr>(Val: getProperties().op); |
| 478 | return attr; |
| 479 | } |
| 480 | |
| 481 | ::mlir::mpi::MPI_ReductionOpEnum getOp(); |
| 482 | }; |
| 483 | |
| 484 | } // namespace detail |
| 485 | template <typename RangeT> |
| 486 | class AllReduceOpGenericAdaptor : public detail::AllReduceOpGenericAdaptorBase { |
| 487 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 488 | using Base = detail::AllReduceOpGenericAdaptorBase; |
| 489 | static constexpr int odsIndex_sendbuf = 0; |
| 490 | static constexpr int odsIndex_recvbuf = 1; |
| 491 | static constexpr int odsIndex_comm = 2; |
| 492 | public: |
| 493 | AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 494 | |
| 495 | AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 496 | |
| 497 | AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AllReduceOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 498 | |
| 499 | AllReduceOpGenericAdaptor(RangeT values, const AllReduceOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 500 | |
| 501 | template <typename LateInst = AllReduceOp, typename = std::enable_if_t<std::is_same_v<LateInst, AllReduceOp>>> |
| 502 | AllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 503 | |
| 504 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 505 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 506 | } |
| 507 | |
| 508 | RangeT getODSOperands(unsigned index) { |
| 509 | auto valueRange = getODSOperandIndexAndLength(index); |
| 510 | return {std::next(odsOperands.begin(), valueRange.first), |
| 511 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 512 | } |
| 513 | |
| 514 | ValueT getSendbuf() { |
| 515 | return (*getODSOperands(index: 0).begin()); |
| 516 | } |
| 517 | |
| 518 | ValueT getRecvbuf() { |
| 519 | return (*getODSOperands(index: 1).begin()); |
| 520 | } |
| 521 | |
| 522 | ValueT getComm() { |
| 523 | return (*getODSOperands(index: 2).begin()); |
| 524 | } |
| 525 | |
| 526 | RangeT getOperands() { |
| 527 | return odsOperands; |
| 528 | } |
| 529 | |
| 530 | private: |
| 531 | RangeT odsOperands; |
| 532 | }; |
| 533 | class AllReduceOpAdaptor : public AllReduceOpGenericAdaptor<::mlir::ValueRange> { |
| 534 | public: |
| 535 | using AllReduceOpGenericAdaptor::AllReduceOpGenericAdaptor; |
| 536 | AllReduceOpAdaptor(AllReduceOp op); |
| 537 | |
| 538 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 539 | }; |
| 540 | class AllReduceOp : public ::mlir::Op<AllReduceOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { |
| 541 | public: |
| 542 | using Op::Op; |
| 543 | using Op::print; |
| 544 | using Adaptor = AllReduceOpAdaptor; |
| 545 | template <typename RangeT> |
| 546 | using GenericAdaptor = AllReduceOpGenericAdaptor<RangeT>; |
| 547 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 548 | static constexpr int odsIndex_sendbuf = 0; |
| 549 | static constexpr int odsIndex_recvbuf = 1; |
| 550 | static constexpr int odsIndex_comm = 2; |
| 551 | static constexpr int odsIndex_retval = 0; |
| 552 | using Properties = FoldAdaptor::Properties; |
| 553 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 554 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("op" )}; |
| 555 | return ::llvm::ArrayRef(attrNames); |
| 556 | } |
| 557 | |
| 558 | ::mlir::StringAttr getOpAttrName() { |
| 559 | return getAttributeNameForIndex(index: 0); |
| 560 | } |
| 561 | |
| 562 | static ::mlir::StringAttr getOpAttrName(::mlir::OperationName name) { |
| 563 | return getAttributeNameForIndex(name, index: 0); |
| 564 | } |
| 565 | |
| 566 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 567 | return ::llvm::StringLiteral("mpi.allreduce" ); |
| 568 | } |
| 569 | |
| 570 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 571 | return {index, 1}; |
| 572 | } |
| 573 | |
| 574 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 575 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 576 | return getOperation()->getOperands().slice(n: start, m: length); |
| 577 | } |
| 578 | |
| 579 | ::mlir::TypedValue<::mlir::MemRefType> getSendbuf() { |
| 580 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 581 | } |
| 582 | |
| 583 | ::mlir::TypedValue<::mlir::MemRefType> getRecvbuf() { |
| 584 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 1).begin()); |
| 585 | } |
| 586 | |
| 587 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 588 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 2).begin()); |
| 589 | } |
| 590 | |
| 591 | ::mlir::OpOperand &getSendbufMutable() { |
| 592 | auto range = getODSOperandIndexAndLength(index: 0); |
| 593 | return getOperation()->getOpOperand(idx: range.first); |
| 594 | } |
| 595 | |
| 596 | ::mlir::OpOperand &getRecvbufMutable() { |
| 597 | auto range = getODSOperandIndexAndLength(index: 1); |
| 598 | return getOperation()->getOpOperand(idx: range.first); |
| 599 | } |
| 600 | |
| 601 | ::mlir::OpOperand &getCommMutable() { |
| 602 | auto range = getODSOperandIndexAndLength(index: 2); |
| 603 | return getOperation()->getOpOperand(idx: range.first); |
| 604 | } |
| 605 | |
| 606 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 607 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 608 | auto valueRange = getODSResultIndexAndLength(index); |
| 609 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 610 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 611 | } |
| 612 | |
| 613 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 614 | auto results = getODSResults(index: 0); |
| 615 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 616 | } |
| 617 | |
| 618 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 619 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 620 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 621 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 622 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 623 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 624 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 625 | static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); |
| 626 | void writeProperties(::mlir::DialectBytecodeWriter &writer); |
| 627 | ::mlir::mpi::MPI_ReductionOpEnumAttr getOpAttr() { |
| 628 | return ::llvm::cast<::mlir::mpi::MPI_ReductionOpEnumAttr>(Val&: getProperties().op); |
| 629 | } |
| 630 | |
| 631 | ::mlir::mpi::MPI_ReductionOpEnum getOp(); |
| 632 | void setOpAttr(::mlir::mpi::MPI_ReductionOpEnumAttr attr) { |
| 633 | getProperties().op = attr; |
| 634 | } |
| 635 | |
| 636 | void setOp(::mlir::mpi::MPI_ReductionOpEnum attrValue); |
| 637 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 638 | static AllReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 639 | static AllReduceOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 640 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 641 | static AllReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 642 | static AllReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 643 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 644 | static AllReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 645 | static AllReduceOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 646 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 647 | static AllReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 648 | static AllReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 649 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 650 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 651 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 652 | static AllReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 653 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 654 | static AllReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 655 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 656 | static AllReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 657 | static AllReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 658 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 659 | ::llvm::LogicalResult verifyInvariants(); |
| 660 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 661 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 662 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 663 | private: |
| 664 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
| 665 | return getAttributeNameForIndex(name: (*this)->getName(), index); |
| 666 | } |
| 667 | |
| 668 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
| 669 | assert(index < 1 && "invalid attribute index" ); |
| 670 | assert(name.getStringRef() == getOperationName() && "invalid operation name" ); |
| 671 | assert(name.isRegistered() && "Operation isn't registered, missing a " |
| 672 | "dependent dialect loading?" ); |
| 673 | return name.getAttributeNames()[index]; |
| 674 | } |
| 675 | |
| 676 | static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes); |
| 677 | public: |
| 678 | }; |
| 679 | |
| 680 | } // namespace mlir::mpi |
| 681 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::AllReduceOp) |
| 682 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::detail::AllReduceOpGenericAdaptorBase::Properties) |
| 683 | |
| 684 | namespace mlir::mpi { |
| 685 | |
| 686 | |
| 687 | //===----------------------------------------------------------------------===// |
| 688 | // ::mlir::mpi::Barrier declarations |
| 689 | //===----------------------------------------------------------------------===// |
| 690 | |
| 691 | namespace detail { |
| 692 | |
| 693 | class BarrierGenericAdaptorBase { |
| 694 | public: |
| 695 | using Properties = ::mlir::EmptyProperties; |
| 696 | protected: |
| 697 | ::mlir::DictionaryAttr odsAttrs; |
| 698 | ::std::optional<::mlir::OperationName> odsOpName; |
| 699 | Properties properties; |
| 700 | ::mlir::RegionRange odsRegions; |
| 701 | public: |
| 702 | BarrierGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 703 | odsOpName.emplace(args: "mpi.barrier" , args: odsAttrs.getContext()); |
| 704 | } |
| 705 | |
| 706 | BarrierGenericAdaptorBase(Barrier op); |
| 707 | |
| 708 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 709 | return {index, 1}; |
| 710 | } |
| 711 | |
| 712 | const Properties &getProperties() { |
| 713 | return properties; |
| 714 | } |
| 715 | |
| 716 | ::mlir::DictionaryAttr getAttributes() { |
| 717 | return odsAttrs; |
| 718 | } |
| 719 | |
| 720 | }; |
| 721 | |
| 722 | } // namespace detail |
| 723 | template <typename RangeT> |
| 724 | class BarrierGenericAdaptor : public detail::BarrierGenericAdaptorBase { |
| 725 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 726 | using Base = detail::BarrierGenericAdaptorBase; |
| 727 | static constexpr int odsIndex_comm = 0; |
| 728 | public: |
| 729 | BarrierGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 730 | |
| 731 | BarrierGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BarrierGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 732 | |
| 733 | BarrierGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BarrierGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 734 | |
| 735 | BarrierGenericAdaptor(RangeT values, const BarrierGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 736 | |
| 737 | template <typename LateInst = Barrier, typename = std::enable_if_t<std::is_same_v<LateInst, Barrier>>> |
| 738 | BarrierGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 739 | |
| 740 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 741 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 742 | } |
| 743 | |
| 744 | RangeT getODSOperands(unsigned index) { |
| 745 | auto valueRange = getODSOperandIndexAndLength(index); |
| 746 | return {std::next(odsOperands.begin(), valueRange.first), |
| 747 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 748 | } |
| 749 | |
| 750 | ValueT getComm() { |
| 751 | return (*getODSOperands(index: 0).begin()); |
| 752 | } |
| 753 | |
| 754 | RangeT getOperands() { |
| 755 | return odsOperands; |
| 756 | } |
| 757 | |
| 758 | private: |
| 759 | RangeT odsOperands; |
| 760 | }; |
| 761 | class BarrierAdaptor : public BarrierGenericAdaptor<::mlir::ValueRange> { |
| 762 | public: |
| 763 | using BarrierGenericAdaptor::BarrierGenericAdaptor; |
| 764 | BarrierAdaptor(Barrier op); |
| 765 | |
| 766 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 767 | }; |
| 768 | class Barrier : public ::mlir::Op<Barrier, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 769 | public: |
| 770 | using Op::Op; |
| 771 | using Op::print; |
| 772 | using Adaptor = BarrierAdaptor; |
| 773 | template <typename RangeT> |
| 774 | using GenericAdaptor = BarrierGenericAdaptor<RangeT>; |
| 775 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 776 | static constexpr int odsIndex_comm = 0; |
| 777 | static constexpr int odsIndex_retval = 0; |
| 778 | using Properties = FoldAdaptor::Properties; |
| 779 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 780 | return {}; |
| 781 | } |
| 782 | |
| 783 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 784 | return ::llvm::StringLiteral("mpi.barrier" ); |
| 785 | } |
| 786 | |
| 787 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 788 | return {index, 1}; |
| 789 | } |
| 790 | |
| 791 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 792 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 793 | return getOperation()->getOperands().slice(n: start, m: length); |
| 794 | } |
| 795 | |
| 796 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 797 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 0).begin()); |
| 798 | } |
| 799 | |
| 800 | ::mlir::OpOperand &getCommMutable() { |
| 801 | auto range = getODSOperandIndexAndLength(index: 0); |
| 802 | return getOperation()->getOpOperand(idx: range.first); |
| 803 | } |
| 804 | |
| 805 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 806 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 807 | auto valueRange = getODSResultIndexAndLength(index); |
| 808 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 809 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 810 | } |
| 811 | |
| 812 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 813 | auto results = getODSResults(index: 0); |
| 814 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 815 | } |
| 816 | |
| 817 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 818 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 819 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 820 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 821 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 822 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 823 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 824 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value comm); |
| 825 | static Barrier create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value comm); |
| 826 | static Barrier create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value comm); |
| 827 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 828 | static Barrier create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 829 | static Barrier create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 830 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 831 | static Barrier create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 832 | static Barrier create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 833 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 834 | static Barrier create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 835 | static Barrier create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 836 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 837 | ::llvm::LogicalResult verifyInvariants(); |
| 838 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 839 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 840 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 841 | public: |
| 842 | }; |
| 843 | |
| 844 | } // namespace mlir::mpi |
| 845 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::Barrier) |
| 846 | |
| 847 | namespace mlir::mpi { |
| 848 | |
| 849 | |
| 850 | //===----------------------------------------------------------------------===// |
| 851 | // ::mlir::mpi::CommRankOp declarations |
| 852 | //===----------------------------------------------------------------------===// |
| 853 | |
| 854 | namespace detail { |
| 855 | |
| 856 | class CommRankOpGenericAdaptorBase { |
| 857 | public: |
| 858 | using Properties = ::mlir::EmptyProperties; |
| 859 | protected: |
| 860 | ::mlir::DictionaryAttr odsAttrs; |
| 861 | ::std::optional<::mlir::OperationName> odsOpName; |
| 862 | Properties properties; |
| 863 | ::mlir::RegionRange odsRegions; |
| 864 | public: |
| 865 | CommRankOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 866 | odsOpName.emplace(args: "mpi.comm_rank" , args: odsAttrs.getContext()); |
| 867 | } |
| 868 | |
| 869 | CommRankOpGenericAdaptorBase(CommRankOp op); |
| 870 | |
| 871 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 872 | return {index, 1}; |
| 873 | } |
| 874 | |
| 875 | const Properties &getProperties() { |
| 876 | return properties; |
| 877 | } |
| 878 | |
| 879 | ::mlir::DictionaryAttr getAttributes() { |
| 880 | return odsAttrs; |
| 881 | } |
| 882 | |
| 883 | }; |
| 884 | |
| 885 | } // namespace detail |
| 886 | template <typename RangeT> |
| 887 | class CommRankOpGenericAdaptor : public detail::CommRankOpGenericAdaptorBase { |
| 888 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 889 | using Base = detail::CommRankOpGenericAdaptorBase; |
| 890 | static constexpr int odsIndex_comm = 0; |
| 891 | public: |
| 892 | CommRankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 893 | |
| 894 | CommRankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CommRankOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 895 | |
| 896 | CommRankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CommRankOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 897 | |
| 898 | CommRankOpGenericAdaptor(RangeT values, const CommRankOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 899 | |
| 900 | template <typename LateInst = CommRankOp, typename = std::enable_if_t<std::is_same_v<LateInst, CommRankOp>>> |
| 901 | CommRankOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 902 | |
| 903 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 904 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 905 | } |
| 906 | |
| 907 | RangeT getODSOperands(unsigned index) { |
| 908 | auto valueRange = getODSOperandIndexAndLength(index); |
| 909 | return {std::next(odsOperands.begin(), valueRange.first), |
| 910 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 911 | } |
| 912 | |
| 913 | ValueT getComm() { |
| 914 | return (*getODSOperands(index: 0).begin()); |
| 915 | } |
| 916 | |
| 917 | RangeT getOperands() { |
| 918 | return odsOperands; |
| 919 | } |
| 920 | |
| 921 | private: |
| 922 | RangeT odsOperands; |
| 923 | }; |
| 924 | class CommRankOpAdaptor : public CommRankOpGenericAdaptor<::mlir::ValueRange> { |
| 925 | public: |
| 926 | using CommRankOpGenericAdaptor::CommRankOpGenericAdaptor; |
| 927 | CommRankOpAdaptor(CommRankOp op); |
| 928 | |
| 929 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 930 | }; |
| 931 | class CommRankOp : public ::mlir::Op<CommRankOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
| 932 | public: |
| 933 | using Op::Op; |
| 934 | using Op::print; |
| 935 | using Adaptor = CommRankOpAdaptor; |
| 936 | template <typename RangeT> |
| 937 | using GenericAdaptor = CommRankOpGenericAdaptor<RangeT>; |
| 938 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 939 | static constexpr int odsIndex_comm = 0; |
| 940 | static constexpr int odsIndex_retval = 0; |
| 941 | static constexpr int odsIndex_rank = 1; |
| 942 | using Properties = FoldAdaptor::Properties; |
| 943 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 944 | return {}; |
| 945 | } |
| 946 | |
| 947 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
| 948 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 949 | return ::llvm::StringLiteral("mpi.comm_rank" ); |
| 950 | } |
| 951 | |
| 952 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 953 | return {index, 1}; |
| 954 | } |
| 955 | |
| 956 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 957 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 958 | return getOperation()->getOperands().slice(n: start, m: length); |
| 959 | } |
| 960 | |
| 961 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 962 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 0).begin()); |
| 963 | } |
| 964 | |
| 965 | ::mlir::OpOperand &getCommMutable() { |
| 966 | auto range = getODSOperandIndexAndLength(index: 0); |
| 967 | return getOperation()->getOpOperand(idx: range.first); |
| 968 | } |
| 969 | |
| 970 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 971 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 972 | auto valueRange = getODSResultIndexAndLength(index); |
| 973 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 974 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 975 | } |
| 976 | |
| 977 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 978 | auto results = getODSResults(index: 0); |
| 979 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 980 | } |
| 981 | |
| 982 | ::mlir::TypedValue<::mlir::IntegerType> getRank() { |
| 983 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSResults(index: 1).begin()); |
| 984 | } |
| 985 | |
| 986 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 987 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 988 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 989 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 990 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 991 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 992 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 993 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type rank, ::mlir::Value comm); |
| 994 | static CommRankOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type rank, ::mlir::Value comm); |
| 995 | static CommRankOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type rank, ::mlir::Value comm); |
| 996 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 997 | static CommRankOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 998 | static CommRankOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 999 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1000 | static CommRankOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1001 | static CommRankOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1002 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1003 | static CommRankOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1004 | static CommRankOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1005 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 1006 | ::llvm::LogicalResult verifyInvariants(); |
| 1007 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
| 1008 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 1009 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 1010 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 1011 | public: |
| 1012 | }; |
| 1013 | |
| 1014 | } // namespace mlir::mpi |
| 1015 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::CommRankOp) |
| 1016 | |
| 1017 | namespace mlir::mpi { |
| 1018 | |
| 1019 | |
| 1020 | //===----------------------------------------------------------------------===// |
| 1021 | // ::mlir::mpi::CommSizeOp declarations |
| 1022 | //===----------------------------------------------------------------------===// |
| 1023 | |
| 1024 | namespace detail { |
| 1025 | |
| 1026 | class CommSizeOpGenericAdaptorBase { |
| 1027 | public: |
| 1028 | using Properties = ::mlir::EmptyProperties; |
| 1029 | protected: |
| 1030 | ::mlir::DictionaryAttr odsAttrs; |
| 1031 | ::std::optional<::mlir::OperationName> odsOpName; |
| 1032 | Properties properties; |
| 1033 | ::mlir::RegionRange odsRegions; |
| 1034 | public: |
| 1035 | CommSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 1036 | odsOpName.emplace(args: "mpi.comm_size" , args: odsAttrs.getContext()); |
| 1037 | } |
| 1038 | |
| 1039 | CommSizeOpGenericAdaptorBase(CommSizeOp op); |
| 1040 | |
| 1041 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 1042 | return {index, 1}; |
| 1043 | } |
| 1044 | |
| 1045 | const Properties &getProperties() { |
| 1046 | return properties; |
| 1047 | } |
| 1048 | |
| 1049 | ::mlir::DictionaryAttr getAttributes() { |
| 1050 | return odsAttrs; |
| 1051 | } |
| 1052 | |
| 1053 | }; |
| 1054 | |
| 1055 | } // namespace detail |
| 1056 | template <typename RangeT> |
| 1057 | class CommSizeOpGenericAdaptor : public detail::CommSizeOpGenericAdaptorBase { |
| 1058 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 1059 | using Base = detail::CommSizeOpGenericAdaptorBase; |
| 1060 | static constexpr int odsIndex_comm = 0; |
| 1061 | public: |
| 1062 | CommSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 1063 | |
| 1064 | CommSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CommSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 1065 | |
| 1066 | CommSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CommSizeOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 1067 | |
| 1068 | CommSizeOpGenericAdaptor(RangeT values, const CommSizeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 1069 | |
| 1070 | template <typename LateInst = CommSizeOp, typename = std::enable_if_t<std::is_same_v<LateInst, CommSizeOp>>> |
| 1071 | CommSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 1072 | |
| 1073 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1074 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 1075 | } |
| 1076 | |
| 1077 | RangeT getODSOperands(unsigned index) { |
| 1078 | auto valueRange = getODSOperandIndexAndLength(index); |
| 1079 | return {std::next(odsOperands.begin(), valueRange.first), |
| 1080 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 1081 | } |
| 1082 | |
| 1083 | ValueT getComm() { |
| 1084 | return (*getODSOperands(index: 0).begin()); |
| 1085 | } |
| 1086 | |
| 1087 | RangeT getOperands() { |
| 1088 | return odsOperands; |
| 1089 | } |
| 1090 | |
| 1091 | private: |
| 1092 | RangeT odsOperands; |
| 1093 | }; |
| 1094 | class CommSizeOpAdaptor : public CommSizeOpGenericAdaptor<::mlir::ValueRange> { |
| 1095 | public: |
| 1096 | using CommSizeOpGenericAdaptor::CommSizeOpGenericAdaptor; |
| 1097 | CommSizeOpAdaptor(CommSizeOp op); |
| 1098 | |
| 1099 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 1100 | }; |
| 1101 | class CommSizeOp : public ::mlir::Op<CommSizeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
| 1102 | public: |
| 1103 | using Op::Op; |
| 1104 | using Op::print; |
| 1105 | using Adaptor = CommSizeOpAdaptor; |
| 1106 | template <typename RangeT> |
| 1107 | using GenericAdaptor = CommSizeOpGenericAdaptor<RangeT>; |
| 1108 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 1109 | static constexpr int odsIndex_comm = 0; |
| 1110 | static constexpr int odsIndex_retval = 0; |
| 1111 | static constexpr int odsIndex_size = 1; |
| 1112 | using Properties = FoldAdaptor::Properties; |
| 1113 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 1114 | return {}; |
| 1115 | } |
| 1116 | |
| 1117 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
| 1118 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 1119 | return ::llvm::StringLiteral("mpi.comm_size" ); |
| 1120 | } |
| 1121 | |
| 1122 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1123 | return {index, 1}; |
| 1124 | } |
| 1125 | |
| 1126 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 1127 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 1128 | return getOperation()->getOperands().slice(n: start, m: length); |
| 1129 | } |
| 1130 | |
| 1131 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 1132 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 0).begin()); |
| 1133 | } |
| 1134 | |
| 1135 | ::mlir::OpOperand &getCommMutable() { |
| 1136 | auto range = getODSOperandIndexAndLength(index: 0); |
| 1137 | return getOperation()->getOpOperand(idx: range.first); |
| 1138 | } |
| 1139 | |
| 1140 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 1141 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 1142 | auto valueRange = getODSResultIndexAndLength(index); |
| 1143 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 1144 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 1145 | } |
| 1146 | |
| 1147 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 1148 | auto results = getODSResults(index: 0); |
| 1149 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 1150 | } |
| 1151 | |
| 1152 | ::mlir::TypedValue<::mlir::IntegerType> getSize() { |
| 1153 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSResults(index: 1).begin()); |
| 1154 | } |
| 1155 | |
| 1156 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1157 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 1158 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 1159 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 1160 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 1161 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 1162 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1163 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type size, ::mlir::Value comm); |
| 1164 | static CommSizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type size, ::mlir::Value comm); |
| 1165 | static CommSizeOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type size, ::mlir::Value comm); |
| 1166 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 1167 | static CommSizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 1168 | static CommSizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm); |
| 1169 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1170 | static CommSizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1171 | static CommSizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1172 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1173 | static CommSizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1174 | static CommSizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1175 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 1176 | ::llvm::LogicalResult verifyInvariants(); |
| 1177 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
| 1178 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 1179 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 1180 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 1181 | public: |
| 1182 | }; |
| 1183 | |
| 1184 | } // namespace mlir::mpi |
| 1185 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::CommSizeOp) |
| 1186 | |
| 1187 | namespace mlir::mpi { |
| 1188 | |
| 1189 | |
| 1190 | //===----------------------------------------------------------------------===// |
| 1191 | // ::mlir::mpi::CommSplitOp declarations |
| 1192 | //===----------------------------------------------------------------------===// |
| 1193 | |
| 1194 | namespace detail { |
| 1195 | |
| 1196 | class CommSplitOpGenericAdaptorBase { |
| 1197 | public: |
| 1198 | using Properties = ::mlir::EmptyProperties; |
| 1199 | protected: |
| 1200 | ::mlir::DictionaryAttr odsAttrs; |
| 1201 | ::std::optional<::mlir::OperationName> odsOpName; |
| 1202 | Properties properties; |
| 1203 | ::mlir::RegionRange odsRegions; |
| 1204 | public: |
| 1205 | CommSplitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 1206 | odsOpName.emplace(args: "mpi.comm_split" , args: odsAttrs.getContext()); |
| 1207 | } |
| 1208 | |
| 1209 | CommSplitOpGenericAdaptorBase(CommSplitOp op); |
| 1210 | |
| 1211 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 1212 | return {index, 1}; |
| 1213 | } |
| 1214 | |
| 1215 | const Properties &getProperties() { |
| 1216 | return properties; |
| 1217 | } |
| 1218 | |
| 1219 | ::mlir::DictionaryAttr getAttributes() { |
| 1220 | return odsAttrs; |
| 1221 | } |
| 1222 | |
| 1223 | }; |
| 1224 | |
| 1225 | } // namespace detail |
| 1226 | template <typename RangeT> |
| 1227 | class CommSplitOpGenericAdaptor : public detail::CommSplitOpGenericAdaptorBase { |
| 1228 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 1229 | using Base = detail::CommSplitOpGenericAdaptorBase; |
| 1230 | static constexpr int odsIndex_comm = 0; |
| 1231 | static constexpr int odsIndex_color = 1; |
| 1232 | static constexpr int odsIndex_key = 2; |
| 1233 | public: |
| 1234 | CommSplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 1235 | |
| 1236 | CommSplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CommSplitOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 1237 | |
| 1238 | CommSplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CommSplitOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 1239 | |
| 1240 | CommSplitOpGenericAdaptor(RangeT values, const CommSplitOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 1241 | |
| 1242 | template <typename LateInst = CommSplitOp, typename = std::enable_if_t<std::is_same_v<LateInst, CommSplitOp>>> |
| 1243 | CommSplitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 1244 | |
| 1245 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1246 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 1247 | } |
| 1248 | |
| 1249 | RangeT getODSOperands(unsigned index) { |
| 1250 | auto valueRange = getODSOperandIndexAndLength(index); |
| 1251 | return {std::next(odsOperands.begin(), valueRange.first), |
| 1252 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 1253 | } |
| 1254 | |
| 1255 | ValueT getComm() { |
| 1256 | return (*getODSOperands(index: 0).begin()); |
| 1257 | } |
| 1258 | |
| 1259 | ValueT getColor() { |
| 1260 | return (*getODSOperands(index: 1).begin()); |
| 1261 | } |
| 1262 | |
| 1263 | ValueT getKey() { |
| 1264 | return (*getODSOperands(index: 2).begin()); |
| 1265 | } |
| 1266 | |
| 1267 | RangeT getOperands() { |
| 1268 | return odsOperands; |
| 1269 | } |
| 1270 | |
| 1271 | private: |
| 1272 | RangeT odsOperands; |
| 1273 | }; |
| 1274 | class CommSplitOpAdaptor : public CommSplitOpGenericAdaptor<::mlir::ValueRange> { |
| 1275 | public: |
| 1276 | using CommSplitOpGenericAdaptor::CommSplitOpGenericAdaptor; |
| 1277 | CommSplitOpAdaptor(CommSplitOp op); |
| 1278 | |
| 1279 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 1280 | }; |
| 1281 | class CommSplitOp : public ::mlir::Op<CommSplitOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
| 1282 | public: |
| 1283 | using Op::Op; |
| 1284 | using Op::print; |
| 1285 | using Adaptor = CommSplitOpAdaptor; |
| 1286 | template <typename RangeT> |
| 1287 | using GenericAdaptor = CommSplitOpGenericAdaptor<RangeT>; |
| 1288 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 1289 | static constexpr int odsIndex_comm = 0; |
| 1290 | static constexpr int odsIndex_color = 1; |
| 1291 | static constexpr int odsIndex_key = 2; |
| 1292 | static constexpr int odsIndex_retval = 0; |
| 1293 | static constexpr int odsIndex_newcomm = 1; |
| 1294 | using Properties = FoldAdaptor::Properties; |
| 1295 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 1296 | return {}; |
| 1297 | } |
| 1298 | |
| 1299 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
| 1300 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 1301 | return ::llvm::StringLiteral("mpi.comm_split" ); |
| 1302 | } |
| 1303 | |
| 1304 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1305 | return {index, 1}; |
| 1306 | } |
| 1307 | |
| 1308 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 1309 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 1310 | return getOperation()->getOperands().slice(n: start, m: length); |
| 1311 | } |
| 1312 | |
| 1313 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 1314 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 0).begin()); |
| 1315 | } |
| 1316 | |
| 1317 | ::mlir::TypedValue<::mlir::IntegerType> getColor() { |
| 1318 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 1).begin()); |
| 1319 | } |
| 1320 | |
| 1321 | ::mlir::TypedValue<::mlir::IntegerType> getKey() { |
| 1322 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 2).begin()); |
| 1323 | } |
| 1324 | |
| 1325 | ::mlir::OpOperand &getCommMutable() { |
| 1326 | auto range = getODSOperandIndexAndLength(index: 0); |
| 1327 | return getOperation()->getOpOperand(idx: range.first); |
| 1328 | } |
| 1329 | |
| 1330 | ::mlir::OpOperand &getColorMutable() { |
| 1331 | auto range = getODSOperandIndexAndLength(index: 1); |
| 1332 | return getOperation()->getOpOperand(idx: range.first); |
| 1333 | } |
| 1334 | |
| 1335 | ::mlir::OpOperand &getKeyMutable() { |
| 1336 | auto range = getODSOperandIndexAndLength(index: 2); |
| 1337 | return getOperation()->getOpOperand(idx: range.first); |
| 1338 | } |
| 1339 | |
| 1340 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 1341 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 1342 | auto valueRange = getODSResultIndexAndLength(index); |
| 1343 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 1344 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 1345 | } |
| 1346 | |
| 1347 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 1348 | auto results = getODSResults(index: 0); |
| 1349 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 1350 | } |
| 1351 | |
| 1352 | ::mlir::TypedValue<::mlir::mpi::CommType> getNewcomm() { |
| 1353 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSResults(index: 1).begin()); |
| 1354 | } |
| 1355 | |
| 1356 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1357 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 1358 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 1359 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 1360 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 1361 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 1362 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1363 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type newcomm, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key); |
| 1364 | static CommSplitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type newcomm, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key); |
| 1365 | static CommSplitOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type newcomm, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key); |
| 1366 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key); |
| 1367 | static CommSplitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key); |
| 1368 | static CommSplitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key); |
| 1369 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1370 | static CommSplitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1371 | static CommSplitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1372 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1373 | static CommSplitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1374 | static CommSplitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1375 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 1376 | ::llvm::LogicalResult verifyInvariants(); |
| 1377 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 1378 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 1379 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 1380 | public: |
| 1381 | }; |
| 1382 | |
| 1383 | } // namespace mlir::mpi |
| 1384 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::CommSplitOp) |
| 1385 | |
| 1386 | namespace mlir::mpi { |
| 1387 | |
| 1388 | |
| 1389 | //===----------------------------------------------------------------------===// |
| 1390 | // ::mlir::mpi::CommWorldOp declarations |
| 1391 | //===----------------------------------------------------------------------===// |
| 1392 | |
| 1393 | namespace detail { |
| 1394 | |
| 1395 | class CommWorldOpGenericAdaptorBase { |
| 1396 | public: |
| 1397 | using Properties = ::mlir::EmptyProperties; |
| 1398 | protected: |
| 1399 | ::mlir::DictionaryAttr odsAttrs; |
| 1400 | ::std::optional<::mlir::OperationName> odsOpName; |
| 1401 | Properties properties; |
| 1402 | ::mlir::RegionRange odsRegions; |
| 1403 | public: |
| 1404 | CommWorldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 1405 | odsOpName.emplace(args: "mpi.comm_world" , args: odsAttrs.getContext()); |
| 1406 | } |
| 1407 | |
| 1408 | CommWorldOpGenericAdaptorBase(CommWorldOp op); |
| 1409 | |
| 1410 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 1411 | return {index, 1}; |
| 1412 | } |
| 1413 | |
| 1414 | const Properties &getProperties() { |
| 1415 | return properties; |
| 1416 | } |
| 1417 | |
| 1418 | ::mlir::DictionaryAttr getAttributes() { |
| 1419 | return odsAttrs; |
| 1420 | } |
| 1421 | |
| 1422 | }; |
| 1423 | |
| 1424 | } // namespace detail |
| 1425 | template <typename RangeT> |
| 1426 | class CommWorldOpGenericAdaptor : public detail::CommWorldOpGenericAdaptorBase { |
| 1427 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 1428 | using Base = detail::CommWorldOpGenericAdaptorBase; |
| 1429 | public: |
| 1430 | CommWorldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 1431 | |
| 1432 | CommWorldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CommWorldOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 1433 | |
| 1434 | CommWorldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CommWorldOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 1435 | |
| 1436 | CommWorldOpGenericAdaptor(RangeT values, const CommWorldOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 1437 | |
| 1438 | template <typename LateInst = CommWorldOp, typename = std::enable_if_t<std::is_same_v<LateInst, CommWorldOp>>> |
| 1439 | CommWorldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 1440 | |
| 1441 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1442 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 1443 | } |
| 1444 | |
| 1445 | RangeT getODSOperands(unsigned index) { |
| 1446 | auto valueRange = getODSOperandIndexAndLength(index); |
| 1447 | return {std::next(odsOperands.begin(), valueRange.first), |
| 1448 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 1449 | } |
| 1450 | |
| 1451 | RangeT getOperands() { |
| 1452 | return odsOperands; |
| 1453 | } |
| 1454 | |
| 1455 | private: |
| 1456 | RangeT odsOperands; |
| 1457 | }; |
| 1458 | class CommWorldOpAdaptor : public CommWorldOpGenericAdaptor<::mlir::ValueRange> { |
| 1459 | public: |
| 1460 | using CommWorldOpGenericAdaptor::CommWorldOpGenericAdaptor; |
| 1461 | CommWorldOpAdaptor(CommWorldOp op); |
| 1462 | |
| 1463 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 1464 | }; |
| 1465 | class CommWorldOp : public ::mlir::Op<CommWorldOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::mpi::CommType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 1466 | public: |
| 1467 | using Op::Op; |
| 1468 | using Op::print; |
| 1469 | using Adaptor = CommWorldOpAdaptor; |
| 1470 | template <typename RangeT> |
| 1471 | using GenericAdaptor = CommWorldOpGenericAdaptor<RangeT>; |
| 1472 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 1473 | static constexpr int odsIndex_comm = 0; |
| 1474 | using Properties = FoldAdaptor::Properties; |
| 1475 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 1476 | return {}; |
| 1477 | } |
| 1478 | |
| 1479 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 1480 | return ::llvm::StringLiteral("mpi.comm_world" ); |
| 1481 | } |
| 1482 | |
| 1483 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1484 | return {index, 1}; |
| 1485 | } |
| 1486 | |
| 1487 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 1488 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 1489 | return getOperation()->getOperands().slice(n: start, m: length); |
| 1490 | } |
| 1491 | |
| 1492 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) { |
| 1493 | return {index, 1}; |
| 1494 | } |
| 1495 | |
| 1496 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 1497 | auto valueRange = getODSResultIndexAndLength(index); |
| 1498 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 1499 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 1500 | } |
| 1501 | |
| 1502 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 1503 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSResults(index: 0).begin()); |
| 1504 | } |
| 1505 | |
| 1506 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1507 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 1508 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 1509 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 1510 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 1511 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 1512 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1513 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type comm); |
| 1514 | static CommWorldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type comm); |
| 1515 | static CommWorldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type comm); |
| 1516 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); |
| 1517 | static CommWorldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); |
| 1518 | static CommWorldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes); |
| 1519 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1520 | static CommWorldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1521 | static CommWorldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1522 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1523 | static CommWorldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1524 | static CommWorldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1525 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 1526 | ::llvm::LogicalResult verifyInvariants(); |
| 1527 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 1528 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 1529 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 1530 | public: |
| 1531 | }; |
| 1532 | |
| 1533 | } // namespace mlir::mpi |
| 1534 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::CommWorldOp) |
| 1535 | |
| 1536 | namespace mlir::mpi { |
| 1537 | |
| 1538 | |
| 1539 | //===----------------------------------------------------------------------===// |
| 1540 | // ::mlir::mpi::ErrorClassOp declarations |
| 1541 | //===----------------------------------------------------------------------===// |
| 1542 | |
| 1543 | namespace detail { |
| 1544 | |
| 1545 | class ErrorClassOpGenericAdaptorBase { |
| 1546 | public: |
| 1547 | using Properties = ::mlir::EmptyProperties; |
| 1548 | protected: |
| 1549 | ::mlir::DictionaryAttr odsAttrs; |
| 1550 | ::std::optional<::mlir::OperationName> odsOpName; |
| 1551 | Properties properties; |
| 1552 | ::mlir::RegionRange odsRegions; |
| 1553 | public: |
| 1554 | ErrorClassOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 1555 | odsOpName.emplace(args: "mpi.error_class" , args: odsAttrs.getContext()); |
| 1556 | } |
| 1557 | |
| 1558 | ErrorClassOpGenericAdaptorBase(ErrorClassOp op); |
| 1559 | |
| 1560 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 1561 | return {index, 1}; |
| 1562 | } |
| 1563 | |
| 1564 | const Properties &getProperties() { |
| 1565 | return properties; |
| 1566 | } |
| 1567 | |
| 1568 | ::mlir::DictionaryAttr getAttributes() { |
| 1569 | return odsAttrs; |
| 1570 | } |
| 1571 | |
| 1572 | }; |
| 1573 | |
| 1574 | } // namespace detail |
| 1575 | template <typename RangeT> |
| 1576 | class ErrorClassOpGenericAdaptor : public detail::ErrorClassOpGenericAdaptorBase { |
| 1577 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 1578 | using Base = detail::ErrorClassOpGenericAdaptorBase; |
| 1579 | static constexpr int odsIndex_val = 0; |
| 1580 | public: |
| 1581 | ErrorClassOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 1582 | |
| 1583 | ErrorClassOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ErrorClassOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 1584 | |
| 1585 | ErrorClassOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ErrorClassOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 1586 | |
| 1587 | ErrorClassOpGenericAdaptor(RangeT values, const ErrorClassOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 1588 | |
| 1589 | template <typename LateInst = ErrorClassOp, typename = std::enable_if_t<std::is_same_v<LateInst, ErrorClassOp>>> |
| 1590 | ErrorClassOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 1591 | |
| 1592 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1593 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 1594 | } |
| 1595 | |
| 1596 | RangeT getODSOperands(unsigned index) { |
| 1597 | auto valueRange = getODSOperandIndexAndLength(index); |
| 1598 | return {std::next(odsOperands.begin(), valueRange.first), |
| 1599 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 1600 | } |
| 1601 | |
| 1602 | ValueT getVal() { |
| 1603 | return (*getODSOperands(index: 0).begin()); |
| 1604 | } |
| 1605 | |
| 1606 | RangeT getOperands() { |
| 1607 | return odsOperands; |
| 1608 | } |
| 1609 | |
| 1610 | private: |
| 1611 | RangeT odsOperands; |
| 1612 | }; |
| 1613 | class ErrorClassOpAdaptor : public ErrorClassOpGenericAdaptor<::mlir::ValueRange> { |
| 1614 | public: |
| 1615 | using ErrorClassOpGenericAdaptor::ErrorClassOpGenericAdaptor; |
| 1616 | ErrorClassOpAdaptor(ErrorClassOp op); |
| 1617 | |
| 1618 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 1619 | }; |
| 1620 | class ErrorClassOp : public ::mlir::Op<ErrorClassOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::mpi::RetvalType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 1621 | public: |
| 1622 | using Op::Op; |
| 1623 | using Op::print; |
| 1624 | using Adaptor = ErrorClassOpAdaptor; |
| 1625 | template <typename RangeT> |
| 1626 | using GenericAdaptor = ErrorClassOpGenericAdaptor<RangeT>; |
| 1627 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 1628 | static constexpr int odsIndex_val = 0; |
| 1629 | static constexpr int odsIndex_errclass = 0; |
| 1630 | using Properties = FoldAdaptor::Properties; |
| 1631 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 1632 | return {}; |
| 1633 | } |
| 1634 | |
| 1635 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 1636 | return ::llvm::StringLiteral("mpi.error_class" ); |
| 1637 | } |
| 1638 | |
| 1639 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1640 | return {index, 1}; |
| 1641 | } |
| 1642 | |
| 1643 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 1644 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 1645 | return getOperation()->getOperands().slice(n: start, m: length); |
| 1646 | } |
| 1647 | |
| 1648 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getVal() { |
| 1649 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *getODSOperands(index: 0).begin()); |
| 1650 | } |
| 1651 | |
| 1652 | ::mlir::OpOperand &getValMutable() { |
| 1653 | auto range = getODSOperandIndexAndLength(index: 0); |
| 1654 | return getOperation()->getOpOperand(idx: range.first); |
| 1655 | } |
| 1656 | |
| 1657 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) { |
| 1658 | return {index, 1}; |
| 1659 | } |
| 1660 | |
| 1661 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 1662 | auto valueRange = getODSResultIndexAndLength(index); |
| 1663 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 1664 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 1665 | } |
| 1666 | |
| 1667 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getErrclass() { |
| 1668 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *getODSResults(index: 0).begin()); |
| 1669 | } |
| 1670 | |
| 1671 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1672 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 1673 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 1674 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 1675 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 1676 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 1677 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1678 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type errclass, ::mlir::Value val); |
| 1679 | static ErrorClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type errclass, ::mlir::Value val); |
| 1680 | static ErrorClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type errclass, ::mlir::Value val); |
| 1681 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); |
| 1682 | static ErrorClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val); |
| 1683 | static ErrorClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val); |
| 1684 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1685 | static ErrorClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1686 | static ErrorClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1687 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1688 | static ErrorClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1689 | static ErrorClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1690 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 1691 | ::llvm::LogicalResult verifyInvariants(); |
| 1692 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 1693 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 1694 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 1695 | public: |
| 1696 | }; |
| 1697 | |
| 1698 | } // namespace mlir::mpi |
| 1699 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::ErrorClassOp) |
| 1700 | |
| 1701 | namespace mlir::mpi { |
| 1702 | |
| 1703 | |
| 1704 | //===----------------------------------------------------------------------===// |
| 1705 | // ::mlir::mpi::FinalizeOp declarations |
| 1706 | //===----------------------------------------------------------------------===// |
| 1707 | |
| 1708 | namespace detail { |
| 1709 | |
| 1710 | class FinalizeOpGenericAdaptorBase { |
| 1711 | public: |
| 1712 | using Properties = ::mlir::EmptyProperties; |
| 1713 | protected: |
| 1714 | ::mlir::DictionaryAttr odsAttrs; |
| 1715 | ::std::optional<::mlir::OperationName> odsOpName; |
| 1716 | Properties properties; |
| 1717 | ::mlir::RegionRange odsRegions; |
| 1718 | public: |
| 1719 | FinalizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 1720 | odsOpName.emplace(args: "mpi.finalize" , args: odsAttrs.getContext()); |
| 1721 | } |
| 1722 | |
| 1723 | FinalizeOpGenericAdaptorBase(FinalizeOp op); |
| 1724 | |
| 1725 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 1726 | return {index, 1}; |
| 1727 | } |
| 1728 | |
| 1729 | const Properties &getProperties() { |
| 1730 | return properties; |
| 1731 | } |
| 1732 | |
| 1733 | ::mlir::DictionaryAttr getAttributes() { |
| 1734 | return odsAttrs; |
| 1735 | } |
| 1736 | |
| 1737 | }; |
| 1738 | |
| 1739 | } // namespace detail |
| 1740 | template <typename RangeT> |
| 1741 | class FinalizeOpGenericAdaptor : public detail::FinalizeOpGenericAdaptorBase { |
| 1742 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 1743 | using Base = detail::FinalizeOpGenericAdaptorBase; |
| 1744 | public: |
| 1745 | FinalizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 1746 | |
| 1747 | FinalizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FinalizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 1748 | |
| 1749 | FinalizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FinalizeOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 1750 | |
| 1751 | FinalizeOpGenericAdaptor(RangeT values, const FinalizeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 1752 | |
| 1753 | template <typename LateInst = FinalizeOp, typename = std::enable_if_t<std::is_same_v<LateInst, FinalizeOp>>> |
| 1754 | FinalizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 1755 | |
| 1756 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1757 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 1758 | } |
| 1759 | |
| 1760 | RangeT getODSOperands(unsigned index) { |
| 1761 | auto valueRange = getODSOperandIndexAndLength(index); |
| 1762 | return {std::next(odsOperands.begin(), valueRange.first), |
| 1763 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 1764 | } |
| 1765 | |
| 1766 | RangeT getOperands() { |
| 1767 | return odsOperands; |
| 1768 | } |
| 1769 | |
| 1770 | private: |
| 1771 | RangeT odsOperands; |
| 1772 | }; |
| 1773 | class FinalizeOpAdaptor : public FinalizeOpGenericAdaptor<::mlir::ValueRange> { |
| 1774 | public: |
| 1775 | using FinalizeOpGenericAdaptor::FinalizeOpGenericAdaptor; |
| 1776 | FinalizeOpAdaptor(FinalizeOp op); |
| 1777 | |
| 1778 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 1779 | }; |
| 1780 | class FinalizeOp : public ::mlir::Op<FinalizeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 1781 | public: |
| 1782 | using Op::Op; |
| 1783 | using Op::print; |
| 1784 | using Adaptor = FinalizeOpAdaptor; |
| 1785 | template <typename RangeT> |
| 1786 | using GenericAdaptor = FinalizeOpGenericAdaptor<RangeT>; |
| 1787 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 1788 | static constexpr int odsIndex_retval = 0; |
| 1789 | using Properties = FoldAdaptor::Properties; |
| 1790 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 1791 | return {}; |
| 1792 | } |
| 1793 | |
| 1794 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 1795 | return ::llvm::StringLiteral("mpi.finalize" ); |
| 1796 | } |
| 1797 | |
| 1798 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1799 | return {index, 1}; |
| 1800 | } |
| 1801 | |
| 1802 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 1803 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 1804 | return getOperation()->getOperands().slice(n: start, m: length); |
| 1805 | } |
| 1806 | |
| 1807 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 1808 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 1809 | auto valueRange = getODSResultIndexAndLength(index); |
| 1810 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 1811 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 1812 | } |
| 1813 | |
| 1814 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 1815 | auto results = getODSResults(index: 0); |
| 1816 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 1817 | } |
| 1818 | |
| 1819 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1820 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 1821 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 1822 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 1823 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 1824 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 1825 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 1826 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval); |
| 1827 | static FinalizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval); |
| 1828 | static FinalizeOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval); |
| 1829 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); |
| 1830 | static FinalizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); |
| 1831 | static FinalizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes); |
| 1832 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1833 | static FinalizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1834 | static FinalizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 1835 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1836 | static FinalizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1837 | static FinalizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 1838 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 1839 | ::llvm::LogicalResult verifyInvariants(); |
| 1840 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 1841 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 1842 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 1843 | public: |
| 1844 | }; |
| 1845 | |
| 1846 | } // namespace mlir::mpi |
| 1847 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::FinalizeOp) |
| 1848 | |
| 1849 | namespace mlir::mpi { |
| 1850 | |
| 1851 | |
| 1852 | //===----------------------------------------------------------------------===// |
| 1853 | // ::mlir::mpi::IRecvOp declarations |
| 1854 | //===----------------------------------------------------------------------===// |
| 1855 | |
| 1856 | namespace detail { |
| 1857 | |
| 1858 | class IRecvOpGenericAdaptorBase { |
| 1859 | public: |
| 1860 | using Properties = ::mlir::EmptyProperties; |
| 1861 | protected: |
| 1862 | ::mlir::DictionaryAttr odsAttrs; |
| 1863 | ::std::optional<::mlir::OperationName> odsOpName; |
| 1864 | Properties properties; |
| 1865 | ::mlir::RegionRange odsRegions; |
| 1866 | public: |
| 1867 | IRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 1868 | odsOpName.emplace(args: "mpi.irecv" , args: odsAttrs.getContext()); |
| 1869 | } |
| 1870 | |
| 1871 | IRecvOpGenericAdaptorBase(IRecvOp op); |
| 1872 | |
| 1873 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 1874 | return {index, 1}; |
| 1875 | } |
| 1876 | |
| 1877 | const Properties &getProperties() { |
| 1878 | return properties; |
| 1879 | } |
| 1880 | |
| 1881 | ::mlir::DictionaryAttr getAttributes() { |
| 1882 | return odsAttrs; |
| 1883 | } |
| 1884 | |
| 1885 | }; |
| 1886 | |
| 1887 | } // namespace detail |
| 1888 | template <typename RangeT> |
| 1889 | class IRecvOpGenericAdaptor : public detail::IRecvOpGenericAdaptorBase { |
| 1890 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 1891 | using Base = detail::IRecvOpGenericAdaptorBase; |
| 1892 | static constexpr int odsIndex_ref = 0; |
| 1893 | static constexpr int odsIndex_tag = 1; |
| 1894 | static constexpr int odsIndex_source = 2; |
| 1895 | static constexpr int odsIndex_comm = 3; |
| 1896 | public: |
| 1897 | IRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 1898 | |
| 1899 | IRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 1900 | |
| 1901 | IRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IRecvOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 1902 | |
| 1903 | IRecvOpGenericAdaptor(RangeT values, const IRecvOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 1904 | |
| 1905 | template <typename LateInst = IRecvOp, typename = std::enable_if_t<std::is_same_v<LateInst, IRecvOp>>> |
| 1906 | IRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 1907 | |
| 1908 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1909 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 1910 | } |
| 1911 | |
| 1912 | RangeT getODSOperands(unsigned index) { |
| 1913 | auto valueRange = getODSOperandIndexAndLength(index); |
| 1914 | return {std::next(odsOperands.begin(), valueRange.first), |
| 1915 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 1916 | } |
| 1917 | |
| 1918 | ValueT getRef() { |
| 1919 | return (*getODSOperands(index: 0).begin()); |
| 1920 | } |
| 1921 | |
| 1922 | ValueT getTag() { |
| 1923 | return (*getODSOperands(index: 1).begin()); |
| 1924 | } |
| 1925 | |
| 1926 | ValueT getSource() { |
| 1927 | return (*getODSOperands(index: 2).begin()); |
| 1928 | } |
| 1929 | |
| 1930 | ValueT getComm() { |
| 1931 | return (*getODSOperands(index: 3).begin()); |
| 1932 | } |
| 1933 | |
| 1934 | RangeT getOperands() { |
| 1935 | return odsOperands; |
| 1936 | } |
| 1937 | |
| 1938 | private: |
| 1939 | RangeT odsOperands; |
| 1940 | }; |
| 1941 | class IRecvOpAdaptor : public IRecvOpGenericAdaptor<::mlir::ValueRange> { |
| 1942 | public: |
| 1943 | using IRecvOpGenericAdaptor::IRecvOpGenericAdaptor; |
| 1944 | IRecvOpAdaptor(IRecvOp op); |
| 1945 | |
| 1946 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 1947 | }; |
| 1948 | class IRecvOp : public ::mlir::Op<IRecvOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
| 1949 | public: |
| 1950 | using Op::Op; |
| 1951 | using Op::print; |
| 1952 | using Adaptor = IRecvOpAdaptor; |
| 1953 | template <typename RangeT> |
| 1954 | using GenericAdaptor = IRecvOpGenericAdaptor<RangeT>; |
| 1955 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 1956 | static constexpr int odsIndex_ref = 0; |
| 1957 | static constexpr int odsIndex_tag = 1; |
| 1958 | static constexpr int odsIndex_source = 2; |
| 1959 | static constexpr int odsIndex_comm = 3; |
| 1960 | static constexpr int odsIndex_retval = 0; |
| 1961 | static constexpr int odsIndex_req = 1; |
| 1962 | using Properties = FoldAdaptor::Properties; |
| 1963 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 1964 | return {}; |
| 1965 | } |
| 1966 | |
| 1967 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
| 1968 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 1969 | return ::llvm::StringLiteral("mpi.irecv" ); |
| 1970 | } |
| 1971 | |
| 1972 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 1973 | return {index, 1}; |
| 1974 | } |
| 1975 | |
| 1976 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 1977 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 1978 | return getOperation()->getOperands().slice(n: start, m: length); |
| 1979 | } |
| 1980 | |
| 1981 | ::mlir::TypedValue<::mlir::MemRefType> getRef() { |
| 1982 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 1983 | } |
| 1984 | |
| 1985 | ::mlir::TypedValue<::mlir::IntegerType> getTag() { |
| 1986 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 1).begin()); |
| 1987 | } |
| 1988 | |
| 1989 | ::mlir::TypedValue<::mlir::IntegerType> getSource() { |
| 1990 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 2).begin()); |
| 1991 | } |
| 1992 | |
| 1993 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 1994 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 3).begin()); |
| 1995 | } |
| 1996 | |
| 1997 | ::mlir::OpOperand &getRefMutable() { |
| 1998 | auto range = getODSOperandIndexAndLength(index: 0); |
| 1999 | return getOperation()->getOpOperand(idx: range.first); |
| 2000 | } |
| 2001 | |
| 2002 | ::mlir::OpOperand &getTagMutable() { |
| 2003 | auto range = getODSOperandIndexAndLength(index: 1); |
| 2004 | return getOperation()->getOpOperand(idx: range.first); |
| 2005 | } |
| 2006 | |
| 2007 | ::mlir::OpOperand &getSourceMutable() { |
| 2008 | auto range = getODSOperandIndexAndLength(index: 2); |
| 2009 | return getOperation()->getOpOperand(idx: range.first); |
| 2010 | } |
| 2011 | |
| 2012 | ::mlir::OpOperand &getCommMutable() { |
| 2013 | auto range = getODSOperandIndexAndLength(index: 3); |
| 2014 | return getOperation()->getOpOperand(idx: range.first); |
| 2015 | } |
| 2016 | |
| 2017 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 2018 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 2019 | auto valueRange = getODSResultIndexAndLength(index); |
| 2020 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 2021 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 2022 | } |
| 2023 | |
| 2024 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 2025 | auto results = getODSResults(index: 0); |
| 2026 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 2027 | } |
| 2028 | |
| 2029 | ::mlir::TypedValue<::mlir::mpi::RequestType> getReq() { |
| 2030 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RequestType>>(Val: *getODSResults(index: 1).begin()); |
| 2031 | } |
| 2032 | |
| 2033 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2034 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 2035 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 2036 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 2037 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 2038 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 2039 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2040 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2041 | static IRecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2042 | static IRecvOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2043 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2044 | static IRecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2045 | static IRecvOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2046 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2047 | static IRecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2048 | static IRecvOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2049 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2050 | static IRecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2051 | static IRecvOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2052 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 2053 | ::llvm::LogicalResult verifyInvariants(); |
| 2054 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
| 2055 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 2056 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 2057 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 2058 | public: |
| 2059 | }; |
| 2060 | |
| 2061 | } // namespace mlir::mpi |
| 2062 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::IRecvOp) |
| 2063 | |
| 2064 | namespace mlir::mpi { |
| 2065 | |
| 2066 | |
| 2067 | //===----------------------------------------------------------------------===// |
| 2068 | // ::mlir::mpi::ISendOp declarations |
| 2069 | //===----------------------------------------------------------------------===// |
| 2070 | |
| 2071 | namespace detail { |
| 2072 | |
| 2073 | class ISendOpGenericAdaptorBase { |
| 2074 | public: |
| 2075 | using Properties = ::mlir::EmptyProperties; |
| 2076 | protected: |
| 2077 | ::mlir::DictionaryAttr odsAttrs; |
| 2078 | ::std::optional<::mlir::OperationName> odsOpName; |
| 2079 | Properties properties; |
| 2080 | ::mlir::RegionRange odsRegions; |
| 2081 | public: |
| 2082 | ISendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 2083 | odsOpName.emplace(args: "mpi.isend" , args: odsAttrs.getContext()); |
| 2084 | } |
| 2085 | |
| 2086 | ISendOpGenericAdaptorBase(ISendOp op); |
| 2087 | |
| 2088 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 2089 | return {index, 1}; |
| 2090 | } |
| 2091 | |
| 2092 | const Properties &getProperties() { |
| 2093 | return properties; |
| 2094 | } |
| 2095 | |
| 2096 | ::mlir::DictionaryAttr getAttributes() { |
| 2097 | return odsAttrs; |
| 2098 | } |
| 2099 | |
| 2100 | }; |
| 2101 | |
| 2102 | } // namespace detail |
| 2103 | template <typename RangeT> |
| 2104 | class ISendOpGenericAdaptor : public detail::ISendOpGenericAdaptorBase { |
| 2105 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 2106 | using Base = detail::ISendOpGenericAdaptorBase; |
| 2107 | static constexpr int odsIndex_ref = 0; |
| 2108 | static constexpr int odsIndex_tag = 1; |
| 2109 | static constexpr int odsIndex_dest = 2; |
| 2110 | static constexpr int odsIndex_comm = 3; |
| 2111 | public: |
| 2112 | ISendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 2113 | |
| 2114 | ISendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ISendOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 2115 | |
| 2116 | ISendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ISendOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 2117 | |
| 2118 | ISendOpGenericAdaptor(RangeT values, const ISendOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 2119 | |
| 2120 | template <typename LateInst = ISendOp, typename = std::enable_if_t<std::is_same_v<LateInst, ISendOp>>> |
| 2121 | ISendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 2122 | |
| 2123 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2124 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 2125 | } |
| 2126 | |
| 2127 | RangeT getODSOperands(unsigned index) { |
| 2128 | auto valueRange = getODSOperandIndexAndLength(index); |
| 2129 | return {std::next(odsOperands.begin(), valueRange.first), |
| 2130 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 2131 | } |
| 2132 | |
| 2133 | ValueT getRef() { |
| 2134 | return (*getODSOperands(index: 0).begin()); |
| 2135 | } |
| 2136 | |
| 2137 | ValueT getTag() { |
| 2138 | return (*getODSOperands(index: 1).begin()); |
| 2139 | } |
| 2140 | |
| 2141 | ValueT getDest() { |
| 2142 | return (*getODSOperands(index: 2).begin()); |
| 2143 | } |
| 2144 | |
| 2145 | ValueT getComm() { |
| 2146 | return (*getODSOperands(index: 3).begin()); |
| 2147 | } |
| 2148 | |
| 2149 | RangeT getOperands() { |
| 2150 | return odsOperands; |
| 2151 | } |
| 2152 | |
| 2153 | private: |
| 2154 | RangeT odsOperands; |
| 2155 | }; |
| 2156 | class ISendOpAdaptor : public ISendOpGenericAdaptor<::mlir::ValueRange> { |
| 2157 | public: |
| 2158 | using ISendOpGenericAdaptor::ISendOpGenericAdaptor; |
| 2159 | ISendOpAdaptor(ISendOp op); |
| 2160 | |
| 2161 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 2162 | }; |
| 2163 | class ISendOp : public ::mlir::Op<ISendOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
| 2164 | public: |
| 2165 | using Op::Op; |
| 2166 | using Op::print; |
| 2167 | using Adaptor = ISendOpAdaptor; |
| 2168 | template <typename RangeT> |
| 2169 | using GenericAdaptor = ISendOpGenericAdaptor<RangeT>; |
| 2170 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 2171 | static constexpr int odsIndex_ref = 0; |
| 2172 | static constexpr int odsIndex_tag = 1; |
| 2173 | static constexpr int odsIndex_dest = 2; |
| 2174 | static constexpr int odsIndex_comm = 3; |
| 2175 | static constexpr int odsIndex_retval = 0; |
| 2176 | static constexpr int odsIndex_req = 1; |
| 2177 | using Properties = FoldAdaptor::Properties; |
| 2178 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 2179 | return {}; |
| 2180 | } |
| 2181 | |
| 2182 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
| 2183 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 2184 | return ::llvm::StringLiteral("mpi.isend" ); |
| 2185 | } |
| 2186 | |
| 2187 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2188 | return {index, 1}; |
| 2189 | } |
| 2190 | |
| 2191 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 2192 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 2193 | return getOperation()->getOperands().slice(n: start, m: length); |
| 2194 | } |
| 2195 | |
| 2196 | ::mlir::TypedValue<::mlir::MemRefType> getRef() { |
| 2197 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 2198 | } |
| 2199 | |
| 2200 | ::mlir::TypedValue<::mlir::IntegerType> getTag() { |
| 2201 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 1).begin()); |
| 2202 | } |
| 2203 | |
| 2204 | ::mlir::TypedValue<::mlir::IntegerType> getDest() { |
| 2205 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 2).begin()); |
| 2206 | } |
| 2207 | |
| 2208 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 2209 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 3).begin()); |
| 2210 | } |
| 2211 | |
| 2212 | ::mlir::OpOperand &getRefMutable() { |
| 2213 | auto range = getODSOperandIndexAndLength(index: 0); |
| 2214 | return getOperation()->getOpOperand(idx: range.first); |
| 2215 | } |
| 2216 | |
| 2217 | ::mlir::OpOperand &getTagMutable() { |
| 2218 | auto range = getODSOperandIndexAndLength(index: 1); |
| 2219 | return getOperation()->getOpOperand(idx: range.first); |
| 2220 | } |
| 2221 | |
| 2222 | ::mlir::OpOperand &getDestMutable() { |
| 2223 | auto range = getODSOperandIndexAndLength(index: 2); |
| 2224 | return getOperation()->getOpOperand(idx: range.first); |
| 2225 | } |
| 2226 | |
| 2227 | ::mlir::OpOperand &getCommMutable() { |
| 2228 | auto range = getODSOperandIndexAndLength(index: 3); |
| 2229 | return getOperation()->getOpOperand(idx: range.first); |
| 2230 | } |
| 2231 | |
| 2232 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 2233 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 2234 | auto valueRange = getODSResultIndexAndLength(index); |
| 2235 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 2236 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 2237 | } |
| 2238 | |
| 2239 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 2240 | auto results = getODSResults(index: 0); |
| 2241 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 2242 | } |
| 2243 | |
| 2244 | ::mlir::TypedValue<::mlir::mpi::RequestType> getReq() { |
| 2245 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RequestType>>(Val: *getODSResults(index: 1).begin()); |
| 2246 | } |
| 2247 | |
| 2248 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2249 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 2250 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 2251 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 2252 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 2253 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 2254 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2255 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 2256 | static ISendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 2257 | static ISendOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 2258 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 2259 | static ISendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 2260 | static ISendOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 2261 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2262 | static ISendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2263 | static ISendOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2264 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2265 | static ISendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2266 | static ISendOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2267 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 2268 | ::llvm::LogicalResult verifyInvariants(); |
| 2269 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
| 2270 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 2271 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 2272 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 2273 | public: |
| 2274 | }; |
| 2275 | |
| 2276 | } // namespace mlir::mpi |
| 2277 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::ISendOp) |
| 2278 | |
| 2279 | namespace mlir::mpi { |
| 2280 | |
| 2281 | |
| 2282 | //===----------------------------------------------------------------------===// |
| 2283 | // ::mlir::mpi::InitOp declarations |
| 2284 | //===----------------------------------------------------------------------===// |
| 2285 | |
| 2286 | namespace detail { |
| 2287 | |
| 2288 | class InitOpGenericAdaptorBase { |
| 2289 | public: |
| 2290 | using Properties = ::mlir::EmptyProperties; |
| 2291 | protected: |
| 2292 | ::mlir::DictionaryAttr odsAttrs; |
| 2293 | ::std::optional<::mlir::OperationName> odsOpName; |
| 2294 | Properties properties; |
| 2295 | ::mlir::RegionRange odsRegions; |
| 2296 | public: |
| 2297 | InitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 2298 | odsOpName.emplace(args: "mpi.init" , args: odsAttrs.getContext()); |
| 2299 | } |
| 2300 | |
| 2301 | InitOpGenericAdaptorBase(InitOp op); |
| 2302 | |
| 2303 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 2304 | return {index, 1}; |
| 2305 | } |
| 2306 | |
| 2307 | const Properties &getProperties() { |
| 2308 | return properties; |
| 2309 | } |
| 2310 | |
| 2311 | ::mlir::DictionaryAttr getAttributes() { |
| 2312 | return odsAttrs; |
| 2313 | } |
| 2314 | |
| 2315 | }; |
| 2316 | |
| 2317 | } // namespace detail |
| 2318 | template <typename RangeT> |
| 2319 | class InitOpGenericAdaptor : public detail::InitOpGenericAdaptorBase { |
| 2320 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 2321 | using Base = detail::InitOpGenericAdaptorBase; |
| 2322 | public: |
| 2323 | InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 2324 | |
| 2325 | InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : InitOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 2326 | |
| 2327 | InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : InitOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 2328 | |
| 2329 | InitOpGenericAdaptor(RangeT values, const InitOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 2330 | |
| 2331 | template <typename LateInst = InitOp, typename = std::enable_if_t<std::is_same_v<LateInst, InitOp>>> |
| 2332 | InitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 2333 | |
| 2334 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2335 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 2336 | } |
| 2337 | |
| 2338 | RangeT getODSOperands(unsigned index) { |
| 2339 | auto valueRange = getODSOperandIndexAndLength(index); |
| 2340 | return {std::next(odsOperands.begin(), valueRange.first), |
| 2341 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 2342 | } |
| 2343 | |
| 2344 | RangeT getOperands() { |
| 2345 | return odsOperands; |
| 2346 | } |
| 2347 | |
| 2348 | private: |
| 2349 | RangeT odsOperands; |
| 2350 | }; |
| 2351 | class InitOpAdaptor : public InitOpGenericAdaptor<::mlir::ValueRange> { |
| 2352 | public: |
| 2353 | using InitOpGenericAdaptor::InitOpGenericAdaptor; |
| 2354 | InitOpAdaptor(InitOp op); |
| 2355 | |
| 2356 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 2357 | }; |
| 2358 | class InitOp : public ::mlir::Op<InitOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 2359 | public: |
| 2360 | using Op::Op; |
| 2361 | using Op::print; |
| 2362 | using Adaptor = InitOpAdaptor; |
| 2363 | template <typename RangeT> |
| 2364 | using GenericAdaptor = InitOpGenericAdaptor<RangeT>; |
| 2365 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 2366 | static constexpr int odsIndex_retval = 0; |
| 2367 | using Properties = FoldAdaptor::Properties; |
| 2368 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 2369 | return {}; |
| 2370 | } |
| 2371 | |
| 2372 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 2373 | return ::llvm::StringLiteral("mpi.init" ); |
| 2374 | } |
| 2375 | |
| 2376 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2377 | return {index, 1}; |
| 2378 | } |
| 2379 | |
| 2380 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 2381 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 2382 | return getOperation()->getOperands().slice(n: start, m: length); |
| 2383 | } |
| 2384 | |
| 2385 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 2386 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 2387 | auto valueRange = getODSResultIndexAndLength(index); |
| 2388 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 2389 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 2390 | } |
| 2391 | |
| 2392 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 2393 | auto results = getODSResults(index: 0); |
| 2394 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 2395 | } |
| 2396 | |
| 2397 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2398 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 2399 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 2400 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 2401 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 2402 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 2403 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2404 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval); |
| 2405 | static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval); |
| 2406 | static InitOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval); |
| 2407 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); |
| 2408 | static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); |
| 2409 | static InitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes); |
| 2410 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2411 | static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2412 | static InitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2413 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2414 | static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2415 | static InitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2416 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 2417 | ::llvm::LogicalResult verifyInvariants(); |
| 2418 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 2419 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 2420 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 2421 | public: |
| 2422 | }; |
| 2423 | |
| 2424 | } // namespace mlir::mpi |
| 2425 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::InitOp) |
| 2426 | |
| 2427 | namespace mlir::mpi { |
| 2428 | |
| 2429 | |
| 2430 | //===----------------------------------------------------------------------===// |
| 2431 | // ::mlir::mpi::RecvOp declarations |
| 2432 | //===----------------------------------------------------------------------===// |
| 2433 | |
| 2434 | namespace detail { |
| 2435 | |
| 2436 | class RecvOpGenericAdaptorBase { |
| 2437 | public: |
| 2438 | using Properties = ::mlir::EmptyProperties; |
| 2439 | protected: |
| 2440 | ::mlir::DictionaryAttr odsAttrs; |
| 2441 | ::std::optional<::mlir::OperationName> odsOpName; |
| 2442 | Properties properties; |
| 2443 | ::mlir::RegionRange odsRegions; |
| 2444 | public: |
| 2445 | RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 2446 | odsOpName.emplace(args: "mpi.recv" , args: odsAttrs.getContext()); |
| 2447 | } |
| 2448 | |
| 2449 | RecvOpGenericAdaptorBase(RecvOp op); |
| 2450 | |
| 2451 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 2452 | return {index, 1}; |
| 2453 | } |
| 2454 | |
| 2455 | const Properties &getProperties() { |
| 2456 | return properties; |
| 2457 | } |
| 2458 | |
| 2459 | ::mlir::DictionaryAttr getAttributes() { |
| 2460 | return odsAttrs; |
| 2461 | } |
| 2462 | |
| 2463 | }; |
| 2464 | |
| 2465 | } // namespace detail |
| 2466 | template <typename RangeT> |
| 2467 | class RecvOpGenericAdaptor : public detail::RecvOpGenericAdaptorBase { |
| 2468 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 2469 | using Base = detail::RecvOpGenericAdaptorBase; |
| 2470 | static constexpr int odsIndex_ref = 0; |
| 2471 | static constexpr int odsIndex_tag = 1; |
| 2472 | static constexpr int odsIndex_source = 2; |
| 2473 | static constexpr int odsIndex_comm = 3; |
| 2474 | public: |
| 2475 | RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 2476 | |
| 2477 | RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 2478 | |
| 2479 | RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RecvOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 2480 | |
| 2481 | RecvOpGenericAdaptor(RangeT values, const RecvOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 2482 | |
| 2483 | template <typename LateInst = RecvOp, typename = std::enable_if_t<std::is_same_v<LateInst, RecvOp>>> |
| 2484 | RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 2485 | |
| 2486 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2487 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 2488 | } |
| 2489 | |
| 2490 | RangeT getODSOperands(unsigned index) { |
| 2491 | auto valueRange = getODSOperandIndexAndLength(index); |
| 2492 | return {std::next(odsOperands.begin(), valueRange.first), |
| 2493 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 2494 | } |
| 2495 | |
| 2496 | ValueT getRef() { |
| 2497 | return (*getODSOperands(index: 0).begin()); |
| 2498 | } |
| 2499 | |
| 2500 | ValueT getTag() { |
| 2501 | return (*getODSOperands(index: 1).begin()); |
| 2502 | } |
| 2503 | |
| 2504 | ValueT getSource() { |
| 2505 | return (*getODSOperands(index: 2).begin()); |
| 2506 | } |
| 2507 | |
| 2508 | ValueT getComm() { |
| 2509 | return (*getODSOperands(index: 3).begin()); |
| 2510 | } |
| 2511 | |
| 2512 | RangeT getOperands() { |
| 2513 | return odsOperands; |
| 2514 | } |
| 2515 | |
| 2516 | private: |
| 2517 | RangeT odsOperands; |
| 2518 | }; |
| 2519 | class RecvOpAdaptor : public RecvOpGenericAdaptor<::mlir::ValueRange> { |
| 2520 | public: |
| 2521 | using RecvOpGenericAdaptor::RecvOpGenericAdaptor; |
| 2522 | RecvOpAdaptor(RecvOp op); |
| 2523 | |
| 2524 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 2525 | }; |
| 2526 | class RecvOp : public ::mlir::Op<RecvOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 2527 | public: |
| 2528 | using Op::Op; |
| 2529 | using Op::print; |
| 2530 | using Adaptor = RecvOpAdaptor; |
| 2531 | template <typename RangeT> |
| 2532 | using GenericAdaptor = RecvOpGenericAdaptor<RangeT>; |
| 2533 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 2534 | static constexpr int odsIndex_ref = 0; |
| 2535 | static constexpr int odsIndex_tag = 1; |
| 2536 | static constexpr int odsIndex_source = 2; |
| 2537 | static constexpr int odsIndex_comm = 3; |
| 2538 | static constexpr int odsIndex_retval = 0; |
| 2539 | using Properties = FoldAdaptor::Properties; |
| 2540 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 2541 | return {}; |
| 2542 | } |
| 2543 | |
| 2544 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 2545 | return ::llvm::StringLiteral("mpi.recv" ); |
| 2546 | } |
| 2547 | |
| 2548 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2549 | return {index, 1}; |
| 2550 | } |
| 2551 | |
| 2552 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 2553 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 2554 | return getOperation()->getOperands().slice(n: start, m: length); |
| 2555 | } |
| 2556 | |
| 2557 | ::mlir::TypedValue<::mlir::MemRefType> getRef() { |
| 2558 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 2559 | } |
| 2560 | |
| 2561 | ::mlir::TypedValue<::mlir::IntegerType> getTag() { |
| 2562 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 1).begin()); |
| 2563 | } |
| 2564 | |
| 2565 | ::mlir::TypedValue<::mlir::IntegerType> getSource() { |
| 2566 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 2).begin()); |
| 2567 | } |
| 2568 | |
| 2569 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 2570 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 3).begin()); |
| 2571 | } |
| 2572 | |
| 2573 | ::mlir::OpOperand &getRefMutable() { |
| 2574 | auto range = getODSOperandIndexAndLength(index: 0); |
| 2575 | return getOperation()->getOpOperand(idx: range.first); |
| 2576 | } |
| 2577 | |
| 2578 | ::mlir::OpOperand &getTagMutable() { |
| 2579 | auto range = getODSOperandIndexAndLength(index: 1); |
| 2580 | return getOperation()->getOpOperand(idx: range.first); |
| 2581 | } |
| 2582 | |
| 2583 | ::mlir::OpOperand &getSourceMutable() { |
| 2584 | auto range = getODSOperandIndexAndLength(index: 2); |
| 2585 | return getOperation()->getOpOperand(idx: range.first); |
| 2586 | } |
| 2587 | |
| 2588 | ::mlir::OpOperand &getCommMutable() { |
| 2589 | auto range = getODSOperandIndexAndLength(index: 3); |
| 2590 | return getOperation()->getOpOperand(idx: range.first); |
| 2591 | } |
| 2592 | |
| 2593 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 2594 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 2595 | auto valueRange = getODSResultIndexAndLength(index); |
| 2596 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 2597 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 2598 | } |
| 2599 | |
| 2600 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 2601 | auto results = getODSResults(index: 0); |
| 2602 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 2603 | } |
| 2604 | |
| 2605 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2606 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 2607 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 2608 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 2609 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 2610 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 2611 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2612 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2613 | static RecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2614 | static RecvOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2615 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2616 | static RecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2617 | static RecvOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm); |
| 2618 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2619 | static RecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2620 | static RecvOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2621 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2622 | static RecvOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2623 | static RecvOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2624 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 2625 | ::llvm::LogicalResult verifyInvariants(); |
| 2626 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
| 2627 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 2628 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 2629 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 2630 | public: |
| 2631 | }; |
| 2632 | |
| 2633 | } // namespace mlir::mpi |
| 2634 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::RecvOp) |
| 2635 | |
| 2636 | namespace mlir::mpi { |
| 2637 | |
| 2638 | |
| 2639 | //===----------------------------------------------------------------------===// |
| 2640 | // ::mlir::mpi::ReduceScatterBlockOp declarations |
| 2641 | //===----------------------------------------------------------------------===// |
| 2642 | |
| 2643 | namespace detail { |
| 2644 | |
| 2645 | class ReduceScatterBlockOpGenericAdaptorBase { |
| 2646 | public: |
| 2647 | struct Properties { |
| 2648 | using opTy = ::mlir::mpi::MPI_ReductionOpEnumAttr; |
| 2649 | opTy op; |
| 2650 | |
| 2651 | auto getOp() const { |
| 2652 | auto &propStorage = this->op; |
| 2653 | return ::llvm::cast<::mlir::mpi::MPI_ReductionOpEnumAttr>(Val: propStorage); |
| 2654 | } |
| 2655 | void setOp(const ::mlir::mpi::MPI_ReductionOpEnumAttr &propValue) { |
| 2656 | this->op = propValue; |
| 2657 | } |
| 2658 | bool operator==(const Properties &rhs) const { |
| 2659 | return |
| 2660 | rhs.op == this->op && |
| 2661 | true; |
| 2662 | } |
| 2663 | bool operator!=(const Properties &rhs) const { |
| 2664 | return !(*this == rhs); |
| 2665 | } |
| 2666 | }; |
| 2667 | protected: |
| 2668 | ::mlir::DictionaryAttr odsAttrs; |
| 2669 | ::std::optional<::mlir::OperationName> odsOpName; |
| 2670 | Properties properties; |
| 2671 | ::mlir::RegionRange odsRegions; |
| 2672 | public: |
| 2673 | ReduceScatterBlockOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 2674 | odsOpName.emplace(args: "mpi.reduce_scatter_block" , args: odsAttrs.getContext()); |
| 2675 | } |
| 2676 | |
| 2677 | ReduceScatterBlockOpGenericAdaptorBase(ReduceScatterBlockOp op); |
| 2678 | |
| 2679 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 2680 | return {index, 1}; |
| 2681 | } |
| 2682 | |
| 2683 | const Properties &getProperties() { |
| 2684 | return properties; |
| 2685 | } |
| 2686 | |
| 2687 | ::mlir::DictionaryAttr getAttributes() { |
| 2688 | return odsAttrs; |
| 2689 | } |
| 2690 | |
| 2691 | ::mlir::mpi::MPI_ReductionOpEnumAttr getOpAttr() { |
| 2692 | auto attr = ::llvm::cast<::mlir::mpi::MPI_ReductionOpEnumAttr>(Val: getProperties().op); |
| 2693 | return attr; |
| 2694 | } |
| 2695 | |
| 2696 | ::mlir::mpi::MPI_ReductionOpEnum getOp(); |
| 2697 | }; |
| 2698 | |
| 2699 | } // namespace detail |
| 2700 | template <typename RangeT> |
| 2701 | class ReduceScatterBlockOpGenericAdaptor : public detail::ReduceScatterBlockOpGenericAdaptorBase { |
| 2702 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 2703 | using Base = detail::ReduceScatterBlockOpGenericAdaptorBase; |
| 2704 | static constexpr int odsIndex_sendbuf = 0; |
| 2705 | static constexpr int odsIndex_recvbuf = 1; |
| 2706 | static constexpr int odsIndex_comm = 2; |
| 2707 | public: |
| 2708 | ReduceScatterBlockOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 2709 | |
| 2710 | ReduceScatterBlockOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceScatterBlockOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 2711 | |
| 2712 | ReduceScatterBlockOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceScatterBlockOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 2713 | |
| 2714 | ReduceScatterBlockOpGenericAdaptor(RangeT values, const ReduceScatterBlockOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 2715 | |
| 2716 | template <typename LateInst = ReduceScatterBlockOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceScatterBlockOp>>> |
| 2717 | ReduceScatterBlockOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 2718 | |
| 2719 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2720 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 2721 | } |
| 2722 | |
| 2723 | RangeT getODSOperands(unsigned index) { |
| 2724 | auto valueRange = getODSOperandIndexAndLength(index); |
| 2725 | return {std::next(odsOperands.begin(), valueRange.first), |
| 2726 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 2727 | } |
| 2728 | |
| 2729 | ValueT getSendbuf() { |
| 2730 | return (*getODSOperands(index: 0).begin()); |
| 2731 | } |
| 2732 | |
| 2733 | ValueT getRecvbuf() { |
| 2734 | return (*getODSOperands(index: 1).begin()); |
| 2735 | } |
| 2736 | |
| 2737 | ValueT getComm() { |
| 2738 | return (*getODSOperands(index: 2).begin()); |
| 2739 | } |
| 2740 | |
| 2741 | RangeT getOperands() { |
| 2742 | return odsOperands; |
| 2743 | } |
| 2744 | |
| 2745 | private: |
| 2746 | RangeT odsOperands; |
| 2747 | }; |
| 2748 | class ReduceScatterBlockOpAdaptor : public ReduceScatterBlockOpGenericAdaptor<::mlir::ValueRange> { |
| 2749 | public: |
| 2750 | using ReduceScatterBlockOpGenericAdaptor::ReduceScatterBlockOpGenericAdaptor; |
| 2751 | ReduceScatterBlockOpAdaptor(ReduceScatterBlockOp op); |
| 2752 | |
| 2753 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 2754 | }; |
| 2755 | class ReduceScatterBlockOp : public ::mlir::Op<ReduceScatterBlockOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { |
| 2756 | public: |
| 2757 | using Op::Op; |
| 2758 | using Op::print; |
| 2759 | using Adaptor = ReduceScatterBlockOpAdaptor; |
| 2760 | template <typename RangeT> |
| 2761 | using GenericAdaptor = ReduceScatterBlockOpGenericAdaptor<RangeT>; |
| 2762 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 2763 | static constexpr int odsIndex_sendbuf = 0; |
| 2764 | static constexpr int odsIndex_recvbuf = 1; |
| 2765 | static constexpr int odsIndex_comm = 2; |
| 2766 | static constexpr int odsIndex_retval = 0; |
| 2767 | using Properties = FoldAdaptor::Properties; |
| 2768 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 2769 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("op" )}; |
| 2770 | return ::llvm::ArrayRef(attrNames); |
| 2771 | } |
| 2772 | |
| 2773 | ::mlir::StringAttr getOpAttrName() { |
| 2774 | return getAttributeNameForIndex(index: 0); |
| 2775 | } |
| 2776 | |
| 2777 | static ::mlir::StringAttr getOpAttrName(::mlir::OperationName name) { |
| 2778 | return getAttributeNameForIndex(name, index: 0); |
| 2779 | } |
| 2780 | |
| 2781 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 2782 | return ::llvm::StringLiteral("mpi.reduce_scatter_block" ); |
| 2783 | } |
| 2784 | |
| 2785 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2786 | return {index, 1}; |
| 2787 | } |
| 2788 | |
| 2789 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 2790 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 2791 | return getOperation()->getOperands().slice(n: start, m: length); |
| 2792 | } |
| 2793 | |
| 2794 | ::mlir::TypedValue<::mlir::MemRefType> getSendbuf() { |
| 2795 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 2796 | } |
| 2797 | |
| 2798 | ::mlir::TypedValue<::mlir::MemRefType> getRecvbuf() { |
| 2799 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 1).begin()); |
| 2800 | } |
| 2801 | |
| 2802 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 2803 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 2).begin()); |
| 2804 | } |
| 2805 | |
| 2806 | ::mlir::OpOperand &getSendbufMutable() { |
| 2807 | auto range = getODSOperandIndexAndLength(index: 0); |
| 2808 | return getOperation()->getOpOperand(idx: range.first); |
| 2809 | } |
| 2810 | |
| 2811 | ::mlir::OpOperand &getRecvbufMutable() { |
| 2812 | auto range = getODSOperandIndexAndLength(index: 1); |
| 2813 | return getOperation()->getOpOperand(idx: range.first); |
| 2814 | } |
| 2815 | |
| 2816 | ::mlir::OpOperand &getCommMutable() { |
| 2817 | auto range = getODSOperandIndexAndLength(index: 2); |
| 2818 | return getOperation()->getOpOperand(idx: range.first); |
| 2819 | } |
| 2820 | |
| 2821 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 2822 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 2823 | auto valueRange = getODSResultIndexAndLength(index); |
| 2824 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 2825 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 2826 | } |
| 2827 | |
| 2828 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 2829 | auto results = getODSResults(index: 0); |
| 2830 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 2831 | } |
| 2832 | |
| 2833 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2834 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 2835 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 2836 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 2837 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 2838 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 2839 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 2840 | static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); |
| 2841 | void writeProperties(::mlir::DialectBytecodeWriter &writer); |
| 2842 | ::mlir::mpi::MPI_ReductionOpEnumAttr getOpAttr() { |
| 2843 | return ::llvm::cast<::mlir::mpi::MPI_ReductionOpEnumAttr>(Val&: getProperties().op); |
| 2844 | } |
| 2845 | |
| 2846 | ::mlir::mpi::MPI_ReductionOpEnum getOp(); |
| 2847 | void setOpAttr(::mlir::mpi::MPI_ReductionOpEnumAttr attr) { |
| 2848 | getProperties().op = attr; |
| 2849 | } |
| 2850 | |
| 2851 | void setOp(::mlir::mpi::MPI_ReductionOpEnum attrValue); |
| 2852 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 2853 | static ReduceScatterBlockOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 2854 | static ReduceScatterBlockOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 2855 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 2856 | static ReduceScatterBlockOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 2857 | static ReduceScatterBlockOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm); |
| 2858 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 2859 | static ReduceScatterBlockOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 2860 | static ReduceScatterBlockOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 2861 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 2862 | static ReduceScatterBlockOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 2863 | static ReduceScatterBlockOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm); |
| 2864 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 2865 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2866 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 2867 | static ReduceScatterBlockOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2868 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 2869 | static ReduceScatterBlockOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 2870 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2871 | static ReduceScatterBlockOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2872 | static ReduceScatterBlockOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 2873 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 2874 | ::llvm::LogicalResult verifyInvariants(); |
| 2875 | ::llvm::LogicalResult verify(); |
| 2876 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 2877 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 2878 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 2879 | private: |
| 2880 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
| 2881 | return getAttributeNameForIndex(name: (*this)->getName(), index); |
| 2882 | } |
| 2883 | |
| 2884 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
| 2885 | assert(index < 1 && "invalid attribute index" ); |
| 2886 | assert(name.getStringRef() == getOperationName() && "invalid operation name" ); |
| 2887 | assert(name.isRegistered() && "Operation isn't registered, missing a " |
| 2888 | "dependent dialect loading?" ); |
| 2889 | return name.getAttributeNames()[index]; |
| 2890 | } |
| 2891 | |
| 2892 | static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes); |
| 2893 | public: |
| 2894 | }; |
| 2895 | |
| 2896 | } // namespace mlir::mpi |
| 2897 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::ReduceScatterBlockOp) |
| 2898 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::detail::ReduceScatterBlockOpGenericAdaptorBase::Properties) |
| 2899 | |
| 2900 | namespace mlir::mpi { |
| 2901 | |
| 2902 | |
| 2903 | //===----------------------------------------------------------------------===// |
| 2904 | // ::mlir::mpi::RetvalCheckOp declarations |
| 2905 | //===----------------------------------------------------------------------===// |
| 2906 | |
| 2907 | namespace detail { |
| 2908 | |
| 2909 | class RetvalCheckOpGenericAdaptorBase { |
| 2910 | public: |
| 2911 | struct Properties { |
| 2912 | using errclassTy = ::mlir::mpi::MPI_ErrorClassEnumAttr; |
| 2913 | errclassTy errclass; |
| 2914 | |
| 2915 | auto getErrclass() const { |
| 2916 | auto &propStorage = this->errclass; |
| 2917 | return ::llvm::cast<::mlir::mpi::MPI_ErrorClassEnumAttr>(Val: propStorage); |
| 2918 | } |
| 2919 | void setErrclass(const ::mlir::mpi::MPI_ErrorClassEnumAttr &propValue) { |
| 2920 | this->errclass = propValue; |
| 2921 | } |
| 2922 | bool operator==(const Properties &rhs) const { |
| 2923 | return |
| 2924 | rhs.errclass == this->errclass && |
| 2925 | true; |
| 2926 | } |
| 2927 | bool operator!=(const Properties &rhs) const { |
| 2928 | return !(*this == rhs); |
| 2929 | } |
| 2930 | }; |
| 2931 | protected: |
| 2932 | ::mlir::DictionaryAttr odsAttrs; |
| 2933 | ::std::optional<::mlir::OperationName> odsOpName; |
| 2934 | Properties properties; |
| 2935 | ::mlir::RegionRange odsRegions; |
| 2936 | public: |
| 2937 | RetvalCheckOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 2938 | odsOpName.emplace(args: "mpi.retval_check" , args: odsAttrs.getContext()); |
| 2939 | } |
| 2940 | |
| 2941 | RetvalCheckOpGenericAdaptorBase(RetvalCheckOp op); |
| 2942 | |
| 2943 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 2944 | return {index, 1}; |
| 2945 | } |
| 2946 | |
| 2947 | const Properties &getProperties() { |
| 2948 | return properties; |
| 2949 | } |
| 2950 | |
| 2951 | ::mlir::DictionaryAttr getAttributes() { |
| 2952 | return odsAttrs; |
| 2953 | } |
| 2954 | |
| 2955 | ::mlir::mpi::MPI_ErrorClassEnumAttr getErrclassAttr() { |
| 2956 | auto attr = ::llvm::cast<::mlir::mpi::MPI_ErrorClassEnumAttr>(Val: getProperties().errclass); |
| 2957 | return attr; |
| 2958 | } |
| 2959 | |
| 2960 | ::mlir::mpi::MPI_ErrorClassEnum getErrclass(); |
| 2961 | }; |
| 2962 | |
| 2963 | } // namespace detail |
| 2964 | template <typename RangeT> |
| 2965 | class RetvalCheckOpGenericAdaptor : public detail::RetvalCheckOpGenericAdaptorBase { |
| 2966 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 2967 | using Base = detail::RetvalCheckOpGenericAdaptorBase; |
| 2968 | static constexpr int odsIndex_val = 0; |
| 2969 | public: |
| 2970 | RetvalCheckOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 2971 | |
| 2972 | RetvalCheckOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RetvalCheckOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 2973 | |
| 2974 | RetvalCheckOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RetvalCheckOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 2975 | |
| 2976 | RetvalCheckOpGenericAdaptor(RangeT values, const RetvalCheckOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 2977 | |
| 2978 | template <typename LateInst = RetvalCheckOp, typename = std::enable_if_t<std::is_same_v<LateInst, RetvalCheckOp>>> |
| 2979 | RetvalCheckOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 2980 | |
| 2981 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 2982 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 2983 | } |
| 2984 | |
| 2985 | RangeT getODSOperands(unsigned index) { |
| 2986 | auto valueRange = getODSOperandIndexAndLength(index); |
| 2987 | return {std::next(odsOperands.begin(), valueRange.first), |
| 2988 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 2989 | } |
| 2990 | |
| 2991 | ValueT getVal() { |
| 2992 | return (*getODSOperands(index: 0).begin()); |
| 2993 | } |
| 2994 | |
| 2995 | RangeT getOperands() { |
| 2996 | return odsOperands; |
| 2997 | } |
| 2998 | |
| 2999 | private: |
| 3000 | RangeT odsOperands; |
| 3001 | }; |
| 3002 | class RetvalCheckOpAdaptor : public RetvalCheckOpGenericAdaptor<::mlir::ValueRange> { |
| 3003 | public: |
| 3004 | using RetvalCheckOpGenericAdaptor::RetvalCheckOpGenericAdaptor; |
| 3005 | RetvalCheckOpAdaptor(RetvalCheckOp op); |
| 3006 | |
| 3007 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 3008 | }; |
| 3009 | class RetvalCheckOp : public ::mlir::Op<RetvalCheckOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::IntegerType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { |
| 3010 | public: |
| 3011 | using Op::Op; |
| 3012 | using Op::print; |
| 3013 | using Adaptor = RetvalCheckOpAdaptor; |
| 3014 | template <typename RangeT> |
| 3015 | using GenericAdaptor = RetvalCheckOpGenericAdaptor<RangeT>; |
| 3016 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 3017 | static constexpr int odsIndex_val = 0; |
| 3018 | static constexpr int odsIndex_res = 0; |
| 3019 | using Properties = FoldAdaptor::Properties; |
| 3020 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 3021 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("errclass" )}; |
| 3022 | return ::llvm::ArrayRef(attrNames); |
| 3023 | } |
| 3024 | |
| 3025 | ::mlir::StringAttr getErrclassAttrName() { |
| 3026 | return getAttributeNameForIndex(index: 0); |
| 3027 | } |
| 3028 | |
| 3029 | static ::mlir::StringAttr getErrclassAttrName(::mlir::OperationName name) { |
| 3030 | return getAttributeNameForIndex(name, index: 0); |
| 3031 | } |
| 3032 | |
| 3033 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 3034 | return ::llvm::StringLiteral("mpi.retval_check" ); |
| 3035 | } |
| 3036 | |
| 3037 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 3038 | return {index, 1}; |
| 3039 | } |
| 3040 | |
| 3041 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 3042 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 3043 | return getOperation()->getOperands().slice(n: start, m: length); |
| 3044 | } |
| 3045 | |
| 3046 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getVal() { |
| 3047 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *getODSOperands(index: 0).begin()); |
| 3048 | } |
| 3049 | |
| 3050 | ::mlir::OpOperand &getValMutable() { |
| 3051 | auto range = getODSOperandIndexAndLength(index: 0); |
| 3052 | return getOperation()->getOpOperand(idx: range.first); |
| 3053 | } |
| 3054 | |
| 3055 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) { |
| 3056 | return {index, 1}; |
| 3057 | } |
| 3058 | |
| 3059 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 3060 | auto valueRange = getODSResultIndexAndLength(index); |
| 3061 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 3062 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 3063 | } |
| 3064 | |
| 3065 | ::mlir::TypedValue<::mlir::IntegerType> getRes() { |
| 3066 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSResults(index: 0).begin()); |
| 3067 | } |
| 3068 | |
| 3069 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 3070 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 3071 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 3072 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 3073 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 3074 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 3075 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 3076 | static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); |
| 3077 | void writeProperties(::mlir::DialectBytecodeWriter &writer); |
| 3078 | ::mlir::mpi::MPI_ErrorClassEnumAttr getErrclassAttr() { |
| 3079 | return ::llvm::cast<::mlir::mpi::MPI_ErrorClassEnumAttr>(Val&: getProperties().errclass); |
| 3080 | } |
| 3081 | |
| 3082 | ::mlir::mpi::MPI_ErrorClassEnum getErrclass(); |
| 3083 | void setErrclassAttr(::mlir::mpi::MPI_ErrorClassEnumAttr attr) { |
| 3084 | getProperties().errclass = attr; |
| 3085 | } |
| 3086 | |
| 3087 | void setErrclass(::mlir::mpi::MPI_ErrorClassEnum attrValue); |
| 3088 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass); |
| 3089 | static RetvalCheckOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass); |
| 3090 | static RetvalCheckOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass); |
| 3091 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass); |
| 3092 | static RetvalCheckOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass); |
| 3093 | static RetvalCheckOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass); |
| 3094 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass); |
| 3095 | static RetvalCheckOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass); |
| 3096 | static RetvalCheckOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass); |
| 3097 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass); |
| 3098 | static RetvalCheckOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass); |
| 3099 | static RetvalCheckOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass); |
| 3100 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 3101 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3102 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 3103 | static RetvalCheckOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3104 | [[deprecated("use the overload taking Properties and discardableAttributes instead" )]] |
| 3105 | static RetvalCheckOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3106 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3107 | static RetvalCheckOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3108 | static RetvalCheckOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3109 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 3110 | ::llvm::LogicalResult verifyInvariants(); |
| 3111 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 3112 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 3113 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 3114 | private: |
| 3115 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
| 3116 | return getAttributeNameForIndex(name: (*this)->getName(), index); |
| 3117 | } |
| 3118 | |
| 3119 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
| 3120 | assert(index < 1 && "invalid attribute index" ); |
| 3121 | assert(name.getStringRef() == getOperationName() && "invalid operation name" ); |
| 3122 | assert(name.isRegistered() && "Operation isn't registered, missing a " |
| 3123 | "dependent dialect loading?" ); |
| 3124 | return name.getAttributeNames()[index]; |
| 3125 | } |
| 3126 | |
| 3127 | static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes); |
| 3128 | public: |
| 3129 | }; |
| 3130 | |
| 3131 | } // namespace mlir::mpi |
| 3132 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::RetvalCheckOp) |
| 3133 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::detail::RetvalCheckOpGenericAdaptorBase::Properties) |
| 3134 | |
| 3135 | namespace mlir::mpi { |
| 3136 | |
| 3137 | |
| 3138 | //===----------------------------------------------------------------------===// |
| 3139 | // ::mlir::mpi::SendOp declarations |
| 3140 | //===----------------------------------------------------------------------===// |
| 3141 | |
| 3142 | namespace detail { |
| 3143 | |
| 3144 | class SendOpGenericAdaptorBase { |
| 3145 | public: |
| 3146 | using Properties = ::mlir::EmptyProperties; |
| 3147 | protected: |
| 3148 | ::mlir::DictionaryAttr odsAttrs; |
| 3149 | ::std::optional<::mlir::OperationName> odsOpName; |
| 3150 | Properties properties; |
| 3151 | ::mlir::RegionRange odsRegions; |
| 3152 | public: |
| 3153 | SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 3154 | odsOpName.emplace(args: "mpi.send" , args: odsAttrs.getContext()); |
| 3155 | } |
| 3156 | |
| 3157 | SendOpGenericAdaptorBase(SendOp op); |
| 3158 | |
| 3159 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 3160 | return {index, 1}; |
| 3161 | } |
| 3162 | |
| 3163 | const Properties &getProperties() { |
| 3164 | return properties; |
| 3165 | } |
| 3166 | |
| 3167 | ::mlir::DictionaryAttr getAttributes() { |
| 3168 | return odsAttrs; |
| 3169 | } |
| 3170 | |
| 3171 | }; |
| 3172 | |
| 3173 | } // namespace detail |
| 3174 | template <typename RangeT> |
| 3175 | class SendOpGenericAdaptor : public detail::SendOpGenericAdaptorBase { |
| 3176 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 3177 | using Base = detail::SendOpGenericAdaptorBase; |
| 3178 | static constexpr int odsIndex_ref = 0; |
| 3179 | static constexpr int odsIndex_tag = 1; |
| 3180 | static constexpr int odsIndex_dest = 2; |
| 3181 | static constexpr int odsIndex_comm = 3; |
| 3182 | public: |
| 3183 | SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 3184 | |
| 3185 | SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 3186 | |
| 3187 | SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SendOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 3188 | |
| 3189 | SendOpGenericAdaptor(RangeT values, const SendOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 3190 | |
| 3191 | template <typename LateInst = SendOp, typename = std::enable_if_t<std::is_same_v<LateInst, SendOp>>> |
| 3192 | SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 3193 | |
| 3194 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 3195 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 3196 | } |
| 3197 | |
| 3198 | RangeT getODSOperands(unsigned index) { |
| 3199 | auto valueRange = getODSOperandIndexAndLength(index); |
| 3200 | return {std::next(odsOperands.begin(), valueRange.first), |
| 3201 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 3202 | } |
| 3203 | |
| 3204 | ValueT getRef() { |
| 3205 | return (*getODSOperands(index: 0).begin()); |
| 3206 | } |
| 3207 | |
| 3208 | ValueT getTag() { |
| 3209 | return (*getODSOperands(index: 1).begin()); |
| 3210 | } |
| 3211 | |
| 3212 | ValueT getDest() { |
| 3213 | return (*getODSOperands(index: 2).begin()); |
| 3214 | } |
| 3215 | |
| 3216 | ValueT getComm() { |
| 3217 | return (*getODSOperands(index: 3).begin()); |
| 3218 | } |
| 3219 | |
| 3220 | RangeT getOperands() { |
| 3221 | return odsOperands; |
| 3222 | } |
| 3223 | |
| 3224 | private: |
| 3225 | RangeT odsOperands; |
| 3226 | }; |
| 3227 | class SendOpAdaptor : public SendOpGenericAdaptor<::mlir::ValueRange> { |
| 3228 | public: |
| 3229 | using SendOpGenericAdaptor::SendOpGenericAdaptor; |
| 3230 | SendOpAdaptor(SendOp op); |
| 3231 | |
| 3232 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 3233 | }; |
| 3234 | class SendOp : public ::mlir::Op<SendOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 3235 | public: |
| 3236 | using Op::Op; |
| 3237 | using Op::print; |
| 3238 | using Adaptor = SendOpAdaptor; |
| 3239 | template <typename RangeT> |
| 3240 | using GenericAdaptor = SendOpGenericAdaptor<RangeT>; |
| 3241 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 3242 | static constexpr int odsIndex_ref = 0; |
| 3243 | static constexpr int odsIndex_tag = 1; |
| 3244 | static constexpr int odsIndex_dest = 2; |
| 3245 | static constexpr int odsIndex_comm = 3; |
| 3246 | static constexpr int odsIndex_retval = 0; |
| 3247 | using Properties = FoldAdaptor::Properties; |
| 3248 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 3249 | return {}; |
| 3250 | } |
| 3251 | |
| 3252 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 3253 | return ::llvm::StringLiteral("mpi.send" ); |
| 3254 | } |
| 3255 | |
| 3256 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 3257 | return {index, 1}; |
| 3258 | } |
| 3259 | |
| 3260 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 3261 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 3262 | return getOperation()->getOperands().slice(n: start, m: length); |
| 3263 | } |
| 3264 | |
| 3265 | ::mlir::TypedValue<::mlir::MemRefType> getRef() { |
| 3266 | return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(Val: *getODSOperands(index: 0).begin()); |
| 3267 | } |
| 3268 | |
| 3269 | ::mlir::TypedValue<::mlir::IntegerType> getTag() { |
| 3270 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 1).begin()); |
| 3271 | } |
| 3272 | |
| 3273 | ::mlir::TypedValue<::mlir::IntegerType> getDest() { |
| 3274 | return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(Val: *getODSOperands(index: 2).begin()); |
| 3275 | } |
| 3276 | |
| 3277 | ::mlir::TypedValue<::mlir::mpi::CommType> getComm() { |
| 3278 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::CommType>>(Val: *getODSOperands(index: 3).begin()); |
| 3279 | } |
| 3280 | |
| 3281 | ::mlir::OpOperand &getRefMutable() { |
| 3282 | auto range = getODSOperandIndexAndLength(index: 0); |
| 3283 | return getOperation()->getOpOperand(idx: range.first); |
| 3284 | } |
| 3285 | |
| 3286 | ::mlir::OpOperand &getTagMutable() { |
| 3287 | auto range = getODSOperandIndexAndLength(index: 1); |
| 3288 | return getOperation()->getOpOperand(idx: range.first); |
| 3289 | } |
| 3290 | |
| 3291 | ::mlir::OpOperand &getDestMutable() { |
| 3292 | auto range = getODSOperandIndexAndLength(index: 2); |
| 3293 | return getOperation()->getOpOperand(idx: range.first); |
| 3294 | } |
| 3295 | |
| 3296 | ::mlir::OpOperand &getCommMutable() { |
| 3297 | auto range = getODSOperandIndexAndLength(index: 3); |
| 3298 | return getOperation()->getOpOperand(idx: range.first); |
| 3299 | } |
| 3300 | |
| 3301 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 3302 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 3303 | auto valueRange = getODSResultIndexAndLength(index); |
| 3304 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 3305 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 3306 | } |
| 3307 | |
| 3308 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 3309 | auto results = getODSResults(index: 0); |
| 3310 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 3311 | } |
| 3312 | |
| 3313 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 3314 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 3315 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 3316 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 3317 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 3318 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 3319 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 3320 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 3321 | static SendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 3322 | static SendOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 3323 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 3324 | static SendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 3325 | static SendOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm); |
| 3326 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3327 | static SendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3328 | static SendOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3329 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3330 | static SendOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3331 | static SendOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3332 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 3333 | ::llvm::LogicalResult verifyInvariants(); |
| 3334 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
| 3335 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 3336 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 3337 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 3338 | public: |
| 3339 | }; |
| 3340 | |
| 3341 | } // namespace mlir::mpi |
| 3342 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::SendOp) |
| 3343 | |
| 3344 | namespace mlir::mpi { |
| 3345 | |
| 3346 | |
| 3347 | //===----------------------------------------------------------------------===// |
| 3348 | // ::mlir::mpi::Wait declarations |
| 3349 | //===----------------------------------------------------------------------===// |
| 3350 | |
| 3351 | namespace detail { |
| 3352 | |
| 3353 | class WaitGenericAdaptorBase { |
| 3354 | public: |
| 3355 | using Properties = ::mlir::EmptyProperties; |
| 3356 | protected: |
| 3357 | ::mlir::DictionaryAttr odsAttrs; |
| 3358 | ::std::optional<::mlir::OperationName> odsOpName; |
| 3359 | Properties properties; |
| 3360 | ::mlir::RegionRange odsRegions; |
| 3361 | public: |
| 3362 | WaitGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 3363 | odsOpName.emplace(args: "mpi.wait" , args: odsAttrs.getContext()); |
| 3364 | } |
| 3365 | |
| 3366 | WaitGenericAdaptorBase(Wait op); |
| 3367 | |
| 3368 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 3369 | return {index, 1}; |
| 3370 | } |
| 3371 | |
| 3372 | const Properties &getProperties() { |
| 3373 | return properties; |
| 3374 | } |
| 3375 | |
| 3376 | ::mlir::DictionaryAttr getAttributes() { |
| 3377 | return odsAttrs; |
| 3378 | } |
| 3379 | |
| 3380 | }; |
| 3381 | |
| 3382 | } // namespace detail |
| 3383 | template <typename RangeT> |
| 3384 | class WaitGenericAdaptor : public detail::WaitGenericAdaptorBase { |
| 3385 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 3386 | using Base = detail::WaitGenericAdaptorBase; |
| 3387 | static constexpr int odsIndex_req = 0; |
| 3388 | public: |
| 3389 | WaitGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 3390 | |
| 3391 | WaitGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : WaitGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 3392 | |
| 3393 | WaitGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : WaitGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 3394 | |
| 3395 | WaitGenericAdaptor(RangeT values, const WaitGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 3396 | |
| 3397 | template <typename LateInst = Wait, typename = std::enable_if_t<std::is_same_v<LateInst, Wait>>> |
| 3398 | WaitGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 3399 | |
| 3400 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 3401 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 3402 | } |
| 3403 | |
| 3404 | RangeT getODSOperands(unsigned index) { |
| 3405 | auto valueRange = getODSOperandIndexAndLength(index); |
| 3406 | return {std::next(odsOperands.begin(), valueRange.first), |
| 3407 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 3408 | } |
| 3409 | |
| 3410 | ValueT getReq() { |
| 3411 | return (*getODSOperands(index: 0).begin()); |
| 3412 | } |
| 3413 | |
| 3414 | RangeT getOperands() { |
| 3415 | return odsOperands; |
| 3416 | } |
| 3417 | |
| 3418 | private: |
| 3419 | RangeT odsOperands; |
| 3420 | }; |
| 3421 | class WaitAdaptor : public WaitGenericAdaptor<::mlir::ValueRange> { |
| 3422 | public: |
| 3423 | using WaitGenericAdaptor::WaitGenericAdaptor; |
| 3424 | WaitAdaptor(Wait op); |
| 3425 | |
| 3426 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 3427 | }; |
| 3428 | class Wait : public ::mlir::Op<Wait, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { |
| 3429 | public: |
| 3430 | using Op::Op; |
| 3431 | using Op::print; |
| 3432 | using Adaptor = WaitAdaptor; |
| 3433 | template <typename RangeT> |
| 3434 | using GenericAdaptor = WaitGenericAdaptor<RangeT>; |
| 3435 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 3436 | static constexpr int odsIndex_req = 0; |
| 3437 | static constexpr int odsIndex_retval = 0; |
| 3438 | using Properties = FoldAdaptor::Properties; |
| 3439 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 3440 | return {}; |
| 3441 | } |
| 3442 | |
| 3443 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 3444 | return ::llvm::StringLiteral("mpi.wait" ); |
| 3445 | } |
| 3446 | |
| 3447 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 3448 | return {index, 1}; |
| 3449 | } |
| 3450 | |
| 3451 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 3452 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 3453 | return getOperation()->getOperands().slice(n: start, m: length); |
| 3454 | } |
| 3455 | |
| 3456 | ::mlir::TypedValue<::mlir::mpi::RequestType> getReq() { |
| 3457 | return ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RequestType>>(Val: *getODSOperands(index: 0).begin()); |
| 3458 | } |
| 3459 | |
| 3460 | ::mlir::OpOperand &getReqMutable() { |
| 3461 | auto range = getODSOperandIndexAndLength(index: 0); |
| 3462 | return getOperation()->getOpOperand(idx: range.first); |
| 3463 | } |
| 3464 | |
| 3465 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 3466 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 3467 | auto valueRange = getODSResultIndexAndLength(index); |
| 3468 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 3469 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 3470 | } |
| 3471 | |
| 3472 | ::mlir::TypedValue<::mlir::mpi::RetvalType> getRetval() { |
| 3473 | auto results = getODSResults(index: 0); |
| 3474 | return results.empty() ? ::mlir::TypedValue<::mlir::mpi::RetvalType>() : ::llvm::cast<::mlir::TypedValue<::mlir::mpi::RetvalType>>(Val: *results.begin()); |
| 3475 | } |
| 3476 | |
| 3477 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 3478 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 3479 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 3480 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 3481 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 3482 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 3483 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 3484 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value req); |
| 3485 | static Wait create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value req); |
| 3486 | static Wait create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value req); |
| 3487 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value req); |
| 3488 | static Wait create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value req); |
| 3489 | static Wait create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value req); |
| 3490 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3491 | static Wait create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3492 | static Wait create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 3493 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3494 | static Wait create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3495 | static Wait create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 3496 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 3497 | ::llvm::LogicalResult verifyInvariants(); |
| 3498 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 3499 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 3500 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 3501 | public: |
| 3502 | }; |
| 3503 | |
| 3504 | } // namespace mlir::mpi |
| 3505 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mpi::Wait) |
| 3506 | |
| 3507 | |
| 3508 | #endif // GET_OP_CLASSES |
| 3509 | |
| 3510 | |