Skip to content

Commit 1de18ea

Browse files
author
Alexander Batashev
authored
[SYCL] Remove dependency on event_impl from cg.hpp (#1103)
This patch is a part of effort to decouple SYCL Runtime library interface from its actual implementation. The goal is to improve SYCL ABI/API compatibility between different versions of library. This patch moves HostProfilingInfo into a separate export-friendly header file. It also removes the event_impl header from unwanted places. Signed-off-by: Alexander Batashev <[email protected]>
1 parent 7a75b54 commit 1de18ea

File tree

5 files changed

+42
-22
lines changed

5 files changed

+42
-22
lines changed

sycl/include/CL/sycl/detail/accessor_impl.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#pragma once
1010

1111
#include <CL/sycl/access/access.hpp>
12-
#include <CL/sycl/detail/event_impl.hpp>
1312
#include <CL/sycl/detail/sycl_mem_obj_i.hpp>
1413
#include <CL/sycl/id.hpp>
1514
#include <CL/sycl/range.hpp>

sycl/include/CL/sycl/detail/cg.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <CL/sycl/detail/accessor_impl.hpp>
1212
#include <CL/sycl/detail/common.hpp>
1313
#include <CL/sycl/detail/helpers.hpp>
14+
#include <CL/sycl/detail/host_profiling_info.hpp>
1415
#include <CL/sycl/detail/kernel_desc.hpp>
1516
#include <CL/sycl/detail/type_traits.hpp>
1617
#include <CL/sycl/group.hpp>

sycl/include/CL/sycl/detail/event_impl.hpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <CL/sycl/detail/event_info.hpp>
1313
#include <CL/sycl/detail/pi.hpp>
1414
#include <CL/sycl/stl.hpp>
15+
#include <CL/sycl/detail/host_profiling_info.hpp>
1516

1617
#include <cassert>
1718

@@ -24,27 +25,6 @@ using ContextImplPtr = std::shared_ptr<cl::sycl::detail::context_impl>;
2425
class queue_impl;
2526
using QueueImplPtr = std::shared_ptr<cl::sycl::detail::queue_impl>;
2627

27-
/// Profiling info for the host execution.
28-
class HostProfilingInfo {
29-
cl_ulong StartTime = 0;
30-
cl_ulong EndTime = 0;
31-
32-
public:
33-
/// Returns event's start time.
34-
///
35-
/// @return event's start time in nanoseconds.
36-
cl_ulong getStartTime() const { return StartTime; }
37-
/// Returns event's end time.
38-
///
39-
/// @return event's end time in nanoseconds.
40-
cl_ulong getEndTime() const { return EndTime; }
41-
42-
/// Measures event's start time.
43-
void start();
44-
/// Measures event's end time.
45-
void end();
46-
};
47-
4828
class event_impl {
4929
public:
5030
/// Constructs a ready SYCL event.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//==---------- host_profiling_info.hpp - SYCL host profiling ---------------==//
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 <CL/sycl/detail/common.hpp>
12+
13+
__SYCL_INLINE namespace cl {
14+
namespace sycl {
15+
namespace detail {
16+
17+
/// Profiling info for the host execution.
18+
class HostProfilingInfo {
19+
cl_ulong StartTime = 0;
20+
cl_ulong EndTime = 0;
21+
22+
public:
23+
/// Returns event's start time.
24+
///
25+
/// @return event's start time in nanoseconds.
26+
cl_ulong getStartTime() const { return StartTime; }
27+
/// Returns event's end time.
28+
///
29+
/// @return event's end time in nanoseconds.
30+
cl_ulong getEndTime() const { return EndTime; }
31+
32+
/// Measures event's start time.
33+
void start();
34+
/// Measures event's end time.
35+
void end();
36+
};
37+
} // namespace detail
38+
} // namespace sycl
39+
} // namespace cl

sycl/source/detail/sycl_mem_obj_t.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <CL/sycl/detail/scheduler/scheduler.hpp>
1111
#include <CL/sycl/detail/sycl_mem_obj_t.hpp>
1212
#include <CL/sycl/detail/context_impl.hpp>
13+
#include <CL/sycl/detail/event_impl.hpp>
1314

1415
__SYCL_INLINE namespace cl {
1516
namespace sycl {

0 commit comments

Comments
 (0)