Skip to content

Commit

Permalink
[SYCL] Refactor vector_arith* (intel#16349)
Browse files Browse the repository at this point in the history
This PR separates the "base" case functional implementation from
templates/overloads/constraints. The latter doesn't match even the
current SYCL spec and that is not taking into account proposed
vec/swizzle changes.

Making this change would allow to share more code between
non-preview/preview implementation paths when implementing proposed SYCL
vec/swizzle changes.
  • Loading branch information
aelovikov-intel authored Dec 16, 2024
1 parent 5d8a552 commit 746a2bd
Show file tree
Hide file tree
Showing 5 changed files with 395 additions and 366 deletions.
16 changes: 16 additions & 0 deletions sycl/include/sycl/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,22 @@ struct map_type<T, From, To, Rest...> {
template <typename T, typename... Ts>
constexpr bool check_type_in_v = ((std::is_same_v<T, Ts> || ...));

#if __has_builtin(__type_pack_element)
template <int N, typename... Ts>
using nth_type_t = __type_pack_element<N, Ts...>;
#else
template <int N, typename T, typename... Ts> struct nth_type {
using type = typename nth_type<N - 1, Ts...>::type;
};

template <typename T, typename... Ts> struct nth_type<0, T, Ts...> {
using type = T;
};

template <int N, typename... Ts>
using nth_type_t = typename nth_type<N, Ts...>::type;
#endif

} // namespace detail
} // namespace _V1
} // namespace sycl
Loading

0 comments on commit 746a2bd

Please sign in to comment.