MLIR

Multi-Level IR Compiler Framework

Dialect 'quant' definition

Operation definition

quant.const_fake_quant (quant::ConstFakeQuant)

Simulates the effect of uniform quantization with const range.

Description:

Given a const min, max, num_bits and narrow_range attribute, applies the same uniform quantization simulation as is done by the TensorFlow fake_quant_with_min_max_args op. See the fakeQuantAttrsToType() utility method and the quant-convert-simulated-quantization pass for futher details.

Operands:

  1. inputs: tensor of 32-bit float values

Attributes:

AttributeMLIR TypeDescription
minFloatAttr32-bit float attribute attribute
maxFloatAttr32-bit float attribute attribute
num_bitsIntegerAttr64-bit integer attribute attribute
narrow_rangeBoolAttrbool attribute attribute
is_signedBoolAttrbool attribute attribute

Results:

  1. outputs: tensor of 32-bit float values

quant.const_fake_quant_per_axis (quant::ConstFakeQuantPerAxis)

Simulates the effect of per axis uniform quantization with const range.

Description:

Given a const min, max, num_bits and narrow_range attribute, applies the same per axis uniform quantization simulation as is done by the TensorFlow fake_quant_with_min_max_vars_per_channel op. See the fakeQuantAttrsToType() utility method and the quant-convert-simulated-quantization pass for futher details.

Operands:

  1. inputs: tensor of 32-bit float values

Attributes:

AttributeMLIR TypeDescription
minArrayAttr32-bit float array attribute attribute
maxArrayAttr32-bit float array attribute attribute
axisIntegerAttr64-bit integer attribute attribute
num_bitsIntegerAttr64-bit integer attribute attribute
narrow_rangeBoolAttrbool attribute attribute
is_signedBoolAttrbool attribute attribute

Results:

  1. outputs: tensor of 32-bit float values

quant.coupled_ref (quant::CoupledRefOp)

Indicates that one point of the computation is coupled to another.

Description:

Ordinarily, relationships between ops for the purposes of determining compatible quantized types is explicit based on the use-def chain. However, in some situations, a use may be separated from its def by arbitrary external connections. In such a case, during analysis, all coupled_ref nodes in a module which share a coupledKey will be considered to be directly connected as via an identity op for the purpose of type inference.

Operands:

  1. arg: primitive/tensor/vector of real valued primitive (float or quantized type)

Attributes:

AttributeMLIR TypeDescription
coupledKeyStringAttrstring attribute attribute

Results:

  1. «unnamed»: primitive/tensor/vector of real valued primitive (float or quantized type)

quant.dcast (quant::DequantizeCastOp)

Description:

Operands:

  1. arg: primitive/tensor/vector of real valued primitive (float or quantized type)

Attributes:

Results:

  1. «unnamed»: primitive/tensor/vector of real valued primitive (float or quantized type)

quant.qcast (quant::QuantizeCastOp)

Description:

Operands:

  1. arg: primitive/tensor/vector of real valued primitive (float or quantized type)

Attributes:

Results:

  1. «unnamed»: primitive/tensor/vector of real valued primitive (float or quantized type)

quant.stats (quant::StatisticsOp)

Identity op which associates statistics with the value.

Description:

Associates statistics about the runtime ranges of values observed for evaluations of this node.

Statistics about the entire type are reported in the ‘layerStats’ attribute and those for each axis, in the (optional) axisStats attribute. The interpretation of each is determined by the last dimension of its shape. Currently, only dim=2 is supported, which is interpreted as [min, max].

layerStats must be a rank 1 tensor: [2] axisStats must be a rank 2 tensor: [N, 2], where N=the slice size splitted by the axis dimension. For example:

, axis=3 => N=2 , axis=2 => N=6 #### Operands: 1. `arg`: primitive/tensor/vector of real valued primitive (float or quantized type) #### Attributes: | Attribute | MLIR Type | Description | | :-------: | :-------: | ----------- | | `layerStats` | `ElementsAttr` | constant vector/tensor attribute attribute | | `axisStats` | `ElementsAttr` | constant vector/tensor attribute attribute | | `axis` | `IntegerAttr` | 64-bit integer attribute attribute | #### Results: 1. «unnamed»: primitive/tensor/vector of real valued primitive (float or quantized type) ### quant.stats_ref (quant::StatisticsRefOp) Indicates that statistics are resolved by reference. #### Description: This op acts as an identity that, when encountered at runtime, should result in statistics being collected about about the value of its operand/result. Such statistics will be stored with the provided key, allowing this node to later be converted to a 'stats' op if statistics with that key have been encountered. #### Operands: 1. `arg`: primitive/tensor/vector of real valued primitive (float or quantized type) #### Attributes: | Attribute | MLIR Type | Description | | :-------: | :-------: | ----------- | | `statsKey` | `StringAttr` | string attribute attribute | #### Results: 1. «unnamed»: primitive/tensor/vector of real valued primitive (float or quantized type) ### quant.scast (quant::StorageCastOp) #### Description: #### Operands: 1. `arg`: quant_RealOrStorageValueType #### Attributes: #### Results: 1. «unnamed»: quant_RealOrStorageValueType