-
Notifications
You must be signed in to change notification settings - Fork 734
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
[SYCL] Make sycl::marray trivially copyable #4885
Conversation
/summary:run |
I'm not sure, break the changes the ABI since the class will be trivially copyable? |
# Conflicts: # sycl/include/CL/sycl/types.hpp
@@ -38,6 +38,8 @@ constexpr sycl::specialization_id<uint64_t> uint64_id(8); | |||
constexpr sycl::specialization_id<float> float_id(10.0); | |||
constexpr sycl::specialization_id<double> double_id(11.0); | |||
constexpr sycl::marray<double, 5> ma; | |||
constexpr sycl::marray<double, 5> mb(ma); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear why these lines were added to the test?
They are not used in specialization constants and this test is for specialization constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I've moved the lines into marray.cpp
test.
A test with a struct containing |
Should we also add a regression test here? I'm thinking it would be good to check via a
|
I think these changes look good. I agree with @Pennycook about adding some more tests. In addition, we should probably add code to conditionally define the trait |
MData[I] = Rhs.MData[I]; | ||
} | ||
} | ||
constexpr marray(const marray<Type, NumElements> &Rhs) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love C++! :-)
@gmlueck Sorry, I don't understand why we should define the trait UPD I understood, you a talking about |
sycl::marray is device copyable if element type is device copyable and it is also not trivially copyable (if the element type is trivially copyable, the marray is device copyable by default). The tests are also added.
@Pennycook Thank you for the suggestion. I've added the tests in |
|
Added in 26670dc to workaround #4885. Windows CI and a local Windows build are happy with this change, so it seems like this has been properly fixed at some point. If this does break somebody, this can be easily reverted. (Also, Linux does the same `#define alloca` in system headers, so I'm not sure why it'd be different on Windows) This is tech debt that caused breakages, see comments on #71709.
The sycl::marray class is not trivially copyable but marked as device copyable. It makes problems with any class that contain a member with the sycl::marray type: that class will not be trivially copyable and therefore device copyable regardless the sycl::marray one is. To solve this issue, the sycl::marray class is converted into a trivially copyable one. The constexpr attribute for the copy constructor is saved so the class can still be copied in constant expressions.