PostMessage
Supported Products
Product |
Supported/Unsupported |
|---|---|
x |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function Usage
Sends the message after the message structure CubeMsgType is constructed at the message space address msg obtained using the AllocMessage API.
Prototype
1 2 | template <PipeMode pipeMode = PipeMode::SCALAR_MODE> __aicore__ inline uint16_t PostMessage(__gm__ CubeMsgType* msg, CubeMsgType& msgInput) |
Parameters
Parameter |
Description |
||
|---|---|---|---|
pipeMode |
Execution unit for sending messages. The PipeMode type is defined as follows:
|
Parameter |
Input/Output |
Description |
|---|---|---|
msg |
Input |
Message space address of a task in the CubeResGroupHandle object. |
msgInput |
Input |
Message content to be sent. |
Returns
Address offset between the current message space and the head space of the message queue
Constraints
None
Example
1 2 3 4 5 | handle.AssignQueue(queIdx); auto msgPtr = handle.AllocMessage(); // Obtain the message space pointer 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 offset = handle.PostMessage(msgPtr, msgA); // Fill the custom message structure at the location pointed to by msgPtr and send the message. |