DPC++ Runtime
Runtime libraries for oneAPI DPC++
event_info.hpp
Go to the documentation of this file.
1 //==---------------- event_info.hpp - 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 #pragma once
10 
11 #include <detail/event_impl.hpp>
12 #include <detail/plugin.hpp>
13 #include <sycl/detail/common.hpp>
15 #include <sycl/info/info_desc.hpp>
16 
17 namespace sycl {
18 inline namespace _V1 {
19 namespace detail {
20 
21 template <typename Param>
22 typename Param::return_type get_event_profiling_info(ur_event_handle_t Event,
23  const PluginPtr &Plugin) {
25  "Unexpected event profiling info descriptor");
26  typename Param::return_type Result{0};
27  // TODO catch an exception and put it to list of asynchronous exceptions
28  Plugin->call(urEventGetProfilingInfo, Event, UrInfoCode<Param>::value,
29  sizeof(Result), &Result, nullptr);
30  return Result;
31 }
32 
33 template <typename Param>
34 typename Param::return_type get_event_info(ur_event_handle_t Event,
35  const PluginPtr &Plugin) {
37  "Unexpected event info descriptor");
38  typename Param::return_type Result{0};
39  // TODO catch an exception and put it to list of asynchronous exceptions
40  Plugin->call(urEventGetInfo, Event, UrInfoCode<Param>::value, sizeof(Result),
41  &Result, nullptr);
42 
43  // If the status is UR_EVENT_STATUS_QUEUED We need to change it since QUEUE is
44  // not a valid status in sycl.
45  if constexpr (std::is_same<Param,
46  info::event::command_execution_status>::value) {
47  Result = static_cast<ur_event_status_t>(Result) == UR_EVENT_STATUS_QUEUED
48  ? sycl::info::event_command_status::submitted
49  : Result;
50  }
51 
52  return Result;
53 }
54 
55 } // namespace detail
56 } // namespace _V1
57 } // namespace sycl
Param::return_type get_event_info(ur_event_handle_t Event, const PluginPtr &Plugin)
Definition: event_info.hpp:34
std::shared_ptr< plugin > PluginPtr
Definition: ur.hpp:60
Param::return_type get_event_profiling_info(ur_event_handle_t Event, const PluginPtr &Plugin)
Definition: event_info.hpp:22
Definition: access.hpp:18