DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::detail::event_impl Class Reference

#include <detail/event_impl.hpp>

Public Types

enum  HostEventState : int { HES_NotComplete = 0, HES_Complete, HES_Discarded }
 

Public Member Functions

 event_impl (HostEventState State=HES_Complete)
 Constructs a ready SYCL event. More...
 
 event_impl (RT::PiEvent Event, const context &SyclContext)
 Constructs an event instance from a plug-in event handle. More...
 
 event_impl (const QueueImplPtr &Queue)
 
bool is_host () const
 Checks if this event is a SYCL host event. More...
 
cl_event get () const
 Returns a valid OpenCL event interoperability handle. More...
 
void wait (std::shared_ptr< cl::sycl::detail::event_impl > Self) const
 Waits for the event. More...
 
void wait_and_throw (std::shared_ptr< cl::sycl::detail::event_impl > Self)
 Waits for the event. More...
 
void cleanupCommand (std::shared_ptr< cl::sycl::detail::event_impl > Self) const
 Clean up the command associated with the event. More...
 
template<info::event_profiling param>
info::param_traits< info::event_profiling, param >::return_type get_profiling_info () const
 Queries this event for profiling information. More...
 
template<info::event param>
info::param_traits< info::event, param >::return_type get_info () const
 Queries this SYCL event for information. More...
 
 ~event_impl ()
 
void waitInternal () const
 Waits for the event with respect to device type. More...
 
void setComplete ()
 Marks this event as completed. More...
 
RT::PiEventgetHandleRef ()
 Returns raw interoperability event handle. More...
 
const RT::PiEventgetHandleRef () const
 Returns raw interoperability event handle. More...
 
const ContextImplPtrgetContextImpl ()
 Returns context that is associated with this event. More...
 
const plugingetPlugin () const
 
void setContextImpl (const ContextImplPtr &Context)
 Associate event with the context. More...
 
void * getCommand ()
 Returns command that is associated with the event. More...
 
void setCommand (void *Command)
 Associates this event with the command. More...
 
HostProfilingInfogetHostProfilingInfo ()
 Returns host profiling information. More...
 
pi_native_handle getNative () const
 Gets the native handle of the SYCL event. More...
 
std::vector< std::shared_ptr< event_impl > > & getPreparedDepsEvents ()
 Returns vector of event dependencies. More...
 
std::vector< std::shared_ptr< event_impl > > & getPreparedHostDepsEvents ()
 Returns vector of host event dependencies. More...
 
std::vector< EventImplPtrgetWaitList ()
 Returns vector of event_impl that this event_impl depends on. More...
 
void flushIfNeeded (const QueueImplPtr &UserQueue)
 Performs a flush on the queue associated with this event if the user queue is different and the task associated with this event hasn't been submitted to the device yet. More...
 
void cleanupDependencyEvents ()
 Cleans dependencies of this event_impl. More...
 
void cleanDepEventsThroughOneLevel ()
 Cleans dependencies of this event's dependencies. More...
 
bool isDiscarded () const
 Checks if this event is discarded by SYCL implementation. More...
 
void setNeedsCleanupAfterWait (bool NeedsCleanupAfterWait)
 
bool needsCleanupAfterWait ()
 

Detailed Description

Definition at line 33 of file event_impl.hpp.

Member Enumeration Documentation

◆ HostEventState

Enumerator
HES_NotComplete 
HES_Complete 
HES_Discarded 

Definition at line 35 of file event_impl.hpp.

Constructor & Destructor Documentation

◆ event_impl() [1/3]

cl::sycl::detail::event_impl::event_impl ( HostEventState  State = HES_Complete)

Constructs a ready SYCL event.

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

Definition at line 101 of file event_impl.cpp.

◆ event_impl() [2/3]

cl::sycl::detail::event_impl::event_impl ( RT::PiEvent  Event,
const context SyclContext 
)

Constructs an event instance from a plug-in event handle.

The SyclContext must match the plug-in context associated with the ClEvent.

Parameters
Eventis a valid instance of plug-in event.
SyclContextis an instance of SYCL context.

Definition at line 104 of file event_impl.cpp.

References cl::sycl::detail::plugin::call(), getPlugin(), PI_EVENT_INFO_CONTEXT, PI_INVALID_CONTEXT, piEventGetInfo(), and piEventRetain().

◆ event_impl() [3/3]

