ReserveLocalMemory
Function Usage
Reserves a memory space of a specified size in the Unified Buffer. After this API is called, you can use GetCoreMemSize API to obtain the actual available space of the Unified Buffer.
Prototype
1 | void ReserveLocalMemory(ReservedSize size) |
Parameters
Parameter |
Input/Output |
Description |
||
|---|---|---|---|---|
ReservedSize |
Input |
Size of the space to be reserved.
|
Returns
None
Restrictions
If this function is called multiple times, only the result of the last call is retained.
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; // Reserve 8 KB Unified Buffer memory. ascendcPlatform.ReserveLocalMemory(platform_ascendc::ReservedSize::RESERVED_SIZE_8K); // Obtain the actual available memory size of Unified Buffer and L1. ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ub_size); ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::L1, l1_size); // ... return ret; } |
For details about the complete example, see Example 2.
Parent topic: PlatformAscendC