NotifyNextBlock
Supported Products
|
Product |
Supported/Unsupported |
|---|---|
|
|
x |
|
|
√ |
|
|
x |
|
|
√ |
|
|
x |
|
|
x |
Function Usage
Writes the GM address to notify the next core that the operation of the current core is completed and the next core can perform the operation. Before calling this API, ensure that InitDetermineComputeWorkspace has been called to initialize the shared memory.
Prototype
1
|
__aicore__ inline void NotifyNextBlock(GlobalTensor<int32_t>& gmWorkspace, LocalTensor<int32_t>& ubWorkspace) |
Parameters
|
Parameter |
Input/Output |
Meaning |
|---|---|---|
|
gmWorkspace |
Input |
Temporary space. gmWorkspace is written to notify other cores that the current core has completed the execution and other cores can continue the execution. The type is GlobalTensor. |
|
ubWorkspace |
Input |
Temporary space, which is used to operate gmWorkspace. The type is LocalTensor. |
Returns
None
Constraints
- Ensure that each core calls this API the same times.
- The minimum space allocated to gmWorkspace is blockNum * 32 bytes. The minimum space allocated to ubWorkspace is (blockNum * 32 + 32 bytes). blockNum indicates the number of called cores, which can be obtained by calling GetBlockNum.
- In separated mode, when this API is used for multi-core synchronization, the synchronization takes effect only on the AIV core. Only vector calculation instructions can be inserted between WaitPreBlock and NotifyNextBlock. Matrix calculation instructions do not take effect.
- When this API is used for multi-core control, the logical blockDim specified during operator calling must be less than or equal to the number of cores for running the operator. Otherwise, the framework inserts abnormal synchronization during multi-round scheduling, causing the kernel to stop responding.
Example
For details, see Example.