GetResCubeGroupWorkSpaceSize

Function Usage

Obtains the workspace size required by CreateCubeResGroup. To perform AI Core group computing based on CreateCubeResGroup, the workspace needs to be passed for message communication.

Prototype

uint32_t GetResCubeGroupWorkSpaceSize(void) const;

Parameters

None

Returns

Workspace size required by CreateCubeResGroup.

Constraints

None

Example

// User-defined tiling function
static ge::graphStatus TilingFunc(gert::TilingContext* context)
{
    AddApiTiling tiling;
    ...
    // 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();
    // Set the size of the required workspace and CreateCubeResGroup as the total size of usrWorkspace.
    size_t usrSize = 256 + ascendcPlatform.GetResCubeGroupWorkSpaceSize(); 
    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.
    ...
}