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

[RUST] Flat index benchmark #461

Merged
merged 11 commits into from
Jan 26, 2023
Merged

[RUST] Flat index benchmark #461

merged 11 commits into from
Jan 26, 2023

Conversation

eddyxu
Copy link
Contributor

@eddyxu eddyxu commented Jan 25, 2023

  • Provide a benchmark for Flat index
  • Implement Apple Accelerate / Blas and NEON SIMD versions of L2 distance
  • Currently BLAS only works on MacOS + Accelerate

@eddyxu eddyxu self-assigned this Jan 25, 2023
@eddyxu eddyxu added benchmark rust Rust related tasks labels Jan 25, 2023
@eddyxu eddyxu force-pushed the lei/flat_idx_perf branch from bc4944e to 2be92e3 Compare January 25, 2023 20:06
@eddyxu eddyxu requested a review from changhiskhan January 25, 2023 23:18
@eddyxu eddyxu marked this pull request as ready for review January 25, 2023 23:20
@eddyxu
Copy link
Contributor Author

eddyxu commented Jan 25, 2023

Flat index run on SIFT-1M dataset, on a M1 Macbook Air 16GB

With Blas / Apple Accelerate Framework
Screenshot 2023-01-25 at 3 19 28 PM

With hand written ARM NEON SIMD

Screenshot 2023-01-25 at 3 22 35 PM

@eddyxu eddyxu changed the title Flat index benchmark [RUST] Flat index benchmark Jan 25, 2023
let a = from.values();
let b = to.values();
let mut d = 0.0;
// Better chance to auto-vectorization.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only got about 5% from this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's interesting. thought those blog posts showed bigger gains

Copy link
Contributor

@changhiskhan changhiskhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we distribute this in the python package?

let a = from.values();
let b = to.values();
let mut d = 0.0;
// Better chance to auto-vectorization.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's interesting. thought those blog posts showed bigger gains

@eddyxu
Copy link
Contributor Author

eddyxu commented Jan 26, 2023

how do we distribute this in the python package?

For macOS, we can build it with cargo release --features="blas". The other platform, release as old as usual.

that's interesting. thought those blog posts showed bigger gains

I think i did not try hard enough.

@eddyxu eddyxu merged commit 99a8e5e into main Jan 26, 2023
@eddyxu eddyxu deleted the lei/flat_idx_perf branch January 26, 2023 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark rust Rust related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants