Wait
Product Support
Product |
Supported |
|---|---|
x |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function
Waits for executing tasks after all AIVs in the Arrive group have completed tasks.
Prototype
1 | __aicore__ inline void Wait(uint32_t waitIndex) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
waitIndex |
Input |
Index of the AIV in the Wait group. Value range: [0, waitSize – 1]. |
Returns
None
Restrictions
This API can be used in iterations. However, the maximum number of iterations cannot exceed 1,048,575 due to the limitation of the inter-core communication efficiency.
Example
1 2 3 4 5 6 7 | if (id >= 0 && id < ARRIVE_NUM) { //Various Vector compute logic, which is implemented by users. barA.Arrive(id); } else if(id >= ARRIVE_NUM && id < ARRIVE_NUM + WAIT_NUM){ barA.Wait(id - ARRIVE_NUM); // Six AIVs in the Wait group need to wait until the AIVs in the Arrive group complete tasks. // Various Vector compute logic, which is implemented by users. } |
Parent topic: GroupBarrier