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

use RAFT for select_k on the gpu #656

Merged
merged 11 commits into from
May 24, 2023
Merged

use RAFT for select_k on the gpu #656

merged 11 commits into from
May 24, 2023

Conversation

benfred
Copy link
Owner

@benfred benfred commented May 19, 2023

This changes to use RAFT https://github.com/rapidsai/raft for GPU top-k code instead of faiss. The RAFT version is quite a bit faster, and also doesn't have the same performance issues with small batch sizes that faiss has (meaning we can delete a bunch of code that was trying to work around that). RAFT also doesn't have limitations on the size of K, where faiss is limited to k less than 2048.

benfred added 11 commits May 19, 2023 15:29
This changes to use RAFT https://github.com/rapidsai/raft for GPU
top-k code instead of faiss. The RAFT version is quite a bit faster,
and also doesn't have the same performance issues with small batch
sizes that faiss has (meaning we can delete a bunch of code that
was trying to work around that).
Use the raft cublas handle and thrust policy so that we use the stream
associated with the raft handle (rather than just the default stream)
raft::select_k doesn't always return sorted outputs - handle this in unittest
@benfred benfred merged commit 3cb4532 into main May 24, 2023
@benfred benfred deleted the raft_select_k branch May 24, 2023 00:04
@benfred
Copy link
Owner Author

benfred commented Jun 19, 2023

Benchmarking this change on a dataset of github stars - containing 9M items with 96 dimensional embeddings, shows a good improvement in queries per second:

dataset batch_size Previous QPS QPS with RAFT % improvement
github 1 161.73 185.26 14.5%
github 1000 2299.46 2774.98 21%

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.

1 participant