GetNormalConfig
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
x |
|
|
x |
Function
Configures the parameters of the Norm template and obtains the custom Norm template. For details about the Norm template, see Table 1.
Prototype
1
|
__aicore__ constexpr MatmulConfig GetNormalConfig(const bool intrinsicsLimit = false, const bool batchLoop = false, const bool isVecND2NZ = false, const BatchMode bmmMode = BatchMode::BATCH_LESS_THAN_L1, const bool isMsgReuse = true, const IterateOrder iterateOrder = IterateOrder::UNDEF, const ScheduleType scheduleType = ScheduleType::INNER_PRODUCT, const bool enUnitFlag = true, const bool enableMixDualMaster = false, const BatchOutMode bmmOutMode = BatchOutMode::SINGLE_BATCH) |
Parameters
All parameters of this API are used to set the parameters of the MatmulConfig structure. The functions of the corresponding parameters are the same.
|
Parameter |
Input/Output |
Description |
||
|---|---|---|---|---|
|
intrinsicsLimit |
Input |
Sets the intrinsicsCheck parameter. Whether to enable cyclic data move-in from the Global Memory to L1 Buffer when the inner axis (last axis) of the left or right matrix on a single core is greater than or equal to 65535 (number of elements). 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. After this parameter is enabled, only the Norm template is supported, and IterateNBatch needs to be called to implement multi-batch input and output. Values:
|
||
|
isVecND2NZ |
Input |
Sets the enVecND2NZ parameter. Whether to enable ND2NZ (converting data from ND format to NZ format) using vector. To enable this function, you need to set SetLocalWorkspace. Values:
For |
||
|
bmmMode |
Input |
Sets the batchMode parameter. This parameter is used in the BatchMatmul scenario. For details about BatchMatmul, see Batch Matmul basic functions. Relationship between the total amount of multi-batch data for input matrices A and B in a BatchMatmul operation and the size of L1 Buffer when the layout type is set to Normal in the BatchMatmul scenario. Values:
|
||
|
isMsgReuse |
Input |
Sets the enableReuse parameter. SetSelfDefineDatafunction directly transfers the computation data. If the SetSelfDefineData function is not called to set dataPtr, this parameter can only be set to the default value true. Values:
|
||
|
iterateOrder |
Input |
Sets the iterateOrder parameter. Iteration sequence for Matmul to perform cube computation. The meaning of this parameter is the same as that of iterateOrder in Table 1. This parameter is valid only when ScheduleType is set to ScheduleType::OUTER_PRODUCT. Values:
Note: When the Norm template (Matmul scenario) and the MDL template are used, if IterateOrder is set to ORDER_M, the value of stepN in the TCubeTiling structure must be greater than 1. If IterateOrder is set to ORDER_N, the value of stepM in the TCubeTiling structure must be greater than 1. For details about how to use this parameter, see Matmul operator sample for pipeline parallelism in the M and N directions. For For For For |
||
|
scheduleType |
Input |
Sets the scheduleType parameter. Matmul data movement mode. Values:
Note:
|
||
|
enUnitFlag |
Input |
Sets the enUnitFlag parameter. Whether to enable the UnitFlag function to allow parallel execution of computation and data movement for performance improvement. By default, the function is enabled when the Norm and IBShare templates are used and disabled when the MDL template is used. Values:
|
||
|
enableMixDualMaster |
Input |
Sets the enableMixDualMaster parameter. Whether to enable MixDualMaster (dual-master mode). Different from the MIX mode (including cube computation and vector computation) that drives the AIC to run using the message mechanism, the dual-master mode enables the AIC and AIV to run independently without depending on the message mechanism. The default value is false. This parameter can be set to true only in the following scenarios:
Note that the following conditions must be met to enable MixDualMaster:
For For For For |
||
|
bmmOutMode |
Input |
Reserved parameter |
Returns
Restrictions
None
Examples
1 2 3 4 5 6 7 |
constexpr MatmulConfig MM_CFG = GetNormalConfig(); AscendC::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); |