AllocEventID

Function Usage

Applies for a TEventID of HardEvent (hardware synchronization event). This API must be used together with ReleaseEventID. After this API is called, the applied TEventID is occupied until ReleaseEventID is called.

Prototype

1
2
template <HardEvent evt>
__aicore__ inline TEventID TPipe::AllocEventID()

Parameters

Parameter

Input/Output

Meaning

evt

Input

HardEvent hardware synchronization type. For details about this type, see the description of synchronization types in the SetFlag/WaitFlag(ISASI).

Availability

Atlas Training Series Product

Precautions

The number of TEventIDs is limited. ReleaseEventID must be immediately called to release TEventID after the TEventID is used to prevent TEventID from being used up.

Returns

TEventID

Example

1
2
3
4
5
6
7
8
AscendC::TEventID eventID = GetTPipePtr()->AllocEventID<AscendC::HardEvent::V_S>(); //The scalar needs to wait for vector synchronization and the HardEvent ID is required.
AscendC::SetFlag<AscendC::HardEvent::V_S>(eventID);
......
......
......
AscendC::WaitFlag<AscendC::HardEvent::V_S>(eventID);
GetTPipePtr()->ReleaseEventID<AscendC::HardEvent::V_S>(eventID); //Release the ID of the hard event (scalar waiting for vector synchronization).
......