Skip to content

Commit 1fa1416

Browse files
[SYCL] fix post-commit failure introduced by override of get_info<parent_device> (#7290)
gcc and clang++ differ in warnings for duplicate specializations. get_info<parent_device> is overridden, leading to a duplicate specialization, leading to failures in post-commit where clang++ is used to compile. This PR removes the duplication entirely. Signed-off-by: Chris Perkins <chris.perkins@intel.com>
1 parent 1ee35aa commit 1fa1416

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

sycl/include/sycl/detail/info_desc_helpers.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,13 @@ struct IsSubGroupInfo<info::kernel_device_specific::compile_sub_group_size>
9494
struct is_##DescType##_info_desc<info::DescType::Desc> : std::true_type { \
9595
using return_type = info::DescType::Desc::return_type; \
9696
};
97+
#define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
98+
__SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode)
99+
97100
#include <sycl/info/device_traits.def>
101+
98102
#undef __SYCL_PARAM_TRAITS_SPEC
103+
#undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
99104

100105
#define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
101106
template <> struct PiInfoCode<Namespace::info::DescType::Desc> { \

sycl/include/sycl/info/device_traits.def

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ __SYCL_PARAM_TRAITS_SPEC(device, printf_buffer_size, size_t,
149149
PI_DEVICE_INFO_PRINTF_BUFFER_SIZE)
150150
__SYCL_PARAM_TRAITS_SPEC(device, preferred_interop_user_sync, bool,
151151
PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC)
152-
__SYCL_PARAM_TRAITS_SPEC(device, parent_device, sycl::device,
153-
PI_DEVICE_INFO_PARENT_DEVICE)
154152
__SYCL_PARAM_TRAITS_SPEC(device, partition_max_sub_devices, pi_uint32,
155153
PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES)
156154
__SYCL_PARAM_TRAITS_SPEC(device, partition_properties,
@@ -165,6 +163,11 @@ __SYCL_PARAM_TRAITS_SPEC(device, partition_type_property,
165163
__SYCL_PARAM_TRAITS_SPEC(device, partition_type_affinity_domain,
166164
info::partition_affinity_domain,
167165
PI_DEVICE_INFO_PARTITION_TYPE)
166+
167+
// Has custom specialization.
168+
__SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(device, parent_device, sycl::device,
169+
PI_DEVICE_INFO_PARENT_DEVICE)
170+
168171
// Extensions/deprecated
169172
__SYCL_PARAM_TRAITS_SPEC(device, atomic64, bool, PI_DEVICE_INFO_ATOMIC_64)
170173
__SYCL_PARAM_TRAITS_SPEC(device, kernel_kernel_pipe_support, bool, 0)

sycl/include/sycl/info/info_desc.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,12 @@ template <int Dimensions> struct max_work_item_sizes;
103103
template <> struct Desc { \
104104
using return_type = ReturnT; \
105105
};
106+
#define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
107+
__SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode)
108+
106109
#include <sycl/info/device_traits.def>
107110
} // namespace device
111+
#undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
108112
#undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
109113

110114
// A.4 Queue information descriptors

sycl/source/device.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ device::get_info() const {
127127
return impl->template get_info<Param>();
128128
}
129129

130+
// Explicit override. Not fulfilled by #include device_traits.def below.
130131
template <> device device::get_info<info::device::parent_device>() const {
131132
// With ONEAPI_DEVICE_SELECTOR the impl.MRootDevice is preset and may be
132133
// overridden (ie it may be nullptr on a sub-device) The PI of the sub-devices
@@ -143,7 +144,10 @@ template <> device device::get_info<info::device::parent_device>() const {
143144
#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
144145
template __SYCL_EXPORT ReturnT device::get_info<info::device::Desc>() const;
145146

147+
#define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode)
148+
146149
#include <sycl/info/device_traits.def>
150+
#undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
147151
#undef __SYCL_PARAM_TRAITS_SPEC
148152

149153
#define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \

0 commit comments

Comments
 (0)