Skip to content

[SYCL] Fix underlying type for std::byte when multi_ptr is used #4705

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 2 commits into from
Oct 12, 2021
Merged
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
16 changes: 13 additions & 3 deletions sycl/include/CL/sycl/detail/generic_type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,23 @@ struct select_cl_vector_or_scalar<
template <typename T, typename Enable = void>
struct select_cl_mptr_or_vector_or_scalar;

// this struct helps to use std::uint8_t instead of std::byte,
// which is not supported on device
template <typename T> struct TypeHelper { using RetType = T; };

#if __cplusplus >= 201703L
template <> struct TypeHelper<std::byte> { using RetType = std::uint8_t; };
#endif

template <typename T> using type_helper = typename TypeHelper<T>::RetType;

template <typename T>
struct select_cl_mptr_or_vector_or_scalar<
T, typename detail::enable_if_t<is_genptr<T>::value &&
!std::is_pointer<T>::value>> {
using type = multi_ptr<
typename select_cl_vector_or_scalar<typename T::element_type>::type,
T::address_space>;
using type = multi_ptr<typename select_cl_vector_or_scalar<
type_helper<typename T::element_type>>::type,
T::address_space>;
};

template <typename T>
Expand Down