获取硬件平台存储空间的内存大小,例如L1、L0_A、L0_B、L2等,支持的存储空间类型定义如下。
enum class CoreMemType {
L0_A = 0,
L0_B = 1,
L0_C = 2,
L1 = 3,
L2 = 4,
UB = 5,
HBM = 6,
RESERVED
}; 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;
}