AllocMessage
Supported Products
|
Product |
Supported/Unsupported |
|---|---|
|
|
x |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
Function Usage
Allocates message space in a message queue requested by the AIV, which is used to store message structures. The address of the current message space is returned. The depth of the message queue is fixed to 4. The allocation of message space follows a specific order (e.g., top-down, then looping back). When the message space to which the message queue pointer points is in the FREE state, AllocMessage returns the address of the space. Otherwise, AllocMessage loops until the current space is in the FREE state.
Prototype
1 2 |
template <PipeMode pipeMode = PipeMode::SCALAR_MODE> __aicore__ inline __gm__ CubeMsgType *AllocMessage() |
Parameters
|
Parameter |
Description |
||
|---|---|---|---|
|
pipeMode |
Execution unit for sending messages. The PipeMode type is defined as follows:
Note that if pipeMode is set to MTE3_MODE, only the PostMessage API can be used to send messages. In addition, the template parameter pipeMode of the AllocMessage and PostMessage APIs must be the same. |
Returns
Address of the message space that is currently allocated for
Constraints
None
Example
1 2 3 |
auto queIdx = AscendC::GetBlockIdx(); handle.AssignQueue(queIdx); auto msgPtr = handle.AllocMessage(); // After a queue is bound, allocate message space in the queue. The message space address is msgPtr. |