SetMatmulConfigParams
Function Usage
Sets the MatmulConfig parameters in Table 1 before the GetTiling API is called during tiling computation. The functions of parameters configured in this API must be the same in tiling and in the kernel. Therefore, the parameter settings in this API must be the same as the settings of the MatmulConfig parameters in the kernel. For details about the MatmulConfig parameters, see Table 2.
Prototype
1 | void SetMatmulConfigParams(int32_t mmConfigTypeIn = 1, bool enableL1CacheUBIn = false, ScheduleType scheduleTypeIn = ScheduleType::INNER_PRODUCT, MatrixTraverse traverseIn = MatrixTraverse::NOSET, bool enVecND2NZIn = false) |
1 | void SetMatmulConfigParams(const MatmulConfigParams& configParams) |
Parameters
Parameter |
Input/Output |
Description |
||
|---|---|---|---|---|
mmConfigTypeIn |
Input |
Matmul template type, which must be the same as the template created by the Matmul object. Currently, the value can only be 0 or 1.
|
||
enableL1CacheUBIn |
Input |
Whether to cache UB computing blocks in L1. It can be enabled in scenarios where MTE3 and MTE2 serial pipelines are applied.
|
||
scheduleTypeIn |
Input |
Matmul data movement mode. Values:
|
||
traverseIn |
Input |
Cyclic iteration order for Matmul to perform matrix computation, that is, the order in which Matmul automatically offsets to the output position of Matrix C for the next iteration after a matrix C slice with the size of [baseM, baseN] is computed in one iteration. Values:
|
||
enVecND2NZIn |
Input |
Whether to enable ND2NZ. |
||
configParams |
Input |
config parameter. It is of the MatmulConfigParams type. The structure is defined as follows: For details about the parameters, see Table 2.
|
Parameter |
Description |
||
|---|---|---|---|
mmConfigType |
Matmul template type, which must be the same as the template created by the Matmul object. Currently, the value can only be 0 or 1.
|
||
enableL1CacheUB |
Whether to cache UB computing blocks in L1. It can be enabled in scenarios where MTE3 and MTE2 serial pipelines are applied.
|
||
scheduleType |
Matmul data movement mode. Values:
|
||
traverse |
Cyclic iteration order for Matmul to perform matrix computation, that is, the order in which Matmul automatically offsets to the output position of Matrix C for the next iteration after a matrix C slice with the size of [baseM, baseN] is computed in one iteration. Values:
|
||
enVecND2NZ |
Whether to enable ND2NZ. |
Returns
None
Precautions
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); tiling.SetAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); tiling.SetBType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT); tiling.SetBiasType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT); tiling.SetShape(1024, 1024, 1024); tiling.SetOrgShape(1024, 1024, 1024); tiling.SetBias(true); tiling.SetBufferSpace(-1, -1, -1); tiling.SetMatmulConfigParams(0); // Additional settings // tiling.SetMatmulConfigParams({1, false, ScheduleType::OUTER_PRODUCT, MatrixTraverse::FIRSTM}); optiling::TCubeTiling tilingData; int ret = tiling.GetTiling(tilingData); |