SetTensorScaleB
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
Function Usage
In the MxMatmul scenario, sets the quantization coefficient matrix scaleB of the right matrix in matrix multiplication.
Prototype
1
|
__aicore__ inline void SetTensorScaleB(const GlobalTensor<ScaleT>& gm, bool isTransposeScaleB = true); |
1
|
__aicore__ inline void SetTensorScaleB(const LocalTensor<ScaleT>& rightMatrix, bool isTransposeScaleB = true); |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
gm |
Input |
Matrix scaleB of the quantization coefficient. The type is GlobalTensor. For the Atlas 350 Accelerator Card, the supported data type is fp8_e8m0_t. |
|
rightMatrix |
Input |
Matrix scaleB 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. |
|
isTransposeScaleB |
Input |
Whether matrix scaleB 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 B's MatmulMxType on the kernel side and the value of isScaleTrans of the SetScaleBType() 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 scaleB address space must be greater than or equal to singleCoreK x singleCoreN/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); mm.SetTensorScaleB(gm_scaleB); // Set the quantization coefficient matrix scaleB of the right matrix. if (tiling.isBias) { mm.SetBias(gmBias); } mm.IterateAll(gm_c); mm.End(); |