tesseract 4.1.1
Loading...
Searching...
No Matches
tesseract::SIMDDetect Class Reference

#include <simddetect.h>

Static Public Member Functions

static bool IsAVXAvailable ()
 
static bool IsAVX2Available ()
 
static bool IsAVX512FAvailable ()
 
static bool IsAVX512BWAvailable ()
 
static bool IsFMAAvailable ()
 
static bool IsSSEAvailable ()
 
static TESS_API void Update ()
 

Detailed Description

Definition at line 31 of file simddetect.h.

Member Function Documentation

◆ IsAVX2Available()

static bool tesseract::SIMDDetect::IsAVX2Available ( )
inlinestatic

Definition at line 38 of file simddetect.h.

38 {
39 return detector.avx2_available_;
40 }

◆ IsAVX512BWAvailable()

static bool tesseract::SIMDDetect::IsAVX512BWAvailable ( )
inlinestatic

Definition at line 46 of file simddetect.h.

46 {
47 return detector.avx512BW_available_;
48 }

◆ IsAVX512FAvailable()

static bool tesseract::SIMDDetect::IsAVX512FAvailable ( )
inlinestatic

Definition at line 42 of file simddetect.h.

42 {
43 return detector.avx512F_available_;
44 }

◆ IsAVXAvailable()

static bool tesseract::SIMDDetect::IsAVXAvailable ( )
inlinestatic

Definition at line 34 of file simddetect.h.

34 {
35 return detector.avx_available_;
36 }

◆ IsFMAAvailable()

static bool tesseract::SIMDDetect::IsFMAAvailable ( )
inlinestatic

Definition at line 50 of file simddetect.h.

50 {
51 return detector.fma_available_;
52 }

◆ IsSSEAvailable()

static bool tesseract::SIMDDetect::IsSSEAvailable ( )
inlinestatic

Definition at line 54 of file simddetect.h.

54 {
55 return detector.sse_available_;
56 }

◆ Update()

void tesseract::SIMDDetect::Update ( )
static

Definition at line 173 of file simddetect.cpp.

173 {
174 // Select code for calculation of dot product based on the
175 // value of the config variable if that value is not empty.
176 const char* dotproduct_method = "generic";
177 if (!strcmp(dotproduct.string(), "auto")) {
178 // Automatic detection. Nothing to be done.
179 } else if (!strcmp(dotproduct.string(), "generic")) {
180 // Generic code selected by config variable.
181 SetDotProduct(DotProductGeneric);
182 dotproduct_method = "generic";
183 } else if (!strcmp(dotproduct.string(), "native")) {
184 // Native optimized code selected by config variable.
185 SetDotProduct(DotProductNative);
186 dotproduct_method = "native";
187#if defined(AVX2)
188 } else if (!strcmp(dotproduct.string(), "avx2")) {
189 // AVX2 selected by config variable.
191 dotproduct_method = "avx2";
192#endif
193#if defined(AVX)
194 } else if (!strcmp(dotproduct.string(), "avx")) {
195 // AVX selected by config variable.
197 dotproduct_method = "avx";
198#endif
199#if defined(FMA)
200 } else if (!strcmp(dotproduct.string(), "fma")) {
201 // FMA selected by config variable.
203 dotproduct_method = "fma";
204#endif
205#if defined(SSE4_1)
206 } else if (!strcmp(dotproduct.string(), "sse")) {
207 // SSE selected by config variable.
209 dotproduct_method = "sse";
210#endif
211 } else if (!strcmp(dotproduct.string(), "std::inner_product")) {
212 // std::inner_product selected by config variable.
213 SetDotProduct(DotProductStdInnerProduct);
214 dotproduct_method = "std::inner_product";
215 } else {
216 // Unsupported value of config variable.
217 tprintf("Warning, ignoring unsupported config variable value: dotproduct=%s\n",
218 dotproduct.string());
219 tprintf("Support values for dotproduct: auto generic native"
220#if defined(AVX)
221 " avx"
222#endif
223#if defined(SSE4_1)
224 " sse"
225#endif
226 " std::inner_product.\n");
227 }
228
229 dotproduct.set_value(dotproduct_method);
230}
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:35
double DotProductAVX(const double *u, const double *v, int n)
double DotProductNative(const double *u, const double *v, int n)
Definition: dotproduct.cpp:22
double DotProductFMA(const double *u, const double *v, int n)
double DotProductSSE(const double *u, const double *v, int n)
static const IntSimdMatrix intSimdMatrixAVX2
static const IntSimdMatrix * intSimdMatrix
static const IntSimdMatrix intSimdMatrixSSE

The documentation for this class was generated from the following files: