目录

GetCoreNum

Function Description

Obtains the core number of the current hardware platform. If the AI Core architecture is a cube/vector decoupled architecture, the number of vector cores on AI Cores is returned. If the architecture is not a decoupled architecture, the number of AI Cores is returned.

Function Prototype

uint32_t GetCoreNum(void) const;

Parameters

None

Return Value

If the AI Core architecture is a cube/vector decoupled architecture, the number of vector cores on AI Cores is returned. If the architecture is not a decoupled architecture, the number of AI Cores is returned.

Currently, the processors with decoupled architecture include Kirin 9020 and Kirin 9030 series processors.

Restrictions

None

Calling Example

ge::graphStatus TilingXXX(gert::TilingContext* context) {
    auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
    auto coreNum = ascendcPlatform.GetCoreNum();
    // ... Design the tiling policy based on the number of cores.
    context->SetBlockDim(coreNum);
    return ret;
}