SetTensorScaleA
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
Function Usage
In the MxMatmul scenario, sets the quantization coefficient matrix scaleA of the left matrix in matrix multiplication.
Prototype
1
|
__aicore__ inline void SetTensorScaleA(const GlobalTensor<ScaleT>& gm, bool isTransposeScaleA = false); |
1
|
__aicore__ inline void SetTensorScaleA(const LocalTensor<ScaleT>& leftMatrix, bool isTransposeScaleA = false); |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
gm |
Input |
Matrix scaleA of the quantization coefficient. The type is GlobalTensor. For the Atlas 350 Accelerator Card, the supported data type is fp8_e8m0_t. |
|
leftMatrix |
Input |
Matrix scaleA of the quantization coefficient. The type is LocalTensor, and TPosition can be TSCM or VECOUT. For the Atlas 350 Accelerator Card, the supported data type is fp8_e8m0_t. |
|
isTransposeScaleA |
Input |
Whether matrix scaleA is transposed. The options are as follows:
Notes:
With the bias input, to ensure that the L1 Buffer space calculation size is consistent between the tiling side and the kernel side, and to guarantee correct result precision, the value of this parameter must be the same as the value of SCALE_ISTRANS defined for matrix A's MatmulTypeWithScale on the kernel side and the value of isScaleTrans of the SetScaleAType() API on the tiling side. In other words, all three parameters must be set to true or false simultaneously. |
Returns
None
Restrictions
- The size of the input scaleA address space must be greater than or equal to singleCoreM x singleCoreK/32.
- This API is not supported when enableMixDualMaster (dual-master mode) is set to true.
Examples
1 2 3 4 5 6 7 8 9 10 |
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetTensorScaleA(gm_scaleA); // Set the quantization coefficient matrix scaleA of the left matrix. mm.SetTensorScaleB(gm_scaleB); if (tiling.isBias) { mm.SetBias(gmBias); } mm.IterateAll(gm_c); mm.End(); |