@@ -1036,6 +1036,70 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x,
10361036#define GKO_INSTANTIATE_FOR_INT32_TYPE (_macro ) template _macro(int32)
10371037
10381038
1039+ namespace detail {
1040+
1041+ template <typename ValueType>
1042+ struct is_supported_value_type : std::false_type {};
1043+
1044+ template <typename ValueType>
1045+ struct is_supported_index_type : std::false_type {};
1046+
1047+ #if GINKGO_ENABLE_HALF
1048+ template <>
1049+ struct is_supported_value_type <float16> : std::true_type {};
1050+ template <>
1051+ struct is_supported_value_type <std::complex <float16>> : std::true_type {};
1052+ #endif
1053+ #if GINKGO_ENABLE_BFLOAT16
1054+ template <>
1055+ struct is_supported_value_type <bfloat16> : std::true_type {};
1056+ template <>
1057+ struct is_supported_value_type <std::complex <bfloat16>> : std::true_type {};
1058+ #endif
1059+ template <>
1060+ struct is_supported_value_type <float > : std::true_type {};
1061+ template <>
1062+ struct is_supported_value_type <double > : std::true_type {};
1063+ template <>
1064+ struct is_supported_value_type <std::complex <float >> : std::true_type {};
1065+ template <>
1066+ struct is_supported_value_type <std::complex <double >> : std::true_type {};
1067+ template <>
1068+ struct is_supported_index_type <int32> : std::true_type {};
1069+ template <>
1070+ struct is_supported_index_type <int64> : std::true_type {};
1071+
1072+
1073+ } // namespace detail
1074+
1075+
1076+ // TODO20: Replace this by concepts
1077+ #define GKO_ASSERT_SUPPORTED_VALUE_TYPE \
1078+ static_assert (::gko::detail::is_supported_value_type<ValueType>::value, \
1079+ " Unsupported value type" )
1080+
1081+ // TODO20: Replace this by concepts
1082+ #define GKO_ASSERT_SUPPORTED_INDEX_TYPE \
1083+ static_assert (::gko::detail::is_supported_index_type<IndexType>::value, \
1084+ " Unsupported index type" )
1085+
1086+ #define GKO_ASSERT_SUPPORTED_VALUE_AND_INDEX_TYPE \
1087+ GKO_ASSERT_SUPPORTED_VALUE_TYPE; \
1088+ GKO_ASSERT_SUPPORTED_INDEX_TYPE
1089+
1090+ #define GKO_ASSERT_SUPPORTED_VALUE_AND_DIST_INDEX_TYPE \
1091+ GKO_ASSERT_SUPPORTED_VALUE_TYPE; \
1092+ static_assert ( \
1093+ ::gko::detail::is_supported_index_type<GlobalIndexType>::value, \
1094+ " Unsupported global index type" ); \
1095+ static_assert ( \
1096+ ::gko::detail::is_supported_index_type<LocalIndexType>::value, \
1097+ " Unsupported local index type" ); \
1098+ static_assert ( \
1099+ sizeof (GlobalIndexType) >= sizeof(LocalIndexType), \
1100+ "global index type must not be smaller than local index type")
1101+
1102+
10391103/* *
10401104 * Value for an invalid signed index type.
10411105 */
0 commit comments