Skip to content

[SYCL] Add a nice error message to sycl::buffer to std::string #4973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from Nov 22, 2021
Merged

[SYCL] Add a nice error message to sycl::buffer to std::string #4973

merged 5 commits into from Nov 22, 2021

Conversation

ghost
Copy link

@ghost ghost commented Nov 17, 2021

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
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 general
check until the sycl::vec class is modified to be trivially copyable. Instead a particular
check for the std::string class only was added.

…#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.
@ghost ghost self-requested a review as a code owner November 17, 2021 06:53
@ghost ghost marked this pull request as draft November 17, 2021 07:56
sergey-semenov
sergey-semenov previously approved these changes Nov 17, 2021
@ghost ghost changed the title Revert "[SYCL] Check if the underlying buffer type is device copyable… Add a nice error message to sycl::buffer to std::string Nov 19, 2021
The implementation should diagnose an error if the underlying type "T"
of a buffer is not device copyable. Currently, we cannot implement a
check for all not device copyable types since sycl::vec is not
trivially copyable on the host and therefore all the types that contain
sycl::vec are also not trivially copyable as well as not device
copyable. The check is implemented for std::string only.
@ghost ghost marked this pull request as ready for review November 19, 2021 12:10
@ghost ghost requested a review from sergey-semenov November 19, 2021 15:02
@bader bader changed the title Add a nice error message to sycl::buffer to std::string [SYCL] Add a nice error message to sycl::buffer to std::string Nov 20, 2021
@dm-vodopyanov dm-vodopyanov merged commit b0f9a81 into intel:sycl Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants