Skip to content

Commit c6e45cf

Browse files
authored
[SYCL] Deprecate current implementations of get_backend_info() (#16700)
The `get_backend_info()` functions implemented in #12906 are returning some info descriptors that are not backend-specific info descriptors but SYCL core info descriptors. This leads to problems as described in #16272 . Therefore, its current implementations are being deprecated, and removed under the `__INTEL_PREVIEW_BREAKING_CHANGES` flag. --------- Signed-off-by: Hu, Peisen <[email protected]>
1 parent e880f95 commit c6e45cf

18 files changed

+207
-10
lines changed

sycl/include/sycl/context.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,20 @@ class __SYCL_EXPORT context : public detail::OwnerLessBase<context> {
177177
///
178178
/// The return type depends on information being queried.
179179
template <typename Param
180+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
180181
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
181182
,
182183
int = detail::emit_get_backend_info_error<context, Param>()
184+
#endif
183185
#endif
184186
>
187+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
188+
__SYCL_DEPRECATED(
189+
"All current implementations of get_backend_info() are to be removed. "
190+
"Use respective variants of get_info() instead.")
191+
#endif
185192
typename detail::is_backend_info_desc<Param>::return_type
186-
get_backend_info() const;
193+
get_backend_info() const;
187194

188195
context(const context &rhs) = default;
189196

sycl/include/sycl/detail/info_desc_helpers.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct IsKernelInfo<info::kernel_device_specific::ext_codeplay_num_regs>
129129
#include <sycl/info/sycl_backend_traits.def>
130130
#undef __SYCL_PARAM_TRAITS_SPEC
131131

132+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
132133
template <typename SyclObject, typename Param>
133134
constexpr int emit_get_backend_info_error() {
134135
// Implementation of get_backend_info doesn't seem to be aligned with the
@@ -140,6 +141,7 @@ constexpr int emit_get_backend_info_error() {
140141
"This interface is incompatible with _GLIBCXX_USE_CXX11_ABI=0");
141142
return 0;
142143
}
144+
#endif
143145

144146
} // namespace detail
145147
} // namespace _V1

sycl/include/sycl/device.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,20 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
222222
///
223223
/// The return type depends on information being queried.
224224
template <typename Param
225+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
225226
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
226227
,
227228
int = detail::emit_get_backend_info_error<device, Param>()
229+
#endif
228230
#endif
229231
>
232+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
233+
__SYCL_DEPRECATED(
234+
"All current implementations of get_backend_info() are to be removed. "
235+
"Use respective variants of get_info() instead.")
236+
#endif
230237
typename detail::is_backend_info_desc<Param>::return_type
231-
get_backend_info() const;
238+
get_backend_info() const;
232239

233240
/// Check SYCL extension support by device
234241
///

