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

Remove MMX header #2939

Merged
merged 1 commit into from
Mar 31, 2024
Merged

Remove MMX header #2939

merged 1 commit into from
Mar 31, 2024

Conversation

Chainfire
Copy link
Contributor

MMX is not actually used by dlib and including the header breaks SIMD support detection and usage on platforms that support SSE but not MMX, such as emcc

MMX is not actually used by dlib and including the header breaks SIMD support detection and usage on platforms that support SSE but not MMX, such as emcc
@Chainfire
Copy link
Contributor Author

Chainfire commented Mar 30, 2024

When using emcc (Emscripten) to compile to 32-bit WebAssembly with SIMD support (-msse42 -msimd128), support is available for SSE through SSE4.2. These calls are translated (or emulated if not compatible) under the hood to WebAssembly SIMD instructions.

dlib pulls in the MMX intrinsics header as well, but MMX instructions are not supported by emcc, and compilation fails.

I went through the MMX intrinsics header file and searched for all the symbols in the dlib codebase, but could not find any references to any of them. I believe it is not (or perhaps no longer) used. Thus removal shouldn't be a problem, and it fixes SIMD compatibility with emcc.

I have additionally compiled my own code with clang in SSE2 mode and forced SSE2 usage in dlib, and it compiled and worked without issue. SSE4.2 builds kept working as before. However, I did not run the entire dlib test suite.

@davisking davisking merged commit 8edfa54 into davisking:master Mar 31, 2024
9 checks passed
@davisking
Copy link
Owner

Cool, yeah shouldn't be needed. Thanks for the PR :D

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

Successfully merging this pull request may close these issues.

2 participants