目录

AllocEventID

Function Description

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.

Function Prototype

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

Parameters

Parameter Input/Output Description
evt Input Parameter of the **HardEvent **hardware synchronization type.

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

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.

Return Value

TEventID

Calling Example

// Need to insert synchronization between scalar and vector, and request the corresponding HardEvent ID.
AscendC::TEventID eventID = GetTPipePtr()->AllocEventID<AscendC::HardEvent::V_S>();
AscendC::SetFlag<AscendC::HardEvent::V_S>(eventID);
// ...
AscendC::WaitFlag<AscendC::HardEvent::V_S>(eventID);
// Release the ID of the HardEvent that synchronizes scalar with vector.
GetTPipePtr()->ReleaseEventID<AscendC::HardEvent::V_S>(eventID);
// ...