目录

GetLibApiWorkSpaceSize

Function Description

Obtains the workspace size required by Ascend C APIs.

Function Prototype

uint32_t GetLibApiWorkSpaceSize(void) const;

Parameters

None

Return Value

Result of the uint32_t type, which indicates the size of the workspace in the current system

Restrictions

None

Calling Example

// User-defined tiling function.
static ge::graphStatus TilingFunc(gert::TilingContext* context)
{
    AddApiTiling tiling;
    // ...
    size_t usrSize = 256; // Set the workspace size as required.
    // To use the system workspace, call GetLibApiWorkSpaceSize to obtain the size of the system workspace.
    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; // Set the total workspace size. The total workspace space is allocated and managed by the framework.
    // ...
}