File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,17 @@ namespace x86simdsort {
108108 return (*internal_argselect##TYPE)(arr, k, arrsize, hasnan); \
109109 }
110110
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+
111122/* runtime dispatch mechanism */
112123#define DISPATCH (func, TYPE, ISA ) \
113124 DECLARE_INTERNAL_##func(TYPE) static __attribute__ ((constructor)) void \
@@ -118,7 +129,7 @@ namespace x86simdsort {
118129 std::string_view preferred_cpu = find_preferred_cpu (ISA); \
119130 if constexpr (dispatch_requested (" avx512" , ISA)) { \
120131 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>() ) { \
122133 if (preferred_cpu.find (" avx512_spr" ) \
123134 != std::string_view::npos) { \
124135 CAT (CAT (internal_, func), TYPE) \
You can’t perform that action at this time.
0 commit comments