838 lines
31 KiB
C++
838 lines
31 KiB
C++
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|
|
|* *|
|
|
|* Enum Utility Declarations *|
|
|
|* *|
|
|
|* Automatically generated file, do not edit! *|
|
|
|* From: LinalgEnums.td *|
|
|
|* *|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
|
|
enum class BinaryFn : uint32_t {
|
|
add = 0,
|
|
sub = 1,
|
|
mul = 2,
|
|
div = 3,
|
|
div_unsigned = 4,
|
|
max_signed = 5,
|
|
min_signed = 6,
|
|
max_unsigned = 7,
|
|
min_unsigned = 8,
|
|
powf = 9,
|
|
};
|
|
|
|
::std::optional<BinaryFn> symbolizeBinaryFn(uint32_t);
|
|
::llvm::StringRef stringifyBinaryFn(BinaryFn);
|
|
::std::optional<BinaryFn> symbolizeBinaryFn(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForBinaryFn() {
|
|
return 9;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(BinaryFn enumValue) {
|
|
return stringifyBinaryFn(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<BinaryFn> symbolizeEnum<BinaryFn>(::llvm::StringRef str) {
|
|
return symbolizeBinaryFn(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::BinaryFn, ::mlir::linalg::BinaryFn> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::BinaryFn> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::BinaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::BinaryFn>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [add, sub, mul, div, div_unsigned, max_signed, min_signed, max_unsigned, min_unsigned, powf] for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::BinaryFn>, std::optional<::mlir::linalg::BinaryFn>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::BinaryFn>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"add", "sub", "mul", "div", "div_unsigned", "max_signed", "min_signed", "max_unsigned", "min_unsigned", "powf"})))
|
|
return std::optional<::mlir::linalg::BinaryFn>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::BinaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::BinaryFn>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [add, sub, mul, div, div_unsigned, max_signed, min_signed, max_unsigned, min_unsigned, powf] for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::BinaryFn value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::BinaryFn> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::BinaryFn &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::BinaryFn &lhs, const ::mlir::linalg::BinaryFn &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 1, 2, 3
|
|
enum class ElementwiseArityGroup : uint32_t {
|
|
Unary = 1,
|
|
Binary = 2,
|
|
Ternary = 3,
|
|
};
|
|
|
|
::std::optional<ElementwiseArityGroup> symbolizeElementwiseArityGroup(uint32_t);
|
|
::llvm::StringRef stringifyElementwiseArityGroup(ElementwiseArityGroup);
|
|
::std::optional<ElementwiseArityGroup> symbolizeElementwiseArityGroup(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForElementwiseArityGroup() {
|
|
return 3;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(ElementwiseArityGroup enumValue) {
|
|
return stringifyElementwiseArityGroup(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<ElementwiseArityGroup> symbolizeEnum<ElementwiseArityGroup>(::llvm::StringRef str) {
|
|
return symbolizeElementwiseArityGroup(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::ElementwiseArityGroup, ::mlir::linalg::ElementwiseArityGroup> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::ElementwiseArityGroup> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 1, 2, 3");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::ElementwiseArityGroup> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::ElementwiseArityGroup>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [Unary, Binary, Ternary] for allowed 32-bit signless integer cases: 1, 2, 3, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::ElementwiseArityGroup>, std::optional<::mlir::linalg::ElementwiseArityGroup>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::ElementwiseArityGroup>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"Unary", "Binary", "Ternary"})))
|
|
return std::optional<::mlir::linalg::ElementwiseArityGroup>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::ElementwiseArityGroup> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::ElementwiseArityGroup>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [Unary, Binary, Ternary] for allowed 32-bit signless integer cases: 1, 2, 3, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::ElementwiseArityGroup value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::ElementwiseArityGroup> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::ElementwiseArityGroup &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::ElementwiseArityGroup &lhs, const ::mlir::linalg::ElementwiseArityGroup &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases:
|
|
enum class ElementwiseCaseLimits : uint32_t {
|
|
LastUnary = 25,
|
|
LastBinary = 35,
|
|
LastTernary = 36,
|
|
};
|
|
|
|
::std::optional<ElementwiseCaseLimits> symbolizeElementwiseCaseLimits(uint32_t);
|
|
::llvm::StringRef stringifyElementwiseCaseLimits(ElementwiseCaseLimits);
|
|
::std::optional<ElementwiseCaseLimits> symbolizeElementwiseCaseLimits(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForElementwiseCaseLimits() {
|
|
return 36;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(ElementwiseCaseLimits enumValue) {
|
|
return stringifyElementwiseCaseLimits(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<ElementwiseCaseLimits> symbolizeEnum<ElementwiseCaseLimits>(::llvm::StringRef str) {
|
|
return symbolizeElementwiseCaseLimits(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::ElementwiseCaseLimits, ::mlir::linalg::ElementwiseCaseLimits> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::ElementwiseCaseLimits> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: ");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::ElementwiseCaseLimits> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::ElementwiseCaseLimits>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [LastUnary, LastBinary, LastTernary] for allowed 32-bit signless integer cases: , got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::ElementwiseCaseLimits>, std::optional<::mlir::linalg::ElementwiseCaseLimits>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::ElementwiseCaseLimits>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"LastUnary", "LastBinary", "LastTernary"})))
|
|
return std::optional<::mlir::linalg::ElementwiseCaseLimits>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::ElementwiseCaseLimits> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::ElementwiseCaseLimits>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [LastUnary, LastBinary, LastTernary] for allowed 32-bit signless integer cases: , got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::ElementwiseCaseLimits value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::ElementwiseCaseLimits> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::ElementwiseCaseLimits &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::ElementwiseCaseLimits &lhs, const ::mlir::linalg::ElementwiseCaseLimits &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
|
|
enum class ElementwiseKind : uint32_t {
|
|
exp = 0,
|
|
log = 1,
|
|
abs = 2,
|
|
ceil = 3,
|
|
floor = 4,
|
|
negf = 5,
|
|
reciprocal = 6,
|
|
round = 7,
|
|
sqrt = 8,
|
|
rsqrt = 9,
|
|
square = 10,
|
|
tanh = 11,
|
|
erf = 12,
|
|
sin = 13,
|
|
cos = 14,
|
|
tan = 15,
|
|
acos = 16,
|
|
acosh = 17,
|
|
asin = 18,
|
|
asinh = 19,
|
|
atan = 20,
|
|
atanh = 21,
|
|
log10 = 22,
|
|
log1p = 23,
|
|
log2 = 24,
|
|
add = 25,
|
|
sub = 26,
|
|
mul = 27,
|
|
div = 28,
|
|
div_unsigned = 29,
|
|
max_signed = 30,
|
|
min_signed = 31,
|
|
max_unsigned = 32,
|
|
min_unsigned = 33,
|
|
powf = 34,
|
|
select = 35,
|
|
};
|
|
|
|
::std::optional<ElementwiseKind> symbolizeElementwiseKind(uint32_t);
|
|
::llvm::StringRef stringifyElementwiseKind(ElementwiseKind);
|
|
::std::optional<ElementwiseKind> symbolizeElementwiseKind(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForElementwiseKind() {
|
|
return 35;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(ElementwiseKind enumValue) {
|
|
return stringifyElementwiseKind(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<ElementwiseKind> symbolizeEnum<ElementwiseKind>(::llvm::StringRef str) {
|
|
return symbolizeElementwiseKind(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::ElementwiseKind, ::mlir::linalg::ElementwiseKind> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::ElementwiseKind> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::ElementwiseKind> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::ElementwiseKind>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [exp, log, abs, ceil, floor, negf, reciprocal, round, sqrt, rsqrt, square, tanh, erf, sin, cos, tan, acos, acosh, asin, asinh, atan, atanh, log10, log1p, log2, add, sub, mul, div, div_unsigned, max_signed, min_signed, max_unsigned, min_unsigned, powf, select] for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::ElementwiseKind>, std::optional<::mlir::linalg::ElementwiseKind>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::ElementwiseKind>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"exp", "log", "abs", "ceil", "floor", "negf", "reciprocal", "round", "sqrt", "rsqrt", "square", "tanh", "erf", "sin", "cos", "tan", "acos", "acosh", "asin", "asinh", "atan", "atanh", "log10", "log1p", "log2", "add", "sub", "mul", "div", "div_unsigned", "max_signed", "min_signed", "max_unsigned", "min_unsigned", "powf", "select"})))
|
|
return std::optional<::mlir::linalg::ElementwiseKind>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::ElementwiseKind> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::ElementwiseKind>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [exp, log, abs, ceil, floor, negf, reciprocal, round, sqrt, rsqrt, square, tanh, erf, sin, cos, tan, acos, acosh, asin, asinh, atan, atanh, log10, log1p, log2, add, sub, mul, div, div_unsigned, max_signed, min_signed, max_unsigned, min_unsigned, powf, select] for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::ElementwiseKind value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::ElementwiseKind> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::ElementwiseKind &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::ElementwiseKind &lhs, const ::mlir::linalg::ElementwiseKind &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 0
|
|
enum class TernaryFn : uint32_t {
|
|
select = 0,
|
|
};
|
|
|
|
::std::optional<TernaryFn> symbolizeTernaryFn(uint32_t);
|
|
::llvm::StringRef stringifyTernaryFn(TernaryFn);
|
|
::std::optional<TernaryFn> symbolizeTernaryFn(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForTernaryFn() {
|
|
return 0;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(TernaryFn enumValue) {
|
|
return stringifyTernaryFn(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<TernaryFn> symbolizeEnum<TernaryFn>(::llvm::StringRef str) {
|
|
return symbolizeTernaryFn(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::TernaryFn, ::mlir::linalg::TernaryFn> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::TernaryFn> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::TernaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::TernaryFn>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [select] for allowed 32-bit signless integer cases: 0, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::TernaryFn>, std::optional<::mlir::linalg::TernaryFn>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::TernaryFn>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"select"})))
|
|
return std::optional<::mlir::linalg::TernaryFn>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::TernaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::TernaryFn>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [select] for allowed 32-bit signless integer cases: 0, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::TernaryFn value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::TernaryFn> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::TernaryFn &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::TernaryFn &lhs, const ::mlir::linalg::TernaryFn &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 0, 1
|
|
enum class TypeFn : uint32_t {
|
|
cast_signed = 0,
|
|
cast_unsigned = 1,
|
|
};
|
|
|
|
::std::optional<TypeFn> symbolizeTypeFn(uint32_t);
|
|
::llvm::StringRef stringifyTypeFn(TypeFn);
|
|
::std::optional<TypeFn> symbolizeTypeFn(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForTypeFn() {
|
|
return 1;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(TypeFn enumValue) {
|
|
return stringifyTypeFn(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<TypeFn> symbolizeEnum<TypeFn>(::llvm::StringRef str) {
|
|
return symbolizeTypeFn(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::TypeFn, ::mlir::linalg::TypeFn> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::TypeFn> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::TypeFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::TypeFn>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [cast_signed, cast_unsigned] for allowed 32-bit signless integer cases: 0, 1, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::TypeFn>, std::optional<::mlir::linalg::TypeFn>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::TypeFn>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"cast_signed", "cast_unsigned"})))
|
|
return std::optional<::mlir::linalg::TypeFn>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::TypeFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::TypeFn>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [cast_signed, cast_unsigned] for allowed 32-bit signless integer cases: 0, 1, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::TypeFn value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::TypeFn> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::TypeFn &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::TypeFn &lhs, const ::mlir::linalg::TypeFn &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
|
|
enum class UnaryFn : uint32_t {
|
|
exp = 0,
|
|
log = 1,
|
|
abs = 2,
|
|
ceil = 3,
|
|
floor = 4,
|
|
negf = 5,
|
|
reciprocal = 6,
|
|
round = 7,
|
|
sqrt = 8,
|
|
rsqrt = 9,
|
|
square = 10,
|
|
tanh = 11,
|
|
erf = 12,
|
|
sin = 13,
|
|
cos = 14,
|
|
tan = 15,
|
|
acos = 16,
|
|
acosh = 17,
|
|
asin = 18,
|
|
asinh = 19,
|
|
atan = 20,
|
|
atanh = 21,
|
|
log10 = 22,
|
|
log1p = 23,
|
|
log2 = 24,
|
|
};
|
|
|
|
::std::optional<UnaryFn> symbolizeUnaryFn(uint32_t);
|
|
::llvm::StringRef stringifyUnaryFn(UnaryFn);
|
|
::std::optional<UnaryFn> symbolizeUnaryFn(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForUnaryFn() {
|
|
return 24;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(UnaryFn enumValue) {
|
|
return stringifyUnaryFn(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<UnaryFn> symbolizeEnum<UnaryFn>(::llvm::StringRef str) {
|
|
return symbolizeUnaryFn(str);
|
|
}
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<::mlir::linalg::UnaryFn, ::mlir::linalg::UnaryFn> {
|
|
template <typename ParserT>
|
|
static FailureOr<::mlir::linalg::UnaryFn> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::UnaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::UnaryFn>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [exp, log, abs, ceil, floor, negf, reciprocal, round, sqrt, rsqrt, square, tanh, erf, sin, cos, tan, acos, acosh, asin, asinh, atan, atanh, log10, log1p, log2] for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<::mlir::linalg::UnaryFn>, std::optional<::mlir::linalg::UnaryFn>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<::mlir::linalg::UnaryFn>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"exp", "log", "abs", "ceil", "floor", "negf", "reciprocal", "round", "sqrt", "rsqrt", "square", "tanh", "erf", "sin", "cos", "tan", "acos", "acosh", "asin", "asinh", "atan", "atanh", "log10", "log1p", "log2"})))
|
|
return std::optional<::mlir::linalg::UnaryFn>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<::mlir::linalg::UnaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::UnaryFn>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [exp, log, abs, ceil, floor, negf, reciprocal, round, sqrt, rsqrt, square, tanh, erf, sin, cos, tan, acos, acosh, asin, asinh, atan, atanh, log10, log1p, log2] for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::UnaryFn value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<::mlir::linalg::UnaryFn> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const ::mlir::linalg::UnaryFn &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const ::mlir::linalg::UnaryFn &lhs, const ::mlir::linalg::UnaryFn &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|
|
namespace mlir::linalg {
|
|
|
|
// allowed 32-bit signless integer cases: 0, 1, 2
|
|
enum class WinogradConv2DFmr : uint32_t {
|
|
F_2_3 = 0,
|
|
F_4_3 = 1,
|
|
F_2_5 = 2,
|
|
};
|
|
|
|
::std::optional<WinogradConv2DFmr> symbolizeWinogradConv2DFmr(uint32_t);
|
|
::llvm::StringRef stringifyWinogradConv2DFmr(WinogradConv2DFmr);
|
|
::std::optional<WinogradConv2DFmr> symbolizeWinogradConv2DFmr(::llvm::StringRef);
|
|
inline constexpr unsigned getMaxEnumValForWinogradConv2DFmr() {
|
|
return 2;
|
|
}
|
|
|
|
|
|
inline ::llvm::StringRef stringifyEnum(WinogradConv2DFmr enumValue) {
|
|
return stringifyWinogradConv2DFmr(enumValue);
|
|
}
|
|
|
|
template <typename EnumType>
|
|
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
|
|
|
|
template <>
|
|
inline ::std::optional<WinogradConv2DFmr> symbolizeEnum<WinogradConv2DFmr>(::llvm::StringRef str) {
|
|
return symbolizeWinogradConv2DFmr(str);
|
|
}
|
|
|
|
class WinogradConv2DFmrAttr : public ::mlir::IntegerAttr {
|
|
public:
|
|
using ValueType = WinogradConv2DFmr;
|
|
using ::mlir::IntegerAttr::IntegerAttr;
|
|
static bool classof(::mlir::Attribute attr);
|
|
static WinogradConv2DFmrAttr get(::mlir::MLIRContext *context, WinogradConv2DFmr val);
|
|
WinogradConv2DFmr getValue() const;
|
|
};
|
|
|
|
} // namespace mlir::linalg
|
|
|
|
namespace mlir {
|
|
template <typename T, typename>
|
|
struct FieldParser;
|
|
|
|
template<>
|
|
struct FieldParser<mlir::linalg::WinogradConv2DFmr, mlir::linalg::WinogradConv2DFmr> {
|
|
template <typename ParserT>
|
|
static FailureOr<mlir::linalg::WinogradConv2DFmr> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
|
|
return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1, 2");
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<mlir::linalg::WinogradConv2DFmr> attr = mlir::linalg::symbolizeEnum<mlir::linalg::WinogradConv2DFmr>(enumKeyword))
|
|
return *attr;
|
|
return parser.emitError(loc, "expected one of [F_2_3, F_4_3, F_2_5] for allowed 32-bit signless integer cases: 0, 1, 2, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
|
|
/// Support for std::optional, useful in attribute/type definition where the enum is
|
|
/// used as:
|
|
///
|
|
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
|
|
template<>
|
|
struct FieldParser<std::optional<mlir::linalg::WinogradConv2DFmr>, std::optional<mlir::linalg::WinogradConv2DFmr>> {
|
|
template <typename ParserT>
|
|
static FailureOr<std::optional<mlir::linalg::WinogradConv2DFmr>> parse(ParserT &parser) {
|
|
// Parse the keyword/string containing the enum.
|
|
std::string enumKeyword;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"F_2_3", "F_4_3", "F_2_5"})))
|
|
return std::optional<mlir::linalg::WinogradConv2DFmr>{};
|
|
|
|
// Symbolize the keyword.
|
|
if (::std::optional<mlir::linalg::WinogradConv2DFmr> attr = mlir::linalg::symbolizeEnum<mlir::linalg::WinogradConv2DFmr>(enumKeyword))
|
|
return attr;
|
|
return parser.emitError(loc, "expected one of [F_2_3, F_4_3, F_2_5] for allowed 32-bit signless integer cases: 0, 1, 2, got: ") << enumKeyword;
|
|
}
|
|
};
|
|
} // namespace mlir
|
|
|
|
namespace llvm {
|
|
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, mlir::linalg::WinogradConv2DFmr value) {
|
|
auto valueStr = stringifyEnum(value);
|
|
return p << valueStr;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace llvm {
|
|
template<> struct DenseMapInfo<mlir::linalg::WinogradConv2DFmr> {
|
|
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
|
|
|
|
static unsigned getHashValue(const mlir::linalg::WinogradConv2DFmr &val) {
|
|
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
|
|
}
|
|
|
|
static bool isEqual(const mlir::linalg::WinogradConv2DFmr &lhs, const mlir::linalg::WinogradConv2DFmr &rhs) {
|
|
return lhs == rhs;
|
|
}
|
|
};
|
|
}
|
|
|