From d53e6d709a598aa6e5ec583968f938a79788fdfb Mon Sep 17 00:00:00 2001 From: Frank Seide Date: Fri, 13 Sep 2019 17:17:20 -0700 Subject: fixed a build error for non-AVX2 builds --- src/QuantUtilsAvx2.cc | 5 +++++ src/Utils.cc | 4 ++++ 2 files changed, 9 insertions(+) mode change 100644 => 100755 src/QuantUtilsAvx2.cc mode change 100644 => 100755 src/Utils.cc diff --git a/src/QuantUtilsAvx2.cc b/src/QuantUtilsAvx2.cc old mode 100644 new mode 100755 index 7f43ced..6371b6f --- a/src/QuantUtilsAvx2.cc +++ b/src/QuantUtilsAvx2.cc @@ -257,6 +257,11 @@ void RequantizeFixedPointAvx2( dst[i] = std::min(std::max(quantized_down, 0l), 255l); } } +#else +// dummy implementation to avoid link errors +void RequantizeFixedPointAvx2(const int32_t* src, uint8_t* dst, int len, const RequantizationParams& params) { + assert(false && "RequantizeFixedPointAvx2() called in build without AVX2 support"); +} #endif template < diff --git a/src/Utils.cc b/src/Utils.cc old mode 100644 new mode 100755 index 355a5cb..99f8125 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -202,8 +202,12 @@ bool fbgemmHasAvx512Support() { cpuinfo_has_x86_avx512dq() && cpuinfo_has_x86_avx512vl()); } +#ifdef __AVX2__ bool fbgemmHasAvx2Support() { return (cpuinfo_initialize() && cpuinfo_has_x86_avx2()); } +#else +bool fbgemmHasAvx2Support() { return false; } +#endif } // namespace fbgemm -- cgit v1.2.3 From 57dcf55075e7173fd21eb81d825133aa740c7255 Mon Sep 17 00:00:00 2001 From: Frank Seide Date: Fri, 13 Sep 2019 17:22:58 -0700 Subject: (fixed an error message) --- src/QuantUtilsAvx2.cc | 7 +++++-- src/Utils.cc | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/QuantUtilsAvx2.cc b/src/QuantUtilsAvx2.cc index 6371b6f..821999e 100755 --- a/src/QuantUtilsAvx2.cc +++ b/src/QuantUtilsAvx2.cc @@ -258,9 +258,12 @@ void RequantizeFixedPointAvx2( } } #else -// dummy implementation to avoid link errors +// dummy implementations to avoid link errors +void RequantizeAvx2(const int32_t* src, uint8_t* dst, int len, const RequantizationParams& params) { + assert(false && "RequantizeAvx2() was called unexpectedly in non-AVX2 build"); +} void RequantizeFixedPointAvx2(const int32_t* src, uint8_t* dst, int len, const RequantizationParams& params) { - assert(false && "RequantizeFixedPointAvx2() called in build without AVX2 support"); + assert(false && "RequantizeFixedPointAvx2() was called unexpectedly in non-AVX2 build"); } #endif diff --git a/src/Utils.cc b/src/Utils.cc index 99f8125..8569553 100755 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -207,7 +207,9 @@ bool fbgemmHasAvx2Support() { return (cpuinfo_initialize() && cpuinfo_has_x86_avx2()); } #else -bool fbgemmHasAvx2Support() { return false; } +bool fbgemmHasAvx2Support() { + return false; +} #endif } // namespace fbgemm -- cgit v1.2.3 From f0b354327aaf2330c65340725b1981040c8bec9e Mon Sep 17 00:00:00 2001 From: Young Jin Kim Date: Tue, 17 Sep 2019 09:52:24 -0700 Subject: Enable AVX2 query API when compiled with AVX --- src/Utils.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Utils.cc b/src/Utils.cc index 8569553..355a5cb 100755 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -202,14 +202,8 @@ bool fbgemmHasAvx512Support() { cpuinfo_has_x86_avx512dq() && cpuinfo_has_x86_avx512vl()); } -#ifdef __AVX2__ bool fbgemmHasAvx2Support() { return (cpuinfo_initialize() && cpuinfo_has_x86_avx2()); } -#else -bool fbgemmHasAvx2Support() { - return false; -} -#endif } // namespace fbgemm -- cgit v1.2.3