Skip to content

Commit 717b18a

Browse files
author
Pavel Samolysov
committed
Revert "[SYCL] Check if the underlying buffer type is device copyable (#4914)"
Since sycl::vec is not a trivially copyable class, even though we have defined a specialization for sycl::is_device_copyable template for the sycl::vec class itself, it doesn't make any classes that have members of the sycl::vec type device copyable since those classes aren't trivially copyable yet. For example, a class from SYCL-CTS: template <typename T> struct image_accessor_failure_item { bool triggered; T value; T expected; image_accessor_failure_item() : triggered(false), value(0), expected(0) {} }; is not trivially copyable since it has two fields: value and expected of type sycl::vec; therefore, the class is not device copyable and a compilation error occurs when a sycl::buffer is created for this class instances. The regression makes us to revert the commit and delay adding the check until the sycl::vec class is modified to be trivially copyable. This reverts commit 61f1ae6.
1 parent 3205368 commit 717b18a

File tree

3 files changed

+0
-34
lines changed

3 files changed

+0
-34
lines changed

sycl/include/CL/sycl/buffer.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <CL/sycl/exception.hpp>
1515
#include <CL/sycl/property_list.hpp>
1616
#include <CL/sycl/stl.hpp>
17-
#include <CL/sycl/types.hpp>
1817
#include <sycl/ext/oneapi/accessor_property_list.hpp>
1918

2019
__SYCL_INLINE_NAMESPACE(cl) {
@@ -45,10 +44,6 @@ template <typename T, int dimensions = 1,
4544
typename __Enabled = typename detail::enable_if_t<(dimensions > 0) &&
4645
(dimensions <= 3)>>
4746
class buffer {
48-
static_assert(
49-
is_device_copyable<T>::value,
50-
"The underlying data type of a buffer 'T' must be device copyable");
51-
5247
public:
5348
using value_type = T;
5449
using reference = value_type &;

sycl/include/CL/sycl/types.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,13 +2420,6 @@ struct is_device_copyable<sycl::marray<T, N>,
24202420
std::enable_if_t<is_device_copyable<T>::value>>
24212421
: std::true_type {};
24222422

2423-
// vec is device copyable on host, on device vec is trivially copyable
2424-
// and therefore is device copyable too.
2425-
#ifndef __SYCL_DEVICE_ONLY__
2426-
template <typename T, int N>
2427-
struct is_device_copyable<sycl::vec<T, N>> : std::true_type {};
2428-
#endif
2429-
24302423
namespace detail {
24312424
template <typename T, typename = void>
24322425
struct IsDeprecatedDeviceCopyable : std::false_type {};

sycl/test/basic_tests/buffer/buffer_for_not_device_copyable.cpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)