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

Fix AVX2 distance function and build with AVX2 if available on host machine #524

Merged
merged 15 commits into from
Oct 17, 2024

Conversation

jparismorgan
Copy link
Contributor

@jparismorgan jparismorgan commented Sep 13, 2024

What

A few changes:

  • Updates the build system so that if we have AVX2 support on the host machine, we will build with AVX2 support in the binary.
  • Fixes several bugs in the AVX2 distance functions.

Based on:

Below are several sets of benchmarks that are run. You can also see more here: #499

The summary:

  • VAMANA got much faster in both ingestion and query.
  • IVF_FLAT had modest improvement.
  • IVF_PQ doesn't seem to have a big improvement, and is worse on one benchmark, but not by much.

CI Benchmarks

C++ CI tests before (left) vs after (right). Note we go from 16 minutes to 10 minutes.

Screenshot 2024-10-10 at 8 14 13 AM

Python CI tests before (left) vs after (right). Note that while the cloud tests are not faster, the non-cloud tests are. i.e. test/test_distance_metrics.py::test_vamana_l2_distance goes from 41.01s to 23.19s. And test/test_ingestion.py::test_ivf_flat_ingestion_f32 goes from 28.90s to 21.48s.

Screenshot 2024-10-10 at 8 13 13 AM

Manual Benchmarks

Before:
ingestion_time_vs_accuracy

After:
ingestion_time_vs_accuracy

Before:
query_time_vs_accuracy

After:
query_time_vs_accuracy

Manual Benchmarks: VAMANA

Before:
VAMANA_ingestion_time_vs_accuracy

After:
VAMANA_ingestion_time_vs_accuracy

Before :
VAMANA_query_time_vs_accuracy

After:
VAMANA_query_time_vs_accuracy

Manual Benchmarks: IVF_FLAT

Before:
IVF_FLAT_ingestion_time_vs_accuracy

After:
IVF_FLAT_ingestion_time_vs_accuracy

Before:
IVF_FLAT_query_time_vs_accuracy

After:
IVF_FLAT_query_time_vs_accuracy

Manual Benchmarks: IVF_PQ

Before:
IVF_PQ_ingestion_time_vs_accuracy

After:
IVF_PQ_ingestion_time_vs_accuracy

Before :
IVF_PQ_query_time_vs_accuracy

After:
IVF_PQ_query_time_vs_accuracy

@jparismorgan jparismorgan marked this pull request as ready for review October 16, 2024 21:42
@jparismorgan jparismorgan merged commit fd1bafb into main Oct 17, 2024
6 checks passed
@jparismorgan jparismorgan deleted the jparismorgan/avx2-support branch October 17, 2024 16:00
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.

4 participants