-
Notifications
You must be signed in to change notification settings - Fork 66
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
Migrate feature diff for NN Descent from RAFT to cuVS #421
base: branch-24.12
Are you sure you want to change the base?
Conversation
@@ -55,6 +55,8 @@ struct index_params : cuvs::neighbors::index_params { | |||
size_t intermediate_graph_degree = 128; // Degree of input graph for pruning. | |||
size_t max_iterations = 20; // Number of nn-descent iterations. | |||
float termination_threshold = 0.0001; // Termination threshold of nn-descent. | |||
bool return_distances = false; // return distances if true |
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.
I think we want to set this to true by default and have CAGRA set it to false when it uses it. The reason the distances aren't needed in CAGRA is a special case, whereas in general a knn graph should have distances returned.
void build(raft::resources const& res, | ||
index_params const& params, | ||
raft::device_matrix_view<const float, int64_t, raft::row_major> dataset, | ||
index<uint32_t>& index); |
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.
Why doesn't nn-descent return the built index like all the other index types?
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.
It does, there's an API for that as well. We need this API as well especially for CAGRA because it needs to own the knn graph that it sends to NN Descent. For that, it needs to construct an index first and that's why we need this API.
static const std::string RAFT_NAME = "raft"; | ||
using pinned_memory_resource = thrust::universal_host_pinned_memory_resource; | ||
|
||
using pinned_memory_resource = thrust::universal_host_pinned_memory_resource; |
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.
We should work to minimize the direct thrust calls in this algorithm. Not somehting that needs to be done in this PR, but can you create an issue to do this as tech debt in some future version?
The more direct calls we make to libraries we don't control, the more things can break as those libraries evolve. We have a lot of pinned stuff that we do within RAFT, and we should try to use RAFT calls as much as possible.
This PR is an amalgamation of the diff of 3 PRs in RAFT:
This PR also addresses part 1 of #419 and making CAGRA use the compiled headers of NN Descent, which seemed to have been a pending TODO
cuvs/cpp/src/neighbors/detail/cagra/cagra_build.cuh
Lines 36 to 37 in 009bb8d
Also, batch tests are disabled in this PR due to issue rapidsai/raft#2450. PR #424 will attempt to re-enable them.