Wait

Product Support

Product

Supported

Atlas A3 training products/Atlas A3 inference products

x

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

x

Atlas inference product's Vector Core

x

Atlas training products

x

Function

Checks whether a message has been processed by the AIC after PostMessage or PostFakeMessage is called.

Prototype

1
2
template <bool sync = true>
__aicore__ inline bool Wait(uint16_t offset)

Parameters

Table 1 Template parameters

Parameter

Description

sync

Whether the program needs to wait when messages are queried. Values:

  • true: The program can continue to run only after the AIC has processed the message.
  • false: The system only checks whether the AIC has processed the message.
Table 2 API parameters

Parameter

Input/Output

Description

offset

Input

Offset of the message space address, which is obtained from the return of PostMessage or PostFakeMessage.

Returns

  • true: The current message has been processed by the AIC.
  • false: The current message has not been fully processed by AIC.

Restrictions

None

Example

1
2
3
4
5
6
7
8
9
auto msgPtr = handle.AllocMessage();        // A new message can be sent at the location pointed to by 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.
bool waitState = handle.template Wait<true>(offset);      // Wait for the AIC to finish processing msgA.
// Fake message scenario
auto msgFakePtr = handle.AllocMessage();
offset = handle.PostFakeMsg(msgFakePtr);
bool waitState = handle.template Wait<true>(offset); // Wait for the AIC to finish processing msgFake.