Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Deprecate current implementations of get_backend_info() #16700

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sycl/include/sycl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,20 @@ class __SYCL_EXPORT context : public detail::OwnerLessBase<context> {
///
/// The return type depends on information being queried.
template <typename Param
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
,
int = detail::emit_get_backend_info_error<context, Param>()
steffenlarsen marked this conversation as resolved.
Show resolved Hide resolved
#endif
#endif
>
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_DEPRECATED(
"All current implementations of get_backend_info() are to be removed. "
"Use respective variants of get_info() instead.")
HPS-1 marked this conversation as resolved.
Show resolved Hide resolved
#endif
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

context(const context &rhs) = default;

Expand Down
2 changes: 2 additions & 0 deletions sycl/include/sycl/detail/info_desc_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ struct IsKernelInfo<info::kernel_device_specific::ext_codeplay_num_regs>
#include <sycl/info/sycl_backend_traits.def>
#undef __SYCL_PARAM_TRAITS_SPEC

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

} // namespace detail
} // namespace _V1
Expand Down
9 changes: 8 additions & 1 deletion sycl/include/sycl/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,20 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
///
/// The return type depends on information being queried.
template <typename Param
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
,
int = detail::emit_get_backend_info_error<device, Param>()
#endif
#endif
>
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_DEPRECATED(
"All current implementations of get_backend_info() are to be removed. "
"Use respective variants of get_info() instead.")
#endif
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

