GetLibApiWorkSpaceSize
Function Usage
Obtains the workspace size required by Ascend C APIs.
Prototype
uint32_t GetLibApiWorkSpaceSize(void) const;
Parameters
None
Returns
Result of the uint32_t data type, which indicates the size of the workspace in the current system
Constraints
None
Example
// User-defined tiling function
static ge::graphStatus TilingFunc(gert::TilingContext* context)
{
AddApiTiling tiling;
...
size_t usrSize = 256; // Set the workspace size as required.
// If you want to use the system workspace, call GetLibApiWorkSpaceSize to obtain its size.
auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo());
uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize();
size_t *currentWorkspace = context->GetWorkspaceSizes(1); // Obtain the workspace pointer through the framework. The input parameter of GetWorkspaceSizes is the number of required workspace blocks. Currently, only one block can be used.
currentWorkspace[0] = usrSize + sysWorkspaceSize; // Specify the total workspace size. The total workspace space is allocated and managed by the framework.
...
}
Parent topic: PlatformAscendC