CalcTschBlockDim
Function
Computes the blockDim of the Cube and Vector fusion operators in Cube-Vector separation mode. Operators for Vector/Cube fusion computing are started by groups of AIVs and AICs. blockDim is used to set the number of groups to be started. For example, if an AI processor has 40 Vector cores and 20 Cube cores, a group consists of two Vector cores and one Cube core. Set the number of groups to 20. In this case, 20 groups are started, including 40 Vector cores and 20 Cube cores. This API is used to automatically obtain a proper blockDim value.
Prototype
1
|
uint32_t CalcTschBlockDim(uint32_t sliceNum, uint32_t aicCoreNum, uint32_t aivCoreNum) const |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
sliceNum |
Input |
Number of data slices. |
|
aicCoreNum |
Input |
If cube computation APIs are used for operator implementation, pass the number returned by GetCoreNumAic. Otherwise, pass 0. |
|
aivCoreNum |
Input |
If vector computation APIs are used for operator implementation, pass the number returned by GetCoreNumAiv. Otherwise, pass 0. |
Returns
Number of cores used for underlying task scheduling
Constraints
None
Examples
1 2 3 4 5 6 7 8 9 |
ge::graphStatus TilingXXX(gert::TilingContext* context) { auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); auto aicNum = ascendcPlatform.GetCoreNumAic(); auto aivNum = ascendcPlatform.GetCoreNumAiv(); // ..Split data by aivNum and perform the computation. uint32_t sliceNum = aivNum; context->SetBlockDim(ascendcPlatform.CalcTschBlockDim(sliceNum, aicNum, aivNum)); return ret; } |