/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* AttrDef Definitions *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ #ifdef GET_ATTRDEF_LIST #undef GET_ATTRDEF_LIST ::mlir::ROCDL::BufferOOBModeAttr, ::mlir::ROCDL::BufferOOBModeModuleFlagAttr, ::mlir::ROCDL::TBufferOOBModeModuleFlagAttr, ::mlir::ROCDL::MFMAPermBAttr, ::mlir::ROCDL::MFMANegModifierAttr, ::mlir::ROCDL::MatrixFormatAttr, ::mlir::ROCDL::WMMAMatrixScaleAttr, ::mlir::ROCDL::WMMAMatrixScaleFormatAttr, ::mlir::ROCDL::WMMACModifierAttr, ::mlir::ROCDL::SchedGroupMaskAttr, ::mlir::ROCDL::PreGfx12CachePolicyAttr, ::mlir::ROCDL::Gfx942CachePolicyAttr, ::mlir::ROCDL::Gfx12CachePolicyAttr, ::mlir::ROCDL::Gfx12AtomicCachePolicyAttr, ::mlir::ROCDL::ROCDLTargetAttr #endif // GET_ATTRDEF_LIST #ifdef GET_ATTRDEF_CLASSES #undef GET_ATTRDEF_CLASSES static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) .Case(::mlir::ROCDL::BufferOOBModeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::BufferOOBModeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::BufferOOBModeModuleFlagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::BufferOOBModeModuleFlagAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::TBufferOOBModeModuleFlagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::TBufferOOBModeModuleFlagAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::MFMAPermBAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::MFMAPermBAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::MFMANegModifierAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::MFMANegModifierAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::MatrixFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::MatrixFormatAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::WMMAMatrixScaleAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::WMMAMatrixScaleAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::WMMAMatrixScaleFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::WMMAMatrixScaleFormatAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::WMMACModifierAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::WMMACModifierAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::SchedGroupMaskAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::SchedGroupMaskAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::PreGfx12CachePolicyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::PreGfx12CachePolicyAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::Gfx942CachePolicyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::Gfx942CachePolicyAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::Gfx12CachePolicyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::Gfx12CachePolicyAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::Gfx12AtomicCachePolicyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::Gfx12AtomicCachePolicyAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::ROCDL::ROCDLTargetAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::ROCDL::ROCDLTargetAttr::parse(parser, type); return ::mlir::success(!!value); }) .Default([&](llvm::StringRef keyword, llvm::SMLoc) { *mnemonic = keyword; return std::nullopt; }); } static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::mlir::ROCDL::BufferOOBModeAttr>([&](auto t) { printer << ::mlir::ROCDL::BufferOOBModeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::BufferOOBModeModuleFlagAttr>([&](auto t) { printer << ::mlir::ROCDL::BufferOOBModeModuleFlagAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::TBufferOOBModeModuleFlagAttr>([&](auto t) { printer << ::mlir::ROCDL::TBufferOOBModeModuleFlagAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::MFMAPermBAttr>([&](auto t) { printer << ::mlir::ROCDL::MFMAPermBAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::MFMANegModifierAttr>([&](auto t) { printer << ::mlir::ROCDL::MFMANegModifierAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::MatrixFormatAttr>([&](auto t) { printer << ::mlir::ROCDL::MatrixFormatAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::WMMAMatrixScaleAttr>([&](auto t) { printer << ::mlir::ROCDL::WMMAMatrixScaleAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::WMMAMatrixScaleFormatAttr>([&](auto t) { printer << ::mlir::ROCDL::WMMAMatrixScaleFormatAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::WMMACModifierAttr>([&](auto t) { printer << ::mlir::ROCDL::WMMACModifierAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::SchedGroupMaskAttr>([&](auto t) { printer << ::mlir::ROCDL::SchedGroupMaskAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::PreGfx12CachePolicyAttr>([&](auto t) { printer << ::mlir::ROCDL::PreGfx12CachePolicyAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::Gfx942CachePolicyAttr>([&](auto t) { printer << ::mlir::ROCDL::Gfx942CachePolicyAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::Gfx12CachePolicyAttr>([&](auto t) { printer << ::mlir::ROCDL::Gfx12CachePolicyAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::Gfx12AtomicCachePolicyAttr>([&](auto t) { printer << ::mlir::ROCDL::Gfx12AtomicCachePolicyAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::ROCDL::ROCDLTargetAttr>([&](auto t) { printer << ::mlir::ROCDL::ROCDLTargetAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Default([](auto) { return ::mlir::failure(); }); } namespace mlir::ROCDL { namespace detail { struct BufferOOBModeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::BufferOOBMode>; BufferOOBModeAttrStorage(::mlir::ROCDL::BufferOOBMode value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static BufferOOBModeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) BufferOOBModeAttrStorage(std::move(value)); } ::mlir::ROCDL::BufferOOBMode value; }; } // namespace detail BufferOOBModeAttr BufferOOBModeAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::BufferOOBMode value) { return Base::get(context, std::move(value)); } ::mlir::Attribute BufferOOBModeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::BufferOOBMode> _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::BufferOOBMode>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_BufferOOBModeAttr parameter 'value' which is to be a `::mlir::ROCDL::BufferOOBMode`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return BufferOOBModeAttr::get(odsParser.getContext(), ::mlir::ROCDL::BufferOOBMode((*_result_value))); } void BufferOOBModeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } ::mlir::ROCDL::BufferOOBMode BufferOOBModeAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BufferOOBModeAttr) namespace mlir::ROCDL { namespace detail { struct BufferOOBModeModuleFlagAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::BufferOOBMode>; BufferOOBModeModuleFlagAttrStorage(::mlir::ROCDL::BufferOOBMode value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static BufferOOBModeModuleFlagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) BufferOOBModeModuleFlagAttrStorage(std::move(value)); } ::mlir::ROCDL::BufferOOBMode value; }; } // namespace detail BufferOOBModeModuleFlagAttr BufferOOBModeModuleFlagAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::BufferOOBMode value) { return Base::get(context, std::move(value)); } ::mlir::Attribute BufferOOBModeModuleFlagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::BufferOOBMode> _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::BufferOOBMode>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_BufferOOBModeModuleFlagAttr parameter 'value' which is to be a `::mlir::ROCDL::BufferOOBMode`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return BufferOOBModeModuleFlagAttr::get(odsParser.getContext(), ::mlir::ROCDL::BufferOOBMode((*_result_value))); } void BufferOOBModeModuleFlagAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } ::mlir::ROCDL::BufferOOBMode BufferOOBModeModuleFlagAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BufferOOBModeModuleFlagAttr) namespace mlir::ROCDL { namespace detail { struct TBufferOOBModeModuleFlagAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::BufferOOBMode>; TBufferOOBModeModuleFlagAttrStorage(::mlir::ROCDL::BufferOOBMode value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static TBufferOOBModeModuleFlagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) TBufferOOBModeModuleFlagAttrStorage(std::move(value)); } ::mlir::ROCDL::BufferOOBMode value; }; } // namespace detail TBufferOOBModeModuleFlagAttr TBufferOOBModeModuleFlagAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::BufferOOBMode value) { return Base::get(context, std::move(value)); } ::mlir::Attribute TBufferOOBModeModuleFlagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::BufferOOBMode> _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::BufferOOBMode>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TBufferOOBModeModuleFlagAttr parameter 'value' which is to be a `::mlir::ROCDL::BufferOOBMode`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return TBufferOOBModeModuleFlagAttr::get(odsParser.getContext(), ::mlir::ROCDL::BufferOOBMode((*_result_value))); } void TBufferOOBModeModuleFlagAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } ::mlir::ROCDL::BufferOOBMode TBufferOOBModeModuleFlagAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::TBufferOOBModeModuleFlagAttr) namespace mlir::ROCDL { namespace detail { struct MFMAPermBAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::MFMAPermB>; MFMAPermBAttrStorage(::mlir::ROCDL::MFMAPermB value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MFMAPermBAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) MFMAPermBAttrStorage(std::move(value)); } ::mlir::ROCDL::MFMAPermB value; }; } // namespace detail MFMAPermBAttr MFMAPermBAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::MFMAPermB value) { return Base::get(context, std::move(value)); } ::mlir::Attribute MFMAPermBAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::MFMAPermB> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::MFMAPermB>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_MFMAPermBAttr parameter 'value' which is to be a `::mlir::ROCDL::MFMAPermB`"); return {}; } assert(::mlir::succeeded(_result_value)); return MFMAPermBAttr::get(odsParser.getContext(), ::mlir::ROCDL::MFMAPermB((*_result_value))); } void MFMAPermBAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::MFMAPermB MFMAPermBAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MFMAPermBAttr) namespace mlir::ROCDL { namespace detail { struct MFMANegModifierAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::MFMANegModifier>; MFMANegModifierAttrStorage(::mlir::ROCDL::MFMANegModifier value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MFMANegModifierAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) MFMANegModifierAttrStorage(std::move(value)); } ::mlir::ROCDL::MFMANegModifier value; }; } // namespace detail MFMANegModifierAttr MFMANegModifierAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::MFMANegModifier value) { return Base::get(context, std::move(value)); } ::mlir::Attribute MFMANegModifierAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::MFMANegModifier> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::MFMANegModifier>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_MFMANegModifierAttr parameter 'value' which is to be a `::mlir::ROCDL::MFMANegModifier`"); return {}; } assert(::mlir::succeeded(_result_value)); return MFMANegModifierAttr::get(odsParser.getContext(), ::mlir::ROCDL::MFMANegModifier((*_result_value))); } void MFMANegModifierAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::MFMANegModifier MFMANegModifierAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MFMANegModifierAttr) namespace mlir::ROCDL { namespace detail { struct MatrixFormatAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::MatrixFormat>; MatrixFormatAttrStorage(::mlir::ROCDL::MatrixFormat value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MatrixFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) MatrixFormatAttrStorage(std::move(value)); } ::mlir::ROCDL::MatrixFormat value; }; } // namespace detail MatrixFormatAttr MatrixFormatAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::MatrixFormat value) { return Base::get(context, std::move(value)); } ::mlir::Attribute MatrixFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::MatrixFormat> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::MatrixFormat>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_MatrixFormatAttr parameter 'value' which is to be a `::mlir::ROCDL::MatrixFormat`"); return {}; } assert(::mlir::succeeded(_result_value)); return MatrixFormatAttr::get(odsParser.getContext(), ::mlir::ROCDL::MatrixFormat((*_result_value))); } void MatrixFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::MatrixFormat MatrixFormatAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MatrixFormatAttr) namespace mlir::ROCDL { namespace detail { struct WMMAMatrixScaleAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::WMMAMatrixScale>; WMMAMatrixScaleAttrStorage(::mlir::ROCDL::WMMAMatrixScale value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static WMMAMatrixScaleAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) WMMAMatrixScaleAttrStorage(std::move(value)); } ::mlir::ROCDL::WMMAMatrixScale value; }; } // namespace detail WMMAMatrixScaleAttr WMMAMatrixScaleAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::WMMAMatrixScale value) { return Base::get(context, std::move(value)); } ::mlir::Attribute WMMAMatrixScaleAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::WMMAMatrixScale> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::WMMAMatrixScale>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_WMMAMatrixScaleAttr parameter 'value' which is to be a `::mlir::ROCDL::WMMAMatrixScale`"); return {}; } assert(::mlir::succeeded(_result_value)); return WMMAMatrixScaleAttr::get(odsParser.getContext(), ::mlir::ROCDL::WMMAMatrixScale((*_result_value))); } void WMMAMatrixScaleAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::WMMAMatrixScale WMMAMatrixScaleAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::WMMAMatrixScaleAttr) namespace mlir::ROCDL { namespace detail { struct WMMAMatrixScaleFormatAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::WMMAMatrixScaleFormat>; WMMAMatrixScaleFormatAttrStorage(::mlir::ROCDL::WMMAMatrixScaleFormat value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static WMMAMatrixScaleFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) WMMAMatrixScaleFormatAttrStorage(std::move(value)); } ::mlir::ROCDL::WMMAMatrixScaleFormat value; }; } // namespace detail WMMAMatrixScaleFormatAttr WMMAMatrixScaleFormatAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::WMMAMatrixScaleFormat value) { return Base::get(context, std::move(value)); } ::mlir::Attribute WMMAMatrixScaleFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::WMMAMatrixScaleFormat> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::WMMAMatrixScaleFormat>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_WMMAMatrixScaleFormatAttr parameter 'value' which is to be a `::mlir::ROCDL::WMMAMatrixScaleFormat`"); return {}; } assert(::mlir::succeeded(_result_value)); return WMMAMatrixScaleFormatAttr::get(odsParser.getContext(), ::mlir::ROCDL::WMMAMatrixScaleFormat((*_result_value))); } void WMMAMatrixScaleFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::WMMAMatrixScaleFormat WMMAMatrixScaleFormatAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::WMMAMatrixScaleFormatAttr) namespace mlir::ROCDL { namespace detail { struct WMMACModifierAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::WMMACModifier>; WMMACModifierAttrStorage(::mlir::ROCDL::WMMACModifier value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static WMMACModifierAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) WMMACModifierAttrStorage(std::move(value)); } ::mlir::ROCDL::WMMACModifier value; }; } // namespace detail WMMACModifierAttr WMMACModifierAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::WMMACModifier value) { return Base::get(context, std::move(value)); } ::mlir::Attribute WMMACModifierAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::WMMACModifier> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::WMMACModifier>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_WMMACModifierAttr parameter 'value' which is to be a `::mlir::ROCDL::WMMACModifier`"); return {}; } assert(::mlir::succeeded(_result_value)); return WMMACModifierAttr::get(odsParser.getContext(), ::mlir::ROCDL::WMMACModifier((*_result_value))); } void WMMACModifierAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::WMMACModifier WMMACModifierAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::WMMACModifierAttr) namespace mlir::ROCDL { namespace detail { struct SchedGroupMaskAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::SchedGroupMask>; SchedGroupMaskAttrStorage(::mlir::ROCDL::SchedGroupMask value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static SchedGroupMaskAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) SchedGroupMaskAttrStorage(std::move(value)); } ::mlir::ROCDL::SchedGroupMask value; }; } // namespace detail SchedGroupMaskAttr SchedGroupMaskAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::SchedGroupMask value) { return Base::get(context, std::move(value)); } ::mlir::Attribute SchedGroupMaskAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::SchedGroupMask> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::SchedGroupMask>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_SchedGroupMaskAttr parameter 'value' which is to be a `::mlir::ROCDL::SchedGroupMask`"); return {}; } assert(::mlir::succeeded(_result_value)); return SchedGroupMaskAttr::get(odsParser.getContext(), ::mlir::ROCDL::SchedGroupMask((*_result_value))); } void SchedGroupMaskAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::SchedGroupMask SchedGroupMaskAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::SchedGroupMaskAttr) namespace mlir::ROCDL { namespace detail { struct PreGfx12CachePolicyAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::PreGfx12CachePolicy>; PreGfx12CachePolicyAttrStorage(::mlir::ROCDL::PreGfx12CachePolicy value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static PreGfx12CachePolicyAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) PreGfx12CachePolicyAttrStorage(std::move(value)); } ::mlir::ROCDL::PreGfx12CachePolicy value; }; } // namespace detail PreGfx12CachePolicyAttr PreGfx12CachePolicyAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::PreGfx12CachePolicy value) { return Base::get(context, std::move(value)); } ::mlir::Attribute PreGfx12CachePolicyAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::PreGfx12CachePolicy> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::PreGfx12CachePolicy>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_PreGfx12CachePolicyAttr parameter 'value' which is to be a `::mlir::ROCDL::PreGfx12CachePolicy`"); return {}; } assert(::mlir::succeeded(_result_value)); return PreGfx12CachePolicyAttr::get(odsParser.getContext(), ::mlir::ROCDL::PreGfx12CachePolicy((*_result_value))); } void PreGfx12CachePolicyAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::PreGfx12CachePolicy PreGfx12CachePolicyAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::PreGfx12CachePolicyAttr) namespace mlir::ROCDL { namespace detail { struct Gfx942CachePolicyAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::Gfx942CachePolicy>; Gfx942CachePolicyAttrStorage(::mlir::ROCDL::Gfx942CachePolicy value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static Gfx942CachePolicyAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) Gfx942CachePolicyAttrStorage(std::move(value)); } ::mlir::ROCDL::Gfx942CachePolicy value; }; } // namespace detail Gfx942CachePolicyAttr Gfx942CachePolicyAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::Gfx942CachePolicy value) { return Base::get(context, std::move(value)); } ::mlir::Attribute Gfx942CachePolicyAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::Gfx942CachePolicy> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::Gfx942CachePolicy>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_Gfx942CachePolicyAttr parameter 'value' which is to be a `::mlir::ROCDL::Gfx942CachePolicy`"); return {}; } assert(::mlir::succeeded(_result_value)); return Gfx942CachePolicyAttr::get(odsParser.getContext(), ::mlir::ROCDL::Gfx942CachePolicy((*_result_value))); } void Gfx942CachePolicyAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::Gfx942CachePolicy Gfx942CachePolicyAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::Gfx942CachePolicyAttr) namespace mlir::ROCDL { namespace detail { struct Gfx12CachePolicyAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::Gfx12CachePolicy>; Gfx12CachePolicyAttrStorage(::mlir::ROCDL::Gfx12CachePolicy value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static Gfx12CachePolicyAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) Gfx12CachePolicyAttrStorage(std::move(value)); } ::mlir::ROCDL::Gfx12CachePolicy value; }; } // namespace detail Gfx12CachePolicyAttr Gfx12CachePolicyAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::Gfx12CachePolicy value) { return Base::get(context, std::move(value)); } ::mlir::Attribute Gfx12CachePolicyAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::Gfx12CachePolicy> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::Gfx12CachePolicy>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_Gfx12CachePolicyAttr parameter 'value' which is to be a `::mlir::ROCDL::Gfx12CachePolicy`"); return {}; } assert(::mlir::succeeded(_result_value)); return Gfx12CachePolicyAttr::get(odsParser.getContext(), ::mlir::ROCDL::Gfx12CachePolicy((*_result_value))); } void Gfx12CachePolicyAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::Gfx12CachePolicy Gfx12CachePolicyAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::Gfx12CachePolicyAttr) namespace mlir::ROCDL { namespace detail { struct Gfx12AtomicCachePolicyAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::ROCDL::Gfx12AtomicCachePolicy>; Gfx12AtomicCachePolicyAttrStorage(::mlir::ROCDL::Gfx12AtomicCachePolicy value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static Gfx12AtomicCachePolicyAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) Gfx12AtomicCachePolicyAttrStorage(std::move(value)); } ::mlir::ROCDL::Gfx12AtomicCachePolicy value; }; } // namespace detail Gfx12AtomicCachePolicyAttr Gfx12AtomicCachePolicyAttr::get(::mlir::MLIRContext *context, ::mlir::ROCDL::Gfx12AtomicCachePolicy value) { return Base::get(context, std::move(value)); } ::mlir::Attribute Gfx12AtomicCachePolicyAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::ROCDL::Gfx12AtomicCachePolicy> _result_value; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::ROCDL::Gfx12AtomicCachePolicy>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_Gfx12AtomicCachePolicyAttr parameter 'value' which is to be a `::mlir::ROCDL::Gfx12AtomicCachePolicy`"); return {}; } assert(::mlir::succeeded(_result_value)); return Gfx12AtomicCachePolicyAttr::get(odsParser.getContext(), ::mlir::ROCDL::Gfx12AtomicCachePolicy((*_result_value))); } void Gfx12AtomicCachePolicyAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getValue()); } ::mlir::ROCDL::Gfx12AtomicCachePolicy Gfx12AtomicCachePolicyAttr::getValue() const { return getImpl()->value; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::Gfx12AtomicCachePolicyAttr) namespace mlir::ROCDL { namespace detail { struct ROCDLTargetAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; ROCDLTargetAttrStorage(int O, ::llvm::StringRef triple, ::llvm::StringRef chip, ::llvm::StringRef features, ::llvm::StringRef abi, DictionaryAttr flags, ArrayAttr link) : O(std::move(O)), triple(std::move(triple)), chip(std::move(chip)), features(std::move(features)), abi(std::move(abi)), flags(std::move(flags)), link(std::move(link)) {} KeyTy getAsKey() const { return KeyTy(O, triple, chip, features, abi, flags, link); } bool operator==(const KeyTy &tblgenKey) const { return (O == std::get<0>(tblgenKey)) && (triple == std::get<1>(tblgenKey)) && (chip == std::get<2>(tblgenKey)) && (features == std::get<3>(tblgenKey)) && (abi == std::get<4>(tblgenKey)) && (flags == std::get<5>(tblgenKey)) && (link == std::get<6>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); } static ROCDLTargetAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto O = std::move(std::get<0>(tblgenKey)); auto triple = std::move(std::get<1>(tblgenKey)); auto chip = std::move(std::get<2>(tblgenKey)); auto features = std::move(std::get<3>(tblgenKey)); auto abi = std::move(std::get<4>(tblgenKey)); auto flags = std::move(std::get<5>(tblgenKey)); auto link = std::move(std::get<6>(tblgenKey)); triple = allocator.copyInto(triple); chip = allocator.copyInto(chip); features = allocator.copyInto(features); abi = allocator.copyInto(abi); return new (allocator.allocate()) ROCDLTargetAttrStorage(std::move(O), std::move(triple), std::move(chip), std::move(features), std::move(abi), std::move(flags), std::move(link)); } int O; ::llvm::StringRef triple; ::llvm::StringRef chip; ::llvm::StringRef features; ::llvm::StringRef abi; DictionaryAttr flags; ArrayAttr link; }; } // namespace detail bool ROCDLTargetAttr::hasFlag(StringRef flag) const { if (DictionaryAttr flags = getFlags()) return flags.get(flag) != nullptr; return false; } bool ROCDLTargetAttr::hasWave64() const { return hasFlag("wave64") || !hasFlag("no_wave64"); } bool ROCDLTargetAttr::hasFastMath() const { return hasFlag("fast"); } bool ROCDLTargetAttr::hasDaz() const { return hasFlag("daz"); } bool ROCDLTargetAttr::hasFiniteOnly() const { return hasFlag("finite_only"); } bool ROCDLTargetAttr::hasUnsafeMath() const { return hasFlag("unsafe_math"); } bool ROCDLTargetAttr::hasCorrectSqrt() const { return !hasFlag("unsafe_sqrt"); } ROCDLTargetAttr ROCDLTargetAttr::get(::mlir::MLIRContext *context, int optLevel, StringRef triple, StringRef chip, StringRef features, StringRef abiVersion, DictionaryAttr targetFlags, ArrayAttr linkFiles) { return Base::get(context, optLevel, triple, chip, features, abiVersion, targetFlags, linkFiles); } ROCDLTargetAttr ROCDLTargetAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int optLevel, StringRef triple, StringRef chip, StringRef features, StringRef abiVersion, DictionaryAttr targetFlags, ArrayAttr linkFiles) { return Base::get(context, optLevel, triple, chip, features, abiVersion, targetFlags, linkFiles); } ::llvm::LogicalResult ROCDLTargetAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int O, ::llvm::StringRef triple, ::llvm::StringRef chip, ::llvm::StringRef features, ::llvm::StringRef abi, DictionaryAttr flags, ArrayAttr link) { if (::mlir::failed(verify(emitError, O, triple, chip, features, abi, flags, link))) return ::mlir::failure(); return ::mlir::success(); } ::mlir::Attribute ROCDLTargetAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_O; ::mlir::FailureOr _result_triple; ::mlir::FailureOr _result_chip; ::mlir::FailureOr _result_features; ::mlir::FailureOr _result_abi; ::mlir::FailureOr _result_flags; ::mlir::FailureOr _result_link; // Parse literal '<' if (odsParser.parseOptionalLess()) { } else { // Parse parameter struct bool _seen_O = false; bool _seen_triple = false; bool _seen_chip = false; bool _seen_features = false; bool _seen_abi = false; bool _seen_flags = false; bool _seen_link = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_O && _paramKey == "O") { _seen_O = true; // Parse variable 'O' _result_O = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_O)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'O' which is to be a `int`"); return {}; } } else if (!_seen_triple && _paramKey == "triple") { _seen_triple = true; // Parse variable 'triple' _result_triple = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_triple)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'triple' which is to be a `::llvm::StringRef`"); return {}; } } else if (!_seen_chip && _paramKey == "chip") { _seen_chip = true; // Parse variable 'chip' _result_chip = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_chip)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'chip' which is to be a `::llvm::StringRef`"); return {}; } } else if (!_seen_features && _paramKey == "features") { _seen_features = true; // Parse variable 'features' _result_features = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_features)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'features' which is to be a `::llvm::StringRef`"); return {}; } } else if (!_seen_abi && _paramKey == "abi") { _seen_abi = true; // Parse variable 'abi' _result_abi = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_abi)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'abi' which is to be a `::llvm::StringRef`"); return {}; } } else if (!_seen_flags && _paramKey == "flags") { _seen_flags = true; // Parse variable 'flags' _result_flags = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_flags)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'flags' which is to be a `DictionaryAttr`"); return {}; } } else if (!_seen_link && _paramKey == "link") { _seen_link = true; // Parse variable 'link' _result_link = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_link)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargetAttr parameter 'link' which is to be a `ArrayAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; } return odsParser.getChecked(odsLoc, odsParser.getContext(), int((_result_O.value_or(2))), ::llvm::StringRef((_result_triple.value_or("amdgcn-amd-amdhsa"))), ::llvm::StringRef((_result_chip.value_or("gfx900"))), ::llvm::StringRef((_result_features.value_or(""))), ::llvm::StringRef((_result_abi.value_or("600"))), DictionaryAttr((_result_flags.value_or(DictionaryAttr()))), ArrayAttr((_result_link.value_or(ArrayAttr())))); } void ROCDLTargetAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); if (!(getO() == 2) || !(getTriple() == "amdgcn-amd-amdhsa") || !(getChip() == "gfx900") || !(getFeatures() == "") || !(getAbi() == "600") || !(getFlags() == DictionaryAttr()) || !(getLink() == ArrayAttr())) { odsPrinter << "<"; { bool _firstPrinted = true; if (!(getO() == 2)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "O = "; if (!(getO() == 2)) { odsPrinter.printStrippedAttrOrType(getO()); } } if (!(getTriple() == "amdgcn-amd-amdhsa")) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "triple = "; if (!(getTriple() == "amdgcn-amd-amdhsa")) { odsPrinter.printString(getTriple());; } } if (!(getChip() == "gfx900")) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "chip = "; if (!(getChip() == "gfx900")) { odsPrinter.printString(getChip());; } } if (!(getFeatures() == "")) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "features = "; if (!(getFeatures() == "")) { odsPrinter.printString(getFeatures());; } } if (!(getAbi() == "600")) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "abi = "; if (!(getAbi() == "600")) { odsPrinter.printString(getAbi());; } } if (!(getFlags() == DictionaryAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "flags = "; if (!(getFlags() == DictionaryAttr())) { odsPrinter.printStrippedAttrOrType(getFlags()); } } if (!(getLink() == ArrayAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "link = "; if (!(getLink() == ArrayAttr())) { odsPrinter.printStrippedAttrOrType(getLink()); } } } odsPrinter << ">"; } else { } } int ROCDLTargetAttr::getO() const { return getImpl()->O; } ::llvm::StringRef ROCDLTargetAttr::getTriple() const { return getImpl()->triple; } ::llvm::StringRef ROCDLTargetAttr::getChip() const { return getImpl()->chip; } ::llvm::StringRef ROCDLTargetAttr::getFeatures() const { return getImpl()->features; } ::llvm::StringRef ROCDLTargetAttr::getAbi() const { return getImpl()->abi; } DictionaryAttr ROCDLTargetAttr::getFlags() const { return getImpl()->flags; } ArrayAttr ROCDLTargetAttr::getLink() const { return getImpl()->link; } } // namespace mlir::ROCDL MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ROCDLTargetAttr) namespace mlir::ROCDL { /// Parse an attribute registered to this dialect. ::mlir::Attribute ROCDLDialect::parseAttribute(::mlir::DialectAsmParser &parser, ::mlir::Type type) const { ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); ::llvm::StringRef attrTag; { ::mlir::Attribute attr; auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); if (parseResult.has_value()) return attr; } parser.emitError(typeLoc) << "unknown attribute `" << attrTag << "` in dialect `" << getNamespace() << "`"; return {}; } /// Print an attribute registered to this dialect. void ROCDLDialect::printAttribute(::mlir::Attribute attr, ::mlir::DialectAsmPrinter &printer) const { if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) return; } } // namespace mlir::ROCDL #endif // GET_ATTRDEF_CLASSES