From c636914a7324bac872f468f8543e6ef1546dc548 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 24 Jul 2024 14:55:47 -0700 Subject: [PATCH 1/4] popc public api --- cpp/src/neighbors/detail/knn_brute_force.cuh | 7 +++++-- cpp/test/neighbors/brute_force_prefiltered.cu | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cpp/src/neighbors/detail/knn_brute_force.cuh b/cpp/src/neighbors/detail/knn_brute_force.cuh index fe425fe8f..2443f7994 100644 --- a/cpp/src/neighbors/detail/knn_brute_force.cuh +++ b/cpp/src/neighbors/detail/knn_brute_force.cuh @@ -28,8 +28,9 @@ #include "./knn_utils.cuh" #include -#include #include +#include +#include #include #include #include @@ -591,10 +592,12 @@ void brute_force_search_filtered( auto nnz_view = raft::make_device_scalar_view(nnz.data()); auto filter_view = raft::make_device_vector_view(filter.data(), filter.n_elements()); + IdxT size_h = n_queries * n_dataset; + auto size_view = raft::make_host_scalar_view(&size_h); // TODO(rhdong): Need to switch to the public API, // with the issue: https://github.com/rapidsai/cuvs/issues/158 - raft::detail::popc(res, filter_view, n_queries * n_dataset, nnz_view); + raft::popc(res, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); raft::resource::sync_stream(res, stream); diff --git a/cpp/test/neighbors/brute_force_prefiltered.cu b/cpp/test/neighbors/brute_force_prefiltered.cu index 17166fd7a..05365f566 100644 --- a/cpp/test/neighbors/brute_force_prefiltered.cu +++ b/cpp/test/neighbors/brute_force_prefiltered.cu @@ -20,7 +20,8 @@ #include #include -#include +#include +#include #include #include #include @@ -192,12 +193,14 @@ class PrefilteredBruteForceTest auto nnz_view = raft::make_device_scalar_view(nnz.data()); auto filter_view = raft::make_device_vector_view(filter_d.data(), filter_d.size()); + index_t size_h = m * n; + auto size_view = raft::make_host_scalar_view(&size_h); set_bitmap(src, dst, bitmap, n_edges, n, stream); // TODO(rhdong): Need to switch to the public API, // with the issue: https://github.com/rapidsai/cuvs/issues/158 - raft::detail::popc(handle, filter_view, m * n, nnz_view); + raft::popc(handle, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); raft::resource::sync_stream(handle, stream); From 182952e2d2e9047d76d7692cc0dfdd27c45431ce Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 24 Jul 2024 16:13:22 -0700 Subject: [PATCH 2/4] account for future changes --- cpp/src/neighbors/detail/knn_brute_force.cuh | 4 ++-- cpp/test/neighbors/brute_force_prefiltered.cu | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/neighbors/detail/knn_brute_force.cuh b/cpp/src/neighbors/detail/knn_brute_force.cuh index 2443f7994..beb2c307e 100644 --- a/cpp/src/neighbors/detail/knn_brute_force.cuh +++ b/cpp/src/neighbors/detail/knn_brute_force.cuh @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -47,6 +46,7 @@ #include #include #include +#include #include #include @@ -597,7 +597,7 @@ void brute_force_search_filtered( // TODO(rhdong): Need to switch to the public API, // with the issue: https://github.com/rapidsai/cuvs/issues/158 - raft::popc(res, filter_view, size_view, nnz_view); + raft::util::popc(res, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); raft::resource::sync_stream(res, stream); diff --git a/cpp/test/neighbors/brute_force_prefiltered.cu b/cpp/test/neighbors/brute_force_prefiltered.cu index 05365f566..b8c4973ec 100644 --- a/cpp/test/neighbors/brute_force_prefiltered.cu +++ b/cpp/test/neighbors/brute_force_prefiltered.cu @@ -21,12 +21,12 @@ #include #include -#include #include #include #include #include #include +#include #include @@ -200,7 +200,7 @@ class PrefilteredBruteForceTest // TODO(rhdong): Need to switch to the public API, // with the issue: https://github.com/rapidsai/cuvs/issues/158 - raft::popc(handle, filter_view, size_view, nnz_view); + raft::util::popc(handle, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); raft::resource::sync_stream(handle, stream); From cc05eabd3185464c5850e71e9a74c1c5e7900c80 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 24 Jul 2024 18:54:28 -0700 Subject: [PATCH 3/4] remove todos --- cpp/src/neighbors/detail/knn_brute_force.cuh | 2 -- cpp/test/neighbors/brute_force_prefiltered.cu | 2 -- 2 files changed, 4 deletions(-) diff --git a/cpp/src/neighbors/detail/knn_brute_force.cuh b/cpp/src/neighbors/detail/knn_brute_force.cuh index beb2c307e..e434917ce 100644 --- a/cpp/src/neighbors/detail/knn_brute_force.cuh +++ b/cpp/src/neighbors/detail/knn_brute_force.cuh @@ -595,8 +595,6 @@ void brute_force_search_filtered( IdxT size_h = n_queries * n_dataset; auto size_view = raft::make_host_scalar_view(&size_h); - // TODO(rhdong): Need to switch to the public API, - // with the issue: https://github.com/rapidsai/cuvs/issues/158 raft::util::popc(res, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); diff --git a/cpp/test/neighbors/brute_force_prefiltered.cu b/cpp/test/neighbors/brute_force_prefiltered.cu index b8c4973ec..cb659764c 100644 --- a/cpp/test/neighbors/brute_force_prefiltered.cu +++ b/cpp/test/neighbors/brute_force_prefiltered.cu @@ -198,8 +198,6 @@ class PrefilteredBruteForceTest set_bitmap(src, dst, bitmap, n_edges, n, stream); - // TODO(rhdong): Need to switch to the public API, - // with the issue: https://github.com/rapidsai/cuvs/issues/158 raft::util::popc(handle, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); From 8404782867a1cc546fe89be852d5011e90bca7b5 Mon Sep 17 00:00:00 2001 From: divyegala Date: Thu, 25 Jul 2024 09:03:26 -0700 Subject: [PATCH 4/4] namespace --- cpp/src/neighbors/detail/knn_brute_force.cuh | 2 +- cpp/test/neighbors/brute_force_prefiltered.cu | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/neighbors/detail/knn_brute_force.cuh b/cpp/src/neighbors/detail/knn_brute_force.cuh index e434917ce..f05bebf3f 100644 --- a/cpp/src/neighbors/detail/knn_brute_force.cuh +++ b/cpp/src/neighbors/detail/knn_brute_force.cuh @@ -595,7 +595,7 @@ void brute_force_search_filtered( IdxT size_h = n_queries * n_dataset; auto size_view = raft::make_host_scalar_view(&size_h); - raft::util::popc(res, filter_view, size_view, nnz_view); + raft::popc(res, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); raft::resource::sync_stream(res, stream); diff --git a/cpp/test/neighbors/brute_force_prefiltered.cu b/cpp/test/neighbors/brute_force_prefiltered.cu index cb659764c..2b8ae9d9a 100644 --- a/cpp/test/neighbors/brute_force_prefiltered.cu +++ b/cpp/test/neighbors/brute_force_prefiltered.cu @@ -198,7 +198,7 @@ class PrefilteredBruteForceTest set_bitmap(src, dst, bitmap, n_edges, n, stream); - raft::util::popc(handle, filter_view, size_view, nnz_view); + raft::popc(handle, filter_view, size_view, nnz_view); raft::copy(&nnz_h, nnz.data(), 1, stream); raft::resource::sync_stream(handle, stream);