Skip to content

Commit aab026c

Browse files
[SYCL] Remove IsDeprecatedDeviceCopyable
This was discussed in #15342 (comment) and the consensus seemd to be that we should drop it right away in a separate PR, do it here. Technically, it is a breaking change that could also be considered a bugfix. An example of a class failing the updated check is ``` struct Kernel { Kernel(int); Kernel(const Kernel&) = default; Kernel& operator=(const Kernel&) { return *this; } // non-trivial }; ``` An additional minor reason (other than not being SYCL-conformant) to drop it right away is to save a tiny bit of compile time that is currently used to support something violating the spec.
1 parent 1a7e2f0 commit aab026c

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

sycl/include/sycl/detail/is_device_copyable.hpp

+2-20
Original file line numberDiff line numberDiff line change
@@ -83,31 +83,14 @@ struct is_device_copyable<T[N]> : is_device_copyable<T> {};
8383
template <typename T>
8484
inline constexpr bool is_device_copyable_v = is_device_copyable<T>::value;
8585
namespace detail {
86-
template <typename T, typename = void>
87-
struct IsDeprecatedDeviceCopyable : std::false_type {};
88-
89-
// TODO: using C++ attribute [[deprecated]] or the macro __SYCL2020_DEPRECATED
90-
// does not produce expected warning message for the type 'T'.
91-
template <typename T>
92-
struct __SYCL2020_DEPRECATED("This type isn't device copyable in SYCL 2020")
93-
IsDeprecatedDeviceCopyable<
94-
T, std::enable_if_t<std::is_trivially_copy_constructible_v<T> &&
95-
std::is_trivially_destructible_v<T> &&
96-
!is_device_copyable_v<T>>> : std::true_type {};
97-
98-
template <typename T, int N>
99-
struct __SYCL2020_DEPRECATED("This type isn't device copyable in SYCL 2020")
100-
IsDeprecatedDeviceCopyable<T[N]> : IsDeprecatedDeviceCopyable<T> {};
101-
10286
#ifdef __SYCL_DEVICE_ONLY__
10387
// Checks that the fields of the type T with indices 0 to (NumFieldsToCheck -
10488
// 1) are device copyable.
10589
template <typename T, unsigned NumFieldsToCheck>
10690
struct CheckFieldsAreDeviceCopyable
10791
: CheckFieldsAreDeviceCopyable<T, NumFieldsToCheck - 1> {
10892
using FieldT = decltype(__builtin_field_type(T, NumFieldsToCheck - 1));
109-
static_assert(is_device_copyable_v<FieldT> ||
110-
detail::IsDeprecatedDeviceCopyable<FieldT>::value,
93+
static_assert(is_device_copyable_v<FieldT>,
11194
"The specified type is not device copyable");
11295
};
11396

@@ -119,8 +102,7 @@ template <typename T, unsigned NumBasesToCheck>
119102
struct CheckBasesAreDeviceCopyable
120103
: CheckBasesAreDeviceCopyable<T, NumBasesToCheck - 1> {
121104
using BaseT = decltype(__builtin_base_type(T, NumBasesToCheck - 1));
122-
static_assert(is_device_copyable_v<BaseT> ||
123-
detail::IsDeprecatedDeviceCopyable<BaseT>::value,
105+
static_assert(is_device_copyable_v<BaseT>,
124106
"The specified type is not device copyable");
125107
};
126108

0 commit comments

Comments
 (0)