Skip to content

Commit a49e92e

Browse files
[NFC][SYCL] Inline is_valid_elem_type_v (#16908)
1 parent 96bb3f4 commit a49e92e

File tree

4 files changed

+2
-32
lines changed

4 files changed

+2
-32
lines changed

sycl/include/sycl/builtins_utils_scalar.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ template <typename T> struct simplify_if_swizzle {
120120
template <typename T>
121121
using simplify_if_swizzle_t = typename simplify_if_swizzle<T>::type;
122122

123-
// Utility trait for checking if T's element type is in Ts.
124-
template <typename T, typename... Ts>
125-
struct is_valid_elem_type : std::false_type {};
126-
127-
template <typename T, typename... Ts>
128-
constexpr bool is_valid_elem_type_v = is_valid_elem_type<T, Ts...>::value;
129-
130123
// Utility trait for getting the decoration of a multi_ptr.
131124
template <typename T> struct get_multi_ptr_decoration;
132125
template <typename ElementType, access::address_space Space,

sycl/include/sycl/builtins_utils_vec.hpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,6 @@ namespace sycl {
2121
inline namespace _V1 {
2222
namespace detail {
2323

24-
// Utility trait for checking if T's element type is in Ts.
25-
template <typename T, size_t N, typename... Ts>
26-
struct is_valid_elem_type<marray<T, N>, Ts...>
27-
: std::bool_constant<check_type_in_v<T, Ts...>> {};
28-
template <typename T, int N, typename... Ts>
29-
struct is_valid_elem_type<vec<T, N>, Ts...>
30-
: std::bool_constant<check_type_in_v<T, Ts...>> {};
31-
template <typename VecT, typename OperationLeftT, typename OperationRightT,
32-
template <typename> class OperationCurrentT, int... Indexes,
33-
typename... Ts>
34-
struct is_valid_elem_type<SwizzleOp<VecT, OperationLeftT, OperationRightT,
35-
OperationCurrentT, Indexes...>,
36-
Ts...>
37-
: std::bool_constant<check_type_in_v<typename VecT::element_type, Ts...>> {
38-
};
39-
template <typename ElementType, access::address_space Space,
40-
access::decorated DecorateAddress, typename... Ts>
41-
struct is_valid_elem_type<multi_ptr<ElementType, Space, DecorateAddress>, Ts...>
42-
: std::bool_constant<check_type_in_v<ElementType, Ts...>> {};
43-
template <typename ElementType, typename... Ts>
44-
struct is_valid_elem_type<ElementType *, Ts...>
45-
: std::bool_constant<check_type_in_v<ElementType, Ts...>> {};
46-
4724
// Utilty trait for checking that the number of elements in T is in Ns.
4825
template <typename T, size_t... Ns>
4926
struct is_valid_size

sycl/include/sycl/detail/builtins/math_functions.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ template <typename T0, typename T1>
198198
inline constexpr bool builtin_ptr_check_v =
199199
(std::is_pointer_v<T1> ||
200200
(is_multi_ptr_v<T1> && has_writeable_addr_space_v<T1>)) &&
201-
is_valid_elem_type_v<T1, simplify_if_swizzle_t<T0>>;
201+
std::is_same_v<get_elem_type_t<T1>, simplify_if_swizzle_t<T0>>;
202202

203203
template <typename T0, typename T1>
204204
inline constexpr bool builtin_enable_ptr_v =

sycl/include/sycl/ext/oneapi/experimental/bfloat16_math.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ uint32_t to_uint32_t(sycl::marray<bfloat16, N> x, size_t start) {
3636
template <typename T>
3737
constexpr bool is_vec_or_swizzle_bf16_v =
3838
sycl::detail::is_vec_or_swizzle_v<T> &&
39-
sycl::detail::is_valid_elem_type_v<T, bfloat16>;
39+
std::is_same_v<sycl::detail::get_elem_type_t<T>, bfloat16>;
4040

4141
template <typename T>
4242
constexpr int num_elements_v = sycl::detail::num_elements<T>::value;

0 commit comments

Comments
 (0)