Skip to content

Commit dcd4720

Browse files
[NFC][SYCL] Reduce include dependencies of several headers (#20089)
1 parent c8ec91f commit dcd4720

File tree

11 files changed

+21
-14
lines changed

11 files changed

+21
-14
lines changed

sycl/include/sycl/detail/common.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#pragma once
1010

1111
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
12-
#include <sycl/exception.hpp> // for sycl::exception, sycl::errc
12+
#ifndef __SYCL_DEVICE_ONLY__
13+
#include <sycl/exception.hpp>
14+
#endif
1315
#endif // #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
1416
#include <sycl/detail/defines_elementary.hpp> // for __SYCL_ALWAYS_INLINE
1517
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
@@ -159,8 +161,10 @@ class __SYCL_EXPORT tls_code_loc_t {
159161
// Should never be called. In PREVIEW we marked it as deleted, but
160162
// before ABI breaking change we need to keep it for backward compatibility.
161163
assert(false && "tls_code_loc_t should not be copied");
164+
#ifndef __SYCL_DEVICE_ONLY__
162165
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
163166
"tls_code_loc_t should not be copied");
167+
#endif
164168
return *this;
165169
}
166170
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
@@ -200,8 +204,6 @@ class __SYCL_EXPORT tls_code_loc_t {
200204
std::string(sycl::detail::get_backend_name_no_vendor(backend)) + \
201205
" backend failed with error: "
202206

203-
#include <sycl/exception.hpp>
204-
205207
namespace sycl {
206208
inline namespace _V1 {
207209
namespace detail {

sycl/include/sycl/detail/kernel_launch_helper.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <sycl/detail/cg_types.hpp>
1212
#include <sycl/detail/compile_time_kernel_info.hpp>
1313
#include <sycl/detail/helpers.hpp>
14+
#include <sycl/detail/is_device_copyable.hpp>
1415
#include <sycl/ext/intel/experimental/fp_control_kernel_properties.hpp>
1516
#include <sycl/ext/intel/experimental/kernel_execution_properties.hpp>
1617
#include <sycl/ext/oneapi/experimental/virtual_functions.hpp>

sycl/include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp

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

1111
#include <sycl/detail/defines.hpp>
12+
#include <sycl/detail/is_device_copyable.hpp>
1213
#include <sycl/ext/intel/experimental/fpga_annotated_properties.hpp>
1314
#include <sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr_properties.hpp>
1415
#include <sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp>

sycl/include/sycl/ext/oneapi/properties/properties.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#pragma once
1010

11-
#include <sycl/detail/is_device_copyable.hpp>
1211
#include <sycl/detail/type_traits.hpp>
1312
#include <sycl/ext/oneapi/properties/property.hpp> // for IsRuntimePr...
1413
#include <sycl/ext/oneapi/properties/property_utils.hpp> // for Sorted, Mer...

sycl/include/sycl/memory_enums.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
#pragma once
1010

11+
#ifndef __SYCL_DEVICE_ONLY__
1112
#include <atomic> // for memory_order
12-
#include <vector> // for vector
13+
#endif
1314

1415
namespace sycl {
1516
inline namespace _V1 {

sycl/include/sycl/nd_item.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <sycl/detail/helpers.hpp> // for getSPIRVMemorySemanticsMask
1818
#include <sycl/detail/type_traits.hpp> // for is_bool, change_base_...
1919
#include <sycl/device_event.hpp> // for device_event
20-
#include <sycl/exception.hpp> // for make_error_code, errc, exce...
2120
#include <sycl/group.hpp> // for group
2221
#include <sycl/id.hpp> // for id
2322
#include <sycl/item.hpp> // for item

sycl/include/sycl/sub_group.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@
1414
#include <sycl/detail/fwd/multi_ptr.hpp>
1515
#include <sycl/detail/generic_type_traits.hpp> // for select_cl_scalar_inte...
1616
#include <sycl/detail/type_traits.hpp> // for is_scalar_arithmetic
17-
#include <sycl/exception.hpp> // for exception, make_error...
1817
#include <sycl/id.hpp> // for id
1918
#include <sycl/memory_enums.hpp> // for memory_scope
2019
#include <sycl/nd_item.hpp>
2120
#include <sycl/range.hpp> // for range
2221

2322
#include <stdint.h> // for uint32_t
24-
#include <tuple> // for _Swallow_assign, ignore
2523
#include <type_traits> // for enable_if_t, remove_cv_t
2624

25+
#ifndef __SYCL_DEVICE_ONLY__
26+
#include <sycl/exception.hpp> // for exception, make_error...
27+
#endif
28+
2729
namespace sycl {
2830
inline namespace _V1 {
2931
namespace detail {

sycl/test-e2e/syclcompat/atomic/atomic_class.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
#include "../common.hpp"
4242
#include "atomic_fixt.hpp"
4343

44+
#include <atomic>
45+
4446
constexpr size_t numBlocks = 1;
4547
constexpr size_t numThreads = 1;
4648
constexpr size_t numData = 6;

sycl/test/include_deps/sycl_accessor.hpp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
// CHECK-NEXT: stl_wrappers/cstdlib
1313
// CHECK-NEXT: detail/array.hpp
1414
// CHECK-NEXT: detail/common.hpp
15-
// CHECK-NEXT: exception.hpp
1615
// CHECK-NEXT: detail/export.hpp
17-
// CHECK-NEXT: detail/string.hpp
1816
// CHECK-NEXT: stl_wrappers/cassert
1917
// CHECK-NEXT: stl_wrappers/assert.h
2018
// CHECK-NEXT: __spirv/spirv_vars.hpp
@@ -35,6 +33,8 @@
3533
// CHECK-NEXT: detail/os_util.hpp
3634
// CHECK-NEXT: ext/oneapi/accessor_property_list.hpp
3735
// CHECK-NEXT: detail/property_list_base.hpp
36+
// CHECK-NEXT: exception.hpp
37+
// CHECK-NEXT: detail/string.hpp
3838
// CHECK-NEXT: property_list.hpp
3939
// CHECK-NEXT: properties/property_traits.hpp
4040
// CHECK-NEXT: id.hpp

sycl/test/include_deps/sycl_buffer.hpp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
// CHECK-NEXT: stl_wrappers/cstdlib
1212
// CHECK-NEXT: detail/array.hpp
1313
// CHECK-NEXT: detail/common.hpp
14-
// CHECK-NEXT: exception.hpp
1514
// CHECK-NEXT: detail/export.hpp
16-
// CHECK-NEXT: detail/string.hpp
1715
// CHECK-NEXT: stl_wrappers/cassert
1816
// CHECK-NEXT: stl_wrappers/assert.h
1917
// CHECK-NEXT: __spirv/spirv_vars.hpp
@@ -34,6 +32,8 @@
3432
// CHECK-NEXT: detail/os_util.hpp
3533
// CHECK-NEXT: ext/oneapi/accessor_property_list.hpp
3634
// CHECK-NEXT: detail/property_list_base.hpp
35+
// CHECK-NEXT: exception.hpp
36+
// CHECK-NEXT: detail/string.hpp
3737
// CHECK-NEXT: property_list.hpp
3838
// CHECK-NEXT: properties/property_traits.hpp
3939
// CHECK-NEXT: id.hpp

0 commit comments

Comments
 (0)