Skip to content
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
16 changes: 2 additions & 14 deletions sycl/include/sycl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,9 @@ class __SYCL_EXPORT context : public detail::OwnerLessBase<context> {
/// Queries this SYCL context for SYCL backend-specific information.
///
/// 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>()
#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
template <typename Param>
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit surprising that this remains. Maybe link original PR in the description to explain what is happening.

Copy link
Contributor Author

@againull againull Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was implemented in #12906 and deprecated in #16700.
As far as I understand get_backend_info is documented in the spec: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_information_query_interface but corresponding descriptors are supposed to be specified in backend-specific extensions. At the same time we don't have any such backend-specific descriptor right now and sycl-cts doesn't seem to test this. So I am not sure if we should leave these methods in place or remove them.
@HPS-1 @AlexeySachkov can you provide your input please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit surprising that this remains. Maybe link original PR in the description to explain what is happening.

there is no harm to have this entry point while
template <typename T> struct is_backend_info_desc : std::false_type {};
is still present.

https://github.com/intel/llvm/pull/20676/files#diff-fc49f47ad53d5714302312c21e513c99f8ea464799f05837779fdae9bc3534a1R42

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I will leave approval to Andrey to ensure that his concerns are resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that our plan was to just leave them in place as a foundation for when we actually get those extensions.

Having them would also result in a better error message for user, i.e. "something is not a valid info that can be queried through get_backend_info vs this method does not exist" - the latter may be perceived as a bug by an end user


context(const context &rhs) = default;

Expand Down
22 changes: 0 additions & 22 deletions sycl/include/sycl/detail/info_desc_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,28 +123,6 @@ template <typename T> struct is_backend_info_desc : std::false_type {};
#undef __SYCL_PARAM_TRAITS_SPEC
#undef __SYCL_PARAM_TRAITS_TEMPLATE_PARTIAL_SPEC

#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
template <> \
struct is_backend_info_desc<info::DescType::Desc> : std::true_type { \
using return_type = info::DescType::Desc::return_type; \
};
#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
// spec and is likely going to be deprecated/removed. However, in pre-C++11
// ABI mode if result in ABI mismatch and causes crashes, so emit
// compile-time error under those conditions.
constexpr bool False = !std::is_same_v<Param, Param>;
static_assert(False,
"This interface is incompatible with _GLIBCXX_USE_CXX11_ABI=0");
return 0;
}
#endif

} // namespace detail
} // namespace _V1
} // namespace sycl
16 changes: 2 additions & 14 deletions sycl/include/sycl/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,9 @@ class __SYCL_STANDALONE_DEBUG __SYCL_EXPORT device
/// Queries this SYCL device for SYCL backend-specific information.
///
/// 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
template <typename Param>
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
16 changes: 2 additions & 14 deletions sycl/include/sycl/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,9 @@ class __SYCL_EXPORT event : public detail::OwnerLessBase<event> {
/// Queries this SYCL event for SYCL backend-specific information.
///
/// \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
template <typename Param>
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
5 changes: 0 additions & 5 deletions sycl/include/sycl/info/sycl_backend_traits.def

This file was deleted.

16 changes: 2 additions & 14 deletions sycl/include/sycl/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,9 @@ class __SYCL_EXPORT kernel : public detail::OwnerLessBase<kernel> {
/// Queries the kernel object for SYCL backend-specific information.
///
/// 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
template <typename Param>
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
16 changes: 2 additions & 14 deletions sycl/include/sycl/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,9 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
/// Queries this SYCL platform for SYCL backend-specific info.
///
/// 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
template <typename Param>
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
16 changes: 2 additions & 14 deletions sycl/include/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,21 +536,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
/// Queries SYCL queue for SYCL backend-specific information.
///
/// 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
template <typename Param>
typename detail::is_backend_info_desc<Param>::return_type
get_backend_info() const;
get_backend_info() const;

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
private:
Expand Down
8 changes: 0 additions & 8 deletions sycl/source/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ context::get_backend_info() const {
return impl->get_backend_info<Param>();
}

#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, Picode) \
template __SYCL_EXPORT ReturnT \
context::get_backend_info<info::DescType::Desc>() const;

#include <sycl/info/sycl_backend_traits.def>

#undef __SYCL_PARAM_TRAITS_SPEC

cl_context context::get() const { return impl->get(); }

backend context::get_backend() const noexcept { return impl->getBackend(); }
Expand Down
48 changes: 0 additions & 48 deletions sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,57 +212,9 @@ 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 {
if (getBackend() != backend::opencl) {
throw sycl::exception(errc::backend_mismatch,
"the info::platform::version info descriptor can "
"only be queried with an OpenCL backend");
}
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 {
if (getBackend() != backend::opencl) {
throw sycl::exception(errc::backend_mismatch,
"the info::device::version info descriptor can only "
"be queried with an OpenCL backend");
}
auto Devices = get_info<info::context::devices>();
if (Devices.empty()) {
return "No available device";
}
// Use default selector to pick a device.
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 {
if (getBackend() != backend::ext_oneapi_level_zero) {
throw sycl::exception(errc::backend_mismatch,
"the info::device::backend_version info descriptor "
"can only be queried with a Level Zero backend");
}
return "";
// Currently The Level Zero backend does not define the value of this
// information descriptor and implementations are encouraged to return the
// empty string as per specification.
}
#endif

device_impl *
context_impl::findMatchingDeviceImpl(ur_device_handle_t &DeviceUR) const {
for (device_impl *D : MDevices)
Expand Down
42 changes: 0 additions & 42 deletions sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,48 +63,6 @@ platform device_impl::get_platform() const {
return createSyclObjFromImpl<platform>(MPlatform);
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
typename info::platform::version::return_type
device_impl::get_backend_info<info::platform::version>() const {
if (getBackend() != backend::opencl) {
throw sycl::exception(errc::backend_mismatch,
"the info::platform::version info descriptor can "
"only be queried with an OpenCL backend");
}
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 {
if (getBackend() != backend::opencl) {
throw sycl::exception(errc::backend_mismatch,
"the info::device::version info descriptor can only "
"be queried with an OpenCL backend");
}
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 {
if (getBackend() != backend::ext_oneapi_level_zero) {
throw sycl::exception(errc::backend_mismatch,
"the info::device::backend_version info descriptor "
"can only be queried with a Level Zero backend");
}
return "";
// Currently The Level Zero backend does not define the value of this
// 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 {
if (ExtensionName.empty())
return false;
Expand Down
62 changes: 0 additions & 62 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,68 +439,6 @@ 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 {
if (!MContext) {
return "Context not initialized, no backend info available";
}
if (MContext->getBackend() != backend::opencl) {
throw sycl::exception(errc::backend_mismatch,
"the info::platform::version info descriptor can "
"only be queried with an OpenCL backend");
}
if (std::shared_ptr<queue_impl> Queue = MQueue.lock()) {
return Queue->getDeviceImpl()
.get_platform()
.get_info<info::platform::version>();
}
// If the queue has been released, no platform will be associated
// 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 {
if (!MContext) {
return "Context not initialized, no backend info available";
}
if (MContext->getBackend() != backend::opencl) {
throw sycl::exception(errc::backend_mismatch,
"the info::device::version info descriptor can only "
"be queried with an OpenCL backend");
}
if (std::shared_ptr<queue_impl> Queue = MQueue.lock()) {
return Queue->getDeviceImpl().get_info<info::device::version>();
}
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 {
if (!MContext) {
return "Context not initialized, no backend info available";
}
if (MContext->getBackend() != backend::ext_oneapi_level_zero) {
throw sycl::exception(errc::backend_mismatch,
"the info::device::backend_version info descriptor "
"can only be queried with a Level Zero backend");
}
return "";
// Currently The Level Zero backend does not define the value of this
// information descriptor and implementations are encouraged to return the
// empty string as per specification.
}
#endif

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

void HostProfilingInfo::end() { EndTime = getTimestamp(Device); }
Expand Down
Loading
Loading