/// Check SYCL extension support by device
///
Expand Down
9 changes: 8 additions & 1 deletion sycl/include/sycl/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,20 @@ class __SYCL_EXPORT event : public detail::OwnerLessBase<event> {
///
/// \return depends on information being queried.
template <typename Param
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
,
int = detail::emit_get_backend_info_error<event, Param>()
#endif
#endif
>
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_DEPRECATED(
"All current implementations of get_backend_info() are to be removed. "
"Use respective variants of get_info() instead.")
#endif
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

/// Queries this SYCL event for profiling information.
///
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/info/device_traits_deprecated.def
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Deprecated and not part of SYCL 2020 spec
__SYCL_PARAM_TRAITS_DEPRECATED(image_max_array_size,"support for image arrays has been removed in SYCL 2020")
__SYCL_PARAM_TRAITS_DEPRECATED(opencl_c_version,"use device::get_backend_info instead")
__SYCL_PARAM_TRAITS_DEPRECATED(opencl_c_version,"use device::get_info instead")
__SYCL_PARAM_TRAITS_DEPRECATED(atomic64, "use sycl::aspect::atomic64 instead")

//TODO:Remove when possible
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/sycl/info/sycl_backend_traits.def
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_PARAM_TRAITS_SPEC(platform, version, std::string, PI_PLATFORM_INFO_VERSION)
__SYCL_PARAM_TRAITS_SPEC(device, version, std::string, PI_DEVICE_INFO_VERSION)
__SYCL_PARAM_TRAITS_SPEC(device, backend_version, std::string, PI_DEVICE_INFO_BACKEND_VERSION)
#endif
9 changes: 8 additions & 1 deletion sycl/include/sycl/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,20 @@ class __SYCL_EXPORT kernel : public detail::OwnerLessBase<kernel> {
///
/// The return type depends on information being queried.
template <typename Param
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
,
int = detail::emit_get_backend_info_error<kernel, Param>()
#endif
#endif
>
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_DEPRECATED(
"All current implementations of get_backend_info() are to be removed. "
"Use respective variants of get_info() instead.")
#endif
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

/// Query device-specific information from the kernel object using the
/// info::kernel_device_specific descriptor.
Expand Down
9 changes: 8 additions & 1 deletion sycl/include/sycl/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,20 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
///
/// The return type depends on information being queried.
template <typename Param
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
,
int = detail::emit_get_backend_info_error<platform, Param>()
#endif
#endif
>
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_DEPRECATED(
"All current implementations of get_backend_info() are to be removed. "
"Use respective variants of get_info() instead.")
#endif
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

/// Returns all available SYCL platforms in the system.
///
Expand Down
9 changes: 8 additions & 1 deletion sycl/include/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,20 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
///
/// The return type depends on information being queried.
template <typename Param
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
,
int = detail::emit_get_backend_info_error<queue, Param>()
#endif
#endif
>
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
__SYCL_DEPRECATED(
"All current implementations of get_backend_info() are to be removed. "
"Use respective variants of get_info() instead.")
#endif
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

private:
// A shorthand for `get_device().has()' which is expected to be a bit quicker
Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ context_impl::get_info<info::context::atomic_fence_scope_capabilities>() const {
return CapabilityList;
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
context_impl::get_backend_info<info::platform::version>() const {
Expand All @@ -234,10 +235,12 @@ context_impl::get_backend_info<info::platform::version>() const {
}
return MDevices[0].get_platform().get_info<info::platform::version>();
}
#endif

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

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::device::version::return_type
context_impl::get_backend_info<info::device::version>() const {
Expand All @@ -254,7 +257,9 @@ context_impl::get_backend_info<info::device::version>() const {
return select_device(default_selector_v, Devices)
.get_info<info::device::version>();
}
#endif

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

ur_context_handle_t &context_impl::getHandleRef() { return MContext; }
const ur_context_handle_t &context_impl::getHandleRef() const {
Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ typename Param::return_type device_impl::get_info() const {
#include <sycl/info/ext_oneapi_device_traits.def>
#undef __SYCL_PARAM_TRAITS_SPEC

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
device_impl::get_backend_info<info::platform::version>() const {
Expand All @@ -141,7 +142,9 @@ device_impl::get_backend_info<info::platform::version>() const {
}
return get_platform().get_info<info::platform::version>();
}
#endif

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::device::version::return_type
device_impl::get_backend_info<info::device::version>() const {
Expand All @@ -152,7 +155,9 @@ device_impl::get_backend_info<info::device::version>() const {
}
return get_info<info::device::version>();
}
#endif

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

bool device_impl::has_extension(const std::string &ExtensionName) const {
std::string AllExtensionNames =
Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ event_impl::get_info<info::event::command_execution_status>() {
: info::event_command_status::complete;
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
event_impl::get_backend_info<info::platform::version>() const {
Expand All @@ -438,7 +439,9 @@ event_impl::get_backend_info<info::platform::version>() const {
// so return empty string.
return "";
}
#endif

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

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

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

Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/kernel_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void kernel_impl::checkIfValidForNumArgsInfoQuery() const {
"interoperability function or to query a device built-in kernel");
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
kernel_impl::get_backend_info<info::platform::version>() const {
Expand All @@ -117,10 +118,12 @@ kernel_impl::get_backend_info<info::platform::version>() const {
auto Devices = MKernelBundleImpl->get_devices();
return Devices[0].get_platform().get_info<info::platform::version>();
}
#endif

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

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::device::version::return_type
kernel_impl::get_backend_info<info::device::version>() const {
Expand All @@ -137,7 +140,9 @@ kernel_impl::get_backend_info<info::device::version>() const {
return select_device(default_selector_v, Devices)
.get_info<info::device::version>();
}
#endif

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

} // namespace detail
} // namespace _V1
Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ typename Param::return_type platform_impl::get_info() const {
return get_platform_info<Param>(this->getHandleRef(), getAdapter());
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
platform_impl::get_backend_info<info::platform::version>() const {
Expand All @@ -582,10 +583,12 @@ platform_impl::get_backend_info<info::platform::version>() const {
}
return get_info<info::platform::version>();
}
#endif

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

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::device::version::return_type
platform_impl::get_backend_info<info::device::version>() const {
Expand All @@ -602,7 +605,9 @@ platform_impl::get_backend_info<info::device::version>() const {
return select_device(default_selector_v, Devices)
.get_info<info::device::version>();
}
#endif

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

// All devices on the platform must have the given aspect.
bool platform_impl::has(aspect Aspect) const {
Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/queue_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ template <> device queue_impl::get_info<info::queue::device>() const {
return get_device();
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
queue_impl::get_backend_info<info::platform::version>() const {
Expand All @@ -83,7 +84,9 @@ queue_impl::get_backend_info<info::platform::version>() const {
}
return get_device().get_platform().get_info<info::platform::version>();
}
#endif

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::device::version::return_type
queue_impl::get_backend_info<info::device::version>() const {
Expand All @@ -94,7 +97,9 @@ queue_impl::get_backend_info<info::device::version>() const {
}
return get_device().get_info<info::device::version>();
}
#endif

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

static event prepareSYCLEventAssociatedWithQueue(
const std::shared_ptr<detail::queue_impl> &QueueImpl) {
Expand Down
5 changes: 3 additions & 2 deletions sycl/test-e2e/Basic/backend_info.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// RUN: %{build} -o %t.out
// RUN: %{build} -o %t.out -Wno-deprecated-declarations
// RUN: %{run} %t.out
//
// 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

// 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

//==--- backend_info.cpp - SYCL backend info test---------------------------==//
//
Expand Down
Loading
Loading