Constructor and Destructor

Function

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 computation. The PlatformAscendC class provides a function for obtaining such platform information.

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 by calling the GetPlatformInfo API.

Returns

None

Constraints

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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;
}