GetSysWorkSpacePtr

Function Usage

Obtains the pointer to the system workspace. When using high-level APIs such as Matmul, you need to call this API. When using the system workspace, you need to allocate the workspace size on the host. The reserved space size can be obtained by calling the GetLibApiWorkSpaceSize API. For details, see Workspace.

Prototype

1
__aicore__ inline __gm__ uint8_t* __gm__ GetSysWorkSpacePtr()

Parameters

None

Availability

Atlas Training Series Product

Precautions

None

Returns

Pointer to the system workspace

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
...
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); // Initialization
// CopyIn phase: Copy data from global memory to local memory.
mm.SetTensorA(gm_a);    // Set the left matrix A.
mm.SetTensorB(gm_b);    // Set the right matrix B.
mm.SetBias(gm_bias);    // Set the bias.
// Compute phase: Complete matrix multiplication computation.
while (mm.Iterate()) { 
    // CopyOut phase: Copy data from local memory to global memory.
    mm.GetTensorC(gm_c); 
}
// End the matrix multiplication operation.
mm.End();