GetBasicConfig
Function Usage
Configures the parameters to obtain the user-defined BasicBlock template.
Prototype
1 | __aicore__ constexpr MatmulConfig GetBasicConfig(const uint32_t basicM, const uint32_t basicN, const uint32_t basicK, const bool intrinsicsLimit = false, const bool batchLoop = false, const BatchMode bmmMode = BatchMode::BATCH_LESS_THAN_L1) |
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 |
|---|---|---|
basicM |
Input |
Sets the basicM parameter. Equivalent to baseM. Length of the M axis of a base block during Matmul computation. The unit is element. |
basicN |
Input |
Sets the basicN parameter. Equivalent to baseN. Length of the N axis of a base block during Matmul computation. The unit is element. |
basicK |
Input |
Sets the basicK parameter. Equivalent to baseK. Length of the K axis of a base block during Matmul computation. The unit is element. |
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:
|
bmmMode |
Input |
Sets the batchMode parameter. 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 mode is set to NORMAL. Values:
|
Returns
Availability
Precautions
None
Example
For details about the BasicBlock template usage example, see basic_block_matmul.
1 2 3 4 5 6 7 | constexpr MatmulConfig MM_CFG = GetBasicConfig(128, 256, 64); // baseM, baseN, baseK 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); |