18#include "llvm/ADT/STLExtras.h"
19#include "llvm/ADT/TypeSwitch.h"
20#include "llvm/Support/ErrorHandling.h"
36class TypeExtensionVisitor {
39 std::optional<StorageClass> storage)
40 : extensions(extensions), storage(storage) {}
44 void add(SPIRVType type) {
49 .Case<CooperativeMatrixType, PointerType, ScalarType, TensorArmType>(
50 [
this](
auto concreteType) { addConcrete(concreteType); })
51 .Case<ArrayType, ImageType, MatrixType, RuntimeArrayType, VectorType>(
52 [
this](
auto concreteType) {
add(concreteType.getElementType()); })
53 .Case([
this](SampledImageType concreteType) {
56 .Case([
this](StructType concreteType) {
60 .DefaultUnreachable(
"Unhandled type");
63 void add(Type type) {
add(cast<SPIRVType>(type)); }
67 void addConcrete(CooperativeMatrixType type);
68 void addConcrete(PointerType type);
69 void addConcrete(ScalarType type);
70 void addConcrete(TensorArmType type);
73 std::optional<StorageClass> storage;
74 llvm::SmallDenseSet<std::pair<Type, std::optional<StorageClass>>> seen;
84class TypeCapabilityVisitor {
87 std::optional<StorageClass> storage)
88 : capabilities(capabilities), storage(storage) {}
92 void add(SPIRVType type) {
97 .Case<CooperativeMatrixType, ImageType, MatrixType, PointerType,
98 RuntimeArrayType, ScalarType, TensorArmType, VectorType>(
99 [
this](
auto concreteType) { addConcrete(concreteType); })
100 .Case([
this](ArrayType concreteType) {
103 .Case([
this](SampledImageType concreteType) {
106 .Case([
this](StructType concreteType) {
110 .DefaultUnreachable(
"Unhandled type");
113 void add(Type type) {
add(cast<SPIRVType>(type)); }
117 void addConcrete(CooperativeMatrixType type);
118 void addConcrete(ImageType type);
119 void addConcrete(MatrixType type);
120 void addConcrete(PointerType type);
121 void addConcrete(RuntimeArrayType type);
122 void addConcrete(ScalarType type);
123 void addConcrete(TensorArmType type);
124 void addConcrete(VectorType type);
127 std::optional<StorageClass> storage;
128 llvm::SmallDenseSet<std::pair<Type, std::optional<StorageClass>>> seen;
138 using KeyTy = std::tuple<Type, unsigned, unsigned>;
159 assert(elementCount &&
"ArrayType needs at least one element");
166 assert(elementCount &&
"ArrayType needs at least one element");
181 if (
auto vectorType = dyn_cast<VectorType>(type))
189 return type.getRank() == 1 &&
190 llvm::is_contained({2, 3, 4, 8, 16}, type.getNumElements()) &&
191 isa<ScalarType>(type.getElementType());
197 TensorArmType>([](
auto type) {
return type.getElementType(); })
200 .DefaultUnreachable(
"Invalid composite type");
206 [](
auto type) {
return type.getNumElements(); })
208 .DefaultUnreachable(
"Invalid type for number of elements query");
212 return !isa<CooperativeMatrixType, RuntimeArrayType>(*
this);
215void TypeCapabilityVisitor::addConcrete(VectorType type) {
216 add(type.getElementType());
218 int64_t vecSize = type.getNumElements();
219 if (vecSize == 8 || vecSize == 16) {
220 static constexpr auto cap = Capability::Vector16;
221 capabilities.push_back(cap);
244 std::tuple<Type, int64_t, int64_t, Scope, CooperativeMatrixUseKHR>;
258 shape({std::get<1>(key), std::get<2>(key)}), scope(std::get<3>(key)),
259 use(std::get<4>(key)) {}
265 CooperativeMatrixUseKHR
use;
270 uint32_t columns, Scope scope,
271 CooperativeMatrixUseKHR use) {
282 return static_cast<uint32_t
>(
getImpl()->shape[0]);
287 return static_cast<uint32_t
>(
getImpl()->shape[1]);
302 static constexpr auto ext = Extension::SPV_KHR_cooperative_matrix;
303 extensions.push_back(ext);
308 static constexpr auto caps = Capability::CooperativeMatrixKHR;
309 capabilities.push_back(caps);
322 static_assert((1 << 3) > getMaxEnumValForDim(),
323 "Not enough bits to encode Dim value");
328 static_assert((1 << 2) > getMaxEnumValForImageDepthInfo(),
329 "Not enough bits to encode ImageDepthInfo value");
334 static_assert((1 << 1) > getMaxEnumValForImageArrayedInfo(),
335 "Not enough bits to encode ImageArrayedInfo value");
340 static_assert((1 << 1) > getMaxEnumValForImageSamplingInfo(),
341 "Not enough bits to encode ImageSamplingInfo value");
346 static_assert((1 << 2) > getMaxEnumValForImageSamplerUseInfo(),
347 "Not enough bits to encode ImageSamplerUseInfo value");
352 static_assert((1 << 6) > getMaxEnumValForImageFormat(),
353 "Not enough bits to encode ImageFormat value");
359 using KeyTy = std::tuple<
Type, Dim, ImageDepthInfo, ImageArrayedInfo,
360 ImageSamplingInfo, ImageSamplerUseInfo, ImageFormat>;
389 ImageSamplingInfo, ImageSamplerUseInfo, ImageFormat>
405 return getImpl()->samplingInfo;
409 return getImpl()->samplerUseInfo;
414void TypeCapabilityVisitor::addConcrete(
ImageType type) {
415 if (
auto dimCaps = spirv::getCapabilities(type.
getDim()))
416 capabilities.push_back(*dimCaps);
419 capabilities.push_back(*fmtCaps);
431 using KeyTy = std::pair<Type, StorageClass>;
457 return getImpl()->storageClass;
460void TypeExtensionVisitor::addConcrete(
PointerType type) {
463 std::optional<StorageClass> oldStorageClass = storage;
466 storage = oldStorageClass;
469 extensions.push_back(*scExts);
472void TypeCapabilityVisitor::addConcrete(
PointerType type) {
475 std::optional<StorageClass> oldStorageClass = storage;
478 storage = oldStorageClass;
481 capabilities.push_back(*scCaps);
489 using KeyTy = std::pair<Type, unsigned>;
522 static constexpr auto cap = Capability::Shader;
523 capabilities.push_back(cap);
531 if (
auto floatType = dyn_cast<FloatType>(type)) {
534 if (
auto intType = dyn_cast<IntegerType>(type)) {
541 return llvm::is_contained({16u, 32u, 64u}, type.getWidth());
545 return llvm::is_contained({1u, 8u, 16u, 32u, 64u}, type.getWidth());
548void TypeExtensionVisitor::addConcrete(
ScalarType type) {
549 if (isa<BFloat16Type>(type)) {
550 static constexpr auto ext = Extension::SPV_KHR_bfloat16;
551 extensions.push_back(ext);
561 case StorageClass::PushConstant:
562 case StorageClass::StorageBuffer:
563 case StorageClass::Uniform:
565 static constexpr auto ext = Extension::SPV_KHR_8bit_storage;
566 extensions.push_back(ext);
569 case StorageClass::Input:
570 case StorageClass::Output:
572 static constexpr auto ext = Extension::SPV_KHR_16bit_storage;
573 extensions.push_back(ext);
581void TypeCapabilityVisitor::addConcrete(
ScalarType type) {
588#define STORAGE_CASE(storage, cap8, cap16) \
589 case StorageClass::storage: { \
590 if (bitwidth == 8) { \
591 static constexpr auto cap = Capability::cap8; \
592 capabilities.push_back(cap); \
595 if (bitwidth == 16) { \
596 static constexpr auto cap = Capability::cap16; \
597 capabilities.push_back(cap); \
608 STORAGE_CASE(PushConstant, StoragePushConstant8, StoragePushConstant16);
610 StorageBuffer16BitAccess);
613 case StorageClass::Input:
614 case StorageClass::Output: {
615 if (bitwidth == 16) {
616 static constexpr auto cap = Capability::StorageInputOutput16;
617 capabilities.push_back(cap);
631#define WIDTH_CASE(type, width) \
633 static constexpr auto cap = Capability::type##width; \
634 capabilities.push_back(cap); \
637 if (
auto intType = dyn_cast<IntegerType>(type)) {
646 llvm_unreachable(
"invalid bitwidth to getCapabilities");
649 assert(isa<FloatType>(type));
652 if (isa<BFloat16Type>(type)) {
653 static constexpr auto cap = Capability::BFloat16TypeKHR;
654 capabilities.push_back(cap);
656 static constexpr auto cap = Capability::Float16;
657 capabilities.push_back(cap);
665 llvm_unreachable(
"invalid bitwidth to getCapabilities");
680 if (isa<ScalarType>(type))
682 if (
auto vectorType = dyn_cast<VectorType>(type))
684 if (
auto tensorArmType = dyn_cast<TensorArmType>(type))
685 return isa<ScalarType>(tensorArmType.getElementType());
694 std::optional<StorageClass> storage) {
695 TypeExtensionVisitor{extensions, storage}.add(*
this);
700 std::optional<StorageClass> storage) {
701 TypeCapabilityVisitor{capabilities, storage}.add(*
this);
706 .Case([](
ScalarType type) -> std::optional<int64_t> {
719 .Case([](
ArrayType type) -> std::optional<int64_t> {
722 auto elementType = cast<SPIRVType>(type.getElementType());
723 if (std::optional<int64_t> size = elementType.getSizeInBytes())
724 return (*size + type.getArrayStride()) * type.getNumElements();
727 .Case<VectorType, TensorArmType>([](
auto type) -> std::optional<int64_t> {
728 if (std::optional<int64_t> elementSize =
729 cast<ScalarType>(type.getElementType()).getSizeInBytes())
730 return *elementSize * type.getNumElements();
733 .Default(std::nullopt);
770 auto image = dyn_cast<ImageType>(imageType);
772 return emitError() <<
"expected image type";
777 if (llvm::is_contained({Dim::SubpassData, Dim::Buffer}, image.getDim()))
778 return emitError() <<
"Dim must not be SubpassData or Buffer";
871 StringRef keyIdentifier = std::get<0>(key);
873 if (!keyIdentifier.empty()) {
885 const Type *typesList =
nullptr;
886 if (!keyTypes.empty()) {
887 typesList = allocator.
copyInto(keyTypes).data();
891 if (!std::get<2>(key).empty()) {
893 assert(keyOffsetInfo.size() == keyTypes.size() &&
894 "size of offset information must be same as the size of number of "
896 offsetInfoList = allocator.
copyInto(keyOffsetInfo).data();
901 if (!std::get<3>(key).empty()) {
902 auto keyMemberDecorations = std::get<3>(key);
904 memberDecorationList = allocator.
copyInto(keyMemberDecorations).data();
909 if (!std::get<4>(key).empty()) {
910 auto keyStructDecorations = std::get<4>(key);
912 structDecorationList = allocator.
copyInto(keyStructDecorations).data();
977 if (!structMemberTypes.empty())
979 allocator.
copyInto(structMemberTypes).data());
981 if (!structOffsetInfo.empty()) {
982 assert(structOffsetInfo.size() == structMemberTypes.size() &&
983 "size of offset information must be same as the size of number of "
988 if (!structMemberDecorationInfo.empty()) {
991 allocator.
copyInto(structMemberDecorationInfo).data();
994 if (!structDecorationInfo.empty()) {
1017 assert(!memberTypes.empty() &&
"Struct needs at least one member type");
1021 llvm::array_pod_sort(sortedMemberDecorations.begin(),
1022 sortedMemberDecorations.end());
1025 llvm::array_pod_sort(sortedStructDecorations.begin(),
1026 sortedStructDecorations.end());
1028 return Base::get(memberTypes.vec().front().getContext(),
1029 StringRef(), memberTypes, offsetInfo,
1030 sortedMemberDecorations, sortedStructDecorations);
1034 StringRef identifier) {
1035 assert(!identifier.empty() &&
1036 "StructType identifier must be non-empty string");
1057 return newStructType;
1068 return getImpl()->memberTypesAndIsBodySet.getPointer()[
index];
1080 getImpl()->getStructDecorationsInfo())
1081 if (info.decoration == decoration)
1095 memberDecorations.clear();
1096 auto implMemberDecorations =
getImpl()->getMemberDecorationsInfo();
1097 memberDecorations.append(implMemberDecorations.begin(),
1098 implMemberDecorations.end());
1105 auto memberDecorations =
getImpl()->getMemberDecorationsInfo();
1106 decorationsInfo.clear();
1107 for (
const auto &memberDecoration : memberDecorations) {
1108 if (memberDecoration.memberIndex ==
index) {
1109 decorationsInfo.push_back(memberDecoration);
1111 if (memberDecoration.memberIndex >
index) {
1121 structDecorations.clear();
1122 auto implDecorations =
getImpl()->getStructDecorationsInfo();
1123 structDecorations.append(implDecorations.begin(), implDecorations.end());
1131 return Base::mutate(memberTypes, offsetInfo, memberDecorations,
1137 return llvm::hash_combine(memberDecorationInfo.
memberIndex,
1143 return llvm::hash_value(structDecorationInfo.
decoration);
1154 using KeyTy = std::tuple<Type, uint32_t>;
1177 Type columnType, uint32_t columnCount) {
1184 Type columnType, uint32_t columnCount) {
1185 if (columnCount < 2 || columnCount > 4)
1186 return emitError() <<
"matrix can have 2, 3, or 4 columns only";
1189 return emitError() <<
"matrix columns must be vectors of floats";
1193 if (columnShape.size() != 1)
1194 return emitError() <<
"matrix columns must be 1D vectors";
1196 if (columnShape[0] < 2 || columnShape[0] > 4)
1197 return emitError() <<
"matrix columns must be of size 2, 3, or 4";
1204 if (
auto vectorType = dyn_cast<VectorType>(columnType)) {
1205 if (isa<FloatType>(vectorType.getElementType()))
1214 return cast<VectorType>(
getImpl()->columnType).getElementType();
1220 return cast<VectorType>(
getImpl()->columnType).getShape()[0];
1227void TypeCapabilityVisitor::addConcrete(
MatrixType type) {
1229 static constexpr auto cap = Capability::Matrix;
1230 capabilities.push_back(cap);
1269 Type elementType)
const {
1278 static constexpr auto ext = Extension::SPV_ARM_tensors;
1279 extensions.push_back(ext);
1282void TypeCapabilityVisitor::addConcrete(
TensorArmType type) {
1284 static constexpr auto cap = Capability::TensorsARM;
1285 capabilities.push_back(cap);
1291 if (llvm::is_contained(
shape, 0))
1292 return emitError() <<
"arm.tensor do not support dimensions = 0";
1293 if (llvm::any_of(
shape, [](
int64_t dim) {
return dim < 0; }) &&
1294 llvm::any_of(
shape, [](
int64_t dim) {
return dim > 0; }))
1296 <<
"arm.tensor shape dimensions must be either fully dynamic or "
1305void SPIRVDialect::registerTypes() {
*if copies could not be generated due to yet unimplemented cases *copyInPlacementStart and copyOutPlacementStart in copyPlacementBlock *specify the insertion points where the incoming copies and outgoing should be inserted(the insertion happens right before the *insertion point). Since `begin` can itself be invalidated due to the memref *rewriting done from this method
false
Parses a map_entries map type from a string format back into its numeric value.
constexpr unsigned getNumBits< ImageSamplerUseInfo >()
#define STORAGE_CASE(storage, cap8, cap16)
constexpr unsigned getNumBits< ImageFormat >()
static constexpr unsigned getNumBits()
#define WIDTH_CASE(type, width)
constexpr unsigned getNumBits< ImageArrayedInfo >()
constexpr unsigned getNumBits< ImageSamplingInfo >()
constexpr unsigned getNumBits< Dim >()
constexpr unsigned getNumBits< ImageDepthInfo >()
This class represents a diagnostic that is inflight and set to be reported.
MLIRContext is the top-level object for a collection of MLIR operations.
ArrayRef< T > copyInto(ArrayRef< T > elements)
Copy the specified array of elements into memory managed by our bump pointer allocator.
T * allocate()
Allocate an instance of the provided type.
This class provides an abstraction over the various different ranges of value types.
TypeStorage()
This constructor is used by derived classes as part of the TypeUniquer.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Dialect & getDialect() const
Get the dialect this type is registered to.
MLIRContext * getContext() const
Return the MLIRContext in which this type was uniqued.
bool isIntOrFloat() const
Return true if this is an integer (of any signedness) or a float type.
unsigned getIntOrFloatBitWidth() const
Return the bit width of an integer or a float type, assert failure on other types.
static ConcreteType get(MLIRContext *ctx, Args &&...args)
LogicalResult mutate(Args &&...args)
static ConcreteType getChecked(const Location &loc, Args &&...args)
ImplType * getImpl() const
Type getElementType() const
unsigned getArrayStride() const
Returns the array stride in bytes.
unsigned getNumElements() const
static ArrayType get(Type elementType, unsigned elementCount)
bool hasCompileTimeKnownNumElements() const
Return true if the number of elements is known at compile time and is not implementation dependent.
unsigned getNumElements() const
Return the number of elements of the type.
static bool isValid(VectorType)
Returns true if the given vector type is valid for the SPIR-V dialect.
Type getElementType(unsigned) const
static bool classof(Type type)
Scope getScope() const
Returns the scope of the matrix.
uint32_t getRows() const
Returns the number of rows of the matrix.
uint32_t getColumns() const
Returns the number of columns of the matrix.
static CooperativeMatrixType get(Type elementType, uint32_t rows, uint32_t columns, Scope scope, CooperativeMatrixUseKHR use)
ArrayRef< int64_t > getShape() const
Type getElementType() const
CooperativeMatrixUseKHR getUse() const
Returns the use parameter of the cooperative matrix.
static ImageType get(Type elementType, Dim dim, ImageDepthInfo depth=ImageDepthInfo::DepthUnknown, ImageArrayedInfo arrayed=ImageArrayedInfo::NonArrayed, ImageSamplingInfo samplingInfo=ImageSamplingInfo::SingleSampled, ImageSamplerUseInfo samplerUse=ImageSamplerUseInfo::SamplerUnknown, ImageFormat format=ImageFormat::Unknown)
ImageDepthInfo getDepthInfo() const
ImageArrayedInfo getArrayedInfo() const
ImageFormat getImageFormat() const
ImageSamplerUseInfo getSamplerUseInfo() const
Type getElementType() const
ImageSamplingInfo getSamplingInfo() const
static MatrixType getChecked(function_ref< InFlightDiagnostic()> emitError, Type columnType, uint32_t columnCount)
unsigned getNumElements() const
Returns total number of elements (rows*columns).
static MatrixType get(Type columnType, uint32_t columnCount)
Type getColumnType() const
static LogicalResult verifyInvariants(function_ref< InFlightDiagnostic()> emitError, Type columnType, uint32_t columnCount)
unsigned getNumColumns() const
Returns the number of columns.
static bool isValidColumnType(Type columnType)
Returns true if the matrix elements are vectors of float elements.
Type getElementType() const
Returns the elements' type (i.e, single element type).
unsigned getNumRows() const
Returns the number of rows.
Type getPointeeType() const
StorageClass getStorageClass() const
static PointerType get(Type pointeeType, StorageClass storageClass)
Type getElementType() const
unsigned getArrayStride() const
Returns the array stride in bytes.
static RuntimeArrayType get(Type elementType)
std::optional< int64_t > getSizeInBytes()
Returns the size in bytes for each type.
static bool classof(Type type)
void getCapabilities(CapabilityArrayRefVector &capabilities, std::optional< StorageClass > storage=std::nullopt)
Appends to capabilities the capabilities needed for this type to appear in the given storage class.
SmallVectorImpl< ArrayRef< Capability > > CapabilityArrayRefVector
The capability requirements for each type are following the ((Capability::A OR Extension::B) AND (Cap...
void getExtensions(ExtensionArrayRefVector &extensions, std::optional< StorageClass > storage=std::nullopt)
Appends to extensions the extensions needed for this type to appear in the given storage class.
SmallVectorImpl< ArrayRef< Extension > > ExtensionArrayRefVector
The extension requirements for each type are following the ((Extension::A OR Extension::B) AND (Exten...
static LogicalResult verifyInvariants(function_ref< InFlightDiagnostic()> emitError, Type imageType)
static SampledImageType getChecked(function_ref< InFlightDiagnostic()> emitError, Type imageType)
Type getImageType() const
static SampledImageType get(Type imageType)
static bool classof(Type type)
static bool isValid(FloatType)
Returns true if the given integer type is valid for the SPIR-V dialect.
void getStructDecorations(SmallVectorImpl< StructType::StructDecorationInfo > &structDecorations) const
void getMemberDecorations(SmallVectorImpl< StructType::MemberDecorationInfo > &memberDecorations) const
static StructType getIdentified(MLIRContext *context, StringRef identifier)
Construct an identified StructType.
bool isIdentified() const
Returns true if the StructType is identified.
StringRef getIdentifier() const
For literal structs, return an empty string.
static StructType getEmpty(MLIRContext *context, StringRef identifier="")
Construct a (possibly identified) StructType with no members.
bool hasDecoration(spirv::Decoration decoration) const
Returns true if the struct has a specified decoration.
unsigned getNumElements() const
Type getElementType(unsigned) const
LogicalResult trySetBody(ArrayRef< Type > memberTypes, ArrayRef< OffsetInfo > offsetInfo={}, ArrayRef< MemberDecorationInfo > memberDecorations={}, ArrayRef< StructDecorationInfo > structDecorations={})
Sets the contents of an incomplete identified StructType.
TypeRange getElementTypes() const
static StructType get(ArrayRef< Type > memberTypes, ArrayRef< OffsetInfo > offsetInfo={}, ArrayRef< MemberDecorationInfo > memberDecorations={}, ArrayRef< StructDecorationInfo > structDecorations={})
Construct a literal StructType with at least one member.
uint64_t getMemberOffset(unsigned) const
static LogicalResult verifyInvariants(function_ref< InFlightDiagnostic()> emitError, ArrayRef< int64_t > shape, Type elementType)
Type getElementType() const
static TensorArmType get(ArrayRef< int64_t > shape, Type elementType)
TensorArmType cloneWith(std::optional< ArrayRef< int64_t > > shape, Type elementType) const
ArrayRef< int64_t > getShape() const
llvm::hash_code hash_value(const StructType::MemberDecorationInfo &memberDecorationInfo)
Include the generated interface declarations.
StorageUniquer::StorageAllocator TypeStorageAllocator
This is a utility allocator used to allocate memory for instances of derived Types.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
llvm::TypeSwitch< T, ResultT > TypeSwitch
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
llvm::function_ref< Fn > function_ref
ArrayTypeStorage(const KeyTy &key)
static ArrayTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
std::tuple< Type, unsigned, unsigned > KeyTy
bool operator==(const KeyTy &key) const
CooperativeMatrixTypeStorage(const KeyTy &key)
static CooperativeMatrixTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
CooperativeMatrixUseKHR use
std::array< int64_t, 2 > shape
std::tuple< Type, int64_t, int64_t, Scope, CooperativeMatrixUseKHR > KeyTy
bool operator==(const KeyTy &key) const
std::tuple< Type, Dim, ImageDepthInfo, ImageArrayedInfo, ImageSamplingInfo, ImageSamplerUseInfo, ImageFormat > KeyTy
bool operator==(const KeyTy &key) const
ImageSamplerUseInfo samplerUseInfo
static ImageTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
ImageTypeStorage(const KeyTy &key)
ImageSamplingInfo samplingInfo
ImageArrayedInfo arrayedInfo
const uint32_t columnCount
MatrixTypeStorage(Type columnType, uint32_t columnCount)
bool operator==(const KeyTy &key) const
static MatrixTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
std::tuple< Type, uint32_t > KeyTy
StorageClass storageClass
static PointerTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
PointerTypeStorage(const KeyTy &key)
bool operator==(const KeyTy &key) const
std::pair< Type, StorageClass > KeyTy
RuntimeArrayTypeStorage(const KeyTy &key)
static RuntimeArrayTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
std::pair< Type, unsigned > KeyTy
bool operator==(const KeyTy &key) const
bool operator==(const KeyTy &key) const
static SampledImageTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
SampledImageTypeStorage(const KeyTy &key)
Type storage for SPIR-V structure types:
ArrayRef< StructType::MemberDecorationInfo > getMemberDecorationsInfo() const
StructType::OffsetInfo const * offsetInfo
static StructTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
If the given key contains a non-empty identifier, this method constructs an identified struct and lea...
bool operator==(const KeyTy &key) const
For identified structs, return true if the given key contains the same identifier.
std::tuple< StringRef, ArrayRef< Type >, ArrayRef< StructType::OffsetInfo >, ArrayRef< StructType::MemberDecorationInfo >, ArrayRef< StructType::StructDecorationInfo > > KeyTy
A storage key is divided into 2 parts:
ArrayRef< StructType::OffsetInfo > getOffsetInfo() const
StructTypeStorage(StringRef identifier)
Construct a storage object for an identified struct type.
unsigned numStructDecorations
ArrayRef< StructType::StructDecorationInfo > getStructDecorationsInfo() const
StructType::MemberDecorationInfo const * memberDecorationsInfo
StructTypeStorage(unsigned numMembers, Type const *memberTypes, StructType::OffsetInfo const *layoutInfo, unsigned numMemberDecorations, StructType::MemberDecorationInfo const *memberDecorationsInfo, unsigned numStructDecorations, StructType::StructDecorationInfo const *structDecorationsInfo)
Construct a storage object for a literal struct type.
StructType::StructDecorationInfo const * structDecorationsInfo
llvm::PointerIntPair< Type const *, 1, bool > memberTypesAndIsBodySet
StringRef getIdentifier() const
ArrayRef< Type > getMemberTypes() const
unsigned numMemberDecorations
bool isIdentified() const
LogicalResult mutate(TypeStorageAllocator &allocator, ArrayRef< Type > structMemberTypes, ArrayRef< StructType::OffsetInfo > structOffsetInfo, ArrayRef< StructType::MemberDecorationInfo > structMemberDecorationInfo, ArrayRef< StructType::StructDecorationInfo > structDecorationInfo)
Sets the struct type content for identified structs.
static TensorArmTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
static llvm::hash_code hashKey(const KeyTy &key)
std::tuple< ArrayRef< int64_t >, Type > KeyTy
TensorArmTypeStorage(ArrayRef< int64_t > shape, Type elementType)
bool operator==(const KeyTy &key) const
ArrayRef< int64_t > shape