aclrtCreateEventWithFlag

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

Creates an event with a flag. Events with different flags are used for different functions. When an event is created, multiple flags can be carried (bitwise OR operation) to enable the corresponding flag function.

Prototype

1
aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag)

Parameters

Parameter

Input/Output

Description

event

Output

Event pointer. For details about the type definition, see aclrtEvent.

flag

Input

Flag of the event pointer.

The supported macros are as follows:

  • ACL_EVENT_TIME_LINE: If this bit is enabled, the timestamp information needs to be recorded for the created event. Note: Enabling the timestamp function affects the performance of event-related APIs.
  • ACL_EVENT_SYNC: If this bit is enabled, the created event supports synchronization between multiple streams.
  • ACL_EVENT_CAPTURE_STREAM_PROGRESS: If this bit is enabled, the created event is used to trace the task execution progress of the stream.
  • ACL_EVENT_EXTERNAL: If this bit is enabled, the created event is used for task update in the task capture scenario. For details, see aclmdlRICaptureBegin. Note: This flag cannot be used with other flags in a bitwise OR operation.
  • ACL_EVENT_DEVICE_USE_ONLY: If this bit is enabled, the created event is called only on a device.

    ACL_EVENT_DEVICE_USE_ONLY is supported only by the following models:

    Atlas 350 Accelerator Card

    Atlas A3 training product/Atlas A3 inference product

    Atlas A2 training product/Atlas A2 inference product

    Atlas inference product

The macros are defined as follows:

#define ACL_EVENT_TIME_LINE 0x00000008U
#define ACL_EVENT_SYNC 0x00000001U
#define ACL_EVENT_CAPTURE_STREAM_PROGRESS 0x00000002U
#define ACL_EVENT_EXTERNAL  0x00000020U
#define ACL_EVENT_DEVICE_USE_ONLY  0x00000010U

Returns

0 on success; otherwise, failure. For details, see aclError.

Restrictions

When this API is called to create an event, the flag is a bitmap. You can set the flag to a single macro or perform the OR operation on multiple macros.

If the value of flag does not contain the ACL_EVENT_SYNC macro, events created by this API cannot be used in the following APIs: aclrtResetEvent, aclrtStreamWaitEvent, and aclrtQueryEventWaitStatus. If the value of flag contains the ACL_EVENT_SYNC macro or is set to ACL_EVENT_EXTERNAL, the number of created events is limited. For details, see the limits in the following table.

Model

Max. Events for a Device

Atlas inference product

1,023

Atlas training product

65,535

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

65536