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

500 lines
17 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Enum Utility Declarations *|
|* *|
|* Automatically generated file, do not edit! *|
|* From: ParallelLoopMapperAttr.td *|
|* *|
\*===----------------------------------------------------------------------===*/
namespace mlir::gpu {
// GPU address space
enum class AddressSpace : uint32_t {
Global = 1,
Workgroup = 2,
Private = 3,
Constant = 4,
};
::std::optional<AddressSpace> symbolizeAddressSpace(uint32_t);
::llvm::StringRef stringifyAddressSpace(AddressSpace);
::std::optional<AddressSpace> symbolizeAddressSpace(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForAddressSpace() {
return 4;
}
inline ::llvm::StringRef stringifyEnum(AddressSpace enumValue) {
return stringifyAddressSpace(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<AddressSpace> symbolizeEnum<AddressSpace>(::llvm::StringRef str) {
return symbolizeAddressSpace(str);
}
} // namespace mlir::gpu
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::gpu::AddressSpace, ::mlir::gpu::AddressSpace> {
template <typename ParserT>
static FailureOr<::mlir::gpu::AddressSpace> 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 GPU address space");
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::AddressSpace> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::AddressSpace>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [global, workgroup, private, constant] for GPU address space, 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::gpu::AddressSpace>, std::optional<::mlir::gpu::AddressSpace>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::gpu::AddressSpace>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"global", "workgroup", "private", "constant"})))
return std::optional<::mlir::gpu::AddressSpace>{};
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::AddressSpace> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::AddressSpace>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [global, workgroup, private, constant] for GPU address space, got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::AddressSpace value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::gpu::AddressSpace> {
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
static unsigned getHashValue(const ::mlir::gpu::AddressSpace &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
static bool isEqual(const ::mlir::gpu::AddressSpace &lhs, const ::mlir::gpu::AddressSpace &rhs) {
return lhs == rhs;
}
};
}
namespace mlir::gpu {
// barrier execution scope
enum class BarrierScope : uint32_t {
Subgroup = 1,
Workgroup = 2,
Cluster = 3,
};
::std::optional<BarrierScope> symbolizeBarrierScope(uint32_t);
::llvm::StringRef stringifyBarrierScope(BarrierScope);
::std::optional<BarrierScope> symbolizeBarrierScope(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForBarrierScope() {
return 3;
}
inline ::llvm::StringRef stringifyEnum(BarrierScope enumValue) {
return stringifyBarrierScope(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<BarrierScope> symbolizeEnum<BarrierScope>(::llvm::StringRef str) {
return symbolizeBarrierScope(str);
}
} // namespace mlir::gpu
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::gpu::BarrierScope, ::mlir::gpu::BarrierScope> {
template <typename ParserT>
static FailureOr<::mlir::gpu::BarrierScope> 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 barrier execution scope");
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::BarrierScope> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::BarrierScope>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [subgroup, workgroup, cluster] for barrier execution scope, 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::gpu::BarrierScope>, std::optional<::mlir::gpu::BarrierScope>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::gpu::BarrierScope>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"subgroup", "workgroup", "cluster"})))
return std::optional<::mlir::gpu::BarrierScope>{};
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::BarrierScope> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::BarrierScope>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [subgroup, workgroup, cluster] for barrier execution scope, got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::BarrierScope value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::gpu::BarrierScope> {
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
static unsigned getHashValue(const ::mlir::gpu::BarrierScope &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
static bool isEqual(const ::mlir::gpu::BarrierScope &lhs, const ::mlir::gpu::BarrierScope &rhs) {
return lhs == rhs;
}
};
}
namespace mlir::gpu {
// a dimension, either 'x', 'y', or 'z'
enum class Dimension : uint32_t {
x = 0,
y = 1,
z = 2,
};
::std::optional<Dimension> symbolizeDimension(uint32_t);
::llvm::StringRef stringifyDimension(Dimension);
::std::optional<Dimension> symbolizeDimension(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForDimension() {
return 2;
}
inline ::llvm::StringRef stringifyEnum(Dimension enumValue) {
return stringifyDimension(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<Dimension> symbolizeEnum<Dimension>(::llvm::StringRef str) {
return symbolizeDimension(str);
}
} // namespace mlir::gpu
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::gpu::Dimension, ::mlir::gpu::Dimension> {
template <typename ParserT>
static FailureOr<::mlir::gpu::Dimension> 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 a dimension, either 'x', 'y', or 'z'");
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::Dimension> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Dimension>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [x, y, z] for a dimension, either 'x', 'y', or 'z', 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::gpu::Dimension>, std::optional<::mlir::gpu::Dimension>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::gpu::Dimension>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"x", "y", "z"})))
return std::optional<::mlir::gpu::Dimension>{};
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::Dimension> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Dimension>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [x, y, z] for a dimension, either 'x', 'y', or 'z', got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::Dimension value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::gpu::Dimension> {
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
static unsigned getHashValue(const ::mlir::gpu::Dimension &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
static bool isEqual(const ::mlir::gpu::Dimension &lhs, const ::mlir::gpu::Dimension &rhs) {
return lhs == rhs;
}
};
}
namespace mlir::gpu {
// the possible kinds of launch dimension
enum class DimensionKind : uint32_t {
Other = 0,
Block = 1,
Grid = 2,
Cluster = 3,
};
::std::optional<DimensionKind> symbolizeDimensionKind(uint32_t);
::llvm::StringRef stringifyDimensionKind(DimensionKind);
::std::optional<DimensionKind> symbolizeDimensionKind(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForDimensionKind() {
return 3;
}
inline ::llvm::StringRef stringifyEnum(DimensionKind enumValue) {
return stringifyDimensionKind(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<DimensionKind> symbolizeEnum<DimensionKind>(::llvm::StringRef str) {
return symbolizeDimensionKind(str);
}
} // namespace mlir::gpu
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::gpu::DimensionKind, ::mlir::gpu::DimensionKind> {
template <typename ParserT>
static FailureOr<::mlir::gpu::DimensionKind> 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 the possible kinds of launch dimension");
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::DimensionKind> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::DimensionKind>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [other, block, grid, cluster] for the possible kinds of launch dimension, 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::gpu::DimensionKind>, std::optional<::mlir::gpu::DimensionKind>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::gpu::DimensionKind>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"other", "block", "grid", "cluster"})))
return std::optional<::mlir::gpu::DimensionKind>{};
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::DimensionKind> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::DimensionKind>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [other, block, grid, cluster] for the possible kinds of launch dimension, got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::DimensionKind value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::gpu::DimensionKind> {
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
static unsigned getHashValue(const ::mlir::gpu::DimensionKind &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
static bool isEqual(const ::mlir::gpu::DimensionKind &lhs, const ::mlir::gpu::DimensionKind &rhs) {
return lhs == rhs;
}
};
}
namespace mlir::gpu {
// processor for loop mapping
enum class Processor : uint64_t {
BlockX = 0,
BlockY = 1,
BlockZ = 2,
ThreadX = 3,
ThreadY = 4,
ThreadZ = 5,
Sequential = 6,
};
::std::optional<Processor> symbolizeProcessor(uint64_t);
::llvm::StringRef stringifyProcessor(Processor);
::std::optional<Processor> symbolizeProcessor(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForProcessor() {
return 6;
}
inline ::llvm::StringRef stringifyEnum(Processor enumValue) {
return stringifyProcessor(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<Processor> symbolizeEnum<Processor>(::llvm::StringRef str) {
return symbolizeProcessor(str);
}
class ProcessorAttr : public ::mlir::IntegerAttr {
public:
using ValueType = Processor;
using ::mlir::IntegerAttr::IntegerAttr;
static bool classof(::mlir::Attribute attr);
static ProcessorAttr get(::mlir::MLIRContext *context, Processor val);
Processor getValue() const;
};
} // namespace mlir::gpu
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::gpu::Processor, ::mlir::gpu::Processor> {
template <typename ParserT>
static FailureOr<::mlir::gpu::Processor> 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 processor for loop mapping");
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::Processor> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Processor>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [block_x, block_y, block_z, thread_x, thread_y, thread_z, sequential] for processor for loop mapping, 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::gpu::Processor>, std::optional<::mlir::gpu::Processor>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::gpu::Processor>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"block_x", "block_y", "block_z", "thread_x", "thread_y", "thread_z", "sequential"})))
return std::optional<::mlir::gpu::Processor>{};
// Symbolize the keyword.
if (::std::optional<::mlir::gpu::Processor> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Processor>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [block_x, block_y, block_z, thread_x, thread_y, thread_z, sequential] for processor for loop mapping, got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::Processor value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::gpu::Processor> {
using StorageInfo = ::llvm::DenseMapInfo<uint64_t>;
static unsigned getHashValue(const ::mlir::gpu::Processor &val) {
return StorageInfo::getHashValue(static_cast<uint64_t>(val));
}
static bool isEqual(const ::mlir::gpu::Processor &lhs, const ::mlir::gpu::Processor &rhs) {
return lhs == rhs;
}
};
}