SetWorkspace
功能说明
异步场景时,需要使用一块临时空间来缓存Iterate计算结果,调用GetTensorC时会在该临时空间中获取C的矩阵分片。
函数原型
建议用户使用GlobalTensor类型传入:
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)  | 
参数说明
参数名  | 
输入/输出  | 
描述  | 
|---|---|---|
addr  | 
输入  | 
用户传入的GM上的workspace空间,GlobalTensor类型。  | 
addr  | 
输入  | 
用户传入的GM上的workspace空间,GM地址类型。  | 
size  | 
输入  | 
传入GM地址时,需要配合传入元素个数。  | 
返回值
无
支持的型号
约束说明
模板参数enableMixDualMaster(默认取值为false)设置为true,即使能MixDualMaster(双主模式)场景时,不支持使用该接口。
调用示例
1 2 3 4 5 6 7 8 9  | REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetWorkspace(workspaceGM); //设置异步时使用的临时空间 mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetBias(gm_bias); mm.template Iterate<false>(); for (int i = 0; i < singleCoreM/baseM * singleCoreN/baseN; ++i) { mm.GetTensorC<false>(ub_c); }  | 
父主题: Matmul