PostMessage
功能说明
通过AllocMessage接口获取到消息空间地址msg后,构造消息结构体CubeMsgType,发送该消息。
函数原型
1 2  | template <PipeMode pipeMode = PipeMode::SCALAR_MODE> __aicore__ inline uint16_t PostMessage(__gm__ CubeMsgType* msg, CubeMsgType& msgInput)  | 
参数说明
参数名  | 
描述  | 
||
|---|---|---|---|
pipeMode  | 
用于配置发送消息的执行单元。PipeMode类型,其定义如下: 
  | 
参数  | 
输入/输出  | 
说明  | 
|---|---|---|
msg  | 
输入  | 
该CubeResGroupHandle中某个任务的消息空间地址。  | 
msgInput  | 
输入  | 
需要发送的消息内容。  | 
返回值
当前消息空间与该消息队列队首空间的地址偏移。
支持的型号
Atlas A2训练系列产品/Atlas 800I A2推理产品
约束说明
无
调用示例
1 2 3 4 5  | a.AssignQueue(queIdx); auto msgPtr = a.AllocMessage(); // 获取消息空间指针msgPtr AscendC::CubeGroupMsgHead headA = {AscendC::CubeMsgState::VALID, 0}; AscendC::CubeMsgBody msgA = {headA, 1, 0, 0, false, false, false, false, 0, 0, 0, 0, 0, 0, 0, 0}; auto evtId = a.PostMessage(msgPtr, msgA); // 在msgPtr指针位置,填充用户自定义的消息结构体,并发送  | 
父主题: CubeResGroupHandle