Skip to content

[SYCL] Fix operator~ for sycl::vec<bool, N> #9259

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 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sycl/include/sycl/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,11 @@ template <typename Type, int NumElements> class vec {
// Use __SYCL_DEVICE_ONLY__ macro because cast to OpenCL vector type is defined
// by SYCL device compiler only.
#ifdef __SYCL_DEVICE_ONLY__
return vec{(typename vec::DataType) ~m_Data};
vec Ret{(typename vec::DataType) ~m_Data};
if constexpr (std::is_same<Type, bool>::value) {
Ret.ConvertToDataT();
}
return Ret;
#else
vec Ret;
for (size_t I = 0; I < NumElements; ++I) {
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Basic/vec_bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main() {

// Test negate (operator ~)
{
init_arr(expected, false);
init_arr(expected, true);

sycl::buffer<sycl::vec<bool, size>> bufVecTrue(&vec_true, 1);
sycl::buffer<sycl::vec<bool, size>> bufResVec(&resVec, 1);
Expand Down