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

Disable the NEON optimisations on gcc <= 8 #3869

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

JAicewizard
Copy link
Contributor

GCC7 doesnt support all the necessary NEON intrinsics, which is really a shame. However this means that for aarch64 GCC cannot compile faiss with neon intrinsics, so we should avoid using them.

This is similar to #3860, build issues on GCC7, which I need. This one is a bit uglier, since GCC7 does support NEON just not all of the intrinsics.

GCC7 doesnt support all the neccesary NEON intrinsics, which is really a shame.
However this means that for aarch64 GCC cannot compile faiss with neon intrinsics,
so we should avoid using them.
@alexanderguzhva
Copy link
Contributor

alexanderguzhva commented Sep 17, 2024

@JAicewizard this should not affect clang, correct? because clang may pretend in certain situations

@JAicewizard
Copy link
Contributor Author

I just checked on CC explorer here and even with the oldest aarch64 clang there were no issues. So there might be an old clang compiler that doesn't work, but I am not in a position to test all of them. I suspect they were just always supported.

@facebook-github-bot
Copy link
Contributor

@junjieqi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@junjieqi
Copy link
Contributor

@JAicewizard we received bunch of errors internally. In case, you already know the issue before I look into it.

fbcode/faiss/impl/ScalarQuantizer.cpp:712:25: error: unknown type name 'float32x4x2_t'
[CONTEXT]   712 |     FAISS_ALWAYS_INLINE float32x4x2_t
[CONTEXT]       |                         ^
fbcode/faiss/impl/ScalarQuantizer.cpp:714:9: error: unknown type name 'uint8x8_t'; did you mean 'uint8_t'?
[CONTEXT]   714 |         uint8x8_t x8 = vld1_u8((const uint8_t*)(code + i));
[CONTEXT]       |         ^~~~~~~~~
fbcode/faiss/impl/ScalarQuantizer.cpp:714:24: error: use of undeclared identifier 'vld1_u8'
[CONTEXT]   714 |         uint8x8_t x8 = vld1_u8((const uint8_t*)(code + i));
[CONTEXT]       |                        ^
fbcode/faiss/impl/ScalarQuantizer.cpp:715:9: error: unknown type name 'uint16x8_t'; did you mean 'uint16_t'?
[CONTEXT]   715 |         uint16x8_t y8 = vmovl_u8(x8); // convert uint8 -> uint16
[CONTEXT]       |         ^~~~~~~~~~
fbcode/faiss/impl/ScalarQuantizer.cpp:715:25: error: use of undeclared identifier 'vmovl_u8'
[CONTEXT]   715 |         uint16x8_t y8 = vmovl_u8(x8); // convert uint8 -> uint16
[CONTEXT]       |                         ^
fbcode/faiss/impl/ScalarQuantizer.cpp:716:9: error: unknown type name 'uint16x4_t'
[CONTEXT]   716 |         uint16x4_t y8_0 = vget_low_u16(y8);
[CONTEXT]       |         ^
fbcode/faiss/impl/ScalarQuantizer.cpp:716:27: error: use of undeclared identifier 'vget_low_u16'
[CONTEXT]   716 |         uint16x4_t y8_0 = vget_low_u16(y8);
[CONTEXT]       |                           ^
fbcode/faiss/impl/ScalarQuantizer.cpp:717:9: error: unknown type name 'uint16x4_t'
[CONTEXT]   717 |         uint16x4_t y8_1 = vget_high_u16(y8);
[CONTEXT]       |         ^
fbcode/faiss/impl/ScalarQuantizer.cpp:717:27: error: use of undeclared identifier 'vget_high_u16'
[CONTEXT]   717 |         uint16x4_t y8_1 = vget_high_u16(y8);
[CONTEXT]       |                           ^
fbcode/faiss/impl/ScalarQuantizer.cpp:719:9: error: unknown type name 'float32x4_t'
[CONTEXT]   719 |         float32x4_t z8_0 = vcvtq_f32_u32(
[CONTEXT]       |         ^
fbcode/faiss/impl/ScalarQuantizer.cpp:721:9: error: unknown type name 'float32x4_t'
[CONTEXT]   721 |         float32x4_t z8_1 = vcvtq_f32_u32(vmovl_u16(y8_1));
[CONTEXT]       |         ^
fbcode/faiss/impl/ScalarQuantizer.cpp:724:33: error: use of undeclared identifier 'vmovq_n_f32'
[CONTEXT]   724 |         return {vsubq_f32(z8_0, vmovq_n_f32(128.0)),
[CONTEXT]       |                                 ^
fbcode/faiss/impl/ScalarQuantizer.cpp:725:33: error: use of undeclared identifier 'vmovq_n_f32'
[CONTEXT]   725 |                 vsubq_f32(z8_1, vmovq_n_f32(128.0))};

@JAicewizard
Copy link
Contributor Author

This should be fixed now

@junjieqi
Copy link
Contributor

github action failed. @JAicewizard could you help fix them before I import again? Thanks!

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

Successfully merging this pull request may close these issues.

5 participants