GetSysWorkSpacePtr
Supported Products
Product |
Supported/Unsupported |
|---|---|
√ |
|
√ |
|
x |
|
√ |
|
x |
|
√ |
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(); |
Parent topic: Workspace