下载
中文
注册

FreeMessage

功能说明

在自定义的回调函数逻辑中,当前消息任务完成相关AIC计算后,调用该接口,刷新消息状态为FREE;或者待消息状态为指定状态waitState时,刷新消息状态为FREE。消息状态的介绍可以参考表2中的参数msgState。

函数原型

1
2
__aicore__ inline uint16_t FreeMessage(__gm__ CubeMsgType *msg);     
__aicore__ inline uint16_t FreeMessage(__gm__ CubeMsgType *msg, CubeMsgState waitState);   

参数说明

表1 接口参数说明

参数

输入/输出

说明

msg

输入

该CubeResGroupHandle中某个任务的消息空间地址。

waitState

输入

需要等待的msgState。

返回值

当前消息空间与该消息队列队首空间的地址偏移。

支持的型号

Atlas A2训练系列产品/Atlas 800I A2推理产品

约束说明

指定的消息状态waitState不能为QUIT和FREE。

调用示例

1
2
3
4
5
6
7
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);
};