Skip to content

Commit 252245a

Browse files
[SYCL][NFC] Cleanup includes of context.hpp (intel#16265)
Replaced them with forward declarations. Unfortunatly, it isn't enough of a cleanup to actually reduce amount of dependencies of `core.hpp` because of image and buffer properties.
1 parent c3eb160 commit 252245a

10 files changed

+15
-9
lines changed

sycl/include/sycl/detail/backend_traits_cuda.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#pragma once
1616

17-
#include <sycl/context.hpp>
1817
#include <sycl/detail/backend_traits.hpp>
1918
#include <sycl/device.hpp>
2019
#include <sycl/event.hpp>
@@ -35,6 +34,9 @@ typedef unsigned int CUdeviceptr;
3534

3635
namespace sycl {
3736
inline namespace _V1 {
37+
38+
class context;
39+
3840
namespace detail {
3941

4042
// TODO the interops for context, device, event, platform and program

sycl/include/sycl/detail/backend_traits_hip.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#pragma once
1616

17-
#include <sycl/context.hpp>
1817
#include <sycl/detail/backend_traits.hpp>
1918
#include <sycl/device.hpp>
2019
#include <sycl/event.hpp>
@@ -29,6 +28,9 @@ typedef void *HIPdeviceptr;
2928

3029
namespace sycl {
3130
inline namespace _V1 {
31+
32+
class context;
33+
3234
namespace detail {
3335

3436
// TODO the interops for context, device, event, platform and program

sycl/include/sycl/detail/backend_traits_level_zero.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#pragma once
1717

1818
#include <sycl/backend_types.hpp> // for backend
19-
#include <sycl/context.hpp> // for context
2019
#include <sycl/detail/backend_traits.hpp> // for BackendI...
2120
#include <sycl/device.hpp> // for device
2221
#include <sycl/event.hpp> // for event
@@ -45,6 +44,7 @@ typedef struct _ze_module_handle_t *ze_module_handle_t;
4544
namespace sycl {
4645
inline namespace _V1 {
4746
class queue;
47+
class context;
4848

4949
namespace detail {
5050

sycl/include/sycl/detail/backend_traits_opencl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#pragma once
1717

1818
#include <sycl/backend_types.hpp> // for backend
19-
#include <sycl/context.hpp> // for context
2019
#include <sycl/detail/backend_traits.hpp> // for BackendInput, BackendReturn
2120
#include <sycl/detail/cl.h> // for _cl_event, cl_event, cl_de...
2221
#include <sycl/detail/ur.hpp> // for assertion and ur handles
@@ -35,6 +34,7 @@ template <bundle_state State> class kernel_bundle;
3534
class queue;
3635
template <typename T, int Dimensions, typename AllocatorT, typename Enable>
3736
class buffer;
37+
class context;
3838

3939
namespace detail {
4040

sycl/include/sycl/handler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <sycl/access/access.hpp>
1212
#include <sycl/accessor.hpp>
13-
#include <sycl/context.hpp>
1413
#include <sycl/detail/cg_types.hpp>
1514
#include <sycl/detail/cl.h>
1615
#include <sycl/detail/common.hpp>
@@ -170,6 +169,7 @@ class kernel_impl;
170169
class queue_impl;
171170
class stream_impl;
172171
class event_impl;
172+
class context_impl;
173173
template <typename DataT, int Dimensions, access::mode AccessMode,
174174
access::target AccessTarget, access::placeholder IsPlaceholder>
175175
class image_accessor;

sycl/include/sycl/image.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <sycl/aliases.hpp> // for cl_float, cl_half
1313
#include <sycl/backend_types.hpp> // for backend, backe...
1414
#include <sycl/buffer.hpp> // for range
15-
#include <sycl/context.hpp> // for context
1615
#include <sycl/detail/aligned_allocator.hpp> // for aligned_allocator
1716
#include <sycl/detail/backend_traits.hpp> // for InteropFeature...
1817
#include <sycl/detail/common.hpp> // for convertToArrayOfN
@@ -43,6 +42,7 @@ inline namespace _V1 {
4342

4443
// forward declarations
4544
class handler;
45+
class context;
4646

4747
template <int D, typename A> class image;
4848

sycl/include/sycl/kernel_bundle.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#pragma once
1010

1111
#include <sycl/backend_types.hpp> // for backend, backend_return_t
12-
#include <sycl/context.hpp> // for context
1312
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
1413
#include <sycl/detail/kernel_desc.hpp> // for get_spec_constant_symboli...
1514
#include <sycl/detail/owner_less_base.hpp> // for OwnerLessBase
@@ -46,6 +45,7 @@ template <backend Backend> class backend_traits;
4645
template <backend Backend, bundle_state State>
4746
auto get_native(const kernel_bundle<State> &Obj)
4847
-> backend_return_t<Backend, kernel_bundle<State>>;
48+
class context;
4949

5050
namespace detail {
5151
class kernel_id_impl;

sycl/include/sycl/queue.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <sycl/async_handler.hpp> // for async_handler
1515
#include <sycl/backend_types.hpp> // for backend, backe...
1616
#include <sycl/buffer.hpp> // for buffer
17-
#include <sycl/context.hpp> // for context
1817
#include <sycl/detail/assert_happened.hpp> // for AssertHappened
1918
#include <sycl/detail/cg_types.hpp> // for check_fn_signa...
2019
#include <sycl/detail/common.hpp> // for code_location

sycl/include/sycl/usm.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#pragma once
99

1010
#include <sycl/builtins.hpp>
11-
#include <sycl/context.hpp>
1211
#include <sycl/detail/common.hpp>
1312
#include <sycl/detail/export.hpp>
1413
#include <sycl/device.hpp>
@@ -21,6 +20,9 @@
2120

2221
namespace sycl {
2322
inline namespace _V1 {
23+
24+
class context;
25+
2426
///
2527
// Explicit USM
2628
///

sycl/source/platform.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <detail/global_handler.hpp>
1212
#include <detail/platform_impl.hpp>
1313
#include <detail/ur.hpp>
14+
#include <sycl/context.hpp>
1415
#include <sycl/device.hpp>
1516
#include <sycl/device_selector.hpp>
1617
#include <sycl/image.hpp>

0 commit comments

Comments
 (0)