cl::sycl::detail::event_impl::event_impl ( const QueueImplPtr Queue)

Definition at line 130 of file event_impl.cpp.

◆ ~event_impl()

cl::sycl::detail::event_impl::~event_impl ( )

Member Function Documentation

◆ cleanDepEventsThroughOneLevel()

void cl::sycl::detail::event_impl::cleanDepEventsThroughOneLevel ( )

Cleans dependencies of this event's dependencies.

Definition at line 414 of file event_impl.cpp.

◆ cleanupCommand()

void cl::sycl::detail::event_impl::cleanupCommand ( std::shared_ptr< cl::sycl::detail::event_impl Self) const

Clean up the command associated with the event.

Assumes that the task this event is associated with has been completed.

Parameters
Selfis a pointer to this event.

Definition at line 247 of file event_impl.cpp.

References cl::sycl::detail::Scheduler::cleanupFinishedCommands(), and cl::sycl::detail::Scheduler::getInstance().

Referenced by wait().

◆ cleanupDependencyEvents()

void cl::sycl::detail::event_impl::cleanupDependencyEvents ( )

Cleans dependencies of this event_impl.

Definition at line 408 of file event_impl.cpp.

◆ flushIfNeeded()

void cl::sycl::detail::event_impl::flushIfNeeded ( const QueueImplPtr UserQueue)

Performs a flush on the queue associated with this event if the user queue is different and the task associated with this event hasn't been submitted to the device yet.

Definition at line 382 of file event_impl.cpp.

References cl::sycl::detail::plugin::call(), getPlugin(), PI_EVENT_INFO_COMMAND_EXECUTION_STATUS, PI_EVENT_QUEUED, piEventGetInfo(), and piQueueFlush().

◆ get()

cl_event cl::sycl::detail::event_impl::get ( ) const

Returns a valid OpenCL event interoperability handle.

Returns
a valid instance of OpenCL cl_event.

Definition at line 38 of file event_impl.cpp.

References cl::sycl::detail::plugin::call(), cl::sycl::detail::pi::getPlugin(), PI_INVALID_EVENT, and piEventRetain().

◆ get_info()

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

Queries this SYCL event for information.

Returns
depends on the information being requested.

◆ get_profiling_info()

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

Queries this 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.

◆ getCommand()

void* cl::sycl::detail::event_impl::getCommand ( )
inline

Returns command that is associated with the event.

Scheduler mutex must be locked in read mode when this is called.

Returns
a generic pointer to Command object instance.

Definition at line 153 of file event_impl.hpp.

◆ getContextImpl()

const ContextImplPtr & cl::sycl::detail::event_impl::getContextImpl ( )

Returns context that is associated with this event.

Returns
a shared pointer to a valid context_impl.

Definition at line 89 of file event_impl.cpp.

◆ getHandleRef() [1/2]

RT::PiEvent & cl::sycl::detail::event_impl::getHandleRef ( )

Returns raw interoperability event handle.

Returned reference will be] invalid if event_impl was destroyed.

Returns
a reference to an instance of plug-in event handle.

Definition at line 86 of file event_impl.cpp.

Referenced by getNative().

◆ getHandleRef() [2/2]

const RT::PiEvent& cl::sycl::detail::event_impl::getHandleRef ( ) const

Returns raw interoperability event handle.

Returned reference will be] invalid if event_impl was destroyed.

Returns
a const reference to an instance of plug-in event handle.

◆ getHostProfilingInfo()

HostProfilingInfo* cl::sycl::detail::event_impl::getHostProfilingInfo ( )
inline

Returns host profiling information.

Returns
a pointer to HostProfilingInfo instance.

Definition at line 165 of file event_impl.hpp.

◆ getNative()

pi_native_handle cl::sycl::detail::event_impl::getNative ( ) const

Gets the native handle of the SYCL event.

Returns
a native handle.

Definition at line 344 of file event_impl.cpp.

References getHandleRef(), getPlugin(), cl::sycl::detail::getSyclObjImpl(), cl::sycl::opencl, piEventCreate, piEventRetain(), and piextEventGetNativeHandle().

◆ getPlugin()

const plugin & cl::sycl::detail::event_impl::getPlugin ( ) const
Returns
the Plugin associated with the context of this event. Should be called when this is not a Host Event.

Definition at line 91 of file event_impl.cpp.

Referenced by event_impl(), flushIfNeeded(), and getNative().

