Skip to content

Commit ece363d

Browse files
[SYCL] Switch to "preview" sycl::exception implementation (#14548)
It will use `sycl::detail::string` instead of `std::string` as data member by default now.
1 parent 2a5f913 commit ece363d

File tree

9 files changed

+10
-58
lines changed

9 files changed

+10
-58
lines changed

sycl/include/sycl/context.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ class __SYCL_EXPORT context : public detail::OwnerLessBase<context> {
252252
friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
253253
};
254254

255-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
256255
// context.hpp depends on exception.hpp but we can't define these ctors in
257256
// exception.hpp while context is still an incomplete type.
258257
inline exception::exception(context Ctx, std::error_code EC,
@@ -279,7 +278,6 @@ inline exception::exception(context Ctx, int EV,
279278
inline exception::exception(context Ctx, int EV,
280279
const std::error_category &ECat)
281280
: exception(Ctx, EV, ECat, "") {}
282-
#endif
283281

284282
} // namespace _V1
285283
} // namespace sycl

sycl/include/sycl/exception.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
#include <sycl/detail/defines_elementary.hpp> // for __SYCL2020_DEPRECATED
1515
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
1616
#include <sycl/detail/pi.h> // for pi_int32
17-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
1817
#include <sycl/detail/string.hpp>
19-
#endif
2018

2119
#include <exception> // for exception
2220
#include <memory> // for allocator, shared_ptr, make...
@@ -119,11 +117,7 @@ class __SYCL_EXPORT exception : public virtual std::exception {
119117
private:
120118
// Exceptions must be noexcept copy constructible, so cannot use std::string
121119
// directly.
122-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
123120
std::shared_ptr<detail::string> MMsg;
124-
#else
125-
std::shared_ptr<std::string> MMsg;
126-
#endif
127121
pi_int32 MPIErr = 0;
128122
std::shared_ptr<context> MContext;
129123
std::error_code MErrC = make_error_code(sycl::errc::invalid);

sycl/source/exception.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,10 @@ exception::exception(int EV, const std::error_category &ECat,
2929
exception::exception(int EV, const std::error_category &ECat)
3030
: exception({EV, ECat}, nullptr, "") {}
3131

32-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
33-
exception::exception(context Ctx, std::error_code EC,
34-
const std::string &WhatArg)
35-
: exception(EC, std::make_shared<context>(Ctx), WhatArg) {}
36-
37-
exception::exception(context Ctx, std::error_code EC, const char *WhatArg)
38-
: exception(Ctx, EC, std::string(WhatArg)) {}
39-
40-
exception::exception(context Ctx, std::error_code EC)
41-
: exception(Ctx, EC, "") {}
42-
43-
exception::exception(context Ctx, int EV, const std::error_category &ECat,
44-
const char *WhatArg)
45-
: exception(Ctx, {EV, ECat}, std::string(WhatArg)) {}
46-
47-
exception::exception(context Ctx, int EV, const std::error_category &ECat,
48-
const std::string &WhatArg)
49-
: exception(Ctx, {EV, ECat}, WhatArg) {}
50-
51-
exception::exception(context Ctx, int EV, const std::error_category &ECat)
52-
: exception(Ctx, EV, ECat, "") {}
53-
#endif
54-
5532
// protected base constructor for all SYCL 2020 constructors
5633
exception::exception(std::error_code EC, std::shared_ptr<context> SharedPtrCtx,
5734
const char *WhatArg)
58-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
5935
: MMsg(std::make_shared<detail::string>(WhatArg)),
60-
#else
61-
: MMsg(std::make_shared<std::string>(WhatArg)),
62-
#endif
6336
MPIErr(PI_ERROR_INVALID_VALUE), MContext(SharedPtrCtx), MErrC(EC) {
6437
detail::GlobalHandler::instance().TraceEventXPTI(MMsg->c_str());
6538
}

sycl/test/abi/layout_exception.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ void foo() {
1212
}
1313
}
1414

15-
// clang-format off
16-
1715
// The order of field declarations and their types are important.
18-
// CHECK: 0 | class sycl::exception
19-
// CHECK-NEXT: 8 | class std::shared_ptr<class std::basic_string<char> > MMsg
20-
// CHECK-NEXT: 8 | class std::__shared_ptr<class std::basic_string<char> > (base)
21-
// CHECK-NEXT: 8 | class std::__shared_ptr_access<class std::basic_string<char>, __gnu_cxx::_S_atomic> (base) (empty)
16+
// CHECK-LABEL: 0 | class sycl::exception
17+
// CHECK-NEXT: 8 | class std::shared_ptr<class sycl::detail::string> MMsg
18+
// CHECK-NEXT: 8 | class std::__shared_ptr<class sycl::detail::string> (base)
19+
// CHECK-NEXT: 8 | class std::__shared_ptr_access<class sycl::detail::string, __gnu_cxx::_S_atomic> (base) (empty)
2220
// CHECK-NEXT: 8 | element_type * _M_ptr
2321
// CHECK-NEXT: 16 | class std::__shared_count<> _M_refcount
2422
// CHECK-NEXT: 16 | _Sp_counted_base<(_Lock_policy)2U> * _M_pi

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,14 +3516,14 @@ _ZN4sycl3_V17handler22memcpyFromDeviceGlobalEPvPKvbmm
35163516
_ZN4sycl3_V17handler22setHandlerKernelBundleENS0_6kernelE
35173517
_ZN4sycl3_V17handler22setHandlerKernelBundleERKSt10shared_ptrINS0_6detail18kernel_bundle_implEE
35183518
_ZN4sycl3_V17handler22setKernelIsCooperativeEb
3519-
_ZN4sycl3_V17handler26setKernelUsesClusterLaunchEv
35203519
_ZN4sycl3_V17handler24GetRangeRoundingSettingsERmS2_S2_
35213520
_ZN4sycl3_V17handler24ext_intel_read_host_pipeENS0_6detail11string_viewEPvmb
35223521
_ZN4sycl3_V17handler24ext_oneapi_memcpy2d_implEPvmPKvmmm
35233522
_ZN4sycl3_V17handler24ext_oneapi_memset2d_implEPvmimm
35243523
_ZN4sycl3_V17handler24registerDynamicParameterERNS0_3ext6oneapi12experimental6detail22dynamic_parameter_baseEi
35253524
_ZN4sycl3_V17handler25ext_intel_write_host_pipeENS0_6detail11string_viewEPvmb
35263525
_ZN4sycl3_V17handler26associateWithHandlerCommonESt10shared_ptrINS0_6detail16AccessorImplHostEEi
3526+
_ZN4sycl3_V17handler26setKernelUsesClusterLaunchEv
35273527
_ZN4sycl3_V17handler27computeFallbackKernelBoundsEmm
35283528
_ZN4sycl3_V17handler28extractArgsAndReqsFromLambdaEPcmPKNS0_6detail19kernel_param_desc_tEb
35293529
_ZN4sycl3_V17handler28memcpyToHostOnlyDeviceGlobalEPKvS3_mbmm
@@ -3559,23 +3559,11 @@ _ZN4sycl3_V18platformC2EP15_cl_platform_id
35593559
_ZN4sycl3_V18platformC2ERKNS0_15device_selectorE
35603560
_ZN4sycl3_V18platformC2ERKNS0_6deviceE
35613561
_ZN4sycl3_V18platformC2Ev
3562-
_ZN4sycl3_V19exceptionC1ENS0_7contextESt10error_code
3563-
_ZN4sycl3_V19exceptionC1ENS0_7contextESt10error_codePKc
3564-
_ZN4sycl3_V19exceptionC1ENS0_7contextESt10error_codeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
3565-
_ZN4sycl3_V19exceptionC1ENS0_7contextEiRKNSt3_V214error_categoryE
3566-
_ZN4sycl3_V19exceptionC1ENS0_7contextEiRKNSt3_V214error_categoryEPKc
3567-
_ZN4sycl3_V19exceptionC1ENS0_7contextEiRKNSt3_V214error_categoryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
35683562
_ZN4sycl3_V19exceptionC1ESt10error_code
35693563
_ZN4sycl3_V19exceptionC1ESt10error_codePKc
35703564
_ZN4sycl3_V19exceptionC1ESt10error_codeSt10shared_ptrINS0_7contextEEPKc
35713565
_ZN4sycl3_V19exceptionC1EiRKNSt3_V214error_categoryE
35723566
_ZN4sycl3_V19exceptionC1EiRKNSt3_V214error_categoryEPKc
3573-
_ZN4sycl3_V19exceptionC2ENS0_7contextESt10error_code
3574-
_ZN4sycl3_V19exceptionC2ENS0_7contextESt10error_codePKc
3575-
_ZN4sycl3_V19exceptionC2ENS0_7contextESt10error_codeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
3576-
_ZN4sycl3_V19exceptionC2ENS0_7contextEiRKNSt3_V214error_categoryE
3577-
_ZN4sycl3_V19exceptionC2ENS0_7contextEiRKNSt3_V214error_categoryEPKc
3578-
_ZN4sycl3_V19exceptionC2ENS0_7contextEiRKNSt3_V214error_categoryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
35793567
_ZN4sycl3_V19exceptionC2ESt10error_code
35803568
_ZN4sycl3_V19exceptionC2ESt10error_codePKc
35813569
_ZN4sycl3_V19exceptionC2ESt10error_codeSt10shared_ptrINS0_7contextEEPKc
@@ -3958,6 +3946,7 @@ _ZNK4sycl3_V16device13get_info_implINS0_4info6device27preferred_vector_width_hal
39583946
_ZNK4sycl3_V16device13get_info_implINS0_4info6device27preferred_vector_width_longEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39593947
_ZNK4sycl3_V16device13get_info_implINS0_4info6device28preferred_vector_width_floatEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39603948
_ZNK4sycl3_V16device13get_info_implINS0_4info6device28preferred_vector_width_shortEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
3949+
_ZNK4sycl3_V16device13get_info_implINS0_4info6device29ext_oneapi_cuda_cluster_groupEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39613950
_ZNK4sycl3_V16device13get_info_implINS0_4info6device29ext_oneapi_max_work_groups_1dEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39623951
_ZNK4sycl3_V16device13get_info_implINS0_4info6device29ext_oneapi_max_work_groups_2dEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39633952
_ZNK4sycl3_V16device13get_info_implINS0_4info6device29ext_oneapi_max_work_groups_3dEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
@@ -3973,7 +3962,6 @@ _ZNK4sycl3_V16device13get_info_implINS0_4info6device33ext_oneapi_max_global_work
39733962
_ZNK4sycl3_V16device13get_info_implINS0_4info6device33usm_restricted_shared_allocationsEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39743963
_ZNK4sycl3_V16device13get_info_implINS0_4info6device35ext_intel_gpu_eu_count_per_subsliceEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39753964
_ZNK4sycl3_V16device13get_info_implINS0_4info6device38sub_group_independent_forward_progressEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
3976-
_ZNK4sycl3_V16device13get_info_implINS0_4info6device29ext_oneapi_cuda_cluster_groupEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39773965
_ZNK4sycl3_V16device13get_info_implINS0_4info6device4nameEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39783966
_ZNK4sycl3_V16device13get_info_implINS0_4info6device6vendorEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv
39793967
_ZNK4sycl3_V16device13get_info_implINS0_4info6device7aspectsEEENS0_6detail11ABINeutralTINS6_19is_device_info_descIT_E11return_typeEE4typeEv

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@
137137
??$get_info_impl@Uext_intel_max_mem_bandwidth@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA_KXZ
138138
??$get_info_impl@Uext_intel_mem_channel@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA_NXZ
139139
??$get_info_impl@Uext_intel_pci_address@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AVstring@detail@12@XZ
140+
??$get_info_impl@Uext_oneapi_cuda_cluster_group@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA_NXZ
140141
??$get_info_impl@Uext_oneapi_max_global_work_groups@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA_KXZ
141142
??$get_info_impl@Uext_oneapi_max_work_groups_1d@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AV?$id@$00@12@XZ
142143
??$get_info_impl@Uext_oneapi_max_work_groups_2d@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AV?$id@$01@12@XZ
143144
??$get_info_impl@Uext_oneapi_max_work_groups_3d@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AV?$id@$02@12@XZ
144145
??$get_info_impl@Uext_oneapi_srgb@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA_NXZ
145-
??$get_info_impl@Uext_oneapi_cuda_cluster_group@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA_NXZ
146146
??$get_info_impl@Uextensions@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AV?$vector@Vstring@detail@_V1@sycl@@V?$allocator@Vstring@detail@_V1@sycl@@@std@@@std@@XZ
147147
??$get_info_impl@Uextensions@platform@info@_V1@sycl@@@platform@_V1@sycl@@AEBA?AV?$vector@Vstring@detail@_V1@sycl@@V?$allocator@Vstring@detail@_V1@sycl@@@std@@@std@@XZ
148148
??$get_info_impl@Ufree_memory@device@info@intel@ext@_V1@sycl@@@device@_V1@sycl@@AEBA_KXZ

sycl/test/include_deps/sycl_accessor.hpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
// CHECK-NEXT: CL/cl_version.h
6969
// CHECK-NEXT: CL/cl_platform.h
7070
// CHECK-NEXT: CL/cl_ext.h
71+
// CHECK-NEXT: detail/string.hpp
7172
// CHECK-NEXT: detail/common.hpp
7273
// CHECK-NEXT: detail/is_device_copyable.hpp
7374
// CHECK-NEXT: detail/owner_less_base.hpp
@@ -113,7 +114,6 @@
113114
// CHECK-NEXT: info/ext_oneapi_device_traits.def
114115
// CHECK-NEXT: info/sycl_backend_traits.def
115116
// CHECK-NEXT: platform.hpp
116-
// CHECK-NEXT: detail/string.hpp
117117
// CHECK-NEXT: detail/string_view.hpp
118118
// CHECK-NEXT: detail/util.hpp
119119
// CHECK-NEXT: device_selector.hpp

sycl/test/include_deps/sycl_buffer.hpp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
// CHECK-NEXT: CL/cl_version.h
2323
// CHECK-NEXT: CL/cl_platform.h
2424
// CHECK-NEXT: CL/cl_ext.h
25+
// CHECK-NEXT: detail/string.hpp
2526
// CHECK-NEXT: detail/common.hpp
2627
// CHECK-NEXT: detail/helpers.hpp
2728
// CHECK-NEXT: detail/pi.hpp

sycl/test/include_deps/sycl_detail_core.hpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
// CHECK-NEXT: CL/cl_version.h
7070
// CHECK-NEXT: CL/cl_platform.h
7171
// CHECK-NEXT: CL/cl_ext.h
72+
// CHECK-NEXT: detail/string.hpp
7273
// CHECK-NEXT: detail/common.hpp
7374
// CHECK-NEXT: detail/is_device_copyable.hpp
7475
// CHECK-NEXT: detail/owner_less_base.hpp
@@ -114,7 +115,6 @@
114115
// CHECK-NEXT: info/ext_oneapi_device_traits.def
115116
// CHECK-NEXT: info/sycl_backend_traits.def
116117
// CHECK-NEXT: platform.hpp
117-
// CHECK-NEXT: detail/string.hpp
118118
// CHECK-NEXT: detail/string_view.hpp
119119
// CHECK-NEXT: detail/util.hpp
120120
// CHECK-NEXT: device_selector.hpp

0 commit comments

Comments
 (0)