GetResGroupBarrierWorkSpaceSize

Function

Obtains the workspace size required by GroupBarrier.

Prototype

1
uint32_t GetResGroupBarrierWorkSpaceSize(void) const

Parameters

None

Returns

Workspace size required by the current GroupBarrier.

Constraints

None.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// 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 GroupBarrier as the total size of usrWorkspace.
    size_t usrSize = 256 + ascendcPlatform.GetResGroupBarrierWorkSpaceSize(); // Set the size of the workspace to be used by the user.
    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.
    ...
}