Overview

Function Usage

To implement the Tiling function on the host, certain hardware platform information, such as the number of cores on a hardware platform, may be required for Tiling calculation. The PlatformAscendC class provides a function for obtaining such platform information.

To use this function, the "tiling/platform/platform_ascendc.h" header file must be included. An example is as follows.

#include "tiling/platform/platform_ascendc.h"

Prototype

1
2
3
PlatformAscendC() = delete
~PlatformAscendC() = default
explicit PlatformAscendC(fe::PlatFormInfos *platformInfo): platformInfo_(platformInfo) {}

Parameters

Parameter

Input/Output

Description

platformlnfo

Input

platformInfo structure, which can be obtained through the GetPlatformInfo API.

Returns

None

Constraints

None

Example

ge::graphStatus TilingXXX(gert::TilingContext* context) {
    auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
    uint64_t ub_size, l1_size;
    ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ub_size);
    ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::L1, l1_size);
    auto aicNum = ascendcPlatform.GetCoreNumAic();
    auto aivNum = ascendcPlatform.GetCoreNumAiv();
    // ... Split by aivNum.
    context->SetBlockDim(ascendcPlatform.CalcTschBlockDim(aivNum, aicNum, aivNum));
    return ret;
}