Skip to content
Draft
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
7 changes: 6 additions & 1 deletion sycl/include/sycl/info/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include <sycl/detail/defines_elementary.hpp>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's guard this include here and in other files so that we don't forget to remove it.

#include <sycl/detail/info_desc_traits.hpp>
#include <unified-runtime/ur_api.h>

Expand All @@ -31,9 +32,13 @@ using context_traits =
using context_runtime_traits =
sycl::detail::rt_traits_base<sycl::detail::info_class::context>;

struct reference_count : context_traits<UR_CONTEXT_INFO_REFERENCE_COUNT> {
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
struct __SYCL_DEPRECATED("info::context::reference_count is not part of "
"SYCL 2020") reference_count
: context_traits<UR_CONTEXT_INFO_REFERENCE_COUNT> {
using return_type = uint32_t;
};
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
struct platform : context_runtime_traits {
using return_type = sycl::platform;
};
Expand Down
6 changes: 5 additions & 1 deletion sycl/include/sycl/info/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,13 @@ struct __SYCL_DEPRECATED("use sycl::aspect::atomic64 instead") atomic64
};
#endif // __INTEL_PREVIEW_BREAKING_CHANGES

struct reference_count : device_traits<UR_DEVICE_INFO_REFERENCE_COUNT> {
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
struct __SYCL_DEPRECATED("info::device::reference_count is not part of "
"SYCL 2020") reference_count
: device_traits<UR_DEVICE_INFO_REFERENCE_COUNT> {
using return_type = uint32_t;
};
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
// To be dropped (has alternatives/not needed)
struct usm_device_allocations
: device_traits<UR_DEVICE_INFO_USM_DEVICE_SUPPORT> {
Expand Down
7 changes: 6 additions & 1 deletion sycl/include/sycl/info/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/info_desc_traits.hpp>
#include <unified-runtime/ur_api.h>

Expand Down Expand Up @@ -36,9 +37,13 @@ struct command_execution_status
: event_traits<UR_EVENT_INFO_COMMAND_EXECUTION_STATUS> {
using return_type = info::event_command_status;
};
struct reference_count : event_traits<UR_EVENT_INFO_REFERENCE_COUNT> {
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
struct __SYCL_DEPRECATED("info::event::reference_count is not part of "
"SYCL 2020") reference_count
: event_traits<UR_EVENT_INFO_REFERENCE_COUNT> {
using return_type = uint32_t;
};
Comment on lines +41 to 45
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
} // namespace event
namespace event_profiling {
template <ur_profiling_info_t UrCode>
Expand Down
7 changes: 6 additions & 1 deletion sycl/include/sycl/info/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/info_desc_traits.hpp>
#include <sycl/range.hpp>
#include <unified-runtime/ur_api.h>
Expand Down Expand Up @@ -38,9 +39,13 @@ struct attributes : kernel_traits<UR_KERNEL_INFO_ATTRIBUTES> {
struct function_name : kernel_traits<UR_KERNEL_INFO_FUNCTION_NAME> {
using return_type = std::string;
};
struct reference_count : kernel_traits<UR_KERNEL_INFO_REFERENCE_COUNT> {
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
struct __SYCL_DEPRECATED("info::kernel::reference_count is not part of "
"SYCL 2020") reference_count
: kernel_traits<UR_KERNEL_INFO_REFERENCE_COUNT> {
using return_type = uint32_t;
};
Comment on lines +43 to 47
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
struct context : kernel_traits<UR_KERNEL_INFO_CONTEXT> {
using return_type = sycl::context;
};
Expand Down
7 changes: 6 additions & 1 deletion sycl/include/sycl/info/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/info_desc_traits.hpp>
#include <unified-runtime/ur_api.h>

Expand All @@ -32,9 +33,13 @@ struct context : queue_traits<UR_QUEUE_INFO_CONTEXT> {
struct device : queue_traits<UR_QUEUE_INFO_DEVICE> {
using return_type = sycl::device;
};
struct reference_count : queue_traits<UR_QUEUE_INFO_REFERENCE_COUNT> {
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
struct __SYCL_DEPRECATED("info::queue::reference_count is not part of "
"SYCL 2020") reference_count
: queue_traits<UR_QUEUE_INFO_REFERENCE_COUNT> {
using return_type = uint32_t;
};
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
} // namespace queue
} // namespace info

Expand Down
2 changes: 2 additions & 0 deletions sycl/source/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ context::get_info() const {
#define __SYCL_CONTEXT_INFO_INST(NAME, RETURN_T) \
template __SYCL_EXPORT RETURN_T context::get_info<info::context::NAME>() \
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::device>)
__SYCL_CONTEXT_INFO_INST(atomic_memory_order_capabilities,
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<info::context::reference_count>() const {
return get_context_info<info::context::reference_count>(this->getHandleRef(),
this->getAdapter());
}
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
template <> platform context_impl::get_info<info::context::platform>() const {
return createSyclObjFromImpl<platform>(MPlatform);
}
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ uint64_t event_impl::get_profiling_info<info::event_profiling::command_end>() {
return MHostProfilingInfo->getEndTime();
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <> uint32_t event_impl::get_info<info::event::reference_count>() {
auto Handle = this->getHandle();
if (!MIsHostEvent && Handle) {
Expand All @@ -410,6 +411,7 @@ template <> uint32_t event_impl::get_info<info::event::reference_count>() {
}
return 0;
}
#endif // __INTEL_PREVIEW_BREAKING_CHANGES

template <>
info::event_command_status
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/detail/queue_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ getUrEvents(const std::vector<sycl::event> &DepEvents) {
return RetUrEvents;
}

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
template <>
uint32_t queue_impl::get_info<info::queue::reference_count>() const {
ur_result_t result = UR_RESULT_SUCCESS;
getAdapter().call<UrApiKind::urQueueGetInfo>(
MQueue, UR_QUEUE_INFO_REFERENCE_COUNT, sizeof(result), &result, nullptr);
return result;
Comment on lines 68 to 71
}
#endif // __INTEL_PREVIEW_BREAKING_CHANGES

template <> context queue_impl::get_info<info::queue::context>() const {
return get_context();
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<info::event::NAME>() 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) \
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions sycl/source/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ queue::get_info() const {
template __SYCL_EXPORT RETURN_T queue::get_info<info::queue::NAME>() 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 <typename Param>
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/Basic/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ int main() {
print_info<info::device::partition_type_affinity_domain,
info::partition_affinity_domain>(dev,
"Partition type affinity domain");
print_info<info::device::reference_count, sycl::opencl::cl_uint>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tests also can be guarded with #ifdef __INTEL_PREVIEW_BREAKING_CHANGES, although I'm okay with just removing this, up to @uditagarwal97

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm also okay with just removing this.

dev, "Reference count");

std::cout << separator << "Platform information\n" << separator;
platform plt(dev.get_platform());
Expand Down
7 changes: 0 additions & 7 deletions sycl/test-e2e/Basic/kernel_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,11 @@ int main() {

const context krnCtx = krn.get_info<info::kernel::context>();
assert(krnCtx == q.get_context());
const cl_uint krnRefCount = krn.get_info<info::kernel::reference_count>();
assert(krnRefCount > 0);

// Use ext_oneapi_get_kernel_info extension and check that answers match.
const context krnCtxExt =
syclex::get_kernel_info<SingleTask, info::kernel::context>(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<SingleTask, info::kernel::reference_count>(ctx);
assert(krnRefCountExt > 0);

device dev = q.get_device();
const size_t wgSize =
Expand Down
47 changes: 47 additions & 0 deletions sycl/test-e2e/DeprecatedFeatures/reference_count.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// UNSUPPORTED: preview-mode
// UNSUPPORTED-INTENDED: reference_count is unavailable in preview mode.
// RUN: %{build} -o %t.out

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would -fsyntax-only suffice here? since we are not running the test anyway.


//==---------- 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 <sycl/context.hpp>
#include <sycl/device.hpp>
#include <sycl/event.hpp>
#include <sycl/kernel.hpp>
#include <sycl/queue.hpp>

#include <cstdint>
#include <type_traits>

using namespace sycl;

template <typename SyclObject, typename Param>
using GetInfoMemberT = uint32_t (SyclObject::*)() const;

template <typename SyclObject, typename Param>
GetInfoMemberT<SyclObject, Param> check_get_info() {
static_assert(std::is_same_v<typename Param::return_type, uint32_t>);
return &SyclObject::template get_info<Param>;
}

int main() {
auto ContextRefCount =
check_get_info<context, info::context::reference_count>();
auto DeviceRefCount = check_get_info<device, info::device::reference_count>();
auto EventRefCount = check_get_info<event, info::event::reference_count>();
auto KernelRefCount = check_get_info<kernel, info::kernel::reference_count>();
auto QueueRefCount = check_get_info<queue, info::queue::reference_count>();

(void)ContextRefCount;
(void)DeviceRefCount;
(void)EventRefCount;
(void)KernelRefCount;
(void)QueueRefCount;
return 0;
}
1 change: 0 additions & 1 deletion sycl/test-e2e/Regression/dummy_event_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ int main() {

assert(e.get_info<info::event::command_execution_status>() ==
info::event_command_status::complete);
assert(e.get_info<info::event::reference_count>() == 0);
auto submit_time =
e.get_profiling_info<sycl::info::event_profiling::command_submit>();
auto start_time =
Expand Down
Loading