Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2019-12-19 00:49:10 +0300
committerKenneth Heafield <github@kheafield.com>2019-12-19 00:49:10 +0300
commit588978add02fa30ec6bc949e1275587c8968f6d4 (patch)
tree4c362b11e7ef2bf89f970da7b009b97700ed7bf4
parent4b04b639796a78a3c755aa94c2f3a09b0e365a54 (diff)
Workarounds for icc, still need operator() to change
-rw-r--r--compile_test_avx512vnni.cc15
-rw-r--r--intgemm.h17
-rw-r--r--types.h1
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
+ ;
}
diff --git a/intgemm.h b/intgemm.h
index 6f6839c..8b933f2 100644
--- a/intgemm.h
+++ b/intgemm.h
@@ -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
diff --git a/types.h b/types.h
index fb010b0..d901e18 100644
--- a/types.h
+++ b/types.h
@@ -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")))