From 85e45066a4eb250b43b6ffedd0cbeb77e452c99d Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 24 Sep 2024 03:12:13 -0700 Subject: [PATCH 1/5] Drop unused generic type traits --- .../sycl/detail/generic_type_traits.hpp | 163 ------------------ sycl/test/basic_tests/generic_type_traits.cpp | 44 ----- 2 files changed, 207 deletions(-) diff --git a/sycl/include/sycl/detail/generic_type_traits.hpp b/sycl/include/sycl/detail/generic_type_traits.hpp index e4d2f70d66095..95d9fb650325e 100644 --- a/sycl/include/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/sycl/detail/generic_type_traits.hpp @@ -65,73 +65,6 @@ template inline constexpr bool is_svgenfloat_v = is_contained_v; -template -inline constexpr bool is_mgenfloat_v = - is_marray_v && is_svgenfloat_v>; - -template -inline constexpr bool is_gengeofloat_v = is_contained_v; - -template -inline constexpr bool is_gengeodouble_v = - is_contained_v; - -template -inline constexpr bool is_gengeomarrayfloat_v = - is_contained_v; - -template -inline constexpr bool is_gengeomarray_v = - is_contained_v; - -template -inline constexpr bool is_gengeohalf_v = is_contained_v; - -template -inline constexpr bool is_vgengeofloat_v = - is_contained_v; - -template -inline constexpr bool is_vgengeodouble_v = - is_contained_v; - -template -inline constexpr bool is_vgengeohalf_v = - is_contained_v; - -template -inline constexpr bool is_sgengeo_v = is_contained_v; - -template -inline constexpr bool is_vgengeo_v = is_contained_v; - -template -inline constexpr bool is_gencrossfloat_v = - is_contained_v; - -template -inline constexpr bool is_gencrossdouble_v = - is_contained_v; - -template -inline constexpr bool is_gencrosshalf_v = - is_contained_v; - -template -inline constexpr bool is_gencross_v = - is_contained_v; - -template -inline constexpr bool is_gencrossmarray_v = - is_contained_v; - -template -inline constexpr bool is_ugenint_v = is_contained_v; - -template -inline constexpr bool is_intn_v = - is_contained_v; - template inline constexpr bool is_genint_v = is_contained_v; @@ -141,28 +74,10 @@ inline constexpr bool is_geninteger_v = is_contained_v; template using is_geninteger = std::bool_constant>; -template -inline constexpr bool is_igeninteger_v = - is_contained_v; - -template -using is_igeninteger = std::bool_constant>; - -template -inline constexpr bool is_ugeninteger_v = - is_contained_v; - -template -using is_ugeninteger = std::bool_constant>; - template inline constexpr bool is_sgeninteger_v = is_contained_v; -template -inline constexpr bool is_vgeninteger_v = - is_contained_v; - template inline constexpr bool is_sigeninteger_v = is_contained_v; @@ -171,87 +86,9 @@ template inline constexpr bool is_sugeninteger_v = is_contained_v; -template -inline constexpr bool is_vigeninteger_v = - is_contained_v; - -template -inline constexpr bool is_vugeninteger_v = - is_contained_v; - template inline constexpr bool is_genbool_v = is_contained_v; -template -inline constexpr bool is_gentype_v = is_contained_v; - -template -inline constexpr bool is_vgentype_v = is_contained_v; - -template -inline constexpr bool is_sgentype_v = is_contained_v; - -template -inline constexpr bool is_igeninteger8bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_igeninteger16bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_igeninteger32bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_igeninteger64bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_ugeninteger8bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_ugeninteger16bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_ugeninteger32bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_ugeninteger64bit_v = - is_gen_based_on_type_sizeof_v; - -template -inline constexpr bool is_genintptr_v = - is_pointer_v && is_genint_v> && - is_address_space_compliant_v; - -template -inline constexpr bool is_genintptr_marray_v = - std::is_same_v, T::size()>> && - is_genint_v>> && - is_address_space_compliant_v, - gvl::nonconst_address_space_list> && - (IsDecorated == access::decorated::yes || - IsDecorated == access::decorated::no); - -template -inline constexpr bool is_genfloatptr_v = - is_pointer_v && is_genfloat_v> && - is_address_space_compliant_v; - -template -inline constexpr bool is_genfloatptr_marray_v = - is_mgenfloat_v && - is_address_space_compliant_v, - gvl::nonconst_address_space_list> && - (IsDecorated == access::decorated::yes || - IsDecorated == access::decorated::no); - template using is_byte = typename #if (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE != 0) diff --git a/sycl/test/basic_tests/generic_type_traits.cpp b/sycl/test/basic_tests/generic_type_traits.cpp index 5f13263f92998..2d63cc12e082f 100644 --- a/sycl/test/basic_tests/generic_type_traits.cpp +++ b/sycl/test/basic_tests/generic_type_traits.cpp @@ -23,15 +23,6 @@ int main() { static_assert(d::is_genfloat_v == true); static_assert(d::is_genfloat_v> == true); - static_assert(d::is_ugenint_v> == false); - static_assert(d::is_ugenint_v == false); - - static_assert(d::is_ugenint_v == true); - static_assert(d::is_ugenint_v == true); - - static_assert(d::is_ugenint_v> == true); - static_assert(d::is_ugenint_v == true); - static_assert(d::is_half_v); static_assert(d::is_bfloat16_v); @@ -51,19 +42,6 @@ int main() { is_sgenfloat is_vgenfloat - is_gengeofloat - is_gengeodouble - is_gengeohalf - - is_vgengeofloat - is_vgengeodouble - is_vgengeohalf - - is_gencrossfloat - is_gencrossdouble - is_gencrosshalf - is_gencross - is_charn is_scharn is_ucharn @@ -77,8 +55,6 @@ int main() { is_ugenshort is_uintn - is_ugenint - is_intn is_genint */ @@ -92,31 +68,11 @@ int main() { is_ugenlonginteger is_geninteger - is_igeninteger - is_ugeninteger is_sgeninteger - is_vgeninteger is_sigeninteger is_sugeninteger - is_vigeninteger - is_vugeninteger - - is_gentype - - is_igeninteger8bit - is_igeninteger16bit - is_igeninteger32bit - is_igeninteger64bit - - is_ugeninteger8bit - is_ugeninteger16bit - is_ugeninteger32bit - is_ugeninteger64bit - - is_genintptr - is_genfloatptr unsing_integeral_to_float_point float_point_to_sign_integeral From c40f67f4621a2e82d7607013dabd4ad00406b081 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 24 Sep 2024 03:20:23 -0700 Subject: [PATCH 2/5] Drop unused generic type lists --- .../sycl/detail/generic_type_lists.hpp | 101 +----------------- 1 file changed, 3 insertions(+), 98 deletions(-) diff --git a/sycl/include/sycl/detail/generic_type_lists.hpp b/sycl/include/sycl/detail/generic_type_lists.hpp index ddf0ab3e3ed2c..c6a62504efbec 100644 --- a/sycl/include/sycl/detail/generic_type_lists.hpp +++ b/sycl/include/sycl/detail/generic_type_lists.hpp @@ -119,59 +119,6 @@ using scalar_vector_floating_list = using floating_list = tl_append; -// geometric floating point types -using scalar_geo_half_list = type_list; - -using scalar_geo_float_list = type_list; - -using scalar_geo_double_list = type_list; - -using vector_geo_half_list = - type_list, vec, vec, vec>; - -using vector_geo_float_list = - type_list, vec, vec, vec>; - -using vector_geo_double_list = - type_list, vec, vec, vec>; - -using marray_geo_float_list = - type_list, marray, marray>; - -using marray_geo_double_list = - type_list, marray, marray>; - -using geo_half_list = tl_append; - -using geo_float_list = tl_append; - -using geo_double_list = - tl_append; - -using scalar_geo_list = tl_append; - -using vector_geo_list = tl_append; - -using marray_geo_list = - tl_append; - -using geo_list = tl_append; - -// cross floating point types -using cross_half_list = type_list, vec>; - -using cross_float_list = type_list, vec>; - -using cross_double_list = type_list, vec>; - -using cross_floating_list = - tl_append; - -using cross_marray_list = type_list, marray, - marray, marray>; - using scalar_default_char_list = type_list; using vector_default_char_list = @@ -197,10 +144,6 @@ using marray_signed_char_list = marray, marray, marray, marray>; -using signed_char_list = - tl_append; - using scalar_unsigned_char_list = type_list; using vector_unsigned_char_list = @@ -213,24 +156,6 @@ using marray_unsigned_char_list = marray, marray, marray, marray>; -using unsigned_char_list = - tl_append; - -using scalar_char_list = - tl_append; - -using vector_char_list = - tl_append; - -using marray_char_list = - tl_append; - -using char_list = tl_append; - // short int types using scalar_signed_short_list = type_list; @@ -244,10 +169,6 @@ using marray_signed_short_list = marray, marray, marray, marray>; -using signed_short_list = - tl_append; - using scalar_unsigned_short_list = type_list; using vector_unsigned_short_list = @@ -571,29 +492,13 @@ using signed_basic_list = using scalar_unsigned_basic_list = tl_append; -using vector_unsigned_basic_list = tl_append; - -using marray_unsigned_basic_list = tl_append; - using unsigned_basic_list = - tl_append; - -using scalar_basic_list = - tl_append; + tl_append; using vector_basic_list = - tl_append; - -using marray_basic_list = - tl_append; - -using basic_list = - tl_append; + tl_append; -// nan builtin types -using nan_list = tl_append; } // namespace gtl namespace gvl { // address spaces From eb2a4237b15848ac3d4f295a7289915f86a2b06f Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 24 Sep 2024 03:20:38 -0700 Subject: [PATCH 3/5] Drop unused InlineVariableHelper --- sycl/include/sycl/detail/common.hpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index 1a867a72aff7c..26030d22354fc 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -287,12 +287,6 @@ size_t getLinearIndex(const T &Index, const U &Range) { return LinearIndex; } -template struct InlineVariableHelper { - static constexpr T value{}; -}; - -template constexpr T InlineVariableHelper::value; - // The function extends or truncates number of dimensions of objects of id // or ranges classes. When extending the new values are filled with // DefaultValue, truncation just removes extra values. From 50ba40c49f0f1cdc2cc63fb1d1f96c6ac78f29c8 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 24 Sep 2024 03:34:35 -0700 Subject: [PATCH 4/5] Drop unused type traits --- sycl/include/sycl/detail/type_traits.hpp | 30 ++---------------------- sycl/test/type_traits/type_traits.cpp | 22 ----------------- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/sycl/include/sycl/detail/type_traits.hpp b/sycl/include/sycl/detail/type_traits.hpp index d024a109bfd75..fc3cd7807dd85 100644 --- a/sycl/include/sycl/detail/type_traits.hpp +++ b/sycl/include/sycl/detail/type_traits.hpp @@ -441,27 +441,6 @@ struct remove_pointer : remove_pointer_impl> {}; template using remove_pointer_t = typename remove_pointer::type; -// is_address_space_compliant -template -struct is_address_space_compliant_impl : std::false_type {}; - -template -struct is_address_space_compliant_impl : std::true_type {}; - -template -struct is_address_space_compliant_impl, - SpaceList> - : std::bool_constant::value> {}; - -template -struct is_address_space_compliant - : is_address_space_compliant_impl, SpaceList> {}; - -template -inline constexpr bool is_address_space_compliant_v = - is_address_space_compliant::value; - // make_type_t template struct make_type_impl { using type = find_same_size_type_t; @@ -514,6 +493,8 @@ struct make_larger_impl, marray> { using type = std::conditional_t; }; +// TODO: this type trait is not used anyweher in SYCL headers and it should +// be moved to the library code template struct make_larger { using type = typename make_larger_impl::type; }; @@ -530,13 +511,6 @@ template using const_if_const_AS = DataT; #endif -template struct function_traits {}; - -template struct function_traits { - using ret_type = Ret; - using args_type = std::tuple; -}; - // No first_type_t due to // https://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1430. template struct first_type { diff --git a/sycl/test/type_traits/type_traits.cpp b/sycl/test/type_traits/type_traits.cpp index 25ac39b8e9bf7..a53bec3d0008b 100644 --- a/sycl/test/type_traits/type_traits.cpp +++ b/sycl/test/type_traits/type_traits.cpp @@ -72,12 +72,6 @@ void test_remove_pointer_t() { ""); } -template -void test_is_address_space_compliant() { - static_assert(d::is_address_space_compliant::value == Expected, - ""); -} - template void test_vector_size() { static_assert((d::vector_size::value == Checked) == Expected, ""); @@ -102,22 +96,6 @@ int main() { test_remove_pointer_t, s::int2>(); test_remove_pointer_t, s::float2>(); - test_is_address_space_compliant(); - test_is_address_space_compliant(); - test_is_address_space_compliant, - d::gvl::nonconst_address_space_list, false>(); - test_is_address_space_compliant, - d::gvl::nonconst_address_space_list, false>(); - test_is_address_space_compliant(); - test_is_address_space_compliant(); - test_is_address_space_compliant, - d::gvl::nonconst_address_space_list, false>(); - test_is_address_space_compliant, - d::gvl::nonconst_address_space_list, false>(); - test_is_integral(); test_is_integral(); test_is_integral(); From 215717c4686aed23d289dd87a2e89460330463d1 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Tue, 24 Sep 2024 03:54:24 -0700 Subject: [PATCH 5/5] Drop unused type traits --- sycl/include/sycl/detail/type_traits.hpp | 28 +++---------------- .../program_manager/program_manager.hpp | 3 +- sycl/test/type_traits/type_traits.cpp | 14 ---------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/sycl/include/sycl/detail/type_traits.hpp b/sycl/include/sycl/detail/type_traits.hpp index fc3cd7807dd85..51c638baaa075 100644 --- a/sycl/include/sycl/detail/type_traits.hpp +++ b/sycl/include/sycl/detail/type_traits.hpp @@ -124,12 +124,11 @@ template struct copy_cv_qualifiers; template using copy_cv_qualifiers_t = typename copy_cv_qualifiers::type; -template using int_constant = std::integral_constant; // vector_size // scalars are interpreted as a vector of 1 length. -template struct vector_size_impl : int_constant<1> {}; +template struct vector_size_impl : std::integral_constant {}; template -struct vector_size_impl> : int_constant {}; +struct vector_size_impl> : std::integral_constant {}; template struct vector_size : vector_size_impl>> {}; @@ -184,6 +183,7 @@ template struct get_elem_type_unqual { template struct is_ext_vector : std::false_type {}; +// FIXME: unguarded use of non-standard built-in template struct is_ext_vector< T, std::void_t()))>> @@ -192,6 +192,7 @@ struct is_ext_vector< template inline constexpr bool is_ext_vector_v = is_ext_vector::value; +// FIXME: unguarded use of non-standard built-in template struct get_elem_type_unqual>> { using type = decltype(__builtin_reduce_max(std::declval())); @@ -237,27 +238,6 @@ template struct copy_cv_qualifiers { using type = typename copy_cv_qualifiers_impl>::type; }; -// make_signed with support SYCL vec class -template struct make_signed { - using type = std::make_signed_t; -}; -template using make_signed_t = typename make_signed::type; -template struct make_signed { - using type = const make_signed_t; -}; -template struct make_signed> { - using type = vec, N>; -}; -template class OperationCurrentT, int... Indexes> -struct make_signed> { - using type = make_signed_t>; -}; -template struct make_signed> { - using type = marray, N>; -}; - // make_unsigned with support SYCL vec class template struct make_unsigned { using type = std::make_unsigned_t; diff --git a/sycl/source/detail/program_manager/program_manager.hpp b/sycl/source/detail/program_manager/program_manager.hpp index c38cc7babd370..56db9cf8d1fec 100644 --- a/sycl/source/detail/program_manager/program_manager.hpp +++ b/sycl/source/detail/program_manager/program_manager.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -297,7 +298,7 @@ class ProgramManager { ProgramManager(ProgramManager const &) = delete; ProgramManager &operator=(ProgramManager const &) = delete; - using ProgramPtr = std::unique_ptr, + using ProgramPtr = std::unique_ptr, decltype(&::urProgramRelease)>; ProgramPtr build(ProgramPtr Program, const ContextImplPtr Context, const std::string &CompileOptions, diff --git a/sycl/test/type_traits/type_traits.cpp b/sycl/test/type_traits/type_traits.cpp index a53bec3d0008b..59eab5957da37 100644 --- a/sycl/test/type_traits/type_traits.cpp +++ b/sycl/test/type_traits/type_traits.cpp @@ -51,11 +51,6 @@ void test_vector_element_t() { ""); } -template -void test_make_signed_t() { - static_assert(is_same, CheckedT>::value == Expected, ""); -} - template void test_make_unsigned_t() { static_assert(is_same, CheckedT>::value == Expected, @@ -151,15 +146,6 @@ int main() { test_vector_element_t(); test_vector_element_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_signed_t(); - test_make_unsigned_t(); test_make_unsigned_t(); test_make_unsigned_t();