SetFixPipeConfig

Supported Products

Product

Supported/Unsupported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product's AI Core

x

Atlas inference product's Vector Core

x

Atlas training products

x

Function Usage

Sets the tensor quantization parameters in the real-time quantization during DataCopy (CO1->GM or CO1->A1).

Prototype

1
2
3
4
template <typename T>
__aicore__ inline void SetFixPipeConfig(const LocalTensor<T>& reluPre, const LocalTensor<T>& quantPre, bool isUnitFlag = false)
template <typename T, bool setRelu = false>
__aicore__ inline void SetFixPipeConfig(const LocalTensor<T>& preData, bool isUnitFlag = false)

Parameters

Table 1 Parameters in the template

Parameter

Description

T

Data type of the operand.

setRelu

For a single tensor, if setRelu is true, reluPre is set. Otherwise, quantPre is set. Currently, only false is supported.

Table 2 Parameters

Parameter

Input/Output

Meaning

reluPre

Input

Source operand, ReLU tensor. Type: LocalTensor. Supported TPosition: C2PIPE2GM.

reluPre is a reserved parameter and is not used currently. It is reserved for future function extension. You can pass an empty LocalTensor.

quantPre

Input

Source operand, quantization tensor, a tensor involved in compute during quantization. Type: LocalTensor. Supported TPosition: C2PIPE2GM.

isUnitFlag

Input

UnitFlag configuration item. The type is bool. Reserved for future use. Retain the default value false.

preData

Input

A tensor can be set. The switch is used to determine whether the tensor is a relu tensor or a quant tensor. The supported TPosition is C2PIPE2GM. Currently, only the quant tensor can be passed.

Restrictions

quantPre and reluPre must be tensors on the Fixpipe Buffer.

Returns

None

Example

For details, see the complete example.

1
2
3
4
5
6
7
8
__aicore__inline void SetFPC(const LocalTensor <int32_t>& reluPreTensor, const LocalTensor <int32_t>& quantPreTensor)
{
    // reluPreTensor is an empty tensor.
    AscendC::SetFixPipeConfig<int32_t>(reluPreTensor, quantPreTensor);

    // Equivalent calling:
    // AscendC::SetFixPipeConfig<int32_t>(quantPreTensor);
}