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

+8-1
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

+2
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

+8-1
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

+8-1
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

+1-1
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
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

+8-1
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

+8-1
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

+8-1
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

+6
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 {

sycl/source/detail/device_impl.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ typename Param::return_type device_impl::get_info() const {
131131
#include <sycl/info/ext_oneapi_device_traits.def>
132132
#undef __SYCL_PARAM_TRAITS_SPEC
133133

134+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
134135
template <>
135136
typename info::platform::version::return_type
136137
device_impl::get_backend_info<info::platform::version>() const {
@@ -141,7 +142,9 @@ device_impl::get_backend_info<info::platform::version>() const {
141142
}
142143
return get_platform().get_info<info::platform::version>();
143144
}
145+
#endif
144146

147+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
145148
template <>
146149
typename info::device::version::return_type
147150
device_impl::get_backend_info<info::device::version>() const {
@@ -152,7 +155,9 @@ device_impl::get_backend_info<info::device::version>() const {
152155
}
153156
return get_info<info::device::version>();
154157
}
158+
#endif
155159

160+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
156161
template <>
157162
typename info::device::backend_version::return_type
158163
device_impl::get_backend_info<info::device::backend_version>() const {
@@ -166,6 +171,7 @@ device_impl::get_backend_info<info::device::backend_version>() const {
166171
// information descriptor and implementations are encouraged to return the
167172
// empty string as per specification.
168173
}
174+
#endif
169175

170176
bool device_impl::has_extension(const std::string &ExtensionName) const {
171177
std::string AllExtensionNames =

sycl/source/detail/event_impl.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ event_impl::get_info<info::event::command_execution_status>() {
418418
: info::event_command_status::complete;
419419
}
420420

421+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
421422
template <>
422423
typename info::platform::version::return_type
423424
event_impl::get_backend_info<info::platform::version>() const {
@@ -438,7 +439,9 @@ event_impl::get_backend_info<info::platform::version>() const {
438439
// so return empty string.
439440
return "";
440441
}
442+
#endif
441443

444+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
442445
template <>
443446
typename info::device::version::return_type
444447
event_impl::get_backend_info<info::device::version>() const {
@@ -456,7 +459,9 @@ event_impl::get_backend_info<info::device::version>() const {
456459
return ""; // If the queue has been released, no device will be associated so
457460
// return empty string
458461
}
462+
#endif
459463

464+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
460465
template <>
461466
typename info::device::backend_version::return_type
462467
event_impl::get_backend_info<info::device::backend_version>() const {
@@ -473,6 +478,7 @@ event_impl::get_backend_info<info::device::backend_version>() const {
473478
// information descriptor and implementations are encouraged to return the
474479
// empty string as per specification.
475480
}
481+
#endif
476482

477483
void HostProfilingInfo::start() { StartTime = getTimestamp(); }
478484

sycl/source/detail/kernel_impl.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ void kernel_impl::checkIfValidForNumArgsInfoQuery() const {
106106
"interoperability function or to query a device built-in kernel");
107107
}
108108

109+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
109110
template <>
110111
typename info::platform::version::return_type
111112
kernel_impl::get_backend_info<info::platform::version>() const {
@@ -117,10 +118,12 @@ kernel_impl::get_backend_info<info::platform::version>() const {
117118
auto Devices = MKernelBundleImpl->get_devices();
118119
return Devices[0].get_platform().get_info<info::platform::version>();
119120
}
121+
#endif
120122

121123
device select_device(DSelectorInvocableType DeviceSelectorInvocable,
122124
std::vector<device> &Devices);
123125

126+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
124127
template <>
125128
typename info::device::version::return_type
126129
kernel_impl::get_backend_info<info::device::version>() const {
@@ -137,7 +140,9 @@ kernel_impl::get_backend_info<info::device::version>() const {
137140
return select_device(default_selector_v, Devices)
138141
.get_info<info::device::version>();
139142
}
143+
#endif
140144

145+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
141146
template <>
142147
typename info::device::backend_version::return_type
143148
kernel_impl::get_backend_info<info::device::backend_version>() const {
@@ -151,6 +156,7 @@ kernel_impl::get_backend_info<info::device::backend_version>() const {
151156
// information descriptor and implementations are encouraged to return the
152157
// empty string as per specification.
153158
}
159+
#endif
154160

155161
} // namespace detail
156162
} // namespace _V1

sycl/source/detail/platform_impl.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ typename Param::return_type platform_impl::get_info() const {
572572
return get_platform_info<Param>(this->getHandleRef(), getAdapter());
573573
}
574574

575+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
575576
template <>
576577
typename info::platform::version::return_type
577578
platform_impl::get_backend_info<info::platform::version>() const {
@@ -582,10 +583,12 @@ platform_impl::get_backend_info<info::platform::version>() const {
582583
}
583584
return get_info<info::platform::version>();
584585
}
586+
#endif
585587

586588
device select_device(DSelectorInvocableType DeviceSelectorInvocable,
587589
std::vector<device> &Devices);
588590

591+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
589592
template <>
590593
typename info::device::version::return_type
591594
platform_impl::get_backend_info<info::device::version>() const {
@@ -602,7 +605,9 @@ platform_impl::get_backend_info<info::device::version>() const {
602605
return select_device(default_selector_v, Devices)
603606
.get_info<info::device::version>();
604607
}
608+
#endif
605609

610+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
606611
template <>
607612
typename info::device::backend_version::return_type
608613
platform_impl::get_backend_info<info::device::backend_version>() const {
@@ -616,6 +621,7 @@ platform_impl::get_backend_info<info::device::backend_version>() const {
616621
// information descriptor and implementations are encouraged to return the
617622
// empty string as per specification.
618623
}
624+
#endif
619625

620626
// All devices on the platform must have the given aspect.
621627
bool platform_impl::has(aspect Aspect) const {

sycl/source/detail/queue_impl.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ template <> device queue_impl::get_info<info::queue::device>() const {
7373
return get_device();
7474
}
7575

76+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
7677
template <>
7778
typename info::platform::version::return_type
7879
queue_impl::get_backend_info<info::platform::version>() const {
@@ -83,7 +84,9 @@ queue_impl::get_backend_info<info::platform::version>() const {
8384
}
8485
return get_device().get_platform().get_info<info::platform::version>();
8586
}
87+
#endif
8688

89+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
8790
template <>
8891
typename info::device::version::return_type
8992
queue_impl::get_backend_info<info::device::version>() const {
@@ -94,7 +97,9 @@ queue_impl::get_backend_info<info::device::version>() const {
9497
}
9598
return get_device().get_info<info::device::version>();
9699
}
100+
#endif
97101

102+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
98103
template <>
99104
typename info::device::backend_version::return_type
100105
queue_impl::get_backend_info<info::device::backend_version>() const {
@@ -108,6 +113,7 @@ queue_impl::get_backend_info<info::device::backend_version>() const {
108113
// information descriptor and implementations are encouraged to return the
109114
// empty string as per specification.
110115
}
116+
#endif
111117

112118
static event prepareSYCLEventAssociatedWithQueue(
113119
const std::shared_ptr<detail::queue_impl> &QueueImpl) {

sycl/test-e2e/Basic/backend_info.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// RUN: %{build} -o %t.out
1+
// RUN: %{build} -o %t.out -Wno-deprecated-declarations
22
// RUN: %{run} %t.out
33
//
4-
// RUN: %{build} -DTEST_ERRORS -D_GLIBCXX_USE_CXX11_ABI=0 -fsyntax-only -Wno-error=unused-command-line-argument -Xclang -verify -Xclang -verify-ignore-unexpected=note
4+
5+
// RUN: %{build} -DTEST_ERRORS -D_GLIBCXX_USE_CXX11_ABI=0 -fsyntax-only -Wno-deprecated-declarations -Wno-error=unused-command-line-argument -Xclang -verify -Xclang -verify-ignore-unexpected=note
56

67
//==--- backend_info.cpp - SYCL backend info test---------------------------==//
78
//

0 commit comments

Comments
 (0)