Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesseract does not support SIMD instructions on FreeBSD with amd64 #3964

Closed
stweil opened this issue Nov 14, 2022 · 8 comments
Closed

Tesseract does not support SIMD instructions on FreeBSD with amd64 #3964

stweil opened this issue Nov 14, 2022 · 8 comments
Labels

Comments

@stweil
Copy link
Contributor

stweil commented Nov 14, 2022

The current autoconf build does not enable SIMD detection and compiler flags when running on FreeBSD for 64 bit AMD / Intel CPUs. This results in bad performance for text recognition and model training, and tesseract -v cannot show SIMD support (see #3960 (comment)).

@stweil
Copy link
Contributor Author

stweil commented Nov 14, 2022

I'll commit a fix.

@stweil stweil added the bug label Nov 14, 2022
@stweil
Copy link
Contributor Author

stweil commented Nov 14, 2022

With a fix in configure.ac the compiler builds the code for SIMD , but the values from get_cpuid don't show any SIMD support when running FreeBSD in my test with a QEMU virtual machine. With commit adbefa8 Tesseract now uses SIMD instructions (also when running in a QEMU virtual machine).

stweil added a commit that referenced this issue Nov 14, 2022
Tesseract for FreeBSD was built without support for SSE4.1, AVX,
AVX2 or FMA because it uses a different value for `host_cpu`.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil stweil closed this as completed Nov 14, 2022
@stweil
Copy link
Contributor Author

stweil commented Nov 14, 2022

Cc @pkubaj who seems to be the maintainer for Tesseract on FreeBSD.

@amitdo
Copy link
Collaborator

amitdo commented Nov 14, 2022

@stweil
Copy link
Contributor Author

stweil commented Nov 14, 2022

qemu -cpu host passes all host features through to the virtual machine.

@amitdo
Copy link
Collaborator

amitdo commented Nov 15, 2022

CMake:

if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686")
...
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64.*|AARCH64.*")

Should we do something similar with Autotools?

@stweil
Copy link
Contributor Author

stweil commented Nov 15, 2022

I don't think that is necessary. See https://git.savannah.gnu.org/cgit/config.git/plain/config.guess for the values which can be detected automatically.

@stweil
Copy link
Contributor Author

stweil commented Nov 15, 2022

FreeBSD provides an old version of config.guess (timestamp='2018-08-29') which returns amd64-unknown-freebsd13.1. The original config.guess returns x86_64 even on FreeBSD sind 2006, but the version which is distributed with FreeBSD was patched to return amd64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants