SetWorkspace
Function Description
In the asynchronous scenario, a temporary space is required to cache the Iterate computation result. When GetTensorC is called, slices of matrix C are obtained from the temporary space.
Prototype
It is recommended that the GlobalTensor type be used.
1 | template <class T> __aicore__ inline void SetWorkspace(GlobalTensor<T>& addr) |
1 | template <class T> __aicore__ inline void SetWorkspace(__gm__ const T* addr, int size) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
addr |
Input |
Workspace on GM transferred by the user, of the GlobalTensor type. |
addr |
Input |
Workspace space on GM transferred by the user, of the GM address type. |
size |
Input |
When the GM address is transferred, the number of elements must also be transferred. |
Returns
None
Availability
Precautions
None
Example
1 2 3 4 5 6 | REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetWorkspace(workspaceGM); // Set the temporary space used in asynchronous mode. mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetBias(gm_bias); mm.IterateAll(gm_c); |
Parent topic: Matmul