GetSysWorkSpacePtr

Supported Products

Product

Supported/Unsupported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

Function Usage

Obtains the pointer to the system workspace. Some high-level APIs, such as Matmul, require the system workspace. The system workspace pointer needs to be passed to related APIs. In this case, you can call GetSysWorkSpacePtr to obtain the workspace pointer. When using the system workspace, you need to allocate the workspace size on the host. The reserved space size can be obtained by calling GetLibApiWorkSpaceSize.

Prototype

1
__aicore__ inline __gm__ uint8_t* __gm__ GetSysWorkSpacePtr()

Parameters

None

Restrictions

None

Return Value Description

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 the global memory to the 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 the local memory to the global memory.
    mm.GetTensorC(gm_c); 
}
// End the matrix multiplication operation.
mm.End();