◆ getPreparedDepsEvents()

std::vector<std::shared_ptr<event_impl> >& cl::sycl::detail::event_impl::getPreparedDepsEvents ( )
inline

Returns vector of event dependencies.

Returns
a reference to MPreparedDepsEvents.

Definition at line 175 of file event_impl.hpp.

◆ getPreparedHostDepsEvents()

std::vector<std::shared_ptr<event_impl> >& cl::sycl::detail::event_impl::getPreparedHostDepsEvents ( )
inline

Returns vector of host event dependencies.

Returns
a reference to MPreparedHostDepsEvents.

Definition at line 182 of file event_impl.hpp.

◆ getWaitList()

std::vector< EventImplPtr > cl::sycl::detail::event_impl::getWaitList ( )

Returns vector of event_impl that this event_impl depends on.

Returns
a vector of "immediate" dependencies for this event_impl.

Definition at line 364 of file event_impl.cpp.

References HES_Discarded, cl::sycl::invalid, and cl::sycl::make_error_code().

Referenced by wait_and_throw().

◆ is_host()

bool cl::sycl::detail::event_impl::is_host ( ) const

Checks if this event is a SYCL host event.

All devices that do not support OpenCL interoperability are treated as host device to avoid attempts to call method get on such events.

Returns
true if this event is a SYCL host event.

Definition at line 36 of file event_impl.cpp.

◆ isDiscarded()

bool cl::sycl::detail::event_impl::isDiscarded ( ) const
inline

Checks if this event is discarded by SYCL implementation.

Returns
true if this event is discarded.

Definition at line 205 of file event_impl.hpp.

◆ needsCleanupAfterWait()

bool cl::sycl::detail::event_impl::needsCleanupAfterWait ( )
inline

Definition at line 210 of file event_impl.hpp.

◆ setCommand()

void cl::sycl::detail::event_impl::setCommand ( void *  Command)
inline

Associates this event with the command.

Scheduler mutex must be locked in write mode when this is called.

Parameters
Commandis a generic pointer to Command object instance.

Definition at line 160 of file event_impl.hpp.

◆ setComplete()

void cl::sycl::detail::event_impl::setComplete ( )

Marks this event as completed.

Definition at line 68 of file event_impl.cpp.

◆ setContextImpl()

void cl::sycl::detail::event_impl::setContextImpl ( const ContextImplPtr Context)

Associate event with the context.

Provided PiContext inside ContextImplPtr must be associated with the PiEvent object stored in this class

Parameters
Contextis a shared pointer to an instance of valid context_impl.

Definition at line 93 of file event_impl.cpp.

◆ setNeedsCleanupAfterWait()

void cl::sycl::detail::event_impl::setNeedsCleanupAfterWait ( bool  NeedsCleanupAfterWait)
inline

Definition at line 207 of file event_impl.hpp.

◆ wait()

void cl::sycl::detail::event_impl::wait ( std::shared_ptr< cl::sycl::detail::event_impl Self) const

Waits for the event.

Self is needed in order to pass shared_ptr to Scheduler.

Parameters
Selfis a pointer to this event.

Definition at line 195 of file event_impl.cpp.

References cleanupCommand(), cl::sycl::detail::Scheduler::getInstance(), HES_Discarded, cl::sycl::invalid, cl::sycl::make_error_code(), cl::sycl::detail::SYCL_STREAM_NAME, cl::sycl::detail::Scheduler::waitForEvent(), and waitInternal().

Referenced by wait_and_throw().

◆ wait_and_throw()

void cl::sycl::detail::event_impl::wait_and_throw ( std::shared_ptr< cl::sycl::detail::event_impl Self)

Waits 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. Self is needed in order to pass shared_ptr to Scheduler.

Parameters
Selfis a pointer to this event.

Definition at line 222 of file event_impl.cpp.

References cl::sycl::detail::Scheduler::getInstance(), cl::sycl::detail::Command::getSubmittedQueue(), getWaitList(), cl::sycl::detail::Scheduler::MGraphLock, and wait().

◆ waitInternal()

void cl::sycl::detail::event_impl::waitInternal ( ) const

Waits for the event with respect to device type.

Definition at line 53 of file event_impl.cpp.

References cl::sycl::detail::plugin::call(), cl::sycl::detail::pi::getPlugin(), cl::sycl::make_error_code(), and piEventsWait().

Referenced by wait().


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