DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
cl::sycl::event Class Reference

An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barriers. More...

#include <CL/sycl/event.hpp>

Public Member Functions

 event ()
 Constructs a ready SYCL event. More...
 
 event (cl_event ClEvent, const context &SyclContext)
 Constructs a SYCL event instance from an OpenCL cl_event. More...
 
 event (const event &rhs)=default
 
 event (event &&rhs)=default
 
eventoperator= (const event &rhs)=default
 
eventoperator= (event &&rhs)=default
 
bool operator== (const event &rhs) const
 
bool operator!= (const event &rhs) const
 
cl_event get () const
 Returns a valid OpenCL event interoperability handle. More...
 
bool is_host () const
 Checks if this event is a SYCL host event. More...
 
std::vector< eventget_wait_list ()
 Return the list of events that this event waits for. More...
 
void wait ()
 Wait for the event. More...
 
void wait_and_throw ()
 Wait for the event. More...
 
template<info::event param>
info::param_traits< info::event, param >::return_type get_info () const
 Queries this SYCL event for information. More...
 
template<info::event_profiling param>
info::param_traits< info::event_profiling, param >::return_type get_profiling_info () const
 Queries this SYCL event for profiling information. More...
 
backend get_backend () const noexcept
 Returns the backend associated with this platform. More...
 
template<backend BackendName>
auto get_native () const -> typename interop< BackendName, event >::type
 Gets the native handle of the SYCL event. More...
 

Static Public Member Functions

static void wait (const std::vector< event > &EventList)
 Synchronously wait on a list of events. More...
 
static void wait_and_throw (const std::vector< event > &EventList)
 Synchronously wait on a list of events. More...
 

Friends

template<class T >
T detail::createSyclObjFromImpl (decltype(T::impl) ImplObj)
 

Detailed Description

An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barriers.

Definition at line 31 of file event.hpp.

Constructor & Destructor Documentation

◆ event() [1/4]

cl::sycl::event::event ( )

Constructs a ready SYCL event.

If the constructed SYCL event is waited on it will complete immediately.

Definition at line 25 of file event.cpp.

◆ event() [2/4]

cl::sycl::event::event ( cl_event  ClEvent,
const context SyclContext 
)

Constructs a SYCL event instance from an OpenCL cl_event.

The SyclContext must match the OpenCL context associated with the ClEvent.

Parameters
ClEventis a valid instance of OpenCL cl_event.
SyclContextis an instance of SYCL context.

Definition at line 27 of file event.cpp.

◆ event() [3/4]

cl::sycl::event::event ( const event rhs)
default

◆ event() [4/4]

cl::sycl::event::event ( event &&  rhs)
default

Member Function Documentation

◆ get()

cl_event cl::sycl::event::get ( ) const

Returns a valid OpenCL event interoperability handle.

Returns
a valid instance of OpenCL cl_event.

Definition at line 35 of file event.cpp.

◆ get_backend()

backend cl::sycl::event::get_backend ( ) const
noexcept

Returns the backend associated with this platform.

Returns
the backend associated with this platform

Definition at line 89 of file event.cpp.

References cl::sycl::detail::getImplBackend().

◆ get_info()

template<info::event param>
info::param_traits<info::event, param>::return_type cl::sycl::event::get_info ( ) const

Queries this SYCL event for information.

Returns
depends on the information being requested.

◆ get_native()

template<backend BackendName>
auto cl::sycl::event::get_native ( ) const -> typename interop<BackendName, event>::type
inline

Gets the native handle of the SYCL event.

Returns
a native handle, the type of which defined by the backend.

Definition at line 133 of file event.hpp.

◆ get_profiling_info()

template<info::event_profiling param>
info::param_traits<info::event_profiling, param>::return_type cl::sycl::event::get_profiling_info ( ) const

Queries this SYCL event for profiling information.

If the requested info is not available when this member function is called due to incompletion of command groups associated with the event, then the call to this member function will block until the requested info is available. If the queue which submitted the command group this event is associated with was not constructed with the property::queue::enable_profiling property, an invalid_object_error SYCL exception is thrown.

Returns
depends on template parameter.

◆ get_wait_list()

std::vector< event > cl::sycl::event::get_wait_list ( )

Return the list of events that this event waits for.

Only direct dependencies are returned. Already completed events are not included in the returned vector.

Returns
a vector of SYCL events.

Definition at line 55 of file event.cpp.

References cl::sycl::detail::Scheduler::getInstance().

◆ is_host()

bool cl::sycl::event::is_host ( ) const

Checks if this event is a SYCL host event.

Returns
true if this event is a SYCL host event.

Definition at line 37 of file event.cpp.

◆ operator!=()

bool cl::sycl::event::operator!= ( const event rhs) const

Definition at line 33 of file event.cpp.

◆ operator=() [1/2]

event& cl::sycl::event::operator= ( const event rhs)
default

◆ operator=() [2/2]

event& cl::sycl::event::operator= ( event &&  rhs)
default

◆ operator==()

bool cl::sycl::event::operator== ( const event rhs) const

Definition at line 31 of file event.cpp.

◆ wait() [1/2]

void cl::sycl::event::wait ( )

Wait for the event.

Definition at line 39 of file event.cpp.

◆ wait() [2/2]

void cl::sycl::event::wait ( const std::vector< event > &  EventList)
static

Synchronously wait on a list of events.

Parameters
EventListis a vector of SYCL events.

Definition at line 41 of file event.cpp.

◆ wait_and_throw() [1/2]

void cl::sycl::event::wait_and_throw ( )

Wait for the event.

If any uncaught asynchronous errors occurred on the context that the event is waiting on executions from, then call that context's asynchronous error handler with those errors.

Definition at line 47 of file event.cpp.

◆ wait_and_throw() [2/2]

void cl::sycl::event::wait_and_throw ( const std::vector< event > &  EventList)
static

Synchronously wait on a list of events.

If any uncaught asynchronous errors occurred on the context that the events are waiting on executions from, then call those contexts' asynchronous error handlers with those errors.

Parameters
EventListis a vector of SYCL events.

Definition at line 49 of file event.cpp.

Friends And Related Function Documentation

◆ detail::createSyclObjFromImpl

template<class T >
T detail::createSyclObjFromImpl ( decltype(T::impl)  ImplObj)
friend

The documentation for this class was generated from the following files: