产品 |
是否支持 |
|---|---|
Ascend 950PR/Ascend 950DT |
√ |
√ |
|
√ |
|
x |
|
√ |
|
x |
|
√ |
初始化SPM Buffer。
1 2 | template <typename T> __aicore__ inline void InitSpmBuffer(const GlobalTensor<T>& workspace, const int32_t bufferSize) |
1 | __aicore__ inline void InitSpmBuffer(const int32_t bufferSize) |
参数名 |
输入/输出 |
含义 |
|---|---|---|
workspace |
输入 |
workspace地址。 |
bufferSize |
输入 |
SPM Buffer的大小,单位是字节。 |
无
无
1 2 3 4 5 | AscendC::TPipe pipe; int len = 1024; // 设置spm buffer为1024个类型为T的数据 workspace_gm.SetGlobalBuffer((__gm__ T *)usrWorkspace, len); // 此处的usrWorkspace为用户自定义的workspace auto gm = workspace_gm[AscendC::GetBlockIdx() * len]; pipe.InitSpmBuffer(gm, len * sizeof(T)); |
1 2 3 | AscendC::TPipe pipe; int len = 1024; // 设置spm buffer为1024个类型为T的数据 pipe.InitSpmBuffer(len * sizeof(T)); |