Skip to content

Commit

Permalink
Drop unused type traits
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeySachkov committed Sep 24, 2024
1 parent 50ba40c commit 215717c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
28 changes: 4 additions & 24 deletions sycl/include/sycl/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,11 @@ template <typename T, typename R> struct copy_cv_qualifiers;
template <typename T, typename R>
using copy_cv_qualifiers_t = typename copy_cv_qualifiers<T, R>::type;

template <int V> using int_constant = std::integral_constant<int, V>;
// vector_size
// scalars are interpreted as a vector of 1 length.
template <typename T> struct vector_size_impl : int_constant<1> {};
template <typename T> struct vector_size_impl : std::integral_constant<int, 1> {};
template <typename T, int N>
struct vector_size_impl<vec<T, N>> : int_constant<N> {};
struct vector_size_impl<vec<T, N>> : std::integral_constant<int, N> {};
template <typename T>
struct vector_size
: vector_size_impl<std::remove_cv_t<std::remove_reference_t<T>>> {};
Expand Down Expand Up @@ -184,6 +183,7 @@ template <typename ElementType> struct get_elem_type_unqual<ElementType *> {
template <typename T, typename = void>
struct is_ext_vector : std::false_type {};

// FIXME: unguarded use of non-standard built-in
template <typename T>
struct is_ext_vector<
T, std::void_t<decltype(__builtin_reduce_max(std::declval<T>()))>>
Expand All @@ -192,6 +192,7 @@ struct is_ext_vector<
template <typename T>
inline constexpr bool is_ext_vector_v = is_ext_vector<T>::value;

// FIXME: unguarded use of non-standard built-in
template <typename T>
struct get_elem_type_unqual<T, std::enable_if_t<is_ext_vector_v<T>>> {
using type = decltype(__builtin_reduce_max(std::declval<T>()));
Expand Down Expand Up @@ -237,27 +238,6 @@ template <typename T, typename R> struct copy_cv_qualifiers {
using type = typename copy_cv_qualifiers_impl<T, std::remove_cv_t<R>>::type;
};

// make_signed with support SYCL vec class
template <typename T> struct make_signed {
using type = std::make_signed_t<T>;
};
template <typename T> using make_signed_t = typename make_signed<T>::type;
template <class T> struct make_signed<const T> {
using type = const make_signed_t<T>;
};
template <class T, int N> struct make_signed<vec<T, N>> {
using type = vec<make_signed_t<T>, N>;
};
template <typename VecT, typename OperationLeftT, typename OperationRightT,
template <typename> class OperationCurrentT, int... Indexes>
struct make_signed<SwizzleOp<VecT, OperationLeftT, OperationRightT,
OperationCurrentT, Indexes...>> {
using type = make_signed_t<std::remove_cv_t<VecT>>;
};
template <class T, std::size_t N> struct make_signed<marray<T, N>> {
using type = marray<make_signed_t<T>, N>;
};

// make_unsigned with support SYCL vec class
template <typename T> struct make_unsigned {
using type = std::make_unsigned_t<T>;
Expand Down
3 changes: 2 additions & 1 deletion sycl/source/detail/program_manager/program_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <map>
#include <memory>
#include <set>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Expand Down Expand Up @@ -297,7 +298,7 @@ class ProgramManager {
ProgramManager(ProgramManager const &) = delete;
ProgramManager &operator=(ProgramManager const &) = delete;

using ProgramPtr = std::unique_ptr<remove_pointer_t<ur_program_handle_t>,
using ProgramPtr = std::unique_ptr<std::remove_pointer_t<ur_program_handle_t>,
decltype(&::urProgramRelease)>;
ProgramPtr build(ProgramPtr Program, const ContextImplPtr Context,
const std::string &CompileOptions,
Expand Down
14 changes: 0 additions & 14 deletions sycl/test/type_traits/type_traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ void test_vector_element_t() {
"");
}

template <typename T, typename CheckedT, bool Expected = true>
void test_make_signed_t() {
static_assert(is_same<d::make_signed_t<T>, CheckedT>::value == Expected, "");
}

template <typename T, typename CheckedT, bool Expected = true>
void test_make_unsigned_t() {
static_assert(is_same<d::make_unsigned_t<T>, CheckedT>::value == Expected,
Expand Down Expand Up @@ -151,15 +146,6 @@ int main() {
test_vector_element_t<volatile s::int2, volatile int>();
test_vector_element_t<const volatile s::int2, const volatile int>();

test_make_signed_t<int, int>();
test_make_signed_t<const int, const int>();
test_make_signed_t<unsigned int, int>();
test_make_signed_t<const unsigned int, const int>();
test_make_signed_t<s::int2, s::int2>();
test_make_signed_t<const s::int2, const s::int2>();
test_make_signed_t<s::uint2, s::int2>();
test_make_signed_t<const s::uint2, const s::int2>();

test_make_unsigned_t<int, unsigned int>();
test_make_unsigned_t<const int, const unsigned int>();
test_make_unsigned_t<unsigned int, unsigned int>();
Expand Down

0 comments on commit 215717c

Please sign in to comment.