MLIR 23.0.0git
SPIRVTypes.h
Go to the documentation of this file.
1//===- SPIRVTypes.h - MLIR SPIR-V Types -------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the types in the SPIR-V dialect.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DIALECT_SPIRV_IR_SPIRVTYPES_H_
14#define MLIR_DIALECT_SPIRV_IR_SPIRVTYPES_H_
15
19#include "mlir/IR/Diagnostics.h"
20#include "mlir/IR/Location.h"
21#include "mlir/IR/TypeSupport.h"
22#include "mlir/IR/Types.h"
23
24#include <cstdint>
25#include <tuple>
26
27namespace mlir {
28namespace spirv {
29
30namespace detail {
31struct ArrayTypeStorage;
34struct ImageTypeStorage;
40
41} // namespace detail
42
43// Base SPIR-V type for providing availability queries.
44class SPIRVType : public Type {
45public:
46 using Type::Type;
47
48 static bool classof(Type type);
49
50 bool isScalarOrVector();
51
52 /// The extension requirements for each type are following the
53 /// ((Extension::A OR Extension::B) AND (Extension::C OR Extension::D))
54 /// convention.
56
57 /// Appends to `extensions` the extensions needed for this type to appear in
58 /// the given `storage` class. This method does not guarantee the uniqueness
59 /// of extensions; the same extension may be appended multiple times.
61 std::optional<StorageClass> storage = std::nullopt);
62
63 /// The capability requirements for each type are following the
64 /// ((Capability::A OR Extension::B) AND (Capability::C OR Capability::D))
65 /// convention.
67
68 /// Appends to `capabilities` the capabilities needed for this type to appear
69 /// in the given `storage` class. This method does not guarantee the
70 /// uniqueness of capabilities; the same capability may be appended multiple
71 /// times.
73 std::optional<StorageClass> storage = std::nullopt);
74
75 /// Returns the size in bytes for each type. If no size can be calculated,
76 /// returns `std::nullopt`. Note that if the type has explicit layout, it is
77 /// also taken into account in calculation.
78 std::optional<int64_t> getSizeInBytes();
79};
80
81// SPIR-V scalar type: bool type, integer type, floating point type.
82class ScalarType : public SPIRVType {
83public:
84 using SPIRVType::SPIRVType;
85
86 static bool classof(Type type);
87
88 /// Returns true if the given float type is valid for the SPIR-V dialect.
89 static bool isValid(FloatType);
90 /// Returns true if the given integer type is valid for the SPIR-V dialect.
91 static bool isValid(IntegerType);
92};
93
94// SPIR-V composite type: VectorType, SPIR-V ArrayType, SPIR-V
95// StructType, or SPIR-V TensorArmType.
96class CompositeType : public SPIRVType {
97public:
98 using SPIRVType::SPIRVType;
99
100 static bool classof(Type type);
101
102 /// Returns true if the given vector type is valid for the SPIR-V dialect.
103 static bool isValid(VectorType);
104
105 /// Return the number of elements of the type. This should only be called if
106 /// hasCompileTimeKnownNumElements is true.
107 unsigned getNumElements() const;
108
109 Type getElementType(unsigned) const;
110
111 /// Return true if the number of elements is known at compile time and is not
112 /// implementation dependent.
114};
115
116// SPIR-V array type
117class ArrayType : public Type::TypeBase<ArrayType, CompositeType,
118 detail::ArrayTypeStorage> {
119public:
120 using Base::Base;
121
122 static constexpr StringLiteral name = "spirv.array";
123
124 static ArrayType get(Type elementType, unsigned elementCount);
125
126 /// Returns an array type with the given stride in bytes.
127 static ArrayType get(Type elementType, unsigned elementCount,
128 unsigned stride);
129
130 unsigned getNumElements() const;
131
132 Type getElementType() const;
133
134 /// Returns the array stride in bytes. 0 means no stride decorated on this
135 /// type.
136 unsigned getArrayStride() const;
137};
138
139// SPIR-V image type
141 : public Type::TypeBase<ImageType, SPIRVType, detail::ImageTypeStorage> {
142public:
143 using Base::Base;
144
145 static constexpr StringLiteral name = "spirv.image";
146
147 static ImageType
148 get(Type elementType, Dim dim,
149 ImageDepthInfo depth = ImageDepthInfo::DepthUnknown,
150 ImageArrayedInfo arrayed = ImageArrayedInfo::NonArrayed,
151 ImageSamplingInfo samplingInfo = ImageSamplingInfo::SingleSampled,
152 ImageSamplerUseInfo samplerUse = ImageSamplerUseInfo::SamplerUnknown,
153 ImageFormat format = ImageFormat::Unknown) {
154 return ImageType::get(
155 std::tuple<Type, Dim, ImageDepthInfo, ImageArrayedInfo,
156 ImageSamplingInfo, ImageSamplerUseInfo, ImageFormat>(
157 elementType, dim, depth, arrayed, samplingInfo, samplerUse,
158 format));
159 }
160
161 static ImageType
162 get(std::tuple<Type, Dim, ImageDepthInfo, ImageArrayedInfo,
163 ImageSamplingInfo, ImageSamplerUseInfo, ImageFormat>);
164
165 Type getElementType() const;
166 Dim getDim() const;
167 ImageDepthInfo getDepthInfo() const;
168 ImageArrayedInfo getArrayedInfo() const;
169 ImageSamplingInfo getSamplingInfo() const;
170 ImageSamplerUseInfo getSamplerUseInfo() const;
171 ImageFormat getImageFormat() const;
172 // TODO: Add support for Access qualifier
173};
174
175// SPIR-V pointer type
177 : public Type::TypeBase<PointerType, SPIRVType, detail::PointerTypeStorage,
178 VectorElementTypeInterface::Trait> {
179public:
180 using Base::Base;
181
182 static constexpr StringLiteral name = "spirv.pointer";
183
184 static PointerType get(Type pointeeType, StorageClass storageClass);
185
186 Type getPointeeType() const;
187
188 StorageClass getStorageClass() const;
189};
190
191// SPIR-V run-time array type
193 : public Type::TypeBase<RuntimeArrayType, SPIRVType,
194 detail::RuntimeArrayTypeStorage> {
195public:
196 using Base::Base;
197
198 static constexpr StringLiteral name = "spirv.rtarray";
199
200 static RuntimeArrayType get(Type elementType);
201
202 /// Returns a runtime array type with the given stride in bytes.
203 static RuntimeArrayType get(Type elementType, unsigned stride);
204
205 Type getElementType() const;
206
207 /// Returns the array stride in bytes. 0 means no stride decorated on this
208 /// type.
209 unsigned getArrayStride() const;
210};
211
212// SPIR-V sampled image type
214 : public Type::TypeBase<SampledImageType, SPIRVType,
215 detail::SampledImageTypeStorage> {
216public:
217 using Base::Base;
218
219 static constexpr StringLiteral name = "spirv.sampled_image";
220
221 static SampledImageType get(Type imageType);
222
223 static SampledImageType
225
226 static LogicalResult
228 Type imageType);
229
230 Type getImageType() const;
231};
232
233// SPIR-V sampler type
234class SamplerType : public Type::TypeBase<SamplerType, SPIRVType, TypeStorage> {
235public:
236 using Base::Base;
237
238 static constexpr StringLiteral name = "spirv.sampler";
239
240 static SamplerType get(MLIRContext *context);
241};
242
243// SPIR-V named barrier type (OpTypeNamedBarrier)
245 : public Type::TypeBase<NamedBarrierType, SPIRVType, TypeStorage> {
246public:
247 using Base::Base;
248
249 static constexpr StringLiteral name = "spirv.named_barrier";
250
251 static NamedBarrierType get(MLIRContext *context);
252};
253
254/// SPIR-V struct type. Two kinds of struct types are supported:
255/// - Literal: a literal struct type is uniqued by its fields (types + offset
256/// info + decoration info).
257/// - Identified: an indentified struct type is uniqued by its string identifier
258/// (name). This is useful in representing recursive structs. For example, the
259/// following C struct:
260///
261/// struct A {
262/// A* next;
263/// };
264///
265/// would be represented in MLIR as:
266///
267/// !spirv.struct<A, (!spirv.ptr<!spirv.struct<A>, Generic>)>
268///
269/// In the above, expressing recursive struct types is accomplished by giving a
270/// recursive struct a unique identified and using that identifier in the struct
271/// definition for recursive references.
273 : public Type::TypeBase<StructType, CompositeType,
274 detail::StructTypeStorage, TypeTrait::IsMutable> {
275public:
276 using Base::Base;
277
278 // Type for specifying the offset of the struct members
279 using OffsetInfo = uint32_t;
280
281 static constexpr StringLiteral name = "spirv.struct";
282
283 // Type for specifying the decoration(s) on struct members.
284 // If `decorationValue` is UnitAttr then decoration has no
285 // value.
287 uint32_t memberIndex;
288 Decoration decoration;
290
295
297 const MemberDecorationInfo &rhs) {
298 return lhs.memberIndex == rhs.memberIndex &&
299 lhs.decoration == rhs.decoration &&
300 lhs.decorationValue == rhs.decorationValue;
301 }
302
304 const MemberDecorationInfo &rhs) {
305 return std::tuple(lhs.memberIndex, llvm::to_underlying(lhs.decoration)) <
306 std::tuple(rhs.memberIndex, llvm::to_underlying(rhs.decoration));
307 }
308
309 bool hasValue() const { return !isa<UnitAttr>(decorationValue); }
310 };
311
312 // Type for specifying the decoration(s) on the struct itself.
314 Decoration decoration;
316
319
321 const StructDecorationInfo &rhs) {
322 return lhs.decoration == rhs.decoration &&
323 lhs.decorationValue == rhs.decorationValue;
324 }
325
327 const StructDecorationInfo &rhs) {
328 return llvm::to_underlying(lhs.decoration) <
329 llvm::to_underlying(rhs.decoration);
330 }
331
332 bool hasValue() const { return !isa<UnitAttr>(decorationValue); }
333 };
334
335 /// Construct a literal StructType with at least one member.
336 static StructType get(ArrayRef<Type> memberTypes,
337 ArrayRef<OffsetInfo> offsetInfo = {},
338 ArrayRef<MemberDecorationInfo> memberDecorations = {},
339 ArrayRef<StructDecorationInfo> structDecorations = {});
340
341 /// Construct an identified StructType. This creates a StructType whose body
342 /// (member types, offset info, and decorations) is not set yet. A call to
343 /// StructType::trySetBody(...) must follow when the StructType contents are
344 /// available (e.g. parsed or deserialized).
345 ///
346 /// Note: If another thread creates (or had already created) a struct with the
347 /// same identifier, that struct will be returned as a result.
348 static StructType getIdentified(MLIRContext *context, StringRef identifier);
349
350 /// Construct a (possibly identified) StructType with no members.
351 ///
352 /// Note: this method might fail in a multi-threaded setup if another thread
353 /// created an identified struct with the same identifier but with different
354 /// contents before returning. In which case, an empty (default-constructed)
355 /// StructType is returned.
356 static StructType getEmpty(MLIRContext *context, StringRef identifier = "");
357
358 /// For literal structs, return an empty string.
359 /// For identified structs, return the struct's identifier.
360 StringRef getIdentifier() const;
361
362 /// Returns true if the StructType is identified.
363 bool isIdentified() const;
364
365 unsigned getNumElements() const;
366
367 Type getElementType(unsigned) const;
368
370
371 bool hasOffset() const;
372
373 /// Returns true if the struct has a specified decoration.
374 bool hasDecoration(spirv::Decoration decoration) const;
375
376 uint64_t getMemberOffset(unsigned) const;
377
378 // Returns in `memberDecorations` the Decorations (apart from Offset)
379 // associated with all members of the StructType.
380 void getMemberDecorations(SmallVectorImpl<StructType::MemberDecorationInfo>
381 &memberDecorations) const;
382
383 // Returns in `decorationsInfo` all the Decorations (apart from Offset)
384 // associated with the `i`-th member of the StructType.
386 unsigned i,
387 SmallVectorImpl<StructType::MemberDecorationInfo> &decorationsInfo) const;
388
389 // Returns in `structDecorations` the Decorations associated with the
390 // StructType.
391 void getStructDecorations(SmallVectorImpl<StructType::StructDecorationInfo>
392 &structDecorations) const;
393
394 /// Sets the contents of an incomplete identified StructType. This method must
395 /// be called only for identified StructTypes and it must be called only once
396 /// per instance. Otherwise, failure() is returned.
397 LogicalResult
398 trySetBody(ArrayRef<Type> memberTypes, ArrayRef<OffsetInfo> offsetInfo = {},
399 ArrayRef<MemberDecorationInfo> memberDecorations = {},
400 ArrayRef<StructDecorationInfo> structDecorations = {});
401};
402
403llvm::hash_code
404hash_value(const StructType::MemberDecorationInfo &memberDecorationInfo);
405
406llvm::hash_code
407hash_value(const StructType::StructDecorationInfo &structDecorationInfo);
408
409// SPIR-V KHR cooperative matrix type
411 : public Type::TypeBase<CooperativeMatrixType, CompositeType,
412 detail::CooperativeMatrixTypeStorage,
413 ShapedType::Trait> {
414public:
415 using Base::Base;
416
417 static constexpr StringLiteral name = "spirv.coopmatrix";
418
419 static CooperativeMatrixType get(Type elementType, uint32_t rows,
420 uint32_t columns, Scope scope,
421 CooperativeMatrixUseKHR use);
422 Type getElementType() const;
423
424 /// Returns the scope of the matrix.
425 Scope getScope() const;
426 /// Returns the number of rows of the matrix.
427 uint32_t getRows() const;
428 /// Returns the number of columns of the matrix.
429 uint32_t getColumns() const;
430 /// Returns the use parameter of the cooperative matrix.
431 CooperativeMatrixUseKHR getUse() const;
432
433 operator ShapedType() const { return cast<ShapedType>(*this); }
434
436
437 bool hasRank() const { return true; }
438
440 Type elementType) const {
441 if (!shape)
442 return get(elementType, getRows(), getColumns(), getScope(), getUse());
443
444 assert(shape.value().size() == 2);
445 return get(elementType, shape.value()[0], shape.value()[1], getScope(),
446 getUse());
447 }
448};
449
450// SPIR-V matrix type
452 : public Type::TypeBase<MatrixType, CompositeType,
453 detail::MatrixTypeStorage, ShapedType::Trait> {
454public:
455 using Base::Base;
456
457 static constexpr StringLiteral name = "spirv.matrix";
458
459 static MatrixType get(Type columnType, uint32_t columnCount);
460
462 Type columnType, uint32_t columnCount);
463
464 static LogicalResult
466 Type columnType, uint32_t columnCount);
467
468 /// Returns true if the matrix elements are vectors of float elements.
469 static bool isValidColumnType(Type columnType);
470
471 Type getColumnType() const;
472
473 /// Returns the number of rows.
474 unsigned getNumRows() const;
475
476 /// Returns the number of columns.
477 unsigned getNumColumns() const;
478
479 /// Returns total number of elements (rows*columns).
480 unsigned getNumElements() const;
481
482 /// Returns the elements' type (i.e, single element type).
483 Type getElementType() const;
484
485 operator ShapedType() const { return cast<ShapedType>(*this); }
486
488
489 bool hasRank() const { return true; }
490
492 Type elementType) const {
493 if (!shape)
494 return get(elementType, getNumColumns());
495
496 assert(shape.value().size() == 2);
497
498 auto vectorType = cast<VectorType>(elementType);
499 Type newElementType =
500 vectorType.cloneWith({shape.value()[0]}, vectorType.getElementType());
501
502 return get(newElementType, shape.value()[1]);
503 }
504};
505
506/// SPIR-V TensorARM Type
508 : public Type::TypeBase<TensorArmType, CompositeType,
509 detail::TensorArmTypeStorage, ShapedType::Trait> {
510public:
511 using Base::Base;
512
513 using ShapedTypeTraits = ShapedType::Trait<TensorArmType>;
514 using ShapedTypeTraits::getDimSize;
515 using ShapedTypeTraits::getDynamicDimIndex;
516 using ShapedTypeTraits::getElementTypeBitWidth;
517 using ShapedTypeTraits::getNumDynamicDims;
518 using ShapedTypeTraits::getNumElements;
519 using ShapedTypeTraits::getRank;
520 using ShapedTypeTraits::hasStaticShape;
521 using ShapedTypeTraits::isDynamicDim;
522
523 static constexpr StringLiteral name = "spirv.arm.tensor";
524
525 // TensorArm supports minimum rank of 1, hence an empty shape here means
526 // unranked.
527 static TensorArmType get(ArrayRef<int64_t> shape, Type elementType);
529 Type elementType) const;
530
531 static LogicalResult
533 ArrayRef<int64_t> shape, Type elementType);
534
535 Type getElementType() const;
537 bool hasRank() const { return !getShape().empty(); }
538 operator ShapedType() const { return cast<ShapedType>(*this); }
539};
540
541} // namespace spirv
542} // namespace mlir
543
544#endif // MLIR_DIALECT_SPIRV_IR_SPIRVTYPES_H_
lhs
Attributes are known-constant values of operations.
Definition Attributes.h:25
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.
Definition MLIRContext.h:63
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
constexpr Type()=default
detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... > TypeBase
Utility class for implementing types.
Definition Types.h:79
StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... > Base
Type getElementType() const
unsigned getArrayStride() const
Returns the array stride in bytes.
unsigned getNumElements() const
static ArrayType get(Type elementType, unsigned elementCount)
static constexpr StringLiteral name
Definition SPIRVTypes.h:122
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)
CooperativeMatrixType cloneWith(std::optional< ArrayRef< int64_t > > shape, Type elementType) const
Definition SPIRVTypes.h:439
static constexpr StringLiteral name
Definition SPIRVTypes.h:417
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
CooperativeMatrixUseKHR getUse() const
Returns the use parameter of the cooperative matrix.
static constexpr StringLiteral name
Definition SPIRVTypes.h:145
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)
Definition SPIRVTypes.h:148
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)
static LogicalResult verifyInvariants(function_ref< InFlightDiagnostic()> emitError, Type columnType, uint32_t columnCount)
unsigned getNumColumns() const
Returns the number of columns.
MatrixType cloneWith(std::optional< ArrayRef< int64_t > > shape, Type elementType) const
Definition SPIRVTypes.h:491
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).
ArrayRef< int64_t > getShape() const
static constexpr StringLiteral name
Definition SPIRVTypes.h:457
unsigned getNumRows() const
Returns the number of rows.
static NamedBarrierType get(MLIRContext *context)
static constexpr StringLiteral name
Definition SPIRVTypes.h:249
static constexpr StringLiteral name
Definition SPIRVTypes.h:182
StorageClass getStorageClass() const
static PointerType get(Type pointeeType, StorageClass storageClass)
static constexpr StringLiteral name
Definition SPIRVTypes.h:198
unsigned getArrayStride() const
Returns the array stride in bytes.
static RuntimeArrayType get(Type elementType)
constexpr Type()=default
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...
Definition SPIRVTypes.h:66
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...
Definition SPIRVTypes.h:55
static LogicalResult verifyInvariants(function_ref< InFlightDiagnostic()> emitError, Type imageType)
static constexpr StringLiteral name
Definition SPIRVTypes.h:219
static SampledImageType getChecked(function_ref< InFlightDiagnostic()> emitError, Type imageType)
static SampledImageType get(Type imageType)
static SamplerType get(MLIRContext *context)
static constexpr StringLiteral name
Definition SPIRVTypes.h:238
static bool classof(Type type)
static bool isValid(FloatType)
Returns true if the given float type is valid for the SPIR-V dialect.
SPIR-V struct type.
Definition SPIRVTypes.h:274
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
static constexpr StringLiteral name
Definition SPIRVTypes.h:281
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
SPIR-V TensorARM Type.
Definition SPIRVTypes.h:509
static constexpr StringLiteral name
Definition SPIRVTypes.h:523
static LogicalResult verifyInvariants(function_ref< InFlightDiagnostic()> emitError, ArrayRef< int64_t > shape, Type elementType)
ShapedType::Trait< TensorArmType > ShapedTypeTraits
Definition SPIRVTypes.h:513
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.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
llvm::function_ref< Fn > function_ref
Definition LLVM.h:147
friend bool operator==(const MemberDecorationInfo &lhs, const MemberDecorationInfo &rhs)
Definition SPIRVTypes.h:296
MemberDecorationInfo(uint32_t index, Decoration decoration, Attribute decorationValue)
Definition SPIRVTypes.h:291
friend bool operator<(const MemberDecorationInfo &lhs, const MemberDecorationInfo &rhs)
Definition SPIRVTypes.h:303
StructDecorationInfo(Decoration decoration, Attribute decorationValue)
Definition SPIRVTypes.h:317
friend bool operator<(const StructDecorationInfo &lhs, const StructDecorationInfo &rhs)
Definition SPIRVTypes.h:326
friend bool operator==(const StructDecorationInfo &lhs, const StructDecorationInfo &rhs)
Definition SPIRVTypes.h:320
Type storage for SPIR-V structure types: