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

Migrate feature diff for NN Descent from RAFT to cuVS #421

Merged
merged 19 commits into from
Nov 8, 2024

Conversation

divyegala
Copy link
Member

@divyegala divyegala commented Oct 21, 2024

This PR is an amalgamation of the diff of 3 PRs in RAFT:

  1. Enable distance return for NN Descent raft#2345
  2. Use slicing kernel to copy distances inside NN Descent raft#2380
  3. [FEA] Batching NN Descent raft#2403

This PR also addresses part 1 and 2 of #419, closes #391 and makes CAGRA use the compiled headers of NN Descent, which seemed to have been a pending TODO

// TODO: Fixme- this needs to be migrated
#include "../../nn_descent.cuh"

Also, batch tests are disabled in this PR due to issue rapidsai/raft#2450. PR #424 will attempt to re-enable them.

@divyegala divyegala added feature request New feature or request non-breaking Introduces a non-breaking change labels Oct 21, 2024
@divyegala divyegala self-assigned this Oct 21, 2024
@github-actions github-actions bot added the cpp label Oct 21, 2024
@divyegala divyegala marked this pull request as ready for review October 22, 2024 21:26
@divyegala divyegala requested a review from a team as a code owner October 22, 2024 21:26
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);
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

But the usage docs for this function don't reflect that. The whole idea behind these build functon is to abstract away the index so that the user (and anyone using the public APIs) don't need to think about the underlying index object. Instead of having the user construct the index object on their own, we shuold have them pass an optional knn graph into the build function that it then uses when it constructs the underlying index instance underneath.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in latest commit

@divyegala divyegala requested a review from a team as a code owner October 31, 2024 20:50
index<uint32_t>& index);

/**
* @brief Build nn-descent Index with dataset in host memory
Copy link
Member

Choose a reason for hiding this comment

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

Make sure all of these are exposed through the docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, they are part of the doxygen group that is already in the docs source.

@@ -146,6 +189,125 @@ class AnnNNDescentTest : public ::testing::TestWithParam<AnnNNDescentInputs> {
rmm::device_uvector<DataT> database;
};

template <typename DistanceT, typename DataT, typename IdxT>
class AnnNNDescentBatchTest : public ::testing::TestWithParam<AnnNNDescentBatchInputs> {
Copy link
Member

Choose a reason for hiding this comment

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

Do we have this consistently passing yet?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that's a follow-on item. The tests are disabled for now both here and in RAFT.

@divyegala
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit 29c0f5b into rapidsai:branch-24.12 Nov 8, 2024
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp feature request New feature or request non-breaking Introduces a non-breaking change Python
Projects
Development

Successfully merging this pull request may close these issues.

[BUG] Investigate NN Descent low recall in CUDA 12.5 and Python 3.10 wheel environment
2 participants