10 #define TYPE_DETAIL_H_
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/Hashing.h"
17 #include "llvm/ADT/bit.h"
59 template <
typename T,
typename U>
61 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
62 lhs.expressedType == rhs.expressedType &&
63 lhs.storageTypeMin == rhs.storageTypeMin &&
64 lhs.storageTypeMax == rhs.storageTypeMax;
118 template <
typename T,
typename U>
120 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
121 lhs.expressedType == rhs.expressedType && lhs.scale == rhs.scale &&
122 lhs.zeroPoint == rhs.zeroPoint &&
123 lhs.storageTypeMin == rhs.storageTypeMin &&
124 lhs.storageTypeMax == rhs.storageTypeMax;
132 int64_t scaleBits = llvm::bit_cast<int64_t>(
scale);
191 template <
typename T,
typename U>
193 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
194 lhs.expressedType == rhs.expressedType &&
195 lhs.getScales() == rhs.getScales() &&
196 lhs.getZeroPoints() == rhs.getZeroPoints() &&
197 lhs.quantizedDimension == rhs.quantizedDimension &&
198 lhs.storageTypeMin == rhs.storageTypeMin &&
199 lhs.storageTypeMax == rhs.storageTypeMax;
207 int64_t *scalesCast = llvm::bit_cast<int64_t *>(
scales.data());
209 return llvm::hash_combine(
211 llvm::hash_combine_range(scalesBits.begin(), scalesBits.end()),
268 template <
typename T,
typename U>
270 return lhs.expressedType == rhs.expressedType && lhs.min == rhs.min &&
279 int64_t minBits = llvm::bit_cast<double>(
min);
280 int64_t maxBits = llvm::bit_cast<double>(
max);
This is a utility allocator used to allocate memory for instances of derived types.
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.
Base storage class appearing in a Type.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Include the generated interface declarations.
bool operator==(const KeyTy &other) const
static bool genericIsEqual(const T &lhs, const U &rhs)
unsigned getHashValue() const
KeyTy(unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax)
AnyQuantizedTypeStorage(const KeyTy &key)
static AnyQuantizedTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
static unsigned hashKey(const KeyTy &key)
bool operator==(const KeyTy &key) const
unsigned getHashValue() const
static bool genericIsEqual(const T &lhs, const U &rhs)
KeyTy(Type expressedType, double min, double max)
bool operator==(const KeyTy &other) const
bool operator==(const KeyTy &key) const
static unsigned hashKey(const KeyTy &key)
CalibratedQuantizedTypeStorage(const KeyTy &key)
static CalibratedQuantizedTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
QuantizedTypeStorage(unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax)
unsigned flags
Flags corresponding to the bitmapped enum QuantizationFlags::FlagValue.