diff --git a/sycl/include/sycl/info/context.hpp b/sycl/include/sycl/info/context.hpp index e99ee1f5146e5..e04214cfcfaca 100644 --- a/sycl/include/sycl/info/context.hpp +++ b/sycl/include/sycl/info/context.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -31,9 +32,13 @@ using context_traits = using context_runtime_traits = sycl::detail::rt_traits_base; -struct reference_count : context_traits { +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES +struct __SYCL_DEPRECATED("info::context::reference_count is not part of " + "SYCL 2020") reference_count + : context_traits { using return_type = uint32_t; }; +#endif // __INTEL_PREVIEW_BREAKING_CHANGES struct platform : context_runtime_traits { using return_type = sycl::platform; }; diff --git a/sycl/include/sycl/info/device.hpp b/sycl/include/sycl/info/device.hpp index 40b40e2774ac0..d876c8adbf739 100644 --- a/sycl/include/sycl/info/device.hpp +++ b/sycl/include/sycl/info/device.hpp @@ -418,9 +418,13 @@ struct __SYCL_DEPRECATED("use sycl::aspect::atomic64 instead") atomic64 }; #endif // __INTEL_PREVIEW_BREAKING_CHANGES -struct reference_count : device_traits { +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES +struct __SYCL_DEPRECATED("info::device::reference_count is not part of " + "SYCL 2020") reference_count + : device_traits { using return_type = uint32_t; }; +#endif // __INTEL_PREVIEW_BREAKING_CHANGES // To be dropped (has alternatives/not needed) struct usm_device_allocations : device_traits { diff --git a/sycl/include/sycl/info/event.hpp b/sycl/include/sycl/info/event.hpp index aef60c0ec2f84..50647f10600f9 100644 --- a/sycl/include/sycl/info/event.hpp +++ b/sycl/include/sycl/info/event.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -36,9 +37,13 @@ struct command_execution_status : event_traits { using return_type = info::event_command_status; }; -struct reference_count : event_traits { +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES +struct __SYCL_DEPRECATED("info::event::reference_count is not part of " + "SYCL 2020") reference_count + : event_traits { using return_type = uint32_t; }; +#endif // __INTEL_PREVIEW_BREAKING_CHANGES } // namespace event namespace event_profiling { template diff --git a/sycl/include/sycl/info/kernel.hpp b/sycl/include/sycl/info/kernel.hpp index eec1f242635c2..4faccdead55fe 100644 --- a/sycl/include/sycl/info/kernel.hpp +++ b/sycl/include/sycl/info/kernel.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include #include @@ -38,9 +39,13 @@ struct attributes : kernel_traits { struct function_name : kernel_traits { using return_type = std::string; }; -struct reference_count : kernel_traits { +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES +struct __SYCL_DEPRECATED("info::kernel::reference_count is not part of " + "SYCL 2020") reference_count + : kernel_traits { using return_type = uint32_t; }; +#endif // __INTEL_PREVIEW_BREAKING_CHANGES struct context : kernel_traits { using return_type = sycl::context; }; diff --git a/sycl/include/sycl/info/queue.hpp b/sycl/include/sycl/info/queue.hpp index c4f710a6fbcaf..9c7e24932916f 100644 --- a/sycl/include/sycl/info/queue.hpp +++ b/sycl/include/sycl/info/queue.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -32,9 +33,13 @@ struct context : queue_traits { struct device : queue_traits { using return_type = sycl::device; }; -struct reference_count : queue_traits { +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES +struct __SYCL_DEPRECATED("info::queue::reference_count is not part of " + "SYCL 2020") reference_count + : queue_traits { using return_type = uint32_t; }; +#endif // __INTEL_PREVIEW_BREAKING_CHANGES } // namespace queue } // namespace info diff --git a/sycl/source/context.cpp b/sycl/source/context.cpp index 56fe282221c8d..a735952731b7d 100644 --- a/sycl/source/context.cpp +++ b/sycl/source/context.cpp @@ -92,7 +92,9 @@ context::get_info() const { #define __SYCL_CONTEXT_INFO_INST(NAME, RETURN_T) \ template __SYCL_EXPORT RETURN_T context::get_info() \ const; +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_CONTEXT_INFO_INST(reference_count, uint32_t) +#endif // __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_CONTEXT_INFO_INST(platform, sycl::platform) __SYCL_CONTEXT_INFO_INST(devices, std::vector) __SYCL_CONTEXT_INFO_INST(atomic_memory_order_capabilities, diff --git a/sycl/source/detail/context_impl.cpp b/sycl/source/detail/context_impl.cpp index d65e2395d2c1f..79bfdf8f1ebfd 100644 --- a/sycl/source/detail/context_impl.cpp +++ b/sycl/source/detail/context_impl.cpp @@ -143,11 +143,13 @@ const async_handler &context_impl::get_async_handler() const { return MAsyncHandler; } +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES template <> uint32_t context_impl::get_info() const { return get_context_info(this->getHandleRef(), this->getAdapter()); } +#endif // __INTEL_PREVIEW_BREAKING_CHANGES template <> platform context_impl::get_info() const { return createSyclObjFromImpl(MPlatform); } diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index 6b7957bf781bd..273442c4bada2 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -402,6 +402,7 @@ uint64_t event_impl::get_profiling_info() { return MHostProfilingInfo->getEndTime(); } +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES template <> uint32_t event_impl::get_info() { auto Handle = this->getHandle(); if (!MIsHostEvent && Handle) { @@ -410,6 +411,7 @@ template <> uint32_t event_impl::get_info() { } return 0; } +#endif // __INTEL_PREVIEW_BREAKING_CHANGES template <> info::event_command_status diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index ed901c976410b..cb483ebd214c7 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -62,6 +62,7 @@ getUrEvents(const std::vector &DepEvents) { return RetUrEvents; } +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES template <> uint32_t queue_impl::get_info() const { ur_result_t result = UR_RESULT_SUCCESS; @@ -69,6 +70,7 @@ uint32_t queue_impl::get_info() const { MQueue, UR_QUEUE_INFO_REFERENCE_COUNT, sizeof(result), &result, nullptr); return result; } +#endif // __INTEL_PREVIEW_BREAKING_CHANGES template <> context queue_impl::get_info() const { return get_context(); diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index 9545cbb4a5a04..9209c77dbb336 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -282,7 +282,9 @@ __SYCL_DEVICE_INFO_INST(partition_type_affinity_domain, #ifndef __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_DEVICE_INFO_INST(atomic64, bool) #endif // __INTEL_PREVIEW_BREAKING_CHANGES +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_DEVICE_INFO_INST(reference_count, uint32_t) +#endif // __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_DEVICE_INFO_INST(usm_device_allocations, bool) __SYCL_DEVICE_INFO_INST(usm_host_allocations, bool) __SYCL_DEVICE_INFO_INST(usm_shared_allocations, bool) diff --git a/sycl/source/event.cpp b/sycl/source/event.cpp index 48611dfbdb456..246cd6b92dc52 100644 --- a/sycl/source/event.cpp +++ b/sycl/source/event.cpp @@ -94,7 +94,9 @@ event::get_profiling_info() const { #define __SYCL_EVENT_INFO_INST(NAME, RETURN_T) \ template __SYCL_EXPORT RETURN_T event::get_info() const; __SYCL_EVENT_INFO_INST(command_execution_status, info::event_command_status) +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_EVENT_INFO_INST(reference_count, uint32_t) +#endif // __INTEL_PREVIEW_BREAKING_CHANGES #undef __SYCL_EVENT_INFO_INST #define __SYCL_EVENT_PROFILING_INFO_INST(NAME, RETURN_T) \ diff --git a/sycl/source/kernel.cpp b/sycl/source/kernel.cpp index 8abde164c6b62..ad8a168c262d5 100644 --- a/sycl/source/kernel.cpp +++ b/sycl/source/kernel.cpp @@ -62,7 +62,9 @@ kernel::get_info_impl() const { __SYCL_KERNEL_INFO_INST(num_args, uint32_t) __SYCL_KERNEL_INFO_INST(attributes, std::string) __SYCL_KERNEL_INFO_INST(function_name, std::string) +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_KERNEL_INFO_INST(reference_count, uint32_t) +#endif // __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_KERNEL_INFO_INST(context, sycl::context) #undef __SYCL_KERNEL_INFO_INST diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 4e57c36d4ef99..4e5b4b13becc7 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -228,7 +228,9 @@ queue::get_info() const { template __SYCL_EXPORT RETURN_T queue::get_info() const; __SYCL_QUEUE_INFO_INST(context, sycl::context) __SYCL_QUEUE_INFO_INST(device, sycl::device) +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES __SYCL_QUEUE_INFO_INST(reference_count, uint32_t) +#endif // __INTEL_PREVIEW_BREAKING_CHANGES #undef __SYCL_QUEUE_INFO_INST template diff --git a/sycl/test-e2e/Basic/info.cpp b/sycl/test-e2e/Basic/info.cpp index dd849b749ccfe..abdb57c1b29b3 100644 --- a/sycl/test-e2e/Basic/info.cpp +++ b/sycl/test-e2e/Basic/info.cpp @@ -386,8 +386,6 @@ int main() { print_info(dev, "Partition type affinity domain"); - print_info( - dev, "Reference count"); std::cout << separator << "Platform information\n" << separator; platform plt(dev.get_platform()); diff --git a/sycl/test-e2e/Basic/kernel_info.cpp b/sycl/test-e2e/Basic/kernel_info.cpp index 95215356c6383..bf42dbb29bba3 100644 --- a/sycl/test-e2e/Basic/kernel_info.cpp +++ b/sycl/test-e2e/Basic/kernel_info.cpp @@ -71,18 +71,11 @@ int main() { const context krnCtx = krn.get_info(); assert(krnCtx == q.get_context()); - const cl_uint krnRefCount = krn.get_info(); - assert(krnRefCount > 0); // Use ext_oneapi_get_kernel_info extension and check that answers match. const context krnCtxExt = syclex::get_kernel_info(ctx); assert(krnCtxExt == krnCtx); - // Reference count might be different because we have to retain the kernel - // handle first to fetch the info. So just check that it is not 0. - const cl_uint krnRefCountExt = - syclex::get_kernel_info(ctx); - assert(krnRefCountExt > 0); device dev = q.get_device(); const size_t wgSize = diff --git a/sycl/test-e2e/DeprecatedFeatures/reference_count.cpp b/sycl/test-e2e/DeprecatedFeatures/reference_count.cpp new file mode 100644 index 0000000000000..e15f1c008a5bb --- /dev/null +++ b/sycl/test-e2e/DeprecatedFeatures/reference_count.cpp @@ -0,0 +1,47 @@ +// UNSUPPORTED: preview-mode +// UNSUPPORTED-INTENDED: reference_count is unavailable in preview mode. +// RUN: %{build} -o %t.out + +//==---------- reference_count.cpp - Deprecated info test ------------------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include +#include + +#include +#include + +using namespace sycl; + +template +using GetInfoMemberT = uint32_t (SyclObject::*)() const; + +template +GetInfoMemberT check_get_info() { + static_assert(std::is_same_v); + return &SyclObject::template get_info; +} + +int main() { + auto ContextRefCount = + check_get_info(); + auto DeviceRefCount = check_get_info(); + auto EventRefCount = check_get_info(); + auto KernelRefCount = check_get_info(); + auto QueueRefCount = check_get_info(); + + (void)ContextRefCount; + (void)DeviceRefCount; + (void)EventRefCount; + (void)KernelRefCount; + (void)QueueRefCount; + return 0; +} diff --git a/sycl/test-e2e/Regression/dummy_event_info.cpp b/sycl/test-e2e/Regression/dummy_event_info.cpp index 58a721629e4e0..b106810bb3d51 100644 --- a/sycl/test-e2e/Regression/dummy_event_info.cpp +++ b/sycl/test-e2e/Regression/dummy_event_info.cpp @@ -18,7 +18,6 @@ int main() { assert(e.get_info() == info::event_command_status::complete); - assert(e.get_info() == 0); auto submit_time = e.get_profiling_info(); auto start_time =