20 #include <condition_variable>
24 inline namespace _V1 {
25 namespace ext::oneapi::experimental::detail {
36 using EventImplPtr = std::shared_ptr<sycl::detail::event_impl>;
88 void wait(std::shared_ptr<sycl::detail::event_impl> Self,
89 bool *Success =
nullptr);
99 void wait_and_throw(std::shared_ptr<sycl::detail::event_impl> Self);
117 template <
typename Param>
typename Param::return_type
get_info();
122 template <
typename Param>
286 std::lock_guard<std::mutex> Lock(
MMutex);
307 std::shared_ptr<ext::oneapi::experimental::detail::graph_impl> Graph) {
311 std::shared_ptr<ext::oneapi::experimental::detail::graph_impl>
343 uint64_t &instance_id)
const;
346 int32_t StreamID, uint64_t IId)
const;
384 std::condition_variable
cv;
388 std::weak_ptr<ext::oneapi::experimental::detail::graph_impl>
MGraph;
402 friend std::vector<sycl::detail::pi::PiEvent>
404 std::shared_ptr<sycl::detail::context_impl> Context);
The context class represents a SYCL context on which kernel functions may be executed.
The Command class represents some action that needs to be performed on one or more memory objects.
Profiling info for the host execution.
static const char * get()
Param::return_type get_backend_info() const
Queries this SYCL event for SYCL backend-specific information.
void setCommandGraph(std::shared_ptr< ext::oneapi::experimental::detail::graph_impl > Graph)
void attachEventToComplete(const EventImplPtr &Event)
void setSubmittedQueue(const QueueImplPtr &SubmittedQueue)
Sets original queue used for submission.
Param::return_type get_info()
Queries this SYCL event for information.
std::vector< std::shared_ptr< event_impl > > & getPreparedDepsEvents()
Returns vector of event dependencies.
void checkProfilingPreconditions() const
Param::return_type get_profiling_info()
Queries this event for profiling information.
std::vector< EventImplPtr > getWaitList()
Returns vector of event_impl that this event_impl depends on.
void * instrumentationProlog(std::string &Name, int32_t StreamID, uint64_t &instance_id) const
uint64_t getSubmissionTime()
friend std::vector< sycl::detail::pi::PiEvent > getOrWaitEvents(std::vector< sycl::event > DepEvents, std::shared_ptr< sycl::detail::context_impl > Context)
std::vector< EventImplPtr > MPostCompleteEvents
void cleanDepEventsThroughOneLevel()
Cleans dependencies of this event's dependencies.
void waitInternal(bool *Success=nullptr)
Waits for the event with respect to device type.
void setComplete()
Marks this event as completed.
pi_native_handle getNative()
Gets the native handle of the SYCL event.
bool MEventFromSubmittedExecCommandBuffer
Indicates that the event results from a command graph submission.
void * getCommand()
Returns command that is associated with the event.
std::unique_ptr< HostProfilingInfo > MHostProfilingInfo
std::vector< std::shared_ptr< event_impl > > & getPreparedHostDepsEvents()
Returns vector of host event dependencies.
bool isContextInitialized() const noexcept
void setCommandBufferCommand(sycl::detail::pi::PiExtCommandBufferCommand Command)
void setEventFromSubmittedExecCommandBuffer(bool value)
void setContextImpl(const ContextImplPtr &Context)
Associate event with the context.
void setHostEnqueueTime()
Calling this function to capture the host timestamp to use profiling base time.
std::weak_ptr< ext::oneapi::experimental::detail::graph_impl > MGraph
Store the command graph associated with this event, if any.
bool isDiscarded() const
Checks if this event is discarded by SYCL implementation.
const ContextImplPtr & getContextImpl()
Returns context that is associated with this event.
void flushIfNeeded(const QueueImplPtr &UserQueue)
Performs a flush on the queue associated with this event if the user queue is different and the task ...
std::weak_ptr< queue_impl > MSubmittedQueue
void setSyncPoint(sycl::detail::pi::PiExtSyncPoint SyncPoint)
bool MIsContextInitialized
std::atomic< int > MState
sycl::detail::pi::PiEvent MEvent
void ensureContextInitialized()
void instrumentationEpilog(void *TelementryEvent, const std::string &Name, int32_t StreamID, uint64_t IId) const
event_impl(std::optional< HostEventState > State=HES_Complete)
Constructs a ready SYCL event.
bool isEventFromSubmittedExecCommandBuffer() const
void associateWithQueue(const QueueImplPtr &Queue)
Associate event with provided queue.
sycl::detail::pi::PiExtSyncPoint MSyncPoint
bool isCompleted()
Checks if this event is complete.
sycl::detail::pi::PiExtSyncPoint getSyncPoint() const
QueueImplPtr getWorkerQueue()
Returns worker queue for command.
std::vector< EventImplPtr > MPreparedHostDepsEvents
void wait(std::shared_ptr< sycl::detail::event_impl > Self, bool *Success=nullptr)
Waits for the event.
QueueImplPtr getSubmittedQueue() const
void setStateIncomplete()
Clear the event state.
std::condition_variable cv
sycl::detail::pi::PiExtCommandBufferCommand getCommandBufferCommand() const
std::vector< EventImplPtr > MPreparedDepsEvents
Dependency events prepared for waiting by backend.
bool isInitialized() const noexcept
Checks if an event is in a fully intialized state.
void setSubmissionTime()
Calling this function queries the current device timestamp and sets it as submission time for the com...
void cleanupDependencyEvents()
Cleans dependencies of this event_impl.
const std::vector< EventImplPtr > & getPostCompleteEvents() const
void wait_and_throw(std::shared_ptr< sycl::detail::event_impl > Self)
Waits for the event.
void setWorkerQueue(const QueueImplPtr &WorkerQueue)
Sets worker queue for command.
void setCommand(void *Command)
Associates this event with the command.
const PluginPtr & getPlugin()
bool isNOP()
Indicates if this event is not associated with any command and doesn't have native handle.
sycl::detail::pi::PiEvent & getHandleRef()
Returns raw interoperability event handle.
bool is_host()
Checks if this event is a SYCL host event.
HostProfilingInfo * getHostProfilingInfo()
Returns host profiling information.
std::atomic< bool > MIsFlushed
Indicates that the task associated with this event has been submitted by the queue to the device.
std::weak_ptr< queue_impl > MWorkerQueue
sycl::detail::pi::PiExtCommandBufferCommand MCommandBufferCommand
std::weak_ptr< queue_impl > MQueue
std::shared_ptr< ext::oneapi::experimental::detail::graph_impl > getCommandGraph() const
ContextImplPtr getContextImplPtr()
::pi_ext_sync_point PiExtSyncPoint
::pi_ext_command_buffer_command PiExtCommandBufferCommand
std::shared_ptr< sycl::detail::context_impl > ContextImplPtr
std::shared_ptr< event_impl > EventImplPtr
std::shared_ptr< plugin > PluginPtr
std::shared_ptr< sycl::detail::queue_impl > QueueImplPtr
uintptr_t pi_native_handle
C++ wrapper of extern "C" PI interfaces.
_Abi const simd< _Tp, _Abi > & noexcept