File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,17 @@ namespace x86simdsort {
108
108
return (*internal_argselect##TYPE)(arr, k, arrsize, hasnan); \
109
109
}
110
110
111
+ /* simple constexpr function as a way around having #ifdef __FLT16_MAX__ block
112
+ * within the DISPATCH macro */
113
+ template <typename T>
114
+ constexpr bool IS_TYPE_FLOAT16 ()
115
+ {
116
+ #ifdef __FLT16_MAX__
117
+ if constexpr (std::is_same_v<T, _Float16>) { return true ; }
118
+ #endif
119
+ return false ;
120
+ }
121
+
111
122
/* runtime dispatch mechanism */
112
123
#define DISPATCH (func, TYPE, ISA ) \
113
124
DECLARE_INTERNAL_##func(TYPE) static __attribute__ ((constructor)) void \
@@ -118,7 +129,7 @@ namespace x86simdsort {
118
129
std::string_view preferred_cpu = find_preferred_cpu (ISA); \
119
130
if constexpr (dispatch_requested (" avx512" , ISA)) { \
120
131
if (preferred_cpu.find (" avx512" ) != std::string_view::npos) { \
121
- if constexpr (std::is_same_v <TYPE, _Float16> ) { \
132
+ if constexpr (IS_TYPE_FLOAT16 <TYPE>() ) { \
122
133
if (preferred_cpu.find (" avx512_spr" ) \
123
134
!= std::string_view::npos) { \
124
135
CAT (CAT (internal_, func), TYPE) \
You can’t perform that action at this time.
0 commit comments