-
Notifications
You must be signed in to change notification settings - Fork 58
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
feat: add aarch64 neon simd support for distance calculations #127
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great PR a few asks:
-
can you please add the equivalent of https://github.com/timescale/pgvectorscale/blob/main/pgvectorscale/src/access_method/distance.rs#L12 for neon
-
optional: can you add something to https://github.com/timescale/pgvectorscale/blob/main/pgvectorscale/benches/distance.rs (or maybe a different bench)
-
please address the inline comments.
Thanks again
Co-authored-by: Matvey Arye <[email protected]> Signed-off-by: knudtty <[email protected]>
Sure
The neon distance calcs are being run as part of |
Closes #126
Added simd distance (cosine and l2) calculations for aarch64 neon intrinsics. Tested on Macbook M1 Max, AWS EC2 t4g.medium, and even a Raspberry Pi 4. Benchmarks showed anywhere from 3-10x performance improvements depending on the machine. Seeing that many cloud managed db's use ARM (AWS RDS is all Gravitron3 chips IIRC), Neon SIMD would go a long ways.
Added a test between this new function and the unoptimized version to ensure distance calculations are equivalent. All tests pass.