PostFakeMsg
Supported Products
|
Product |
Supported/Unsupported |
|---|---|
|
|
x |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
Function Usage
Sends a fake message for the AIV after the message space address is obtained using the AllocMessage API. The message status msgState is refreshed to FAKE.
When multiple AIV messages have the same content, the AIC needs to read only the first message in the front once. You can implement this function by setting the parameter skipCnt in the message structure to n to notify the AIC that the subsequent n messages do not need to be processed and can be directly skipped. The AIV needs to use this API to send fake messages. This is called the message merging mechanism or message merging scenario.
As shown in the following figure, assume that the 0th message of Queue 1, Queue 2, and Queue 3 is the same as the 0th message of Queue 0. In the message merging scenario, messages of Queue 0 (0) and Queue 4 (0) are processed by the AIC and computation is performed based on the custom message content. For the fake messages of Queue 1 (0), Queue 2 (0), and Queue 3 (0), the AIC directly releases the messages without reading for computation.
Prototype
1
|
__aicore__ inline uint16_t PostFakeMsg(__gm__ CubeMsgType* msg) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
msg |
Input |
Message space address of a task in the CubeResGroupHandle object. |
Returns
Address offset between the current message space and the head space of the message queue
Constraints
None
Example
1 2 3 |
hanndle.AssignQueue(queIdx); auto msgPtr = handle.AllocMessage(); // Obtain the message space pointer msgPtr. auto offset = handle.PostFakeMsg(msgPtr); // Send a fake message at the location pointed to by msgPtr. |