Skip to content

Replace CommandEvent alias with DeviceEvent class

Introduce a wrapper around native device events, offering the following interface:

  • Default-constructed in an un-initialized state.
  • Constructed from an existing native event (taking ownership of it).
  • Checking whether it is initialized (isValid).
  • Checking whether the event has completed/was triggered/is ready (isReady).
  • Host synchronization (wait).
  • Checking if the event supports timing (timingSupported) and accessing it (getExecutionTime).
  • Accessing the internal native event.

The native API for working with events differ greatly between CUDA, OpenCL, and SYCL. This lead to some compromises in the design of this object and, what's worse, the differences in its behavior across different backends. Hopefully, a good balance was struck between making the object unified for the purposes of synchronization and timing (the latter on OpenCL and SYCL), while keeping the wrapper useable with the native API calls.

With this class, GpuEventSynchronizer can be rewritten (not in this MR) in a mostly backend-agnostic manner, see !1212 (closed).

Refs #3924 #2527

Edited by Andrey Alekseenko

Merge request reports