GetSpecialMDLConfig
Function Usage
Configures the parameters to obtain the user-defined SpecialMDL template.
Prototype
1 | __aicore__ constexpr MatmulConfig GetSpecialMDLConfig(const bool intrinsicsLimit = false, const bool batchLoop = false, const uint32_t doMTE2Preload = 0, const bool isVecND2NZ = false, bool isPerTensor = false, bool hasAntiQuantOffset = false) |
Parameters
All parameters of this API are used to set the parameters of the MatmulConfig structure. Parameters corresponding to each other have the same functions.
Parameter |
Input/Output |
Description |
|---|---|---|
intrinsicsLimit |
Input |
Sets the intrinsicsCheck parameter. Whether to enable cyclic data move-in when the inner axis (last axis) of the left or right matrix on a single core is greater than or equal to 65535. For example, for the left matrix A [M, K], if singleCoreK of the inner axis on a single core is greater than 65535 and this parameter is set to true, data is moved in cyclically in the API. Values:
|
batchLoop |
Input |
Sets the isNBatch parameter. Whether to enable multi-batch input and output. This parameter is valid only for BatchMatmul. Values:
|
doMTE2Preload |
Input |
Sets the doMTE2Preload parameter. Whether to enable the preloading function in the M/N direction when MTE2 pipeline gap and the M/N value are large. After this function is enabled, the MTE2 pipeline gap is reduced and the performance is improved. The preloading function is valid only for the MDL template. Values:
Note: When preloading in the M/N direction is enabled, ensure that the data is fully loaded in the K direction and double buffering is enabled in the M/N direction. |
isVecND2NZ |
Input |
Sets the enVecND2NZ parameter. Whether to enable ND2NZ (converting data from ND format to NZ format) using the vector. To enable this function, you need to set SetLocalWorkspace. Values:
|
isPerTensor |
Input |
Sets the isPerTensor parameter. Whether quantization for matrix B is conducted per tensor (true) or per channel (false) in the scenario where matrix A's input type is half and matrix B's input type is int8. |
hasAntiQuantOffset |
Input |
Sets the hasAntiQuantOffset parameter. Whether to use the offset coefficient when matrix B quantization is enabled in the scenario where matrix A's input type is half and matrix B's input type is int8. |
Returns
Availability
Precautions
None
Example
1 2 3 4 5 6 7 | constexpr MatmulConfig MM_CFG = GetSpecialMDLConfig(); Matmul<A_TYPE, B_TYPE, C_TYPE, BIAS_TYPE, MM_CFG> mm; REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetBias(gm_bias); mm.IterateAll(gm_c); |