10 #define TYPE_DETAIL_H_
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/Hashing.h"
18 #include "llvm/ADT/bit.h"
60 template <
typename T,
typename U>
62 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
63 lhs.expressedType == rhs.expressedType &&
64 lhs.storageTypeMin == rhs.storageTypeMin &&
65 lhs.storageTypeMax == rhs.storageTypeMax;
119 template <
typename T,
typename U>
121 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
122 lhs.expressedType == rhs.expressedType && lhs.scale == rhs.scale &&
123 lhs.zeroPoint == rhs.zeroPoint &&
124 lhs.storageTypeMin == rhs.storageTypeMin &&
125 lhs.storageTypeMax == rhs.storageTypeMax;
133 int64_t scaleBits = llvm::bit_cast<int64_t>(
scale);
192 template <
typename T,
typename U>
194 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
195 lhs.expressedType == rhs.expressedType &&
196 lhs.getScales() == rhs.getScales() &&
197 lhs.getZeroPoints() == rhs.getZeroPoints() &&
198 lhs.quantizedDimension == rhs.quantizedDimension &&
199 lhs.storageTypeMin == rhs.storageTypeMin &&
200 lhs.storageTypeMax == rhs.storageTypeMax;
208 int64_t *scalesCast = llvm::bit_cast<int64_t *>(
scales.data());
211 llvm::hash_combine_range(scalesBits),
288 template <
typename T,
typename U>
290 return lhs.flags == rhs.flags && lhs.storageType == rhs.storageType &&
291 lhs.expressedType == rhs.expressedType &&
292 lhs.scales == rhs.scales && lhs.zeroPoints == rhs.zeroPoints &&
293 lhs.quantizedDimensions == rhs.quantizedDimensions &&
294 lhs.blockSizes == rhs.blockSizes &&
295 lhs.storageTypeMin == rhs.storageTypeMin &&
296 lhs.storageTypeMax == rhs.storageTypeMax;
310 hash = llvm::hash_combine(
311 hash, llvm::bit_cast<int64_t>(scaleAttr.convertToDouble()));
316 hash = llvm::hash_combine(hash, zeroPointAttr.getSExtValue());
320 hash = llvm::hash_combine(hash,
387 template <
typename T,
typename U>
389 return lhs.expressedType == rhs.expressedType && lhs.min == rhs.min &&
398 int64_t minBits = llvm::bit_cast<double>(
min);
399 int64_t maxBits = llvm::bit_cast<double>(
max);
An attribute that represents a reference to a dense vector or tensor object.
auto getValues() const
Return the held element values as a range of the given type.
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.