tesseract  5.0.0-alpha-619-ge9db
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 174 of file simddetect.cpp.

174  {
175  // Select code for calculation of dot product based on the
176  // value of the config variable if that value is not empty.
177  const char* dotproduct_method = "generic";
178  if (!strcmp(dotproduct.c_str(), "auto")) {
179  // Automatic detection. Nothing to be done.
180  } else if (!strcmp(dotproduct.c_str(), "generic")) {
181  // Generic code selected by config variable.
182  SetDotProduct(DotProductGeneric);
183  dotproduct_method = "generic";
184  } else if (!strcmp(dotproduct.c_str(), "native")) {
185  // Native optimized code selected by config variable.
186  SetDotProduct(DotProductNative);
187  dotproduct_method = "native";
188 #if defined(HAVE_AVX2)
189  } else if (!strcmp(dotproduct.c_str(), "avx2")) {
190  // AVX2 selected by config variable.
192  dotproduct_method = "avx2";
193 #endif
194 #if defined(HAVE_AVX)
195  } else if (!strcmp(dotproduct.c_str(), "avx")) {
196  // AVX selected by config variable.
198  dotproduct_method = "avx";
199 #endif
200 #if defined(HAVE_FMA)
201  } else if (!strcmp(dotproduct.c_str(), "fma")) {
202  // FMA selected by config variable.
204  dotproduct_method = "fma";
205 #endif
206 #if defined(HAVE_SSE4_1)
207  } else if (!strcmp(dotproduct.c_str(), "sse")) {
208  // SSE selected by config variable.
210  dotproduct_method = "sse";
211 #endif
212  } else if (!strcmp(dotproduct.c_str(), "std::inner_product")) {
213  // std::inner_product selected by config variable.
214  SetDotProduct(DotProductStdInnerProduct);
215  dotproduct_method = "std::inner_product";
216  } else {
217  // Unsupported value of config variable.
218  tprintf("Warning, ignoring unsupported config variable value: dotproduct=%s\n",
219  dotproduct.c_str());
220  tprintf("Support values for dotproduct: auto generic native"
221 #if defined(HAVE_AVX)
222  " avx"
223 #endif
224 #if defined(HAVE_SSE4_1)
225  " sse"
226 #endif
227  " std::inner_product.\n");
228  }
229 
230  dotproduct.set_value(dotproduct_method);
231 }

The documentation for this class was generated from the following files:
tesseract::DotProductFMA
double DotProductFMA(const double *u, const double *v, int n)
Definition: dotproductfma.cpp:30
tesseract::IntSimdMatrix::intSimdMatrixAVX2
static const IntSimdMatrix intSimdMatrixAVX2
Definition: intsimdmatrix.h:117
tesseract::DotProductSSE
double DotProductSSE(const double *u, const double *v, int n)
Definition: dotproductsse.cpp:31
tesseract::IntSimdMatrix::intSimdMatrix
static const IntSimdMatrix * intSimdMatrix
Definition: intsimdmatrix.h:116
tesseract::DotProductAVX
double DotProductAVX(const double *u, const double *v, int n)
Definition: dotproductavx.cpp:30
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34
tesseract::IntSimdMatrix::intSimdMatrixSSE
static const IntSimdMatrix intSimdMatrixSSE
Definition: intsimdmatrix.h:118
tesseract::DotProductNative
double DotProductNative(const double *u, const double *v, int n)
Definition: dotproduct.cpp:22