11diff --git a/faiss/gpu/impl/BinaryCuvsCagra.cu b/faiss/gpu/impl/BinaryCuvsCagra.cu
2- index b331fdc..c7b5733 100644
2+ index 4be7cebb8..42315d027 100644
33--- a/faiss/gpu/impl/BinaryCuvsCagra.cu
44+++ b/faiss/gpu/impl/BinaryCuvsCagra.cu
5- @@ -29,5 +29,6 @@
6- #include <cuvs/neighbors/cagra.hpp>
7- #include <raft/core/device_mdspan.hpp>
5+ @@ -33,6 +33,7 @@
86 #include <raft/core/device_resources.hpp>
97 #include <raft/core/resource/thrust_policy.hpp>
108 #include <raft/linalg/map.cuh>
119+ #include <utility>
12- @@ -58,7 +58,6 @@ BinaryCuvsCagra::BinaryCuvsCagra(
10+
11+ #include <thrust/copy.h>
12+ #include <thrust/device_ptr.h>
13+ @@ -60,7 +61,6 @@ BinaryCuvsCagra::BinaryCuvsCagra(
1314
1415 index_params_.intermediate_graph_degree = intermediate_graph_degree;
1516 index_params_.graph_degree = graph_degree;
1617- index_params_.attach_dataset_on_build = store_dataset;
1718
1819 index_params_.metric = cuvs::distance::DistanceType::BitwiseHamming;
1920
20- @@ -110 ,12 +109 ,14 @@ BinaryCuvsCagra::BinaryCuvsCagra(
21+ @@ -112 ,12 +112 ,14 @@ BinaryCuvsCagra::BinaryCuvsCagra(
2122 auto dataset_mds =
2223 raft::make_device_matrix_view<const uint8_t, int64_t>(
2324 train_dataset, n, dim / 8);
@@ -33,7 +34,7 @@ index b331fdc..c7b5733 100644
3334 raft::make_const_mdspan(knn_graph_copy.view()));
3435 } else if (!distances_on_gpu && !knn_graph_on_gpu) {
3536 // copy idx_t (int64_t) host knn_graph to uint32_t host knn_graph
36- @@ -128 ,12 +129 ,14 @@ BinaryCuvsCagra::BinaryCuvsCagra(
37+ @@ -130 ,12 +132 ,14 @@ BinaryCuvsCagra::BinaryCuvsCagra(
3738
3839 auto dataset_mds = raft::make_host_matrix_view<const uint8_t, int64_t>(
3940 train_dataset, n, dim / 8);
@@ -49,7 +50,7 @@ index b331fdc..c7b5733 100644
4950 raft::make_const_mdspan(knn_graph_copy.view()));
5051 } else {
5152 FAISS_THROW_MSG(
52- @@ -166 ,17 +169 ,23 @@ void BinaryCuvsCagra::train(idx_t n, const uint8_t* x) {
53+ @@ -173 ,17 +177 ,23 @@ void BinaryCuvsCagra::train(idx_t n, const uint8_t* x) {
5354 if (getDeviceForAddress(x) >= 0) {
5455 auto dataset = raft::make_device_matrix_view<const uint8_t, int64_t>(
5556 x, n, dim_ / 8);
@@ -75,7 +76,7 @@ index b331fdc..c7b5733 100644
7576 }
7677 }
7778
78- @@ -212 ,14 +221 ,23 @@ void BinaryCuvsCagra::search(
79+ @@ -220 ,14 +230 ,23 @@ void BinaryCuvsCagra::search(
7980
8081 if (!store_dataset_) {
8182 if (getDeviceForAddress(storage_) >= 0) {
@@ -102,7 +103,7 @@ index b331fdc..c7b5733 100644
102103 }
103104 store_dataset_ = true;
104105 }
105- @@ -280 ,6 +295 ,7 @@ void BinaryCuvsCagra::search(
106+ @@ -307 ,6 +326 ,7 @@ void BinaryCuvsCagra::search(
106107
107108 void BinaryCuvsCagra::reset() {
108109 cuvs_index.reset();
@@ -111,7 +112,7 @@ index b331fdc..c7b5733 100644
111112
112113 idx_t BinaryCuvsCagra::get_knngraph_degree() const {
113114diff --git a/faiss/gpu/impl/BinaryCuvsCagra.cuh b/faiss/gpu/impl/BinaryCuvsCagra.cuh
114- index a14480b..7cbfe39 100644
115+ index 3c7a9eb68..1038380a2 100644
115116--- a/faiss/gpu/impl/BinaryCuvsCagra.cuh
116117+++ b/faiss/gpu/impl/BinaryCuvsCagra.cuh
117118@@ -28,12 +28,14 @@
@@ -129,7 +130,7 @@ index a14480b..7cbfe39 100644
129130
130131 namespace faiss {
131132
132- @@ -115 ,6 +117 ,10 @@ class BinaryCuvsCagra {
133+ @@ -117 ,6 +119 ,10 @@ class BinaryCuvsCagra {
133134 /// Parameters to build CAGRA graph using NN Descent
134135 size_t nn_descent_niter_ = 20;
135136
@@ -141,24 +142,26 @@ index a14480b..7cbfe39 100644
141142 std::shared_ptr<cuvs::neighbors::cagra::index<uint8_t, uint32_t>>
142143 cuvs_index{nullptr};
143144diff --git a/faiss/gpu/impl/CuvsCagra.cu b/faiss/gpu/impl/CuvsCagra.cu
144- index 755817f..0eb03ae 100644
145+ index 6ff3419b7..f03a5e5f0 100644
145146--- a/faiss/gpu/impl/CuvsCagra.cu
146147+++ b/faiss/gpu/impl/CuvsCagra.cu
147- @@ -29,4 +29,5 @@
148- #include <cuvs/neighbors/cagra.hpp>
148+ @@ -32,6 +32,7 @@
149149 #include <raft/core/device_mdspan.hpp>
150150 #include <raft/core/device_resources.hpp>
151151 #include <raft/core/resource/thrust_policy.hpp>
152152+ #include <utility>
153- @@ -75,7 +75,6 @@ CuvsCagra<data_t>::CuvsCagra(
153+
154+ #include <thrust/copy.h>
155+ #include <thrust/device_ptr.h>
156+ @@ -78,7 +79,6 @@ CuvsCagra<data_t>::CuvsCagra(
154157
155158 index_params_.intermediate_graph_degree = intermediate_graph_degree;
156159 index_params_.graph_degree = graph_degree;
157160- index_params_.attach_dataset_on_build = store_dataset;
158161 index_params_.guarantee_connectivity = guarantee_connectivity;
159162
160163 if (!ivf_pq_search_params_) {
161- @@ -133 ,12 +132 ,14 @@ CuvsCagra<data_t>::CuvsCagra(
164+ @@ -136 ,12 +136 ,14 @@ CuvsCagra<data_t>::CuvsCagra(
162165
163166 auto dataset_mds = raft::make_device_matrix_view<const data_t, int64_t>(
164167 dataset, n, dim);
@@ -174,7 +177,7 @@ index 755817f..0eb03ae 100644
174177 raft::make_const_mdspan(knn_graph_copy.view()));
175178 } else if (!dataset_on_gpu && !knn_graph_on_gpu) {
176179 // copy idx_t (int64_t) host knn_graph to uint32_t host knn_graph
177- @@ -151 ,12 +152 ,14 @@ CuvsCagra<data_t>::CuvsCagra(
180+ @@ -154 ,12 +156 ,14 @@ CuvsCagra<data_t>::CuvsCagra(
178181
179182 auto dataset_mds = raft::make_host_matrix_view<const data_t, int64_t>(
180183 dataset, n, dim);
@@ -190,7 +193,7 @@ index 755817f..0eb03ae 100644
190193 raft::make_const_mdspan(knn_graph_copy.view()));
191194 } else {
192195 FAISS_THROW_MSG(
193- @@ -203 ,17 +206 ,23 @@ void CuvsCagra<data_t>::train(idx_t n, const data_t* x) {
196+ @@ -206 ,17 +210 ,23 @@ void CuvsCagra<data_t>::train(idx_t n, const data_t* x) {
194197 if (getDeviceForAddress(x) >= 0) {
195198 auto dataset = raft::make_device_matrix_view<const data_t, int64_t>(
196199 x, n, dim_);
@@ -216,7 +219,7 @@ index 755817f..0eb03ae 100644
216219 }
217220 }
218221
219- @@ -248 ,13 +257 ,22 @@ void CuvsCagra<data_t>::search(
222+ @@ -252 ,13 +262 ,22 @@ void CuvsCagra<data_t>::search(
220223
221224 if (!store_dataset_) {
222225 if (getDeviceForAddress(storage_) >= 0) {
@@ -242,7 +245,7 @@ index 755817f..0eb03ae 100644
242245 }
243246 store_dataset_ = true;
244247 }
245- @@ -303 ,6 +318 ,7 @@ void CuvsCagra<data_t>::search(
248+ @@ -326 ,6 +345 ,7 @@ void CuvsCagra<data_t>::search(
246249 template <typename data_t>
247250 void CuvsCagra<data_t>::reset() {
248251 cuvs_index.reset();
@@ -251,26 +254,26 @@ index 755817f..0eb03ae 100644
251254
252255 template <typename data_t>
253256diff --git a/faiss/gpu/impl/CuvsCagra.cuh b/faiss/gpu/impl/CuvsCagra.cuh
254- index a10e9fb..b5c2bcd 100644
257+ index b4c1989c6..3ad960b92 100644
255258--- a/faiss/gpu/impl/CuvsCagra.cuh
256259+++ b/faiss/gpu/impl/CuvsCagra.cuh
257- @@ -27,13 +27,15 @@
260+ @@ -27,6 +27,7 @@
258261 #include <faiss/gpu/GpuResources.h>
259262 #include <cstddef>
260263 #include <faiss/gpu/utils/Tensor.cuh>
261264+ #include <memory>
262265 #include <optional>
263266
264267 #include <faiss/MetricType.h>
265- #include <faiss/impl/IDSelector.h>
268+ @@ -34,6 +35,7 @@
266269
267270 #include <cuvs/neighbors/cagra.hpp>
268271 #include <cuvs/neighbors/ivf_pq.hpp>
269272+ #include <raft/core/device_mdarray.hpp>
270273
271274 namespace faiss {
272275
273- @@ -147 ,6 +149 ,10 @@ class CuvsCagra {
276+ @@ -154 ,6 +156 ,10 @@ class CuvsCagra {
274277 /// Parameter to use MST optimization to guarantee graph connectivity
275278 bool guarantee_connectivity_ = false;
276279
0 commit comments