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
24  const PluginPtr &Plugin) {
26  "Unexpected event profiling info descriptor");
27  typename Param::return_type Result{0};
28  // TODO catch an exception and put it to list of asynchronous exceptions
30  Event, PiInfoCode<Param>::value, sizeof(Result), &Result, nullptr);
31  return Result;
32 }
33 
34 template <typename Param>
35 typename Param::return_type get_event_info(sycl::detail::pi::PiEvent Event,
36  const PluginPtr &Plugin) {
38  "Unexpected event info descriptor");
39  typename Param::return_type Result{0};
40  // TODO catch an exception and put it to list of asynchronous exceptions
42  sizeof(Result), &Result, nullptr);
43 
44  // If the status is PI_EVENT_QUEUED We need to change it since QUEUE is
45  // not a valid status in sycl.
46  if constexpr (std::is_same<Param,
47  info::event::command_execution_status>::value) {
48  Result = static_cast<pi_event_status>(Result) == PI_EVENT_QUEUED
49  ? sycl::info::event_command_status::submitted
50  : Result;
51  }
52 
53  return Result;
54 }
55 
56 } // namespace detail
57 } // namespace _V1
58 } // namespace sycl
Param::return_type get_event_info(sycl::detail::pi::PiEvent Event, const PluginPtr &Plugin)
Definition: event_info.hpp:35
std::shared_ptr< plugin > PluginPtr
Definition: pi.hpp:48
Param::return_type get_event_profiling_info(sycl::detail::pi::PiEvent Event, const PluginPtr &Plugin)
Definition: event_info.hpp:23
Definition: access.hpp:18
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:583
pi_result piEventGetProfilingInfo(pi_event event, pi_profiling_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Definition: pi_cuda.cpp:590
_pi_event_status
Definition: pi.h:232
@ PI_EVENT_QUEUED
Definition: pi.h:236