diff --git a/src/arch/simddetect.cpp b/src/arch/simddetect.cpp index 573faa0cc1..1afe5a5d81 100644 --- a/src/arch/simddetect.cpp +++ b/src/arch/simddetect.cpp @@ -41,6 +41,7 @@ #endif #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_FMA) || defined(HAVE_SSE4_1) +// See https://en.wikipedia.org/wiki/CPUID. # define HAS_CPUID #endif @@ -94,6 +95,7 @@ bool SIMDDetect::avx_available_; bool SIMDDetect::avx2_available_; bool SIMDDetect::avx512F_available_; bool SIMDDetect::avx512BW_available_; +bool SIMDDetect::avx512VNNI_available_; // If true, then FMA has been detected. bool SIMDDetect::fma_available_; // If true, then SSe4.1 has been detected. @@ -171,6 +173,7 @@ SIMDDetect::SIMDDetect() { avx2_available_ = (ebx & 0x00000020) != 0; avx512F_available_ = (ebx & 0x00010000) != 0; avx512BW_available_ = (ebx & 0x40000000) != 0; + avx512VNNI_available_ = (ecx & 0x00000800) != 0; } # endif } @@ -201,6 +204,7 @@ SIMDDetect::SIMDDetect() { avx2_available_ = (cpuInfo[1] & 0x00000020) != 0; avx512F_available_ = (cpuInfo[1] & 0x00010000) != 0; avx512BW_available_ = (cpuInfo[1] & 0x40000000) != 0; + avx512VNNI_available_ = (cpuInfo[2] & 0x00000800) != 0; } # endif } diff --git a/src/arch/simddetect.h b/src/arch/simddetect.h index 409319465e..fcb0f53eca 100644 --- a/src/arch/simddetect.h +++ b/src/arch/simddetect.h @@ -47,6 +47,10 @@ class SIMDDetect { static inline bool IsAVX512BWAvailable() { return detector.avx512BW_available_; } + // Returns true if AVX512 Vector Neural Network Instructions are available. + static inline bool IsAVX512VNNIAvailable() { + return detector.avx512VNNI_available_; + } // Returns true if FMA is available on this system. static inline bool IsFMAAvailable() { return detector.fma_available_; @@ -75,6 +79,7 @@ class SIMDDetect { static TESS_API bool avx2_available_; static TESS_API bool avx512F_available_; static TESS_API bool avx512BW_available_; + static TESS_API bool avx512VNNI_available_; // If true, then FMA has been detected. static TESS_API bool fma_available_; // If true, then SSe4.1 has been detected. diff --git a/src/tesseract.cpp b/src/tesseract.cpp index 9154db80a6..0586e08694 100644 --- a/src/tesseract.cpp +++ b/src/tesseract.cpp @@ -149,6 +149,9 @@ static void PrintVersionInfo() { if (tesseract::SIMDDetect::IsAVX512FAvailable()) { printf(" Found AVX512F\n"); } + if (tesseract::SIMDDetect::IsAVX512VNNIAvailable()) { + printf(" Found AVX512VNNI\n"); + } if (tesseract::SIMDDetect::IsAVX2Available()) { printf(" Found AVX2\n"); }