GetCoreMemSize

Function

Obtains the memory size of the storage space on the hardware platform, for example, L1, L0_A, L0_B, and L2. The supported storage space types are defined as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
enum class CoreMemType {
L0_A = 0, // L0A Buffer
L0_B = 1, // L0B Buffer
L0_C = 2, // L0C Buffer
L1 = 3,   // L1 Buffer
L2 = 4,   // L2 Cache
UB = 5,   // Unified Buffer
HBM = 6,  // GM
FB = 7,   // Fixpipe Buffer
BT = 8,   // BiasTable Buffer
RESERVED
};

Prototype

1
void GetCoreMemSize(const CoreMemType &memType, uint64_t &size) const

Parameters

Parameter

Input/Output

Description

memType

Input

Hardware memory type.

size

Output

Size of the storage space of the corresponding type, in bytes

Returns

None

Constraints

None

Examples

1
2
3
4
5
6
7
8
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);
    // ...
    return ret;
}