Skip to content

Commit

Permalink
Integrate llvm-project at 07a8ebed56cfa223d1587903e4de0d5788b5f777 (i…
Browse files Browse the repository at this point in the history
…ree-org#19334)

Still carrying a revert for 1004865f1ca41a9581da8747f34b29862d3ebc3d and
a cherry pick for llvm/llvm-project#116650.

Removed `FieldParser`s for optional enums that get autogenerated as of
llvm/llvm-project#117719.
  • Loading branch information
kuhar authored Nov 28, 2024
1 parent 7f99587 commit d3eef09
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 185 deletions.
85 changes: 0 additions & 85 deletions compiler/src/iree/compiler/Dialect/HAL/IR/HALTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<mlir::iree_compiler::IREE::HAL::CollectiveReductionOp>> {
static FailureOr<mlir::iree_compiler::IREE::HAL::CollectiveReductionOp>
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<mlir::iree_compiler::IREE::HAL::CollectiveReductionOp>
param) {
printer << (param.has_value()
? mlir::iree_compiler::IREE::HAL::stringifyEnum(param.value())
: StringRef{""});
return printer;
}

template <>
struct FieldParser<
std::optional<mlir::iree_compiler::IREE::HAL::PipelineLayoutFlags>> {
static FailureOr<mlir::iree_compiler::IREE::HAL::PipelineLayoutFlags>
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<mlir::iree_compiler::IREE::HAL::PipelineLayoutFlags> param) {
printer << (param.has_value()
? mlir::iree_compiler::IREE::HAL::stringifyEnum(param.value())
: StringRef{""});
return printer;
}

template <>
struct FieldParser<
std::optional<mlir::iree_compiler::IREE::HAL::DescriptorFlags>> {
static FailureOr<mlir::iree_compiler::IREE::HAL::DescriptorFlags>
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<mlir::iree_compiler::IREE::HAL::DescriptorFlags> 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
Expand Down
31 changes: 0 additions & 31 deletions compiler/src/iree/compiler/Dialect/Stream/IR/StreamTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<mlir::iree_compiler::IREE::Stream::CollectiveReductionOp>> {
static FailureOr<mlir::iree_compiler::IREE::Stream::CollectiveReductionOp>
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<mlir::iree_compiler::IREE::Stream::CollectiveReductionOp>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,72 +40,4 @@ std::optional<int32_t> 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<mlir::iree_compiler::IREE::Input::PipelineLayoutFlags>> {
static FailureOr<mlir::iree_compiler::IREE::Input::PipelineLayoutFlags>
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<mlir::iree_compiler::IREE::Input::PipelineLayoutFlags>
param) {
printer << (param.has_value()
? mlir::iree_compiler::IREE::Input::stringifyEnum(
param.value())
: StringRef{""});
return printer;
}

template <>
struct FieldParser<
std::optional<mlir::iree_compiler::IREE::Input::DescriptorFlags>> {
static FailureOr<mlir::iree_compiler::IREE::Input::DescriptorFlags>
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<mlir::iree_compiler::IREE::Input::DescriptorFlags> 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
2 changes: 1 addition & 1 deletion third_party/llvm-project
Submodule llvm-project updated 624 files

0 comments on commit d3eef09

Please sign in to comment.