My Project
|
#include <StandardTypes.h>
Public Types | |
using | ImplType = detail::ShapedTypeStorage |
![]() | |
enum | Kind { Function, Opaque, LAST_BUILTIN_TYPE = Opaque, DEFINE_SYM_KIND_RANGE, DEFINE_SYM_KIND_RANGE } |
template<typename ConcreteType , typename BaseType , typename StorageType = DefaultTypeStorage> | |
using | TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer > |
Utility class for implementing types. More... | |
using | ImplType = TypeStorage |
Public Member Functions | |
Type | getElementType () const |
Return the element type. More... | |
unsigned | getElementTypeBitWidth () const |
int64_t | getNumElements () const |
If it has static shape, return the number of elements. Otherwise, abort. More... | |
int64_t | getRank () const |
If this is a ranked type, return the rank. Otherwise, abort. More... | |
bool | hasRank () const |
ArrayRef< int64_t > | getShape () const |
If this is a ranked type, return the shape. Otherwise, abort. More... | |
bool | hasStaticShape () const |
bool | hasStaticShape (ArrayRef< int64_t > shape) const |
If this has a static shape and the shape is equal to shape return true. More... | |
int64_t | getNumDynamicDims () const |
int64_t | getDimSize (int64_t i) const |
unsigned | getDynamicDimIndex (unsigned index) const |
int64_t | getSizeInBits () const |
![]() | |
Type () | |
Type (const ImplType *impl) | |
Type (const Type &other)=default | |
Type & | operator= (const Type &other)=default |
bool | operator== (Type other) const |
bool | operator!= (Type other) const |
operator bool () const | |
bool | operator! () const |
template<typename U > | |
bool | isa () const |
template<typename U > | |
U | dyn_cast () const |
template<typename U > | |
U | dyn_cast_or_null () const |
template<typename U > | |
U | cast () const |
unsigned | getKind () const |
Return the classification for this type. More... | |
MLIRContext * | getContext () const |
Return the LLVMContext in which this type was uniqued. More... | |
Dialect & | getDialect () const |
Get the dialect this type is registered to. More... | |
bool | isIndex () |
bool | isBF16 () |
bool | isF16 () |
bool | isF32 () |
bool | isF64 () |
bool | isInteger (unsigned width) |
Return true if this is an integer type with the specified width. More... | |
unsigned | getIntOrFloatBitWidth () |
bool | isIntOrIndex () |
Return true if this is an integer or index type. More... | |
bool | isIntOrIndexOrFloat () |
Return true if this is an integer, index, or float type. More... | |
bool | isIntOrFloat () |
Return true of this is an integer or a float type. More... | |
void | print (raw_ostream &os) |
Print the current type. More... | |
void | dump () |
unsigned | getSubclassData () const |
void | setSubclassData (unsigned val) |
const void * | getAsOpaquePointer () const |
Methods for supporting PointerLikeTypeTraits. More... | |
Static Public Member Functions | |
static bool | classof (Type type) |
Methods for support type inquiry through isa, cast, and dyn_cast. More... | |
static constexpr bool | isDynamic (int64_t dSize) |
Whether the given dimension size indicates a dynamic dimension. More... | |
static constexpr bool | isDynamicStrideOrOffset (int64_t dStrideOrOffset) |
![]() | |
static bool | classof (Type) |
static Type | getFromOpaquePointer (const void *pointer) |
Static Public Attributes | |
static constexpr int64_t | kDynamicSize = -1 |
static constexpr int64_t | kDynamicStrideOrOffset |
Additional Inherited Members | |
![]() | |
ImplType * | impl |
This is a common base class between Vector, UnrankedTensor, RankedTensor, and MemRef types because they share behavior and semantics around shape, rank, and fixed element type. Any type with these semantics should inherit from ShapedType.
|
inlinestatic |
Methods for support type inquiry through isa, cast, and dyn_cast.
int64_t ShapedType::getDimSize | ( | int64_t | i | ) | const |
If this is ranked type, return the size of the specified dimension. Otherwise, abort.
unsigned ShapedType::getDynamicDimIndex | ( | unsigned | index | ) | const |
Returns the position of the dynamic dimension relative to just the dynamic dimensions, given its index
within the shape.
Type ShapedType::getElementType | ( | ) | const |
Return the element type.
unsigned ShapedType::getElementTypeBitWidth | ( | ) | const |
If an element type is an integer or a float, return its width. Otherwise, abort.
int64_t ShapedType::getNumDynamicDims | ( | ) | const |
If this is a ranked type, return the number of dimensions with dynamic size. Otherwise, abort.
int64_t ShapedType::getNumElements | ( | ) | const |
If it has static shape, return the number of elements. Otherwise, abort.
int64_t ShapedType::getRank | ( | ) | const |
If this is a ranked type, return the rank. Otherwise, abort.
ArrayRef< int64_t > ShapedType::getShape | ( | ) | const |
If this is a ranked type, return the shape. Otherwise, abort.
int64_t ShapedType::getSizeInBits | ( | ) | const |
Get the total amount of bits occupied by a value of this type. This does not take into account any memory layout or widening constraints, e.g. a vector<3xi57> is reported to occupy 3x57=171 bit, even though in practice it will likely be stored as in a 4xi64 vector register. Fail an assertion if the size cannot be computed statically, i.e. if the type has a dynamic shape or if its elemental type does not have a known bit width.
Get the number of bits require to store a value of the given shaped type. Compute the value recursively since tensors are allowed to have vectors as elements.
bool ShapedType::hasRank | ( | ) | const |
Whether or not this is a ranked type. Memrefs, vectors and ranked tensors have a rank, while unranked tensors do not.
bool ShapedType::hasStaticShape | ( | ) | const |
If this is unranked type or any dimension has unknown size (<0), it doesn't have static shape. If all dimensions have known size (>= 0), it has static shape.
bool ShapedType::hasStaticShape | ( | ArrayRef< int64_t > | shape | ) | const |
If this has a static shape and the shape is equal to shape
return true.
|
inlinestatic |
Whether the given dimension size indicates a dynamic dimension.
|
inlinestatic |
|
static |
|
static |