Skip to content

Commit

Permalink
[NFC][SYCL] Inline is_valid_elem_type_v (#16908)
Browse files Browse the repository at this point in the history
  • Loading branch information
aelovikov-intel authored Feb 6, 2025
1 parent 96bb3f4 commit a49e92e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
7 changes: 0 additions & 7 deletions sycl/include/sycl/builtins_utils_scalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ template <typename T> struct simplify_if_swizzle {
template <typename T>
using simplify_if_swizzle_t = typename simplify_if_swizzle<T>::type;

// Utility trait for checking if T's element type is in Ts.
template <typename T, typename... Ts>
struct is_valid_elem_type : std::false_type {};

template <typename T, typename... Ts>
constexpr bool is_valid_elem_type_v = is_valid_elem_type<T, Ts...>::value;

// Utility trait for getting the decoration of a multi_ptr.
template <typename T> struct get_multi_ptr_decoration;
template <typename ElementType, access::address_space Space,
Expand Down
23 changes: 0 additions & 23 deletions sycl/include/sycl/builtins_utils_vec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,6 @@ namespace sycl {
inline namespace _V1 {
namespace detail {

// Utility trait for checking if T's element type is in Ts.
template <typename T, size_t N, typename... Ts>
struct is_valid_elem_type<marray<T, N>, Ts...>
: std::bool_constant<check_type_in_v<T, Ts...>> {};
template <typename T, int N, typename... Ts>
struct is_valid_elem_type<vec<T, N>, Ts...>
: std::bool_constant<check_type_in_v<T, Ts...>> {};
template <typename VecT, typename OperationLeftT, typename OperationRightT,
template <typename> class OperationCurrentT, int... Indexes,
typename... Ts>
struct is_valid_elem_type<SwizzleOp<VecT, OperationLeftT, OperationRightT,
OperationCurrentT, Indexes...>,
Ts...>
: std::bool_constant<check_type_in_v<typename VecT::element_type, Ts...>> {
};
template <typename ElementType, access::address_space Space,
access::decorated DecorateAddress, typename... Ts>
struct is_valid_elem_type<multi_ptr<ElementType, Space, DecorateAddress>, Ts...>
: std::bool_constant<check_type_in_v<ElementType, Ts...>> {};
template <typename ElementType, typename... Ts>
struct is_valid_elem_type<ElementType *, Ts...>
: std::bool_constant<check_type_in_v<ElementType, Ts...>> {};

// Utilty trait for checking that the number of elements in T is in Ns.
template <typename T, size_t... Ns>
struct is_valid_size
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/detail/builtins/math_functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ template <typename T0, typename T1>
inline constexpr bool builtin_ptr_check_v =
(std::is_pointer_v<T1> ||
(is_multi_ptr_v<T1> && has_writeable_addr_space_v<T1>)) &&
is_valid_elem_type_v<T1, simplify_if_swizzle_t<T0>>;
std::is_same_v<get_elem_type_t<T1>, simplify_if_swizzle_t<T0>>;

template <typename T0, typename T1>
inline constexpr bool builtin_enable_ptr_v =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ uint32_t to_uint32_t(sycl::marray<bfloat16, N> x, size_t start) {
template <typename T>
constexpr bool is_vec_or_swizzle_bf16_v =
sycl::detail::is_vec_or_swizzle_v<T> &&
sycl::detail::is_valid_elem_type_v<T, bfloat16>;
std::is_same_v<sycl::detail::get_elem_type_t<T>, bfloat16>;

template <typename T>
constexpr int num_elements_v = sycl::detail::num_elements<T>::value;
Expand Down

0 comments on commit a49e92e

Please sign in to comment.