MLIR  20.0.0git
QuantTypes.h
Go to the documentation of this file.
1 //===- QuantTypes.h - Quantization Ops and 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 #ifndef MLIR_DIALECT_QUANT_QUANTTYPES_H
10 #define MLIR_DIALECT_QUANT_QUANTTYPES_H
11 
12 #include "mlir/IR/Attributes.h"
13 #include "mlir/IR/Builders.h"
14 #include "mlir/IR/BuiltinTypes.h"
15 #include "mlir/IR/Dialect.h"
16 #include "mlir/IR/OpDefinition.h"
17 #include "mlir/IR/Types.h"
18 #include "llvm/Support/MathExtras.h"
19 
20 namespace mlir {
21 namespace quant {
22 namespace detail {
23 
29 
30 } // namespace detail
31 
32 /// Enumeration of bit-mapped flags related to quantized types.
33 namespace QuantizationFlags {
34 enum FlagValue {
35  // Indicates that the storage type should be interpreted as a signed
36  // integer. The default is to interpret it as an unsigned value.
37  Signed = 1,
38 };
39 } // namespace QuantizationFlags
40 
41 /// Base class for all quantized types known to this dialect.
42 /// All quantized types have:
43 /// - storageType: The (narrower) numeric type that is being used to
44 /// approximate some expressed type.
45 /// - expressedType: The type that is being approximated.
46 ///
47 /// The base class provides generic support for manipulating the types based
48 /// on these fields.
49 class QuantizedType : public Type {
50 public:
52  using Type::Type;
53 
54  /// The maximum number of bits supported for storage types.
55  static constexpr unsigned MaxStorageBits = 32;
56 
57  static LogicalResult verify(function_ref<InFlightDiagnostic()> emitError,
58  unsigned flags, Type storageType,
59  Type expressedType, int64_t storageTypeMin,
60  int64_t storageTypeMax);
61 
62  /// Support method to enable LLVM-style type casting.
63  static bool classof(Type type);
64 
65  /// Gets the minimum possible stored by a storageType. storageTypeMin must
66  /// be greater than or equal to this value.
68  unsigned integralWidth) {
69  if (isSigned) {
70  return llvm::minIntN(integralWidth);
71  }
72  return 0;
73  }
74 
75  /// Gets the maximum possible stored by a storageType. storageTypeMax must
76  /// be less than or equal to this value.
78  unsigned integralWidth) {
79  if (isSigned) {
80  return llvm::maxIntN(integralWidth);
81  }
82  return llvm::maxUIntN(integralWidth);
83  }
84 
85  /// Gets the original expressed type that this quantized type approximates.
86  /// Note that this presumes that the quantized type was always derived from
87  /// a floating point type, which in the broadest definition, is not true (i.e.
88  /// it could be some form of integral, fixed type or affine type in its own
89  /// right); however, at the high level, no examples of such usage are
90  /// presently known and the restriction serves some useful purposes (such as
91  /// always being able to reverse a transformation or measure error). In most
92  /// cases, this will be f32.
93  Type getExpressedType() const;
94 
95  /// Gets the flags associated with this type. Typically a more specific
96  /// accessor is appropriate.
97  unsigned getFlags() const;
98 
99  // Convenience helpers.
100  /// Whether the storage type should be interpreted as a signed quantity
101  /// (true) or an unsigned value (false).
102  bool isSigned() const {
103  return (getFlags() & QuantizationFlags::Signed) ==
105  }
106 
107  /// Gets the underlying type used for to store values. Note that this may
108  /// be signed or unsigned. Use the isSigned() accessor to differentiate.
109  Type getStorageType() const;
110 
111  /// The minimum value that storageType can take.
112  int64_t getStorageTypeMin() const;
113 
114  /// The maximum value that storageType can take.
115  int64_t getStorageTypeMax() const;
116 
117  /// Gets the integral bit width that the underlying storage type can exactly
118  /// represent. For integral storage types, this will just be their width.
119  unsigned getStorageTypeIntegralWidth() const;
120 
121  /// Returns whether the candidateExpressedType is a match for this
122  /// QuantizedType. This will be true if the candidate type is either a
123  /// primitive type or a container type whose element type equals this
124  /// QuantizedType's expressed type.
125  /// Examples of compatible candidateExpressedType:
126  /// !quant.uniform<i8:f32, 1.0> =~ f32
127  /// !quant.uniform<i8:f32, 1.0> =~ tensor<4xf32>
128  bool isCompatibleExpressedType(Type candidateExpressedType);
129 
130  /// Returns the element type as a QuantizedType or nullptr if it is not
131  /// a quantized type. If the type is primitive, returns that. If it is a
132  /// container (vector/tensor), return the element type.
133  /// Examples:
134  /// !quant.uniform<i8:f32, 1.0> -> !quant.uniform<i8:f32, 1.0>
135  /// tensor<4x!quant.uniform<i8:f32, 1.0> -> quant.uniform<i8:f32, 1.0>
136  static QuantizedType getQuantizedElementType(Type primitiveOrContainerType);
137 
138  /// Casts from a type based on the storageType to a corresponding type based
139  /// on this type (returns nullptr if the cast is not valid).
140  /// Examples:
141  /// i8 -> !quant.uniform<i8:f32, 1.0>
142  /// tensor<4xi8> -> tensor<4x!quant.uniform<i8:f32, 1.0}>>
143  /// vector<4xi8> -> vector<4x!quant.uniform<i8:f32, 1.0>>
144  Type castFromStorageType(Type candidateType);
145 
146  /// Casts from a type based on a QuantizedType to a corresponding type based
147  /// on the storageType (returns nullptr if the cast is not valid).
148  /// This is the inverse of castFromStorageType().
149  static Type castToStorageType(Type quantizedType);
150 
151  /// Casts from a type based on the expressedType to a corresponding type based
152  /// on this type (returns nullptr if the cast is not valid).
153  /// Examples:
154  /// f32 -> !quant.uniform<i8:f32, 1.0>
155  /// tensor<4xf32> -> tensor<4x!quant.uniform<i8:f32, 1.0>>
156  /// vector<4xf32> -> vector<4x!quant.uniform<i8:f32, 1.0>>
157  Type castFromExpressedType(Type candidateType);
158 
159  /// Casts from a type based on QuantizedType to a corresponding type based
160  /// on the expressedType (returns nullptr if the cast is not valid).
161  /// This is the inverse of castFromExpressedType.
162  static Type castToExpressedType(Type quantizedType);
163 
164  /// Casts from a type based on the expressedType to the equivalent type
165  /// based on storageType by way of this QuantizedType. Equivalent to:
166  /// QuantizedType::castToStorageType(castFromExpressedType(candidateType))
167  /// (but with validity checks).
168  /// Example (for this = !quant.uniform<i8:f32, 1.0>):
169  /// tensor<4xf32> -> tensor<4xi8>
170  Type castExpressedToStorageType(Type candidateType);
171 
172 private:
173  /// Hide the following methods inherited from `Type`. It is almost certainly
174  /// a bug to call them from a `QuantizedType` object. Users should call
175  /// `getStorageType` or `getExpressedType` to get the underlying types
176  /// they want to inspect.
177  using Type::isBF16;
178  using Type::isF16;
179  using Type::isF32;
180  using Type::isF64;
181  using Type::isIndex;
182  using Type::isInteger;
183 };
184 
185 /// A quantized type that maps storage to/from expressed types in an
186 /// unspecified way.
187 ///
188 /// Typical syntax:
189 /// quant.any<i8:f32>
190 /// quant.any<i8>
191 /// quant.any<i8<-16,15>>
192 ///
193 /// Note that for the any type, the expressed type is optional.
195  : public Type::TypeBase<AnyQuantizedType, QuantizedType,
196  detail::AnyQuantizedTypeStorage> {
197 public:
198  using Base::Base;
199  using Base::getChecked;
200 
201  static constexpr StringLiteral name = "quant.any";
202 
203  /// Gets an instance of the type with all parameters specified but not
204  /// checked.
205  static AnyQuantizedType get(unsigned flags, Type storageType,
206  Type expressedType, int64_t storageTypeMin,
207  int64_t storageTypeMax);
208 
209  /// Gets an instance of the type with all specified parameters checked.
210  /// Returns a nullptr convertible type on failure.
211  static AnyQuantizedType
213  Type storageType, Type expressedType, int64_t storageTypeMin,
214  int64_t storageTypeMax);
215 
216  /// Verifies construction invariants and issues errors/warnings.
217  static LogicalResult verify(function_ref<InFlightDiagnostic()> emitError,
218  unsigned flags, Type storageType,
219  Type expressedType, int64_t storageTypeMin,
220  int64_t storageTypeMax);
221 };
222 
223 /// Represents a family of uniform, quantized types.
224 ///
225 /// Each instance of this type expresses a mapping between real values (most
226 /// often expressed in floating point f32) and quantized values (either fixed
227 /// point or affine).
228 ///
229 /// The relationship is:
230 /// real_value = scale * (quantized_value - zero_point)
231 ///
232 /// It is used as part of high level graph transformations that have the goal
233 /// of re-expressing parts of a computation in terms of this common form for
234 /// more efficient execution at runtime. In addition, it is designed to be
235 /// expressive enough to facilitate lowering to precise types and operations
236 /// in target hardware.
237 ///
238 /// As a high-level type, focused on intermediate passes, this type holds
239 /// opinions consistent with high-level usage. If lowering math kernels below
240 /// the high level arithmetic ops (i.e. to LLVM IR or hardware specific
241 /// instruction sets), it is expected that the information expressed here
242 /// will be used to drive low level codegen and target specific type selection,
243 /// but this type will likely be erased in the process.
244 ///
245 /// Syntax synopsis:
246 /// Per-layer, all parameters expressed:
247 /// !quant<uniform[StorageType:ExpressedType]{Scale:ZeroPoint}>
248 /// Per-layer, optional parameters omitted:
249 /// !quant<uniform[StorageType]{Scale}>
250 ///
251 /// StorageType: 'i'|'u' NumBits
252 /// ExpressedType: 'f16', 'f32', 'bf16', 'f64'
253 /// Scale: A legal double value
254 /// ZeroPoint: An integer value
256  : public Type::TypeBase<UniformQuantizedType, QuantizedType,
257  detail::UniformQuantizedTypeStorage> {
258 public:
259  using Base::Base;
260  using Base::getChecked;
261 
262  static constexpr StringLiteral name = "quant.uniform";
263 
264  /// Gets an instance of the type with all parameters specified but not
265  /// checked.
266  static UniformQuantizedType get(unsigned flags, Type storageType,
267  Type expressedType, double scale,
268  int64_t zeroPoint, int64_t storageTypeMin,
269  int64_t storageTypeMax);
270 
271  /// Gets an instance of the type with all specified parameters checked.
272  /// Returns a nullptr convertible type on failure.
273  static UniformQuantizedType
275  Type storageType, Type expressedType, double scale,
276  int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax);
277 
278  /// Verifies construction invariants and issues errors/warnings.
279  static LogicalResult verify(function_ref<InFlightDiagnostic()> emitError,
280  unsigned flags, Type storageType,
281  Type expressedType, double scale,
282  int64_t zeroPoint, int64_t storageTypeMin,
283  int64_t storageTypeMax);
284 
285  /// Gets the scale term. The scale designates the difference between the real
286  /// values corresponding to consecutive quantized values differing by 1.
287  double getScale() const;
288 
289  /// Gets the storage value corresponding to the real value 0 in the affine
290  /// equation.
291  int64_t getZeroPoint() const;
292 
293  // Fixed point values are real numbers divided by a scale.
294  // Currently, only signed storage types are treated as fixed point.
295  // A fixed point value can be obtained from an affine value by subtracting
296  // the zeroPoint.
297  // In the future, this may be explicit versus implied by type and zeroPoint.
298  bool isFixedPoint() const { return isSigned() && getZeroPoint() == 0; }
299 };
300 
301 /// Represents per-axis (also known as per-channel quantization).
302 ///
303 /// Syntax synopsis:
304 /// Per-axis, all parameters expressed:
305 /// !quant<uniform[StorageType:ExpressedType:QuantizedDim]{QuantParams}>
306 /// Per-axis, optional parameters omitted:
307 /// !quant<uniform[StorageType]{Scale}>
308 ///
309 /// StorageType: 'i'|'u' NumBits
310 /// ExpressedType: 'f16', 'f32', 'bf16', 'f64'
311 /// QuantizedDim: An integer value
312 /// QuantParams: (Scale ':' ZeroPoint)+
313 /// Scale: A legal double value
314 /// ZeroPoint: An integer value
316  : public Type::TypeBase<UniformQuantizedPerAxisType, QuantizedType,
317  detail::UniformQuantizedPerAxisTypeStorage> {
318 public:
319  using Base::Base;
320  using Base::getChecked;
321 
322  static constexpr StringLiteral name = "quant.uniform_per_axis";
323 
324  /// Gets an instance of the type with all parameters specified but not
325  /// checked.
327  get(unsigned flags, Type storageType, Type expressedType,
328  ArrayRef<double> scales, ArrayRef<int64_t> zeroPoints,
329  int32_t quantizedDimension, int64_t storageTypeMin,
330  int64_t storageTypeMax);
331 
332  /// Gets an instance of the type with all specified parameters checked.
333  /// Returns a nullptr convertible type on failure.
336  Type storageType, Type expressedType, ArrayRef<double> scales,
337  ArrayRef<int64_t> zeroPoints, int32_t quantizedDimension,
338  int64_t storageTypeMin, int64_t storageTypeMax);
339 
340  /// Verifies construction invariants and issues errors/warnings.
341  static LogicalResult verify(function_ref<InFlightDiagnostic()> emitError,
342  unsigned flags, Type storageType,
343  Type expressedType, ArrayRef<double> scales,
344  ArrayRef<int64_t> zeroPoints,
345  int32_t quantizedDimension,
346  int64_t storageTypeMin, int64_t storageTypeMax);
347 
348  /// Gets the quantization scales. The scales designate the difference between
349  /// the real values corresponding to consecutive quantized values differing
350  /// by 1. The ith scale corresponds to the ith slice in the
351  /// quantized_dimension.
352  ArrayRef<double> getScales() const;
353 
354  /// Gets the storage values corresponding to the real value 0 in the affine
355  /// equation. The ith zero point corresponds to the ith slice in the
356  /// quantized_dimension.
358 
359  /// Specifies the dimension of the Tensor's shape that the scales and
360  /// zero_points correspond to. For example, a tensor t, with dims=[4, 3, 2, 1]
361  /// with quantization params:
362  /// scales=[1.0, 2.0, 3.0], zeroPoints=[1, 2, 3], quantizedDimension=1
363  /// will be quantized across the second dimension of t.
364  /// t[:, 0, :, :] will have scale[0]=1.0, zero_point[0]=1
365  /// t[:, 1, :, :] will have scale[1]=2.0, zero_point[0]=2
366  /// t[:, 2, :, :] will have scale[2]=3.0, zero_point[0]=3
367  int32_t getQuantizedDimension() const;
368 
369  /// Fixed point values are real numbers divided by a scale.
370  /// Currently, only signed storage types are treated as fixed point.
371  /// A fixed point value can be obtained from an affine value by subtracting
372  /// the zeroPoint.
373  /// In the future, this may be explicit versus implied by type and zeroPoint.
374  bool isFixedPoint() const {
375  if (!isSigned())
376  return false;
377  return !llvm::is_contained(getZeroPoints(), 0);
378  }
379 };
380 
381 /// A quantized type that infers its range from given min/max values.
382 ///
383 /// Typical syntax:
384 /// quant.calibrated<f32<-0.922,0.981>>
386  : public Type::TypeBase<CalibratedQuantizedType, QuantizedType,
387  detail::CalibratedQuantizedTypeStorage> {
388 public:
389  using Base::Base;
390  using Base::getChecked;
391 
392  static constexpr StringLiteral name = "quant.calibrated";
393 
394  /// Gets an instance of the type with all parameters specified but not
395  /// checked.
396  static CalibratedQuantizedType get(Type expressedType, double min,
397  double max);
398 
399  /// Gets an instance of the type with all specified parameters checked.
400  /// Returns a nullptr convertible type on failure.
403  double min, double max);
404 
405  /// Verifies construction invariants and issues errors/warnings.
406  static LogicalResult verify(function_ref<InFlightDiagnostic()> emitError,
407  Type expressedType, double min, double max);
408  double getMin() const;
409  double getMax() const;
410 };
411 
412 } // namespace quant
413 } // namespace mlir
414 
415 #endif // MLIR_DIALECT_QUANT_QUANTTYPES_H
static Value max(ImplicitLocOpBuilder &builder, Value value, Value bound)
static Value min(ImplicitLocOpBuilder &builder, Value value, Value bound)
This class represents a diagnostic that is inflight and set to be reported.
Definition: Diagnostics.h:313
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition: Types.h:74
bool isF64() const
Definition: Types.cpp:53
bool isIndex() const
Definition: Types.cpp:57
constexpr Type()=default
bool isF32() const
Definition: Types.cpp:52
bool isInteger() const
Return true if this is an integer type (with the specified width).
Definition: Types.cpp:59
bool isF16() const
Definition: Types.cpp:50
bool isBF16() const
Definition: Types.cpp:49
Utility class for implementing users of storage classes uniqued by a StorageUniquer.
A quantized type that maps storage to/from expressed types in an unspecified way.
Definition: QuantTypes.h:196
static AnyQuantizedType get(unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax)
Gets an instance of the type with all parameters specified but not checked.
Definition: QuantTypes.cpp:217
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax)
Verifies construction invariants and issues errors/warnings.
Definition: QuantTypes.cpp:236
static constexpr StringLiteral name
Definition: QuantTypes.h:201
static AnyQuantizedType getChecked(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax)
Gets an instance of the type with all specified parameters checked.
Definition: QuantTypes.cpp:226
A quantized type that infers its range from given min/max values.
Definition: QuantTypes.h:387
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, Type expressedType, double min, double max)
Verifies construction invariants and issues errors/warnings.
Definition: QuantTypes.cpp:384
static constexpr StringLiteral name
Definition: QuantTypes.h:392
static CalibratedQuantizedType get(Type expressedType, double min, double max)
Gets an instance of the type with all parameters specified but not checked.
Definition: QuantTypes.cpp:371
static CalibratedQuantizedType getChecked(function_ref< InFlightDiagnostic()> emitError, Type expressedType, double min, double max)
Gets an instance of the type with all specified parameters checked.
Definition: QuantTypes.cpp:376
Base class for all quantized types known to this dialect.
Definition: QuantTypes.h:49
Type getExpressedType() const
Gets the original expressed type that this quantized type approximates.
Definition: QuantTypes.cpp:81
static constexpr unsigned MaxStorageBits
The maximum number of bits supported for storage types.
Definition: QuantTypes.h:55
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax)
Definition: QuantTypes.cpp:32
static Type castToStorageType(Type quantizedType)
Casts from a type based on a QuantizedType to a corresponding type based on the storageType (returns ...
Definition: QuantTypes.cpp:127
Type castExpressedToStorageType(Type candidateType)
Casts from a type based on the expressedType to the equivalent type based on storageType by way of th...
Definition: QuantTypes.cpp:209
static Type castToExpressedType(Type quantizedType)
Casts from a type based on QuantizedType to a corresponding type based on the expressedType (returns ...
Definition: QuantTypes.cpp:182
bool isSigned() const
Whether the storage type should be interpreted as a signed quantity (true) or an unsigned value (fals...
Definition: QuantTypes.h:102
static QuantizedType getQuantizedElementType(Type primitiveOrContainerType)
Returns the element type as a QuantizedType or nullptr if it is not a quantized type.
Definition: QuantTypes.cpp:94
unsigned getFlags() const
Gets the flags associated with this type.
Definition: QuantTypes.cpp:23
int64_t getStorageTypeMax() const
The maximum value that storageType can take.
Definition: QuantTypes.cpp:71
static int64_t getDefaultMaximumForInteger(bool isSigned, unsigned integralWidth)
Gets the maximum possible stored by a storageType.
Definition: QuantTypes.h:77
unsigned getStorageTypeIntegralWidth() const
Gets the integral bit width that the underlying storage type can exactly represent.
Definition: QuantTypes.cpp:75
static bool classof(Type type)
Support method to enable LLVM-style type casting.
Definition: QuantTypes.cpp:27
Type castFromStorageType(Type candidateType)
Casts from a type based on the storageType to a corresponding type based on this type (returns nullpt...
Definition: QuantTypes.cpp:103
int64_t getStorageTypeMin() const
The minimum value that storageType can take.
Definition: QuantTypes.cpp:67
static int64_t getDefaultMinimumForInteger(bool isSigned, unsigned integralWidth)
Gets the minimum possible stored by a storageType.
Definition: QuantTypes.h:67
Type getStorageType() const
Gets the underlying type used for to store values.
Definition: QuantTypes.cpp:63
Type castFromExpressedType(Type candidateType)
Casts from a type based on the expressedType to a corresponding type based on this type (returns null...
Definition: QuantTypes.cpp:154
bool isCompatibleExpressedType(Type candidateExpressedType)
Returns whether the candidateExpressedType is a match for this QuantizedType.
Definition: QuantTypes.cpp:85
Represents per-axis (also known as per-channel quantization).
Definition: QuantTypes.h:317
static constexpr StringLiteral name
Definition: QuantTypes.h:322
static UniformQuantizedPerAxisType getChecked(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, ArrayRef< double > scales, ArrayRef< int64_t > zeroPoints, int32_t quantizedDimension, int64_t storageTypeMin, int64_t storageTypeMax)
Gets an instance of the type with all specified parameters checked.
Definition: QuantTypes.cpp:314
bool isFixedPoint() const
Fixed point values are real numbers divided by a scale.
Definition: QuantTypes.h:374
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, ArrayRef< double > scales, ArrayRef< int64_t > zeroPoints, int32_t quantizedDimension, int64_t storageTypeMin, int64_t storageTypeMax)
Verifies construction invariants and issues errors/warnings.
Definition: QuantTypes.cpp:324
static UniformQuantizedPerAxisType get(unsigned flags, Type storageType, Type expressedType, ArrayRef< double > scales, ArrayRef< int64_t > zeroPoints, int32_t quantizedDimension, int64_t storageTypeMin, int64_t storageTypeMax)
Gets an instance of the type with all parameters specified but not checked.
Definition: QuantTypes.cpp:304
int32_t getQuantizedDimension() const
Specifies the dimension of the Tensor's shape that the scales and zero_points correspond to.
Definition: QuantTypes.cpp:367
ArrayRef< int64_t > getZeroPoints() const
Gets the storage values corresponding to the real value 0 in the affine equation.
Definition: QuantTypes.cpp:363
ArrayRef< double > getScales() const
Gets the quantization scales.
Definition: QuantTypes.cpp:359
Represents a family of uniform, quantized types.
Definition: QuantTypes.h:257
double getScale() const
Gets the scale term.
Definition: QuantTypes.cpp:298
int64_t getZeroPoint() const
Gets the storage value corresponding to the real value 0 in the affine equation.
Definition: QuantTypes.cpp:300
static constexpr StringLiteral name
Definition: QuantTypes.h:262
static UniformQuantizedType getChecked(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, double scale, int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax)
Gets an instance of the type with all specified parameters checked.
Definition: QuantTypes.cpp:262
static UniformQuantizedType get(unsigned flags, Type storageType, Type expressedType, double scale, int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax)
Gets an instance of the type with all parameters specified but not checked.
Definition: QuantTypes.cpp:253
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, unsigned flags, Type storageType, Type expressedType, double scale, int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax)
Verifies construction invariants and issues errors/warnings.
Definition: QuantTypes.cpp:271
Include the generated interface declarations.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.