-
Notifications
You must be signed in to change notification settings - Fork 197
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
Add ability to specify select_k algorithm #1430
Conversation
This adds the ability to specify which select_k algorithm we are using in `matrix::select_k` - with the goal of being able to run experiments to automatically pick the best algorithm. We currently have at least 3 different implementations of a top-k algorithm inside of RAFT : radix select, warp sort - and the block select from faiss. (there is also another version in CAGRA that isn't included here). Each of these algorithms is fastest on certain inputs, and slower than others on other inputs.
Some timings from the different methods (will run more exhaustive experiments soon) Single rowfaiss block select underperforms here - since it use's a single threadblock for each row, leading to poor gpu utilization:
1000 rows
larger k valuewarpsort doesn't support k=1024, faiss block select outperforms radix in this case
|
I've started to push out some code to run experiments with this branch to https://gitlab-master.nvidia.com/benf/raft_select_k_experiments For different input shapes and k values - the fastest algorithm can be quite different. As an example, looking at 2**20 columns - with both 256 rows and 16 rows, the best method changes with different values of k: Next steps will be to integrate CAGRA into this, and then automate finding a heuristic to automatically pick the best algorithm. I think both of these should be done in a separate PR though |
Revert the heuristic updates - I was originally intending for this to be in a followup PR, but thought I could sneak in here (It seems to be causing an issue with the ivf_pq unittest, and needs a bit more work before being ready)
In addition to comments from @tfeher in #1455 , I'd like to point out, that I'm not sure we should expose the ability to specify the
To sum up, I'd suggest we use our C++ benchmarks to learn the heuristics and then plug in the heuristics directly into |
I think that sounds like a good plan - going to close this PR |
I like the idea of learning the heuristics and I like the idea of using our c++ benchmarks to run over the grid search, but I think it's extremely useful to consider pulling the results of the grid search into python so we can actually build a model (like the DT/RF model Ben has been playing with). I've already expressed my concern with using an enum to specify the algo, mostly because it doesn't gel with the way we have done this for other APIs in raft, which would just expose new functions for each variant. Just to be clear- I still think there's benefit to exposing the different k-select variants individually, but at this point that could be a conversation for a different day (unless, of course, anyone else sees a dire need for this in the near term). |
This adds the ability to specify which select_k algorithm we are using in
matrix::select_k
- with the goal of being able to run experiments to automatically pick the best algorithm.We currently have at least 3 different implementations of a top-k algorithm inside of RAFT : radix select, warp sort - and the block select from faiss. (there is also another version in CAGRA that isn't included here). Each of these algorithms is fastest on certain inputs, and slower than others on other inputs.