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

Missing includes for faiss when building for Android x86-64 #113

Open
DavidVentura opened this issue Feb 2, 2025 · 0 comments
Open

Missing includes for faiss when building for Android x86-64 #113

DavidVentura opened this issue Feb 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@DavidVentura
Copy link

DavidVentura commented Feb 2, 2025

Bug description

faiss does not build on x86-64

How to reproduce

Include marian-dev in a CMake project (in my case, Android) and hit build.

You will get

error: unknown type name '__m128'
  148 | static inline __m128 masked_read(int d, const float *x)
      |               ^

This patch solves the issue

diff --git a/src/3rd_party/faiss/VectorTransform.h b/src/3rd_party/faiss/VectorTransform.h
index f0ed1440..ab34bc93 100644
--- a/src/3rd_party/faiss/VectorTransform.h
+++ b/src/3rd_party/faiss/VectorTransform.h
@@ -21,6 +21,12 @@
 #if defined(__APPLE__) && !defined(__arm64__)
 #include <x86intrin.h>
 #endif
+#if defined(__x86_64__) || defined(_M_X64)
+#include <xmmintrin.h>
+#include <emmintrin.h>
+#include <pmmintrin.h>
+#endif
+

Also reported upstream

Maybe masked_read should be gated by #ifdef __AVX__ instead of #ifdef __SSE__ ?

@DavidVentura DavidVentura added the bug Something isn't working label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant