File tree 3 files changed +12
-0
lines changed
3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 41
41
#endif
42
42
43
43
#if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_FMA) || defined(HAVE_SSE4_1)
44
+ // See https://en.wikipedia.org/wiki/CPUID.
44
45
# define HAS_CPUID
45
46
#endif
46
47
@@ -94,6 +95,7 @@ bool SIMDDetect::avx_available_;
94
95
bool SIMDDetect::avx2_available_;
95
96
bool SIMDDetect::avx512F_available_;
96
97
bool SIMDDetect::avx512BW_available_;
98
+ bool SIMDDetect::avx512VNNI_available_;
97
99
// If true, then FMA has been detected.
98
100
bool SIMDDetect::fma_available_;
99
101
// If true, then SSe4.1 has been detected.
@@ -171,6 +173,7 @@ SIMDDetect::SIMDDetect() {
171
173
avx2_available_ = (ebx & 0x00000020 ) != 0 ;
172
174
avx512F_available_ = (ebx & 0x00010000 ) != 0 ;
173
175
avx512BW_available_ = (ebx & 0x40000000 ) != 0 ;
176
+ avx512VNNI_available_ = (ecx & 0x00000800 ) != 0 ;
174
177
}
175
178
# endif
176
179
}
@@ -201,6 +204,7 @@ SIMDDetect::SIMDDetect() {
201
204
avx2_available_ = (cpuInfo[1 ] & 0x00000020 ) != 0 ;
202
205
avx512F_available_ = (cpuInfo[1 ] & 0x00010000 ) != 0 ;
203
206
avx512BW_available_ = (cpuInfo[1 ] & 0x40000000 ) != 0 ;
207
+ avx512VNNI_available_ = (cpuInfo[2 ] & 0x00000800 ) != 0 ;
204
208
}
205
209
# endif
206
210
}
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ class SIMDDetect {
47
47
static inline bool IsAVX512BWAvailable () {
48
48
return detector.avx512BW_available_ ;
49
49
}
50
+ // Returns true if AVX512 Vector Neural Network Instructions are available.
51
+ static inline bool IsAVX512VNNIAvailable () {
52
+ return detector.avx512VNNI_available_ ;
53
+ }
50
54
// Returns true if FMA is available on this system.
51
55
static inline bool IsFMAAvailable () {
52
56
return detector.fma_available_ ;
@@ -75,6 +79,7 @@ class SIMDDetect {
75
79
static TESS_API bool avx2_available_;
76
80
static TESS_API bool avx512F_available_;
77
81
static TESS_API bool avx512BW_available_;
82
+ static TESS_API bool avx512VNNI_available_;
78
83
// If true, then FMA has been detected.
79
84
static TESS_API bool fma_available_;
80
85
// If true, then SSe4.1 has been detected.
Original file line number Diff line number Diff line change @@ -149,6 +149,9 @@ static void PrintVersionInfo() {
149
149
if (tesseract::SIMDDetect::IsAVX512FAvailable ()) {
150
150
printf (" Found AVX512F\n " );
151
151
}
152
+ if (tesseract::SIMDDetect::IsAVX512VNNIAvailable ()) {
153
+ printf (" Found AVX512VNNI\n " );
154
+ }
152
155
if (tesseract::SIMDDetect::IsAVX2Available ()) {
153
156
printf (" Found AVX2\n " );
154
157
}
You can’t perform that action at this time.
0 commit comments