FreeMessage
产品支持情况
功能说明
在自定义的回调函数逻辑中,完成消息处理后,调用该接口,刷新消息状态为FREE;或者待消息状态为指定状态waitState时,刷新消息状态为FREE。消息状态的介绍可以参考表2中的参数msgState。
函数原型
__aicore__ inline uint16_t FreeMessage(__gm__ CubeMsgType *msg);
__aicore__ inline uint16_t FreeMessage(__gm__ CubeMsgType *msg, CubeMsgState waitState);
参数说明
表 1 接口参数说明
返回值说明
当前消息空间与该消息队列队首空间的地址偏移。
约束说明
指定的消息状态waitState不能为QUIT和FREE。
调用示例
template <int32_t funcId>
__aicore__ inline static typename IsEqual<funcId, 1>::Type CubeGroupCallBack(
MatmulApiCfg &mm, __gm__ CubeMsgBody *rcvMsg, CubeResGroupHandle<CubeMsgBody> &handle)
{
// Cube核上计算逻辑,此处用户自行实现,在一切计算完毕后需要调用FreeMessage,代表rcvMsg已处理完。
auto tmpId = handle.FreeMessage(rcvMsg);
};