GroupBarrier构造函数
功能说明
创建GroupBarrier对象,通过设置构造函数参数,确定Arrive组的Block个数和Wait组的Block个数。
函数原型
1 2 3 | template <PipeMode pipeMode> class GroupBarrier; __aicore__ inline GroupBarrier(GM_ADDR groupWorkspace, uint32_t arriveSizeIn, uint32_t waitSizeIn); |
参数说明
数据类型 |
说明 |
||
---|---|---|---|
PipeMode |
GroupBarrier存储组同步消息时使用的执行单元,当前仅支持MTE3_MODE。
|
参数 |
输入/输出 |
说明 |
---|---|---|
groupWorkspace |
输入 |
该GroupBarrier储在GM上的起始地址,必须512B对齐。用户自行管理这部分GlobalMemory,包括地址对齐和清零。 |
arriveSizeIn |
输入 |
Arrive组AIV个数。 |
waitSizeIn |
输入 |
Wait组AIV个数。 |
返回值
GroupBarrier对象实例。
支持的型号
Atlas A2训练系列产品/Atlas 800I A2推理产品
约束说明
使用该接口时,UB空间末尾的1600B被占用。
调用示例
1 | AscendC::GroupBarrier<AscendC::PipeMode::MTE3_MODE> barA(startAddr, 3, 6); // 6个AIV等3个AIV Arrive后再开始后续业务,总共花费6 * 512B,起始地址为用户指定的startAddr。 |
父主题: GroupBarrier