DPC++ Runtime
Runtime libraries for oneAPI DPC++
event_impl.cpp
Go to the documentation of this file.
1 //==---------------- event_impl.cpp - SYCL event ---------------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <detail/event_impl.hpp>
10 #include <detail/event_info.hpp>
11 #include <detail/plugin.hpp>
12 #include <detail/queue_impl.hpp>
14 #include <sycl/context.hpp>
15 #include <sycl/device_selector.hpp>
16 
17 #include "detail/config.hpp"
18 
19 #include <chrono>
20 
21 #ifdef XPTI_ENABLE_INSTRUMENTATION
22 #include "xpti/xpti_trace_framework.hpp"
23 #include <atomic>
24 #include <detail/xpti_registry.hpp>
25 #include <sstream>
26 #endif
27 
28 namespace sycl {
29 inline namespace _V1 {
30 namespace detail {
31 #ifdef XPTI_ENABLE_INSTRUMENTATION
32 extern xpti::trace_event_data_t *GSYCLGraphEvent;
33 #endif
34 
35 // If we do not yet have a context, use the default one.
38  return;
39 
40  if (MHostEvent) {
42  this->setContextImpl(detail::getSyclObjImpl(HostQueue->get_context()));
43  } else {
44  const device SyclDevice;
46  detail::getSyclObjImpl(SyclDevice)));
47  }
48 }
49 
51  // Treat all devices that don't support interoperability as host devices to
52  // avoid attempts to call method get on such events.
53  return MHostEvent;
54 }
55 
57  if (MEvent)
59 }
60 
62  if (!MHostEvent && MEvent) {
63  // Wait for the native event
65  } else if (MState == HES_Discarded) {
66  // Waiting for the discarded event is invalid
67  throw sycl::exception(
69  "waitInternal method cannot be used for a discarded event.");
70  } else if (MState != HES_Complete) {
71  // Wait for the host event
72  std::unique_lock<std::mutex> lock(MMutex);
73  cv.wait(lock, [this] { return MState == HES_Complete; });
74  }
75 
76  // Wait for connected events(e.g. streams prints)
77  for (const EventImplPtr &Event : MPostCompleteEvents)
78  Event->wait(Event);
79 }
80 
82  if (MHostEvent || !MEvent) {
83  {
84  std::unique_lock<std::mutex> lock(MMutex);
85 #ifndef NDEBUG
86  int Expected = HES_NotComplete;
87  int Desired = HES_Complete;
88 
89  bool Succeeded = MState.compare_exchange_strong(Expected, Desired);
90 
91  assert(Succeeded && "Unexpected state of event");
92 #else
93  MState.store(static_cast<int>(HES_Complete));
94 #endif
95  }
96  cv.notify_all();
97  return;
98  }
99 
100  assert(false && "setComplete is not supported for non-host event");
101 }
102 
103 static uint64_t inline getTimestamp() {
104  auto Timestamp = std::chrono::high_resolution_clock::now().time_since_epoch();
105  return std::chrono::duration_cast<std::chrono::nanoseconds>(Timestamp)
106  .count();
107 }
108 
110  return MEvent;
111 }
113 
116  return MContext;
117 }
118 
121  return MContext->getPlugin();
122 }
123 
125 
127  MHostEvent = Context->is_host();
128  MContext = Context;
129  MIsContextInitialized = true;
130 }
131 
133  const context &SyclContext)
134  : MIsContextInitialized(true), MEvent(Event),
135  MContext(detail::getSyclObjImpl(SyclContext)), MHostEvent(false),
136  MIsFlushed(true), MState(HES_Complete) {
137 
138  if (MContext->is_host()) {
139  throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
140  "The syclContext must match the OpenCL context "
141  "associated with the clEvent. " +
142  codeToString(PI_ERROR_INVALID_CONTEXT));
143  }
144 
145  sycl::detail::pi::PiContext TempContext;
148  &TempContext, nullptr);
149  if (MContext->getHandleRef() != TempContext) {
150  throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
151  "The syclContext must match the OpenCL context "
152  "associated with the clEvent. " +
153  codeToString(PI_ERROR_INVALID_CONTEXT));
154  }
155 }
156 
158  : MQueue{Queue},
159  MIsProfilingEnabled{Queue->is_host() || Queue->MIsProfilingEnabled},
160  MFallbackProfiling{MIsProfilingEnabled && Queue->isProfilingFallback()} {
161  this->setContextImpl(Queue->getContextImplPtr());
162  if (Queue->is_host()) {
163  MState.store(HES_NotComplete);
164  if (Queue->has_property<property::queue::enable_profiling>()) {
165  MHostProfilingInfo.reset(new HostProfilingInfo());
166  if (!MHostProfilingInfo)
167  throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
168  "Out of host memory " +
169  codeToString(PI_ERROR_OUT_OF_HOST_MEMORY));
170  }
171  return;
172  }
173  MState.store(HES_Complete);
174 }
175 
176 void *event_impl::instrumentationProlog(std::string &Name, int32_t StreamID,
177  uint64_t &IId) const {
178  void *TraceEvent = nullptr;
179 #ifdef XPTI_ENABLE_INSTRUMENTATION
180  constexpr uint16_t NotificationTraceType = xpti::trace_wait_begin;
181  if (!xptiCheckTraceEnabled(StreamID, NotificationTraceType))
182  return TraceEvent;
183  // Use a thread-safe counter to get a unique instance ID for the wait() on the
184  // event
185  static std::atomic<uint64_t> InstanceID = {1};
186  xpti::trace_event_data_t *WaitEvent = nullptr;
187 
188  // Create a string with the event address so it
189  // can be associated with other debug data
190  xpti::utils::StringHelper SH;
191  Name = SH.nameWithAddress<sycl::detail::pi::PiEvent>("event.wait", MEvent);
192 
193  // We can emit the wait associated with the graph if the
194  // event does not have a command object or associated with
195  // the command object, if it exists
196  if (MCommand) {
197  Command *Cmd = (Command *)MCommand;
198  WaitEvent = Cmd->MTraceEvent ? static_cast<xpti_td *>(Cmd->MTraceEvent)
199  : GSYCLGraphEvent;
200  } else
201  WaitEvent = GSYCLGraphEvent;
202 
203  // Record the current instance ID for use by Epilog
204  IId = InstanceID++;
205  xptiNotifySubscribers(StreamID, NotificationTraceType, nullptr, WaitEvent,
206  IId, static_cast<const void *>(Name.c_str()));
207  TraceEvent = (void *)WaitEvent;
208 #endif
209  return TraceEvent;
210 }
211 
212 void event_impl::instrumentationEpilog(void *TelemetryEvent,
213  const std::string &Name,
214  int32_t StreamID, uint64_t IId) const {
215 #ifdef XPTI_ENABLE_INSTRUMENTATION
216  constexpr uint16_t NotificationTraceType = xpti::trace_wait_end;
217  if (!(xptiCheckTraceEnabled(StreamID, NotificationTraceType) &&
218  TelemetryEvent))
219  return;
220  // Close the wait() scope
221  xpti::trace_event_data_t *TraceEvent =
222  (xpti::trace_event_data_t *)TelemetryEvent;
223  xptiNotifySubscribers(StreamID, NotificationTraceType, nullptr, TraceEvent,
224  IId, static_cast<const void *>(Name.c_str()));
225 #endif
226 }
227 
228 void event_impl::wait(std::shared_ptr<sycl::detail::event_impl> Self) {
229  if (MState == HES_Discarded)
231  "wait method cannot be used for a discarded event.");
232 
233  if (MGraph.lock()) {
235  "wait method cannot be used for an event associated "
236  "with a command graph.");
237  }
238 
239 #ifdef XPTI_ENABLE_INSTRUMENTATION
240  void *TelemetryEvent = nullptr;
241  uint64_t IId;
242  std::string Name;
243  int32_t StreamID = xptiRegisterStream(SYCL_STREAM_NAME);
244  TelemetryEvent = instrumentationProlog(Name, StreamID, IId);
245 #endif
246 
247  if (MEvent)
248  // presence of MEvent means the command has been enqueued, so no need to
249  // go via the slow path event waiting in the scheduler
250  waitInternal();
251  else if (MCommand)
253 
254 #ifdef XPTI_ENABLE_INSTRUMENTATION
255  instrumentationEpilog(TelemetryEvent, Name, StreamID, IId);
256 #endif
257 }
258 
260  std::shared_ptr<sycl::detail::event_impl> Self) {
261  wait(Self);
262 
263  if (QueueImplPtr SubmittedQueue = MSubmittedQueue.lock())
264  SubmittedQueue->throw_asynchronous();
265 }
266 
268  std::weak_ptr<queue_impl> EmptyPtr;
269 
270  if (!EmptyPtr.owner_before(MQueue) && !MQueue.owner_before(EmptyPtr)) {
271  throw sycl::exception(make_error_code(sycl::errc::invalid),
272  "Profiling information is unavailable as the event "
273  "has no associated queue.");
274  }
275  if (!MIsProfilingEnabled) {
276  throw sycl::exception(
277  make_error_code(sycl::errc::invalid),
278  "Profiling information is unavailable as the queue associated with "
279  "the event does not have the 'enable_profiling' property.");
280  }
282  throw sycl::exception(make_error_code(sycl::errc::invalid),
283  "Profiling information is unavailable for events "
284  "returned by a graph submission.");
285  }
286 }
287 
288 template <>
289 uint64_t
290 event_impl::get_profiling_info<info::event_profiling::command_submit>() {
291  checkProfilingPreconditions();
292  return MSubmitTime;
293 }
294 
295 template <>
296 uint64_t
297 event_impl::get_profiling_info<info::event_profiling::command_start>() {
298  checkProfilingPreconditions();
299  if (!MHostEvent) {
300  if (MEvent) {
301  auto StartTime =
302  get_event_profiling_info<info::event_profiling::command_start>(
303  this->getHandleRef(), this->getPlugin());
304  if (!MFallbackProfiling) {
305  return StartTime;
306  } else {
307  auto DeviceBaseTime =
308  get_event_profiling_info<info::event_profiling::command_submit>(
309  this->getHandleRef(), this->getPlugin());
310  return MHostBaseTime - DeviceBaseTime + StartTime;
311  }
312  }
313  return 0;
314  }
315  if (!MHostProfilingInfo)
316  throw sycl::exception(
317  sycl::make_error_code(sycl::errc::invalid),
318  "Profiling info is not available. " +
319  codeToString(PI_ERROR_PROFILING_INFO_NOT_AVAILABLE));
320  return MHostProfilingInfo->getStartTime();
321 }
322 
323 template <>
324 uint64_t event_impl::get_profiling_info<info::event_profiling::command_end>() {
325  checkProfilingPreconditions();
326  if (!MHostEvent) {
327  if (MEvent) {
328  auto EndTime =
329  get_event_profiling_info<info::event_profiling::command_end>(
330  this->getHandleRef(), this->getPlugin());
331  if (!MFallbackProfiling) {
332  return EndTime;
333  } else {
334  auto DeviceBaseTime =
335  get_event_profiling_info<info::event_profiling::command_submit>(
336  this->getHandleRef(), this->getPlugin());
337  return MHostBaseTime - DeviceBaseTime + EndTime;
338  }
339  }
340  return 0;
341  }
342  if (!MHostProfilingInfo)
343  throw sycl::exception(
344  sycl::make_error_code(sycl::errc::invalid),
345  "Profiling info is not available. " +
346  codeToString(PI_ERROR_PROFILING_INFO_NOT_AVAILABLE));
347  return MHostProfilingInfo->getEndTime();
348 }
349 
350 template <> uint32_t event_impl::get_info<info::event::reference_count>() {
351  if (!MHostEvent && MEvent) {
352  return get_event_info<info::event::reference_count>(this->getHandleRef(),
353  this->getPlugin());
354  }
355  return 0;
356 }
357 
358 template <>
360 event_impl::get_info<info::event::command_execution_status>() {
361  if (MState == HES_Discarded)
363 
364  if (!MHostEvent) {
365  // Command is enqueued and PiEvent is ready
366  if (MEvent)
367  return get_event_info<info::event::command_execution_status>(
368  this->getHandleRef(), this->getPlugin());
369  // Command is blocked and not enqueued, PiEvent is not assigned yet
370  else if (MCommand)
371  return sycl::info::event_command_status::submitted;
372  }
373 
374  return MHostEvent && MState.load() != HES_Complete
375  ? sycl::info::event_command_status::submitted
377 }
378 
379 void HostProfilingInfo::start() { StartTime = getTimestamp(); }
380 
381 void HostProfilingInfo::end() { EndTime = getTimestamp(); }
382 
385 
386  auto Plugin = getPlugin();
387  if (!MIsInitialized) {
388  MIsInitialized = true;
389  auto TempContext = MContext.get()->getHandleRef();
390  Plugin->call<PiApiKind::piEventCreate>(TempContext, &MEvent);
391  }
392  if (MContext->getBackend() == backend::opencl)
393  Plugin->call<PiApiKind::piEventRetain>(getHandleRef());
394  pi_native_handle Handle;
395  Plugin->call<PiApiKind::piextEventGetNativeHandle>(getHandleRef(), &Handle);
396  return Handle;
397 }
398 
399 std::vector<EventImplPtr> event_impl::getWaitList() {
400  if (MState == HES_Discarded)
401  throw sycl::exception(
403  "get_wait_list() cannot be used for a discarded event.");
404 
405  std::lock_guard<std::mutex> Lock(MMutex);
406 
407  std::vector<EventImplPtr> Result;
408  Result.reserve(MPreparedDepsEvents.size() + MPreparedHostDepsEvents.size());
409  Result.insert(Result.end(), MPreparedDepsEvents.begin(),
410  MPreparedDepsEvents.end());
411  Result.insert(Result.end(), MPreparedHostDepsEvents.begin(),
413 
414  return Result;
415 }
416 
417 void event_impl::flushIfNeeded(const QueueImplPtr &UserQueue) {
418  // Some events might not have a native handle underneath even at this point,
419  // e.g. those produced by memset with 0 size (no PI call is made).
420  if (MIsFlushed || !MEvent)
421  return;
422 
423  QueueImplPtr Queue = MQueue.lock();
424  // If the queue has been released, all of the commands have already been
425  // implicitly flushed by piQueueRelease.
426  if (!Queue) {
427  MIsFlushed = true;
428  return;
429  }
430  if (Queue == UserQueue)
431  return;
432 
433  // Check if the task for this event has already been submitted.
437  nullptr);
438  if (Status == PI_EVENT_QUEUED) {
439  getPlugin()->call<PiApiKind::piQueueFlush>(Queue->getHandleRef());
440  }
441  MIsFlushed = true;
442 }
443 
445  std::lock_guard<std::mutex> Lock(MMutex);
446  MPreparedDepsEvents.clear();
447  MPreparedHostDepsEvents.clear();
448 }
449 
451  std::lock_guard<std::mutex> Lock(MMutex);
452  for (auto &Event : MPreparedDepsEvents) {
453  Event->cleanupDependencyEvents();
454  }
455  for (auto &Event : MPreparedHostDepsEvents) {
456  Event->cleanupDependencyEvents();
457  }
458 }
459 
461  if (!MIsProfilingEnabled)
462  return;
463  if (!MFallbackProfiling) {
464  if (QueueImplPtr Queue = MQueue.lock()) {
465  try {
466  MSubmitTime = Queue->getDeviceImplPtr()->getCurrentDeviceTime();
467  } catch (feature_not_supported &e) {
468  throw sycl::exception(
470  std::string("Unable to get command group submission time: ") +
471  e.what());
472  }
473  }
474  } else {
475  // Capture the host timestamp for a return value of function call
476  // <info::event_profiling::command_submit>. See MFallbackProfiling
478  }
479 }
480 
483  return;
484  // Capture a host timestamp to use normalize profiling time in
485  // <command_start> and <command_end>. See MFallbackProfiling
487 }
488 
490 
492  return get_info<info::event::command_execution_status>() ==
494 }
495 
496 } // namespace detail
497 } // namespace _V1
498 } // namespace sycl
sycl::_V1::detail::Command
The Command class represents some action that needs to be performed on one or more memory objects.
Definition: commands.hpp:99
piEventRelease
pi_result piEventRelease(pi_event event)
Definition: pi_cuda.cpp:594
sycl::_V1::detail::event_impl::MHostEvent
bool MHostEvent
Definition: event_impl.hpp:312
event_info.hpp
event_impl.hpp
sycl::_V1::detail::event_impl::getWaitList
std::vector< EventImplPtr > getWaitList()
Returns vector of event_impl that this event_impl depends on.
Definition: event_impl.cpp:399
sycl::_V1::detail::SYCL_STREAM_NAME
constexpr const char * SYCL_STREAM_NAME
Definition: xpti_registry.hpp:29
sycl::_V1::detail::HostProfilingInfo::end
void end()
Measures event's end time.
Definition: event_impl.cpp:381
sycl::_V1::detail::event_impl::MEvent
sycl::detail::pi::PiEvent MEvent
Definition: event_impl.hpp:307
sycl::_V1::detail::event_impl::cleanupDependencyEvents
void cleanupDependencyEvents()
Cleans dependencies of this event_impl.
Definition: event_impl.cpp:444
sycl::_V1::info::event_command_status::complete
@ complete
sycl::_V1::detail::ContextImplPtr
std::shared_ptr< sycl::detail::context_impl > ContextImplPtr
Definition: event_impl.hpp:33
sycl::_V1::detail::getTimestamp
static uint64_t getTimestamp()
Definition: event_impl.cpp:103
sycl::_V1::make_error_code
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:94
sycl::_V1::detail::event_impl::setSubmissionTime
void setSubmissionTime()
Calling this function queries the current device timestamp and sets it as submission time for the com...
Definition: event_impl.cpp:460
config.hpp
sycl::_V1::detail::event_impl::MIsInitialized
bool MIsInitialized
Definition: event_impl.hpp:305
device_selector.hpp
sycl::_V1::errc::feature_not_supported
@ feature_not_supported
sycl::_V1::detail::event_impl::getHandleRef
sycl::detail::pi::PiEvent & getHandleRef()
Returns raw interoperability event handle.
Definition: event_impl.cpp:109
xpti_registry.hpp
sycl::_V1::info::event_command_status
event_command_status
Definition: info_desc.hpp:144
PI_EVENT_INFO_CONTEXT
@ PI_EVENT_INFO_CONTEXT
Definition: pi.h:516
sycl::_V1::detail::Scheduler::waitForEvent
void waitForEvent(const EventImplPtr &Event)
Waits for the event.
Definition: scheduler.cpp:268
sycl::_V1::detail::event_impl::instrumentationProlog
void * instrumentationProlog(std::string &Name, int32_t StreamID, uint64_t &instance_id) const
Definition: event_impl.cpp:176
sycl::_V1::detail::event_impl::setContextImpl
void setContextImpl(const ContextImplPtr &Context)
Associate event with the context.
Definition: event_impl.cpp:126
sycl::_V1::detail::event_impl::MCommand
void * MCommand
Definition: event_impl.hpp:314
sycl::_V1::detail::event_impl::MIsContextInitialized
bool MIsContextInitialized
Definition: event_impl.hpp:306
detail
---— Error handling, matching OpenCL plugin semantics.
Definition: common.hpp:44
sycl::_V1::detail::event_impl::getContextImpl
const ContextImplPtr & getContextImpl()
Returns context that is associated with this event.
Definition: event_impl.cpp:114
sycl
Definition: access.hpp:18
plugin.hpp
queue_impl.hpp
scheduler.hpp
sycl::_V1::detail::event_impl::getNative
pi_native_handle getNative()
Gets the native handle of the SYCL event.
Definition: event_impl.cpp:383
sycl::_V1::detail::getPlugin
static const PluginPtr & getPlugin(backend Backend)
Definition: backend.cpp:32
sycl::_V1::detail::event_impl::ensureContextInitialized
void ensureContextInitialized()
Definition: event_impl.cpp:36
sycl::_V1::detail::event_impl::MPostCompleteEvents
std::vector< EventImplPtr > MPostCompleteEvents
Definition: event_impl.hpp:326
sycl::_V1::detail::event_impl::MQueue
std::weak_ptr< queue_impl > MQueue
Definition: event_impl.hpp:315
sycl::_V1::detail::event_impl::getSubmissionTime
uint64_t getSubmissionTime()
Definition: event_impl.cpp:489
sycl::_V1::detail::event_impl::MContext
ContextImplPtr MContext
Definition: event_impl.hpp:311
sycl::_V1::detail::HostProfilingInfo::start
void start()
Measures event's start time.
Definition: event_impl.cpp:379
sycl::_V1::detail::event_impl::MIsProfilingEnabled
const bool MIsProfilingEnabled
Definition: event_impl.hpp:316
sycl::_V1::detail::event_impl::checkProfilingPreconditions
void checkProfilingPreconditions() const
Definition: event_impl.cpp:267
sycl::_V1::detail::event_impl::MSubmittedQueue
std::weak_ptr< queue_impl > MSubmittedQueue
Definition: event_impl.hpp:320
piEventsWait
pi_result piEventsWait(pi_uint32 num_events, const pi_event *event_list)
Definition: pi_cuda.cpp:575
sycl::_V1::detail::event_impl::MHostBaseTime
uint64_t MHostBaseTime
Definition: event_impl.hpp:310
sycl::_V1::info::event_command_status::ext_oneapi_unknown
@ ext_oneapi_unknown
sycl::_V1::errc::profiling
@ profiling
sycl::_V1::detail::event_impl::wait_and_throw
void wait_and_throw(std::shared_ptr< sycl::detail::event_impl > Self)
Waits for the event.
Definition: event_impl.cpp:259
sycl::_V1::detail::event_impl::flushIfNeeded
void flushIfNeeded(const QueueImplPtr &UserQueue)
Performs a flush on the queue associated with this event if the user queue is different and the task ...
Definition: event_impl.cpp:417
sycl::_V1::detail::event_impl::MSubmitTime
uint64_t MSubmitTime
Definition: event_impl.hpp:309
sycl::_V1::detail::event_impl::cv
std::condition_variable cv
Definition: event_impl.hpp:338
sycl::_V1::detail::queue_impl::getDefaultOrNew
static ContextImplPtr getDefaultOrNew(const DeviceImplPtr &Device)
Definition: queue_impl.hpp:74
_pi_event_status
_pi_event_status
Definition: pi.h:213
sycl::_V1::detail::pi::PiContext
::pi_context PiContext
Definition: pi.hpp:135
piEventCreate
decltype(piEventCreate) piEventCreate
Definition: pi_level_zero.cpp:24
sycl::_V1::exception
Definition: exception.hpp:68
piextEventGetNativeHandle
pi_result piextEventGetNativeHandle(pi_event event, pi_native_handle *nativeHandle)
Gets the native handle of a PI event object.
Definition: pi_cuda.cpp:598
sycl::_V1::detail::event_impl::MEventFromSubmitedExecCommandBuffer
bool MEventFromSubmitedExecCommandBuffer
Indicates that the event results from a command graph submission.
Definition: event_impl.hpp:344
sycl::_V1::detail::codeToString
std::string codeToString(pi_int32 code)
Definition: common.hpp:153
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:59
sycl::_V1::detail::EventImplPtr
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:39
sycl::_V1::detail::event_impl::~event_impl
~event_impl()
Definition: event_impl.cpp:56
sycl::_V1::detail::event_impl::instrumentationEpilog
void instrumentationEpilog(void *TelementryEvent, const std::string &Name, int32_t StreamID, uint64_t IId) const
Definition: event_impl.cpp:212
sycl::_V1::errc::invalid
@ invalid
sycl::_V1::detail::event_impl::HES_NotComplete
@ HES_NotComplete
Definition: event_impl.hpp:42
pi_native_handle
uintptr_t pi_native_handle
Definition: pi.h:198
sycl::_V1::detail::event_impl::waitInternal
void waitInternal()
Waits for the event with respect to device type.
Definition: event_impl.cpp:61
PI_EVENT_QUEUED
@ PI_EVENT_QUEUED
Definition: pi.h:217
sycl::_V1::detail::event_impl::HES_Discarded
@ HES_Discarded
Definition: event_impl.hpp:44
sycl::_V1::backend::opencl
@ opencl
piEventGetInfo
pi_result piEventGetInfo(pi_event event, pi_event_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Definition: pi_cuda.cpp:560
sycl::_V1::detail::Command::MTraceEvent
void * MTraceEvent
The event for node_create and task_begin.
Definition: commands.hpp:340
sycl::_V1::detail::event_impl::MGraph
std::weak_ptr< ext::oneapi::experimental::detail::graph_impl > MGraph
Store the command graph associated with this event, if any.
Definition: event_impl.hpp:342
piEventRetain
pi_result piEventRetain(pi_event event)
Definition: pi_cuda.cpp:592
_pi_event
Definition: pi_cuda.hpp:64
sycl::_V1::detail::event_impl::event_impl
event_impl(std::optional< HostEventState > State=HES_Complete)
Constructs a ready SYCL event.
Definition: event_impl.hpp:52
sycl::_V1::detail::Scheduler::getDefaultHostQueue
QueueImplPtr getDefaultHostQueue()
Definition: scheduler.hpp:444
sycl::_V1::detail::event_impl::wait
void wait(std::shared_ptr< sycl::detail::event_impl > Self)
Waits for the event.
Definition: event_impl.cpp:228
sycl::_V1::detail::QueueImplPtr
std::shared_ptr< sycl::detail::queue_impl > QueueImplPtr
Definition: event_impl.hpp:35
sycl::_V1::detail::event_impl::HES_Complete
@ HES_Complete
Definition: event_impl.hpp:43
sycl::_V1::detail::Scheduler::getInstance
static Scheduler & getInstance()
Definition: scheduler.cpp:260
context.hpp
sycl::_V1::detail::event_impl::setHostEnqueueTime
void setHostEnqueueTime()
Calling this function to capture the host timestamp to use profiling base time.
Definition: event_impl.cpp:481
sycl::_V1::detail::event_impl::MPreparedDepsEvents
std::vector< EventImplPtr > MPreparedDepsEvents
Dependency events prepared for waiting by backend.
Definition: event_impl.hpp:323
piQueueFlush
pi_result piQueueFlush(pi_queue command_queue)
Definition: pi_cuda.cpp:183
sycl::_V1::detail::event_impl::MState
std::atomic< int > MState
Definition: event_impl.hpp:335
sycl::_V1::detail::event_impl::setComplete
void setComplete()
Marks this event as completed.
Definition: event_impl.cpp:81
PI_EVENT_INFO_COMMAND_EXECUTION_STATUS
@ PI_EVENT_INFO_COMMAND_EXECUTION_STATUS
Definition: pi.h:518
sycl::_V1::detail::event_impl::getPlugin
const PluginPtr & getPlugin()
Definition: event_impl.cpp:119
sycl::_V1::detail::event_impl::MIsFlushed
std::atomic< bool > MIsFlushed
Indicates that the task associated with this event has been submitted by the queue to the device.
Definition: event_impl.hpp:330
sycl::_V1::detail::event_impl::MPreparedHostDepsEvents
std::vector< EventImplPtr > MPreparedHostDepsEvents
Definition: event_impl.hpp:324
sycl::_V1::detail::event_impl::MFallbackProfiling
const bool MFallbackProfiling
Definition: event_impl.hpp:317
sycl::_V1::detail::event_impl::cleanDepEventsThroughOneLevel
void cleanDepEventsThroughOneLevel()
Cleans dependencies of this event's dependencies.
Definition: event_impl.cpp:450
sycl::_V1::detail::event_impl::isCompleted
bool isCompleted()
Checks if this event is complete.
Definition: event_impl.cpp:491
pi_int32
int32_t pi_int32
Definition: pi.h:193
sycl::_V1::detail::event_impl::is_host
bool is_host()
Checks if this event is a SYCL host event.
Definition: event_impl.cpp:50
_pi_context
Definition: pi_cuda.hpp:52
sycl::_V1::detail::event_impl::MMutex
std::mutex MMutex
Definition: event_impl.hpp:337
sycl::_V1::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: impl_utils.hpp:30
sycl::_V1::detail::event_impl::setStateIncomplete
void setStateIncomplete()
Clear the event state.
Definition: event_impl.cpp:124
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:51
sycl::_V1::detail::PluginPtr
std::shared_ptr< plugin > PluginPtr
Definition: pi.hpp:48