diff options
author | Kenneth Heafield <github@kheafield.com> | 2019-12-19 00:49:10 +0300 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2019-12-19 00:49:10 +0300 |
commit | 588978add02fa30ec6bc949e1275587c8968f6d4 (patch) | |
tree | 4c362b11e7ef2bf89f970da7b009b97700ed7bf4 | |
parent | 4b04b639796a78a3c755aa94c2f3a09b0e365a54 (diff) |
Workarounds for icc, still need operator() to change
-rw-r--r-- | compile_test_avx512vnni.cc | 15 | ||||
-rw-r--r-- | intgemm.h | 17 | ||||
-rw-r--r-- | types.h | 1 |
3 files changed, 27 insertions, 6 deletions
diff --git a/compile_test_avx512vnni.cc b/compile_test_avx512vnni.cc index fc1c3dd..611cc53 100644 --- a/compile_test_avx512vnni.cc +++ b/compile_test_avx512vnni.cc @@ -1,6 +1,11 @@ #include <immintrin.h> -__attribute__ ((target ("avx512f,avx512bw,avx512dq,avx512vnni"))) bool Foo() { +#ifdef __INTEL_COMPILER +__attribute__ ((target ("avx512f"))) +#else +__attribute__ ((target ("avx512f,avx512bw,avx512dq,avx512vnni"))) +#endif +bool Foo() { // AVX512F __m512i value = _mm512_set1_epi32(1); // AVX512BW @@ -14,5 +19,11 @@ __attribute__ ((target ("avx512f,avx512bw,avx512dq,avx512vnni"))) bool Foo() { } int main() { - return Foo() && __builtin_cpu_supports("avx512vnni"); + return Foo() && +#ifdef __INTEL_COMPILER + _may_i_use_cpu_feature(_FEATURE_AVX512_VNNI) +#else + __builtin_cpu_supports("avx512vnni") +#endif + ; } @@ -130,14 +130,25 @@ typedef Unsupported_8bit AVX512VNNI_8bit; * unsupported otherwise */ template <class T> T ChooseCPU(T avx512vnni, T avx512, T avx2, T ssse3, T sse2, T unsupported) { - // TODO: don't catch Knights processors here! #ifdef INTGEMM_COMPILER_SUPPORTS_AVX512VNNI - if (__builtin_cpu_supports("avx512vnni")) { + if ( +#ifdef __INTEL_COMPILER + _may_i_use_cpu_feature(_FEATURE_AVX512_VNNI) +#else + __builtin_cpu_supports("avx512vnni") +#endif + ) { return avx512vnni; } #endif #ifdef INTGEMM_COMPILER_SUPPORTS_AVX512 - if (__builtin_cpu_supports("avx512f")) { + if ( +#ifdef __INTEL_COMPILER + __builtin_cpu_supports("avx512bw") +#else + _may_i_use_cpu_feature(_FEATURE_AVX512BW) +#endif + ) { return avx512; } #endif @@ -10,7 +10,6 @@ #define INTGEMM_AVX512F __attribute__ ((target ("avx512f"))) #define INTGEMM_AVX512BW __attribute__ ((target ("avx512f"))) #define INTGEMM_AVX512DQ __attribute__ ((target ("avx512f"))) -// TODO is this right? #define INTGEMM_AVX512VNNI __attribute__ ((target ("avx512f"))) #else #define INTGEMM_AVX512F __attribute__ ((target ("avx512f"))) |