sycl/include/sycl/event.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,20 @@ class __SYCL_EXPORT event : public detail::OwnerLessBase<event> {
112112
///
113113
/// \return depends on information being queried.
114114
template <typename Param
115+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
115116
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
116117
,
117118
int = detail::emit_get_backend_info_error<event, Param>()
119+
#endif
118120
#endif
119121
>
122+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
123+
__SYCL_DEPRECATED(
124+
"All current implementations of get_backend_info() are to be removed. "
125+
"Use respective variants of get_info() instead.")
126+
#endif
120127
typename detail::is_backend_info_desc<Param>::return_type
121-
get_backend_info() const;
128+
get_backend_info() const;
122129

123130
/// Queries this SYCL event for profiling information.
124131
///

sycl/include/sycl/info/device_traits_deprecated.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Deprecated and not part of SYCL 2020 spec
22
__SYCL_PARAM_TRAITS_DEPRECATED(image_max_array_size,"support for image arrays has been removed in SYCL 2020")
3-
__SYCL_PARAM_TRAITS_DEPRECATED(opencl_c_version,"use device::get_backend_info instead")
3+
__SYCL_PARAM_TRAITS_DEPRECATED(opencl_c_version,"use device::get_info instead")
44
__SYCL_PARAM_TRAITS_DEPRECATED(atomic64, "use sycl::aspect::atomic64 instead")
55

66
//TODO:Remove when possible
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
12
__SYCL_PARAM_TRAITS_SPEC(platform, version, std::string, PI_PLATFORM_INFO_VERSION)
23
__SYCL_PARAM_TRAITS_SPEC(device, version, std::string, PI_DEVICE_INFO_VERSION)
34
__SYCL_PARAM_TRAITS_SPEC(device, backend_version, std::string, PI_DEVICE_INFO_BACKEND_VERSION)
5+
#endif

sycl/include/sycl/kernel.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,20 @@ class __SYCL_EXPORT kernel : public detail::OwnerLessBase<kernel> {
132132
///
133133
/// The return type depends on information being queried.
134134
template <typename Param
135+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
135136
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
136137
,
137138
int = detail::emit_get_backend_info_error<kernel, Param>()
139+
#endif
138140
#endif
139141
>
142+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
143+
__SYCL_DEPRECATED(
144+
"All current implementations of get_backend_info() are to be removed. "
145+
"Use respective variants of get_info() instead.")
146+
#endif
140147
typename detail::is_backend_info_desc<Param>::return_type
141-
get_backend_info() const;
148+
get_backend_info() const;
142149

143150
/// Query device-specific information from the kernel object using the
144151
/// info::kernel_device_specific descriptor.

sycl/include/sycl/platform.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,20 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
150150
///
151151
/// The return type depends on information being queried.
152152
template <typename Param
153+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
153154
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
154155
,
155156
int = detail::emit_get_backend_info_error<platform, Param>()
157+
#endif
156158
#endif
157159
>
160+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
161+
__SYCL_DEPRECATED(
162+
"All current implementations of get_backend_info() are to be removed. "
163+
"Use respective variants of get_info() instead.")
164+
#endif
158165
typename detail::is_backend_info_desc<Param>::return_type
159-
get_backend_info() const;
166+
get_backend_info() const;
160167

161168
/// Returns all available SYCL platforms in the system.
162169
///

sycl/include/sycl/queue.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,20 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
349349
///
350350
/// The return type depends on information being queried.
351351
template <typename Param
352+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
352353
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
353354
,
354355
int = detail::emit_get_backend_info_error<queue, Param>()
356+
#endif
355357
#endif
356358
>
359+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
360+
__SYCL_DEPRECATED(
361+
"All current implementations of get_backend_info() are to be removed. "
362+
"Use respective variants of get_info() instead.")
363+
#endif
357364
typename detail::is_backend_info_desc<Param>::return_type
358-
get_backend_info() const;
365+
get_backend_info() const;
359366

360367
private:
361368
// A shorthand for `get_device().has()' which is expected to be a bit quicker

sycl/source/detail/context_impl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ context_impl::get_info<info::context::atomic_fence_scope_capabilities>() const {
224224
return CapabilityList;
225225
}
226226

227+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
227228
template <>
228229
typename info::platform::version::return_type
229230
context_impl::get_backend_info<info::platform::version>() const {
@@ -234,10 +235,12 @@ context_impl::get_backend_info<info::platform::version>() const {
234235
}
235236
return MDevices[0].get_platform().get_info<info::platform::version>();
236237
}
238+
#endif
237239

238240
device select_device(DSelectorInvocableType DeviceSelectorInvocable,
239241
std::vector<device> &Devices);
240242

243+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
241244
template <>
242245
typename info::device::version::return_type
243246
context_impl::get_backend_info<info::device::version>() const {
@@ -254,7 +257,9 @@ context_impl::get_backend_info<info::device::version>() const {
254257
return select_device(default_selector_v, Devices)
255258
.get_info<info::device::version>();
256259
}
260+
#endif
257261

262+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
258263
template <>
259264
typename info::device::backend_version::return_type
260265
context_impl::get_backend_info<info::device::backend_version>() const {
@@ -268,6 +273,7 @@ context_impl::get_backend_info<info::device::backend_version>() const {
268273
// information descriptor and implementations are encouraged to return the
269274
// empty string as per specification.
270275
}
276+
#endif
271277

272278
ur_context_handle_t &context_impl::getHandleRef() { return MContext; }
273279
const ur_context_handle_t &context_impl::getHandleRef() const {

0 commit comments

Comments
 (0)