From d3eef09090d8ad5fba335d7921895e1fdf600e45 Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Thu, 28 Nov 2024 09:57:07 -0500 Subject: [PATCH] Integrate llvm-project at 07a8ebed56cfa223d1587903e4de0d5788b5f777 (#19334) Still carrying a revert for 1004865f1ca41a9581da8747f34b29862d3ebc3d and a cherry pick for https://github.com/llvm/llvm-project/pull/116650. Removed `FieldParser`s for optional enums that get autogenerated as of https://github.com/llvm/llvm-project/pull/117719. --- .../iree/compiler/Dialect/HAL/IR/HALTypes.h | 85 ------------------- .../compiler/Dialect/Stream/IR/StreamTypes.h | 31 ------- .../Dialect/Input/InputDialect.h | 68 --------------- third_party/llvm-project | 2 +- 4 files changed, 1 insertion(+), 185 deletions(-) diff --git a/compiler/src/iree/compiler/Dialect/HAL/IR/HALTypes.h b/compiler/src/iree/compiler/Dialect/HAL/IR/HALTypes.h index fefe68fd38f9..d7168069fcd9 100644 --- a/compiler/src/iree/compiler/Dialect/HAL/IR/HALTypes.h +++ b/compiler/src/iree/compiler/Dialect/HAL/IR/HALTypes.h @@ -190,91 +190,6 @@ struct StaticRange { } // namespace mlir::iree_compiler::IREE::HAL -// It's unfortunate this is required. -namespace mlir { - -template <> -struct FieldParser< - std::optional> { - static FailureOr - parse(AsmParser &parser) { - std::string value; - if (parser.parseKeywordOrString(&value)) - return failure(); - auto result = mlir::iree_compiler::IREE::HAL::symbolizeEnum< - mlir::iree_compiler::IREE::HAL::CollectiveReductionOp>(value); - if (!result.has_value()) - return failure(); - return result.value(); - } -}; -static inline AsmPrinter & -operator<<(AsmPrinter &printer, - std::optional - param) { - printer << (param.has_value() - ? mlir::iree_compiler::IREE::HAL::stringifyEnum(param.value()) - : StringRef{""}); - return printer; -} - -template <> -struct FieldParser< - std::optional> { - static FailureOr - parse(AsmParser &parser) { - std::string value; - if (parser.parseKeywordOrString(&value)) - return failure(); - auto result = mlir::iree_compiler::IREE::HAL::symbolizeEnum< - mlir::iree_compiler::IREE::HAL::PipelineLayoutFlags>(value); - if (!result.has_value()) - return failure(); - return result.value(); - } -}; -static inline AsmPrinter &operator<<( - AsmPrinter &printer, - std::optional param) { - printer << (param.has_value() - ? mlir::iree_compiler::IREE::HAL::stringifyEnum(param.value()) - : StringRef{""}); - return printer; -} - -template <> -struct FieldParser< - std::optional> { - static FailureOr - parse(AsmParser &parser) { - std::string value; - if (parser.parseKeywordOrString(&value)) - return failure(); - auto result = mlir::iree_compiler::IREE::HAL::symbolizeEnum< - mlir::iree_compiler::IREE::HAL::DescriptorFlags>(value); - if (!result.has_value()) - return failure(); - return result.value(); - } -}; -static inline AsmPrinter &operator<<( - AsmPrinter &printer, - std::optional param) { - printer << (param.has_value() - ? mlir::iree_compiler::IREE::HAL::stringifyEnum(param.value()) - : StringRef{""}); - return printer; -} - -static inline AsmPrinter & -operator<<(AsmPrinter &printer, - mlir::iree_compiler::IREE::HAL::DescriptorType param) { - printer << mlir::iree_compiler::IREE::HAL::stringifyEnum(param); - return printer; -} - -} // namespace mlir - // clang-format off: must be included after all LLVM/MLIR headers. #define GET_ATTRDEF_CLASSES #include "iree/compiler/Dialect/HAL/IR/HALAttrs.h.inc" // IWYU pragma: keep diff --git a/compiler/src/iree/compiler/Dialect/Stream/IR/StreamTypes.h b/compiler/src/iree/compiler/Dialect/Stream/IR/StreamTypes.h index d69e226fb868..75cc00ef2b84 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/IR/StreamTypes.h +++ b/compiler/src/iree/compiler/Dialect/Stream/IR/StreamTypes.h @@ -27,37 +27,6 @@ #include "iree/compiler/Dialect/Stream/IR/StreamEnums.h.inc" // IWYU pragma: export // clang-format on -// It's unfortunate this is required. -namespace mlir { - -template <> -struct FieldParser< - std::optional> { - static FailureOr - parse(AsmParser &parser) { - std::string value; - if (parser.parseKeywordOrString(&value)) - return failure(); - auto result = mlir::iree_compiler::IREE::Stream::symbolizeEnum< - mlir::iree_compiler::IREE::Stream::CollectiveReductionOp>(value); - if (!result.has_value()) - return failure(); - return result.value(); - } -}; -static inline AsmPrinter &operator<<( - AsmPrinter &printer, - std::optional - param) { - printer << (param.has_value() - ? mlir::iree_compiler::IREE::Stream::stringifyEnum( - param.value()) - : StringRef{""}); - return printer; -} - -} // namespace mlir - namespace mlir::iree_compiler::IREE::Stream { class AffinityAttr; } // namespace mlir::iree_compiler::IREE::Stream diff --git a/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/Input/InputDialect.h b/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/Input/InputDialect.h index 0ae1d30b986b..032dbd000c1f 100644 --- a/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/Input/InputDialect.h +++ b/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/Input/InputDialect.h @@ -40,72 +40,4 @@ std::optional getEncodingTypeValue(Attribute attr); } // namespace mlir::iree_compiler::IREE::Input -//===----------------------------------------------------------------------===// -// Specialize templates in mlir namespace to support enum attributes -//===----------------------------------------------------------------------===// - -namespace mlir { - -template <> -struct FieldParser< - std::optional> { - static FailureOr - parse(AsmParser &parser) { - std::string value; - if (parser.parseKeywordOrString(&value)) - return failure(); - auto result = mlir::iree_compiler::IREE::Input::symbolizeEnum< - mlir::iree_compiler::IREE::Input::PipelineLayoutFlags>(value); - if (!result.has_value()) - return failure(); - return result.value(); - } -}; - -static inline AsmPrinter & -operator<<(AsmPrinter &printer, - std::optional - param) { - printer << (param.has_value() - ? mlir::iree_compiler::IREE::Input::stringifyEnum( - param.value()) - : StringRef{""}); - return printer; -} - -template <> -struct FieldParser< - std::optional> { - static FailureOr - parse(AsmParser &parser) { - std::string value; - if (parser.parseKeywordOrString(&value)) - return failure(); - auto result = mlir::iree_compiler::IREE::Input::symbolizeEnum< - mlir::iree_compiler::IREE::Input::DescriptorFlags>(value); - if (!result.has_value()) - return failure(); - return result.value(); - } -}; - -static inline AsmPrinter &operator<<( - AsmPrinter &printer, - std::optional param) { - printer << (param.has_value() - ? mlir::iree_compiler::IREE::Input::stringifyEnum( - param.value()) - : StringRef{""}); - return printer; -} - -static inline AsmPrinter & -operator<<(AsmPrinter &printer, - mlir::iree_compiler::IREE::Input::DescriptorType param) { - printer << mlir::iree_compiler::IREE::Input::stringifyEnum(param); - return printer; -} - -} // namespace mlir - #endif // IREE_DIALECTS_DIALECT_INPUT_DIALECT_H diff --git a/third_party/llvm-project b/third_party/llvm-project index 3833fdcdb01b..dfbfc0594887 160000 --- a/third_party/llvm-project +++ b/third_party/llvm-project @@ -1 +1 @@ -Subproject commit 3833fdcdb01b69c2815db08388e0e092a79cbc58 +Subproject commit dfbfc059488770ac1b96a8074739c605475166f9