Files
gps/tools/local/circt/include/mlir/Dialect/MPI/IR/MPIOps.cpp.inc
T
2026-07-12 11:01:51 +03:00

5478 lines
246 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Op Definitions *|
|* *|
|* Automatically generated file, do not edit! *|
|* From: MPIOps.td *|
|* *|
\*===----------------------------------------------------------------------===*/
#ifdef GET_OP_LIST
#undef GET_OP_LIST
::mlir::mpi::AllGatherOp,
::mlir::mpi::AllReduceOp,
::mlir::mpi::Barrier,
::mlir::mpi::CommRankOp,
::mlir::mpi::CommSizeOp,
::mlir::mpi::CommSplitOp,
::mlir::mpi::CommWorldOp,
::mlir::mpi::ErrorClassOp,
::mlir::mpi::FinalizeOp,
::mlir::mpi::IRecvOp,
::mlir::mpi::ISendOp,
::mlir::mpi::InitOp,
::mlir::mpi::RecvOp,
::mlir::mpi::ReduceScatterBlockOp,
::mlir::mpi::RetvalCheckOp,
::mlir::mpi::SendOp,
::mlir::mpi::Wait
#endif // GET_OP_LIST
#ifdef GET_OP_CLASSES
#undef GET_OP_CLASSES
//===----------------------------------------------------------------------===//
// Local Utility Method Definitions
//===----------------------------------------------------------------------===//
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps1(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return !((::llvm::isa<::mlir::TokenType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be memref of any non-token type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps2(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::mpi::CommType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be MPI communicator handler, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps3(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::mpi::RetvalType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be MPI function call return value (!mpi.retval), but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps4(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps5(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::mpi::RequestType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be MPI asynchronous request handler, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps6(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return !((::llvm::isa<::mlir::TokenType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() >= 1))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be non-0-ranked.memref of any non-token type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_MPIOps7(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(1)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 1-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_MPIOps1(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::mpi::MPI_ReductionOpEnumAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: MPI operation class";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_MPIOps1(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_MPIOps1(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_MPIOps2(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::mpi::MPI_ErrorClassEnumAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: MPI error class name";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_MPIOps2(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_MPIOps2(attr, attrName, [op]() {
return op->emitOpError();
});
}
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::AllGatherOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
AllGatherOpGenericAdaptorBase::AllGatherOpGenericAdaptorBase(AllGatherOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
AllGatherOpAdaptor::AllGatherOpAdaptor(AllGatherOp op) : AllGatherOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AllGatherOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> AllGatherOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult AllGatherOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute AllGatherOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AllGatherOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> AllGatherOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void AllGatherOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void AllGatherOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult AllGatherOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void AllGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
}
AllGatherOp AllGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<AllGatherOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllGatherOp AllGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(comm)>(comm));
}
void AllGatherOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.addTypes(resultTypes);
}
AllGatherOp AllGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<AllGatherOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllGatherOp AllGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(comm)>(comm));
}
void AllGatherOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
AllGatherOp AllGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<AllGatherOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllGatherOp AllGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void AllGatherOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
AllGatherOp AllGatherOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<AllGatherOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllGatherOp AllGatherOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult AllGatherOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AllGatherOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult AllGatherOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand sendbufRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sendbufOperands(&sendbufRawOperand, 1); ::llvm::SMLoc sendbufOperandsLoc;
(void)sendbufOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand recvbufRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> recvbufOperands(&recvbufRawOperand, 1); ::llvm::SMLoc recvbufOperandsLoc;
(void)recvbufOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type sendbufRawType{};
::llvm::ArrayRef<::mlir::Type> sendbufTypes(&sendbufRawType, 1);
::mlir::Type recvbufRawType{};
::llvm::ArrayRef<::mlir::Type> recvbufTypes(&recvbufRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
sendbufOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sendbufRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
recvbufOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(recvbufRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sendbufRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
recvbufRawType = type;
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(retvalTypes);
if (parser.resolveOperands(sendbufOperands, sendbufTypes, sendbufOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(recvbufOperands, recvbufTypes, recvbufOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void AllGatherOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getSendbuf();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getRecvbuf();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getSendbuf().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getRecvbuf().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void AllGatherOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
{
auto valueRange = getODSOperandIndexAndLength(1);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::AllGatherOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::AllReduceOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
AllReduceOpGenericAdaptorBase::AllReduceOpGenericAdaptorBase(AllReduceOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::mpi::MPI_ReductionOpEnum AllReduceOpGenericAdaptorBase::getOp() {
auto attr = getOpAttr();
return attr.getValue();
}
} // namespace detail
AllReduceOpAdaptor::AllReduceOpAdaptor(AllReduceOp op) : AllReduceOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AllReduceOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_op = getProperties().op; (void)tblgen_op;
if (!tblgen_op) return emitError(loc, "'mpi.allreduce' op requires attribute 'op'");
if (tblgen_op && !((::llvm::isa<::mlir::mpi::MPI_ReductionOpEnumAttr>(tblgen_op))))
return emitError(loc, "'mpi.allreduce' op attribute 'op' failed to satisfy constraint: MPI operation class");
return ::mlir::success();
}
std::pair<unsigned, unsigned> AllReduceOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult AllReduceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.op;
auto attr = dict.get("op");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `op` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute AllReduceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.op;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("op",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AllReduceOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.op.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> AllReduceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "op")
return prop.op;
return std::nullopt;
}
void AllReduceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "op") {
prop.op = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op)>>(value);
return;
}
}
void AllReduceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.op) attrs.append("op", prop.op);
}
::llvm::LogicalResult AllReduceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getOpAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MPIOps1(attr, "op", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AllReduceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.op)))
return ::mlir::failure();
return ::mlir::success();
}
void AllReduceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.op);
}
::mlir::mpi::MPI_ReductionOpEnum AllReduceOp::getOp() {
auto attr = getOpAttr();
return attr.getValue();
}
void AllReduceOp::setOp(::mlir::mpi::MPI_ReductionOpEnum attrValue) {
getProperties().op = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void AllReduceOp::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) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = op;
if (retval)
odsState.addTypes(retval);
}
AllReduceOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<AllReduceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllReduceOp AllReduceOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = op;
odsState.addTypes(resultTypes);
}
AllReduceOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<AllReduceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllReduceOp AllReduceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void AllReduceOp::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) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(odsBuilder.getContext(), op);
if (retval)
odsState.addTypes(retval);
}
AllReduceOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<AllReduceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllReduceOp AllReduceOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(odsBuilder.getContext(), op);
odsState.addTypes(resultTypes);
}
AllReduceOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<AllReduceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllReduceOp AllReduceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void AllReduceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<AllReduceOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
AllReduceOp AllReduceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<AllReduceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllReduceOp AllReduceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void AllReduceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
AllReduceOp AllReduceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<AllReduceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AllReduceOp AllReduceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult AllReduceOp::verifyInvariantsImpl() {
auto tblgen_op = getProperties().op; (void)tblgen_op;
if (!tblgen_op) return emitOpError("requires attribute 'op'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_MPIOps1(*this, tblgen_op, "op")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AllReduceOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult AllReduceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand sendbufRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sendbufOperands(&sendbufRawOperand, 1); ::llvm::SMLoc sendbufOperandsLoc;
(void)sendbufOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand recvbufRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> recvbufOperands(&recvbufRawOperand, 1); ::llvm::SMLoc recvbufOperandsLoc;
(void)recvbufOperandsLoc;
::mlir::mpi::MPI_ReductionOpEnumAttr opAttr;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type sendbufRawType{};
::llvm::ArrayRef<::mlir::Type> sendbufTypes(&sendbufRawType, 1);
::mlir::Type recvbufRawType{};
::llvm::ArrayRef<::mlir::Type> recvbufTypes(&recvbufRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
sendbufOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sendbufRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
recvbufOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(recvbufRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
{
::llvm::StringRef attrStr;
::mlir::NamedAttrList attrStorage;
auto loc = parser.getCurrentLocation();
if (parser.parseOptionalKeyword(&attrStr, {"MPI_OP_NULL","MPI_MAX","MPI_MIN","MPI_SUM","MPI_PROD","MPI_LAND","MPI_BAND","MPI_LOR","MPI_BOR","MPI_LXOR","MPI_BXOR","MPI_MINLOC","MPI_MAXLOC","MPI_REPLACE"})) {
::mlir::StringAttr attrVal;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalAttribute(attrVal,
parser.getBuilder().getNoneType(),
"op", attrStorage);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
attrStr = attrVal.getValue();
} else {
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'op' [MPI_OP_NULL, MPI_MAX, MPI_MIN, MPI_SUM, MPI_PROD, MPI_LAND, MPI_BAND, MPI_LOR, MPI_BOR, MPI_LXOR, MPI_BXOR, MPI_MINLOC, MPI_MAXLOC, MPI_REPLACE]");
}
}
if (!attrStr.empty()) {
auto attrOptional = ::mlir::mpi::symbolizeMPI_ReductionOpEnum(attrStr);
if (!attrOptional)
return parser.emitError(loc, "invalid ")
<< "op attribute specification: \"" << attrStr << '"';;
opAttr = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(parser.getBuilder().getContext(), *attrOptional);
result.getOrAddProperties<AllReduceOp::Properties>().op = opAttr;
}
}
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sendbufRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
recvbufRawType = type;
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(retvalTypes);
if (parser.resolveOperands(sendbufOperands, sendbufTypes, sendbufOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(recvbufOperands, recvbufTypes, recvbufOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void AllReduceOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getSendbuf();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getRecvbuf();
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto caseValue = getOp();
auto caseValueStr = stringifyMPI_ReductionOpEnum(caseValue);
_odsPrinter << caseValueStr;
}
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("op");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getSendbuf().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getRecvbuf().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void AllReduceOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
{
auto valueRange = getODSOperandIndexAndLength(1);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::AllReduceOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::detail::AllReduceOpGenericAdaptorBase::Properties)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::Barrier definitions
//===----------------------------------------------------------------------===//
namespace detail {
BarrierGenericAdaptorBase::BarrierGenericAdaptorBase(Barrier op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BarrierAdaptor::BarrierAdaptor(Barrier op) : BarrierGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BarrierAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> Barrier::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult Barrier::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute Barrier::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code Barrier::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> Barrier::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void Barrier::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void Barrier::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult Barrier::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void Barrier::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value comm) {
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
}
Barrier Barrier::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<Barrier>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Barrier Barrier::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(comm)>(comm));
}
void Barrier::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
odsState.addOperands(comm);
odsState.addTypes(resultTypes);
}
Barrier Barrier::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<Barrier>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Barrier Barrier::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm));
}
void Barrier::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
Barrier Barrier::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<Barrier>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Barrier Barrier::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void Barrier::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
Barrier Barrier::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<Barrier>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Barrier Barrier::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult Barrier::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult Barrier::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult Barrier::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(retvalTypes);
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void Barrier::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void Barrier::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::Barrier)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::CommRankOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CommRankOpGenericAdaptorBase::CommRankOpGenericAdaptorBase(CommRankOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
CommRankOpAdaptor::CommRankOpAdaptor(CommRankOp op) : CommRankOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CommRankOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void CommRankOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "retval");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "rank");
}
std::pair<unsigned, unsigned> CommRankOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true, false};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult CommRankOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute CommRankOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CommRankOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> CommRankOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void CommRankOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void CommRankOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult CommRankOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void CommRankOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type rank, ::mlir::Value comm) {
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
odsState.addTypes(rank);
}
CommRankOp CommRankOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type rank, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(rank)>(rank), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<CommRankOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommRankOp CommRankOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type rank, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(rank)>(rank), std::forward<decltype(comm)>(comm));
}
void CommRankOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
odsState.addOperands(comm);
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CommRankOp CommRankOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<CommRankOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommRankOp CommRankOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm));
}
void CommRankOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommRankOp CommRankOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CommRankOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommRankOp CommRankOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CommRankOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommRankOp CommRankOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CommRankOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommRankOp CommRankOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CommRankOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CommRankOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CommRankOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
if (parser.parseLParen())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allResultTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(allResultTypes);
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CommRankOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getResultTypes();
}
void CommRankOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::CommRankOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::CommSizeOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CommSizeOpGenericAdaptorBase::CommSizeOpGenericAdaptorBase(CommSizeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
CommSizeOpAdaptor::CommSizeOpAdaptor(CommSizeOp op) : CommSizeOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CommSizeOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void CommSizeOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "retval");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "size");
}
std::pair<unsigned, unsigned> CommSizeOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true, false};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult CommSizeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute CommSizeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CommSizeOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> CommSizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void CommSizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void CommSizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult CommSizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void CommSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type size, ::mlir::Value comm) {
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
odsState.addTypes(size);
}
CommSizeOp CommSizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type size, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(size)>(size), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<CommSizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSizeOp CommSizeOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type size, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(size)>(size), std::forward<decltype(comm)>(comm));
}
void CommSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
odsState.addOperands(comm);
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CommSizeOp CommSizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<CommSizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSizeOp CommSizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm));
}
void CommSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommSizeOp CommSizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CommSizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSizeOp CommSizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CommSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommSizeOp CommSizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CommSizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSizeOp CommSizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CommSizeOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CommSizeOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CommSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
if (parser.parseLParen())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allResultTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(allResultTypes);
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CommSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getResultTypes();
}
void CommSizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::CommSizeOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::CommSplitOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CommSplitOpGenericAdaptorBase::CommSplitOpGenericAdaptorBase(CommSplitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
CommSplitOpAdaptor::CommSplitOpAdaptor(CommSplitOp op) : CommSplitOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CommSplitOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void CommSplitOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "retval");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "newcomm");
}
std::pair<unsigned, unsigned> CommSplitOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true, false};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult CommSplitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute CommSplitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CommSplitOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> CommSplitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void CommSplitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void CommSplitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult CommSplitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void CommSplitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Type newcomm, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key) {
odsState.addOperands(comm);
odsState.addOperands(color);
odsState.addOperands(key);
if (retval)
odsState.addTypes(retval);
odsState.addTypes(newcomm);
}
CommSplitOp CommSplitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Type newcomm, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(newcomm)>(newcomm), std::forward<decltype(comm)>(comm), std::forward<decltype(color)>(color), std::forward<decltype(key)>(key));
auto __res__ = ::llvm::dyn_cast<CommSplitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSplitOp CommSplitOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type newcomm, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(newcomm)>(newcomm), std::forward<decltype(comm)>(comm), std::forward<decltype(color)>(color), std::forward<decltype(key)>(key));
}
void CommSplitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key) {
odsState.addOperands(comm);
odsState.addOperands(color);
odsState.addOperands(key);
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CommSplitOp CommSplitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm), std::forward<decltype(color)>(color), std::forward<decltype(key)>(key));
auto __res__ = ::llvm::dyn_cast<CommSplitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSplitOp CommSplitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value comm, ::mlir::Value color, ::mlir::Value key) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(comm)>(comm), std::forward<decltype(color)>(color), std::forward<decltype(key)>(key));
}
void CommSplitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommSplitOp CommSplitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CommSplitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSplitOp CommSplitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CommSplitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommSplitOp CommSplitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CommSplitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommSplitOp CommSplitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CommSplitOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CommSplitOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CommSplitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand colorRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colorOperands(&colorRawOperand, 1); ::llvm::SMLoc colorOperandsLoc;
(void)colorOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand keyRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> keyOperands(&keyRawOperand, 1); ::llvm::SMLoc keyOperandsLoc;
(void)keyOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
if (parser.parseLParen())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
colorOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(colorRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
keyOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(keyRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allResultTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32);
result.addTypes(allResultTypes);
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(colorOperands, odsBuildableType1, colorOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(keyOperands, odsBuildableType1, keyOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CommSplitOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getComm();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getColor();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getKey();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getResultTypes();
}
void CommSplitOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::CommSplitOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::CommWorldOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CommWorldOpGenericAdaptorBase::CommWorldOpGenericAdaptorBase(CommWorldOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
CommWorldOpAdaptor::CommWorldOpAdaptor(CommWorldOp op) : CommWorldOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CommWorldOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult CommWorldOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute CommWorldOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CommWorldOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> CommWorldOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void CommWorldOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void CommWorldOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult CommWorldOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void CommWorldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type comm) {
odsState.addTypes(comm);
}
CommWorldOp CommWorldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<CommWorldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommWorldOp CommWorldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type comm) {
return create(builder, builder.getLoc(), std::forward<decltype(comm)>(comm));
}
void CommWorldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CommWorldOp CommWorldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
auto __res__ = ::llvm::dyn_cast<CommWorldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommWorldOp CommWorldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}
void CommWorldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommWorldOp CommWorldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CommWorldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommWorldOp CommWorldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CommWorldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CommWorldOp CommWorldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CommWorldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CommWorldOp CommWorldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CommWorldOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CommWorldOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CommWorldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allResultTypes))
return ::mlir::failure();
result.addTypes(allResultTypes);
return ::mlir::success();
}
void CommWorldOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getResultTypes();
}
void CommWorldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::CommWorldOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::ErrorClassOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ErrorClassOpGenericAdaptorBase::ErrorClassOpGenericAdaptorBase(ErrorClassOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
ErrorClassOpAdaptor::ErrorClassOpAdaptor(ErrorClassOp op) : ErrorClassOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ErrorClassOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult ErrorClassOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute ErrorClassOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ErrorClassOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> ErrorClassOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void ErrorClassOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void ErrorClassOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult ErrorClassOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void ErrorClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type errclass, ::mlir::Value val) {
odsState.addOperands(val);
odsState.addTypes(errclass);
}
ErrorClassOp ErrorClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type errclass, ::mlir::Value val) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(errclass)>(errclass), std::forward<decltype(val)>(val));
auto __res__ = ::llvm::dyn_cast<ErrorClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ErrorClassOp ErrorClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type errclass, ::mlir::Value val) {
return create(builder, builder.getLoc(), std::forward<decltype(errclass)>(errclass), std::forward<decltype(val)>(val));
}
void ErrorClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
odsState.addOperands(val);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ErrorClassOp ErrorClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val));
auto __res__ = ::llvm::dyn_cast<ErrorClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ErrorClassOp ErrorClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val));
}
void ErrorClassOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ErrorClassOp ErrorClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ErrorClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ErrorClassOp ErrorClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ErrorClassOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ErrorClassOp ErrorClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ErrorClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ErrorClassOp ErrorClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ErrorClassOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ErrorClassOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ErrorClassOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
(void)valOperandsLoc;
::mlir::Type valRawType{};
::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
valOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(valRawOperand))
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::mpi::RetvalType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
valRawType = type;
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::RetvalType>();
result.addTypes(odsBuildableType0);
if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void ErrorClassOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getVal();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getVal().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::mpi::RetvalType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
}
void ErrorClassOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::ErrorClassOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::FinalizeOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
FinalizeOpGenericAdaptorBase::FinalizeOpGenericAdaptorBase(FinalizeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
FinalizeOpAdaptor::FinalizeOpAdaptor(FinalizeOp op) : FinalizeOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FinalizeOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> FinalizeOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult FinalizeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute FinalizeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FinalizeOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> FinalizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void FinalizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void FinalizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult FinalizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void FinalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval) {
if (retval)
odsState.addTypes(retval);
}
FinalizeOp FinalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval));
auto __res__ = ::llvm::dyn_cast<FinalizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FinalizeOp FinalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval));
}
void FinalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
odsState.addTypes(resultTypes);
}
FinalizeOp FinalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
auto __res__ = ::llvm::dyn_cast<FinalizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FinalizeOp FinalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}
void FinalizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
FinalizeOp FinalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<FinalizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FinalizeOp FinalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void FinalizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
FinalizeOp FinalizeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<FinalizeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FinalizeOp FinalizeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult FinalizeOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult FinalizeOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult FinalizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (::mlir::succeeded(parser.parseOptionalColon())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
result.addTypes(retvalTypes);
return ::mlir::success();
}
void FinalizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
if (getRetval()) {
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void FinalizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::FinalizeOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::IRecvOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
IRecvOpGenericAdaptorBase::IRecvOpGenericAdaptorBase(IRecvOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
IRecvOpAdaptor::IRecvOpAdaptor(IRecvOp op) : IRecvOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IRecvOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void IRecvOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "retval");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "req");
}
std::pair<unsigned, unsigned> IRecvOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true, false};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult IRecvOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute IRecvOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code IRecvOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> IRecvOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void IRecvOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void IRecvOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult IRecvOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void IRecvOp::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) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(source);
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
odsState.addTypes(req);
}
IRecvOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(req)>(req), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<IRecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IRecvOp IRecvOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(req)>(req), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
}
void IRecvOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(source);
odsState.addOperands(comm);
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
IRecvOp IRecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<IRecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IRecvOp IRecvOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
}
void IRecvOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
IRecvOp IRecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<IRecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IRecvOp IRecvOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void IRecvOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
IRecvOp IRecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<IRecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IRecvOp IRecvOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult IRecvOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup3 = getODSOperands(3);
for (auto v : valueGroup3) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps5(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult IRecvOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult IRecvOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand refRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> refOperands(&refRawOperand, 1); ::llvm::SMLoc refOperandsLoc;
(void)refOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand tagRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tagOperands(&tagRawOperand, 1); ::llvm::SMLoc tagOperandsLoc;
(void)tagOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
(void)sourceOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type refRawType{};
::llvm::ArrayRef<::mlir::Type> refTypes(&refRawType, 1);
::mlir::Type tagRawType{};
::llvm::ArrayRef<::mlir::Type> tagTypes(&tagRawType, 1);
::mlir::Type sourceRawType{};
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
if (parser.parseLParen())
return ::mlir::failure();
refOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(refRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
tagOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(tagRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
sourceOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sourceRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
refRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
tagRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sourceRawType = type;
}
if (parser.parseArrow())
return ::mlir::failure();
if (parser.parseTypeList(allResultTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(allResultTypes);
if (parser.resolveOperands(refOperands, refTypes, refOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(tagOperands, tagTypes, tagOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void IRecvOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getRef();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getTag();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getSource();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getRef().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getTag().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getSource().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getResultTypes();
}
void IRecvOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::IRecvOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::ISendOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ISendOpGenericAdaptorBase::ISendOpGenericAdaptorBase(ISendOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
ISendOpAdaptor::ISendOpAdaptor(ISendOp op) : ISendOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ISendOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ISendOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "retval");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "req");
}
std::pair<unsigned, unsigned> ISendOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true, false};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult ISendOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute ISendOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ISendOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> ISendOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void ISendOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void ISendOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult ISendOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void ISendOp::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) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(dest);
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
odsState.addTypes(req);
}
ISendOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(req)>(req), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<ISendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ISendOp ISendOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Type req, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(req)>(req), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
}
void ISendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(dest);
odsState.addOperands(comm);
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ISendOp ISendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<ISendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ISendOp ISendOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
}
void ISendOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ISendOp ISendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ISendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ISendOp ISendOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ISendOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ISendOp ISendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ISendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ISendOp ISendOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ISendOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup3 = getODSOperands(3);
for (auto v : valueGroup3) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps5(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ISendOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ISendOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand refRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> refOperands(&refRawOperand, 1); ::llvm::SMLoc refOperandsLoc;
(void)refOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand tagRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tagOperands(&tagRawOperand, 1); ::llvm::SMLoc tagOperandsLoc;
(void)tagOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand destRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destOperands(&destRawOperand, 1); ::llvm::SMLoc destOperandsLoc;
(void)destOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type refRawType{};
::llvm::ArrayRef<::mlir::Type> refTypes(&refRawType, 1);
::mlir::Type tagRawType{};
::llvm::ArrayRef<::mlir::Type> tagTypes(&tagRawType, 1);
::mlir::Type destRawType{};
::llvm::ArrayRef<::mlir::Type> destTypes(&destRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
if (parser.parseLParen())
return ::mlir::failure();
refOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(refRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
tagOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(tagRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
destOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(destRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
refRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
tagRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
destRawType = type;
}
if (parser.parseArrow())
return ::mlir::failure();
if (parser.parseTypeList(allResultTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(allResultTypes);
if (parser.resolveOperands(refOperands, refTypes, refOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(tagOperands, tagTypes, tagOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(destOperands, destTypes, destOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void ISendOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getRef();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getTag();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getDest();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getRef().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getTag().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getDest().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getResultTypes();
}
void ISendOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::ISendOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::InitOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
InitOpGenericAdaptorBase::InitOpGenericAdaptorBase(InitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
InitOpAdaptor::InitOpAdaptor(InitOp op) : InitOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult InitOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> InitOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult InitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute InitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code InitOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> InitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void InitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void InitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult InitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void InitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval) {
if (retval)
odsState.addTypes(retval);
}
InitOp InitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval));
auto __res__ = ::llvm::dyn_cast<InitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
InitOp InitOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval));
}
void InitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
odsState.addTypes(resultTypes);
}
InitOp InitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
auto __res__ = ::llvm::dyn_cast<InitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
InitOp InitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}
void InitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
InitOp InitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<InitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
InitOp InitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void InitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
InitOp InitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<InitOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
InitOp InitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult InitOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult InitOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult InitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (::mlir::succeeded(parser.parseOptionalColon())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
result.addTypes(retvalTypes);
return ::mlir::success();
}
void InitOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
if (getRetval()) {
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void InitOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::InitOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::RecvOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
RecvOpGenericAdaptorBase::RecvOpGenericAdaptorBase(RecvOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
RecvOpAdaptor::RecvOpAdaptor(RecvOp op) : RecvOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult RecvOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> RecvOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult RecvOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute RecvOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code RecvOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> RecvOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void RecvOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void RecvOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult RecvOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void RecvOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(source);
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
}
RecvOp RecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<RecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RecvOp RecvOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
}
void RecvOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(source);
odsState.addOperands(comm);
odsState.addTypes(resultTypes);
}
RecvOp RecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<RecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RecvOp RecvOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value source, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(source)>(source), std::forward<decltype(comm)>(comm));
}
void RecvOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
RecvOp RecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<RecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RecvOp RecvOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void RecvOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
RecvOp RecvOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<RecvOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RecvOp RecvOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult RecvOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup3 = getODSOperands(3);
for (auto v : valueGroup3) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult RecvOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult RecvOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand refRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> refOperands(&refRawOperand, 1); ::llvm::SMLoc refOperandsLoc;
(void)refOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand tagRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tagOperands(&tagRawOperand, 1); ::llvm::SMLoc tagOperandsLoc;
(void)tagOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
(void)sourceOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type refRawType{};
::llvm::ArrayRef<::mlir::Type> refTypes(&refRawType, 1);
::mlir::Type tagRawType{};
::llvm::ArrayRef<::mlir::Type> tagTypes(&tagRawType, 1);
::mlir::Type sourceRawType{};
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
refOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(refRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
tagOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(tagRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
sourceOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sourceRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
refRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
tagRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sourceRawType = type;
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(retvalTypes);
if (parser.resolveOperands(refOperands, refTypes, refOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(tagOperands, tagTypes, tagOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void RecvOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getRef();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getTag();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getSource();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getRef().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getTag().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getSource().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void RecvOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::RecvOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::ReduceScatterBlockOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ReduceScatterBlockOpGenericAdaptorBase::ReduceScatterBlockOpGenericAdaptorBase(ReduceScatterBlockOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::mpi::MPI_ReductionOpEnum ReduceScatterBlockOpGenericAdaptorBase::getOp() {
auto attr = getOpAttr();
return attr.getValue();
}
} // namespace detail
ReduceScatterBlockOpAdaptor::ReduceScatterBlockOpAdaptor(ReduceScatterBlockOp op) : ReduceScatterBlockOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ReduceScatterBlockOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_op = getProperties().op; (void)tblgen_op;
if (!tblgen_op) return emitError(loc, "'mpi.reduce_scatter_block' op requires attribute 'op'");
if (tblgen_op && !((::llvm::isa<::mlir::mpi::MPI_ReductionOpEnumAttr>(tblgen_op))))
return emitError(loc, "'mpi.reduce_scatter_block' op attribute 'op' failed to satisfy constraint: MPI operation class");
return ::mlir::success();
}
std::pair<unsigned, unsigned> ReduceScatterBlockOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult ReduceScatterBlockOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.op;
auto attr = dict.get("op");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `op` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ReduceScatterBlockOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.op;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("op",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ReduceScatterBlockOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.op.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ReduceScatterBlockOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "op")
return prop.op;
return std::nullopt;
}
void ReduceScatterBlockOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "op") {
prop.op = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.op)>>(value);
return;
}
}
void ReduceScatterBlockOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.op) attrs.append("op", prop.op);
}
::llvm::LogicalResult ReduceScatterBlockOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getOpAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MPIOps1(attr, "op", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ReduceScatterBlockOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.op)))
return ::mlir::failure();
return ::mlir::success();
}
void ReduceScatterBlockOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.op);
}
::mlir::mpi::MPI_ReductionOpEnum ReduceScatterBlockOp::getOp() {
auto attr = getOpAttr();
return attr.getValue();
}
void ReduceScatterBlockOp::setOp(::mlir::mpi::MPI_ReductionOpEnum attrValue) {
getProperties().op = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void ReduceScatterBlockOp::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) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = op;
if (retval)
odsState.addTypes(retval);
}
ReduceScatterBlockOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<ReduceScatterBlockOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void ReduceScatterBlockOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = op;
odsState.addTypes(resultTypes);
}
ReduceScatterBlockOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<ReduceScatterBlockOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnumAttr op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void ReduceScatterBlockOp::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) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(odsBuilder.getContext(), op);
if (retval)
odsState.addTypes(retval);
}
ReduceScatterBlockOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<ReduceScatterBlockOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void ReduceScatterBlockOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm) {
odsState.addOperands(sendbuf);
odsState.addOperands(recvbuf);
odsState.addOperands(comm);
odsState.getOrAddProperties<Properties>().op = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(odsBuilder.getContext(), op);
odsState.addTypes(resultTypes);
}
ReduceScatterBlockOp 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) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<ReduceScatterBlockOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sendbuf, ::mlir::Value recvbuf, ::mlir::mpi::MPI_ReductionOpEnum op, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sendbuf)>(sendbuf), std::forward<decltype(recvbuf)>(recvbuf), std::forward<decltype(op)>(op), std::forward<decltype(comm)>(comm));
}
void ReduceScatterBlockOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<ReduceScatterBlockOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ReduceScatterBlockOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ReduceScatterBlockOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ReduceScatterBlockOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReduceScatterBlockOp ReduceScatterBlockOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ReduceScatterBlockOp::verifyInvariantsImpl() {
auto tblgen_op = getProperties().op; (void)tblgen_op;
if (!tblgen_op) return emitOpError("requires attribute 'op'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_MPIOps1(*this, tblgen_op, "op")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ReduceScatterBlockOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult ReduceScatterBlockOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand sendbufRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sendbufOperands(&sendbufRawOperand, 1); ::llvm::SMLoc sendbufOperandsLoc;
(void)sendbufOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand recvbufRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> recvbufOperands(&recvbufRawOperand, 1); ::llvm::SMLoc recvbufOperandsLoc;
(void)recvbufOperandsLoc;
::mlir::mpi::MPI_ReductionOpEnumAttr opAttr;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type sendbufRawType{};
::llvm::ArrayRef<::mlir::Type> sendbufTypes(&sendbufRawType, 1);
::mlir::Type recvbufRawType{};
::llvm::ArrayRef<::mlir::Type> recvbufTypes(&recvbufRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
sendbufOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sendbufRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
recvbufOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(recvbufRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
{
::llvm::StringRef attrStr;
::mlir::NamedAttrList attrStorage;
auto loc = parser.getCurrentLocation();
if (parser.parseOptionalKeyword(&attrStr, {"MPI_OP_NULL","MPI_MAX","MPI_MIN","MPI_SUM","MPI_PROD","MPI_LAND","MPI_BAND","MPI_LOR","MPI_BOR","MPI_LXOR","MPI_BXOR","MPI_MINLOC","MPI_MAXLOC","MPI_REPLACE"})) {
::mlir::StringAttr attrVal;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalAttribute(attrVal,
parser.getBuilder().getNoneType(),
"op", attrStorage);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
attrStr = attrVal.getValue();
} else {
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'op' [MPI_OP_NULL, MPI_MAX, MPI_MIN, MPI_SUM, MPI_PROD, MPI_LAND, MPI_BAND, MPI_LOR, MPI_BOR, MPI_LXOR, MPI_BXOR, MPI_MINLOC, MPI_MAXLOC, MPI_REPLACE]");
}
}
if (!attrStr.empty()) {
auto attrOptional = ::mlir::mpi::symbolizeMPI_ReductionOpEnum(attrStr);
if (!attrOptional)
return parser.emitError(loc, "invalid ")
<< "op attribute specification: \"" << attrStr << '"';;
opAttr = ::mlir::mpi::MPI_ReductionOpEnumAttr::get(parser.getBuilder().getContext(), *attrOptional);
result.getOrAddProperties<ReduceScatterBlockOp::Properties>().op = opAttr;
}
}
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sendbufRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
recvbufRawType = type;
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(retvalTypes);
if (parser.resolveOperands(sendbufOperands, sendbufTypes, sendbufOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(recvbufOperands, recvbufTypes, recvbufOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void ReduceScatterBlockOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getSendbuf();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getRecvbuf();
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto caseValue = getOp();
auto caseValueStr = stringifyMPI_ReductionOpEnum(caseValue);
_odsPrinter << caseValueStr;
}
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("op");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getSendbuf().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getRecvbuf().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void ReduceScatterBlockOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
{
auto valueRange = getODSOperandIndexAndLength(1);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::ReduceScatterBlockOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::detail::ReduceScatterBlockOpGenericAdaptorBase::Properties)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::RetvalCheckOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
RetvalCheckOpGenericAdaptorBase::RetvalCheckOpGenericAdaptorBase(RetvalCheckOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::mpi::MPI_ErrorClassEnum RetvalCheckOpGenericAdaptorBase::getErrclass() {
auto attr = getErrclassAttr();
return attr.getValue();
}
} // namespace detail
RetvalCheckOpAdaptor::RetvalCheckOpAdaptor(RetvalCheckOp op) : RetvalCheckOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult RetvalCheckOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_errclass = getProperties().errclass; (void)tblgen_errclass;
if (!tblgen_errclass) return emitError(loc, "'mpi.retval_check' op requires attribute 'errclass'");
if (tblgen_errclass && !((::llvm::isa<::mlir::mpi::MPI_ErrorClassEnumAttr>(tblgen_errclass))))
return emitError(loc, "'mpi.retval_check' op attribute 'errclass' failed to satisfy constraint: MPI error class name");
return ::mlir::success();
}
::llvm::LogicalResult RetvalCheckOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.errclass;
auto attr = dict.get("errclass");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `errclass` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute RetvalCheckOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.errclass;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("errclass",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code RetvalCheckOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.errclass.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> RetvalCheckOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "errclass")
return prop.errclass;
return std::nullopt;
}
void RetvalCheckOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "errclass") {
prop.errclass = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.errclass)>>(value);
return;
}
}
void RetvalCheckOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.errclass) attrs.append("errclass", prop.errclass);
}
::llvm::LogicalResult RetvalCheckOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getErrclassAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MPIOps2(attr, "errclass", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult RetvalCheckOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.errclass)))
return ::mlir::failure();
return ::mlir::success();
}
void RetvalCheckOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.errclass);
}
::mlir::mpi::MPI_ErrorClassEnum RetvalCheckOp::getErrclass() {
auto attr = getErrclassAttr();
return attr.getValue();
}
void RetvalCheckOp::setErrclass(::mlir::mpi::MPI_ErrorClassEnum attrValue) {
getProperties().errclass = ::mlir::mpi::MPI_ErrorClassEnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void RetvalCheckOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass) {
odsState.addOperands(val);
odsState.getOrAddProperties<Properties>().errclass = errclass;
odsState.addTypes(res);
}
RetvalCheckOp RetvalCheckOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
auto __res__ = ::llvm::dyn_cast<RetvalCheckOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RetvalCheckOp RetvalCheckOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass) {
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
}
void RetvalCheckOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass) {
odsState.addOperands(val);
odsState.getOrAddProperties<Properties>().errclass = errclass;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
RetvalCheckOp RetvalCheckOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
auto __res__ = ::llvm::dyn_cast<RetvalCheckOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RetvalCheckOp RetvalCheckOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnumAttr errclass) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
}
void RetvalCheckOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass) {
odsState.addOperands(val);
odsState.getOrAddProperties<Properties>().errclass = ::mlir::mpi::MPI_ErrorClassEnumAttr::get(odsBuilder.getContext(), errclass);
odsState.addTypes(res);
}
RetvalCheckOp RetvalCheckOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
auto __res__ = ::llvm::dyn_cast<RetvalCheckOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RetvalCheckOp RetvalCheckOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass) {
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
}
void RetvalCheckOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass) {
odsState.addOperands(val);
odsState.getOrAddProperties<Properties>().errclass = ::mlir::mpi::MPI_ErrorClassEnumAttr::get(odsBuilder.getContext(), errclass);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
RetvalCheckOp RetvalCheckOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
auto __res__ = ::llvm::dyn_cast<RetvalCheckOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RetvalCheckOp RetvalCheckOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::mpi::MPI_ErrorClassEnum errclass) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(val)>(val), std::forward<decltype(errclass)>(errclass));
}
void RetvalCheckOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<RetvalCheckOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
RetvalCheckOp RetvalCheckOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<RetvalCheckOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RetvalCheckOp RetvalCheckOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void RetvalCheckOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
RetvalCheckOp RetvalCheckOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<RetvalCheckOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RetvalCheckOp RetvalCheckOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult RetvalCheckOp::verifyInvariantsImpl() {
auto tblgen_errclass = getProperties().errclass; (void)tblgen_errclass;
if (!tblgen_errclass) return emitOpError("requires attribute 'errclass'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_MPIOps2(*this, tblgen_errclass, "errclass")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult RetvalCheckOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult RetvalCheckOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
(void)valOperandsLoc;
::mlir::mpi::MPI_ErrorClassEnumAttr errclassAttr;
::mlir::Type resRawType{};
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
valOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(valRawOperand))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(errclassAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (errclassAttr) result.getOrAddProperties<RetvalCheckOp::Properties>().errclass = errclassAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
resRawType = type;
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::RetvalType>();
result.addTypes(resTypes);
if (parser.resolveOperands(valOperands, odsBuildableType0, valOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void RetvalCheckOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getVal();
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getErrclassAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("errclass");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getRes().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
}
void RetvalCheckOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::RetvalCheckOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::detail::RetvalCheckOpGenericAdaptorBase::Properties)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::SendOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
SendOpGenericAdaptorBase::SendOpGenericAdaptorBase(SendOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
SendOpAdaptor::SendOpAdaptor(SendOp op) : SendOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult SendOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> SendOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult SendOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute SendOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code SendOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> SendOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void SendOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void SendOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult SendOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void SendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(dest);
odsState.addOperands(comm);
if (retval)
odsState.addTypes(retval);
}
SendOp SendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<SendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SendOp SendOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
}
void SendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
odsState.addOperands(ref);
odsState.addOperands(tag);
odsState.addOperands(dest);
odsState.addOperands(comm);
odsState.addTypes(resultTypes);
}
SendOp SendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
auto __res__ = ::llvm::dyn_cast<SendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SendOp SendOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value tag, ::mlir::Value dest, ::mlir::Value comm) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(ref)>(ref), std::forward<decltype(tag)>(tag), std::forward<decltype(dest)>(dest), std::forward<decltype(comm)>(comm));
}
void SendOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
SendOp SendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<SendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SendOp SendOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void SendOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 4u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
SendOp SendOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<SendOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SendOp SendOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult SendOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup3 = getODSOperands(3);
for (auto v : valueGroup3) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult SendOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult SendOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand refRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> refOperands(&refRawOperand, 1); ::llvm::SMLoc refOperandsLoc;
(void)refOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand tagRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tagOperands(&tagRawOperand, 1); ::llvm::SMLoc tagOperandsLoc;
(void)tagOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand destRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destOperands(&destRawOperand, 1); ::llvm::SMLoc destOperandsLoc;
(void)destOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand commRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> commOperands(&commRawOperand, 1); ::llvm::SMLoc commOperandsLoc;
(void)commOperandsLoc;
::mlir::Type refRawType{};
::llvm::ArrayRef<::mlir::Type> refTypes(&refRawType, 1);
::mlir::Type tagRawType{};
::llvm::ArrayRef<::mlir::Type> tagTypes(&tagRawType, 1);
::mlir::Type destRawType{};
::llvm::ArrayRef<::mlir::Type> destTypes(&destRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
refOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(refRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
tagOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(tagRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
destOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(destRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
commOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(commRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::MemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
refRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
tagRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::IntegerType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
destRawType = type;
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::mpi::CommType>();
result.addTypes(retvalTypes);
if (parser.resolveOperands(refOperands, refTypes, refOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(tagOperands, tagTypes, tagOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(destOperands, destTypes, destOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(commOperands, odsBuildableType0, commOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void SendOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getRef();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getTag();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getDest();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getComm();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getRef().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getTag().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getDest().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void SendOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::SendOp)
namespace mlir::mpi {
//===----------------------------------------------------------------------===//
// ::mlir::mpi::Wait definitions
//===----------------------------------------------------------------------===//
namespace detail {
WaitGenericAdaptorBase::WaitGenericAdaptorBase(Wait op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
WaitAdaptor::WaitAdaptor(Wait op) : WaitGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult WaitAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> Wait::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult Wait::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute Wait::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code Wait::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> Wait::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void Wait::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void Wait::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult Wait::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void Wait::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type retval, ::mlir::Value req) {
odsState.addOperands(req);
if (retval)
odsState.addTypes(retval);
}
Wait Wait::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Type retval, ::mlir::Value req) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(retval)>(retval), std::forward<decltype(req)>(req));
auto __res__ = ::llvm::dyn_cast<Wait>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Wait Wait::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Type retval, ::mlir::Value req) {
return create(builder, builder.getLoc(), std::forward<decltype(retval)>(retval), std::forward<decltype(req)>(req));
}
void Wait::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value req) {
odsState.addOperands(req);
odsState.addTypes(resultTypes);
}
Wait Wait::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value req) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(req)>(req));
auto __res__ = ::llvm::dyn_cast<Wait>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Wait Wait::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value req) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(req)>(req));
}
void Wait::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
Wait Wait::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<Wait>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Wait Wait::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void Wait::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
Wait Wait::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<Wait>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
Wait Wait::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult Wait::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps5(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
if (valueGroup0.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_MPIOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult Wait::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult Wait::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand reqRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> reqOperands(&reqRawOperand, 1); ::llvm::SMLoc reqOperandsLoc;
(void)reqOperandsLoc;
::mlir::Type reqRawType{};
::llvm::ArrayRef<::mlir::Type> reqTypes(&reqRawType, 1);
::llvm::SmallVector<::mlir::Type, 1> retvalTypes;
if (parser.parseLParen())
return ::mlir::failure();
reqOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(reqRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::mpi::RequestType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
reqRawType = type;
}
if (::mlir::succeeded(parser.parseOptionalArrow())) {
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
retvalTypes.push_back(optionalType);
}
}
}
result.addTypes(retvalTypes);
if (parser.resolveOperands(reqOperands, reqTypes, reqOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void Wait::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getReq();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getReq().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::mpi::RequestType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
if (getRetval()) {
_odsPrinter << ' ' << "->";
_odsPrinter << ' ';
_odsPrinter << (getRetval() ? ::llvm::ArrayRef<::mlir::Type>(getRetval().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void Wait::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::mpi
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::mpi::Wait)
#endif // GET_OP_CLASSES