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.
Kirin 9020 series processors
Kirin 9030 series processors
Kirin X90 series processors
// ...
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); // Initialization
// CopyIn stage: Move data from the global memory to the local memory.
mm.SetTensorA(gm_a); // Set the left cube A.
mm.SetTensorB(gm_b); // Set the right cube B.
mm.SetBias(gm_bias); // Set the bias.
// Compute phase: Complete cube multiplication computation.
while (mm.Iterate()) {
// CopyOut phase: Copy data from the local memory to the global memory.
mm.GetTensorC(gm_c);
}
// End the cube multiplication operation.
mm.End();