-
Notifications
You must be signed in to change notification settings - Fork 207
[REVIEW] New Dataset API Clarifying Ownership #1846
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
base: main
Are you sure you want to change the base?
Changes from all commits
d78f459
4febf8b
b403473
8d6833a
5447a4c
17ab09d
fb556c9
37d28dc
f30e7ed
26b46a2
a38fb18
393367a
70b6b58
0c3df3e
dbc47e1
27a6eb3
355adb3
5e5445b
1d4ca18
187e66e
e894477
84573a6
dfb0d4c
7be7329
0c9432d
234606e
20f7ea7
82979c8
167cb75
07caefa
f15317f
ee0b5e4
db16de1
08e5e9d
b0cc113
4098a44
b130341
b897116
547657a
c124b00
bce0f36
a7fbf2f
c15ed1e
8dd7436
34d499f
f41c355
b0e5369
81341c9
f9e83c5
5598753
b4892a5
485b820
7b9edda
14f6bfe
110f9f3
69d45fe
b7148c3
15a8834
9543191
2dee124
7071656
3bbf993
c8b5397
d81f873
98b5697
c88b23c
b32e868
1a88bb8
1f24980
5e5ed60
5cadbad
12272d2
e689b04
58ee2e5
88cfb37
706f95d
231a9e1
8aac5bd
d869208
ad30ca1
4c3faef
6676c3a
d53c4a8
adcb0a2
6a91ca4
7f0ba65
945a249
a2d937a
063e439
cc9c1f3
c3edfc7
5fa5bf3
c5cfcf2
58c7bbd
2b8801c
b12a6c2
8d99fa7
285e5ed
93557e4
e46300f
b1c979b
c6405c6
3ccbe5c
4117f23
0340038
0e2691c
7dfbf85
23b07d3
46935d4
cebcfd4
88da190
79d0fd8
f9adbc5
d1c1dd4
5223862
8c836ec
11b0c61
1de47f9
c6b4901
99ab789
3ea5f56
ea4c1d6
68c3f6b
f7f607d
34d2dc4
3298366
0af9527
6459568
e3cf3d3
e819312
1c1eb55
fa31267
40bc7eb
fd9d591
186d81e
06e879d
d95dd91
a8d27a6
44e8888
6021700
34f6460
8b3d8f8
5411928
de2000b
c0190fa
baab6a7
98ef788
6fdfebf
f356e48
53ef0e6
428542e
6e9b7a5
178eb3f
a09c834
c3af8bd
dfedfb9
6d756e5
828c371
c630451
4258dc5
f58c21e
e0fce27
73bb010
0dfeffe
9c024c6
55736de
af2fd42
598e861
e795819
26b87e5
2804440
48fc8d5
ff8cc82
4d7d0a6
bb275f1
217e5bd
8001bf4
3803e00
c31ea7c
df925ec
f722c2c
fadf92e
6c47d31
4dbceca
f22232e
77f238a
06c4050
809e466
3bfd17e
c5c060d
51b19f5
a69ca2e
6679a0f
262447a
48311e5
368d058
3b4fd60
0ca9cba
a5d8eb2
450dc58
bf23049
2ecd73b
10bd460
f0c980f
cce33bf
75972a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,26 +84,26 @@ extern "C" cuvsError_t cuvsMultiGpuCagraIndexDestroy(cuvsMultiGpuCagraIndex_t in | |
| // Properly clean up the templated inner object based on dtype, like single GPU API | ||
| if (index->dtype.code == kDLFloat && index->dtype.bits == 32) { | ||
| auto mg_index_ptr = | ||
| reinterpret_cast<cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<float, uint32_t>, | ||
| reinterpret_cast<cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<float, uint32_t>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we know it will be |
||
| float, | ||
| uint32_t>*>(index->addr); | ||
| delete mg_index_ptr; | ||
| } else if (index->dtype.code == kDLFloat && index->dtype.bits == 16) { | ||
| auto mg_index_ptr = | ||
| reinterpret_cast<cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<half, uint32_t>, | ||
| reinterpret_cast<cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<half, uint32_t>, | ||
| half, | ||
| uint32_t>*>(index->addr); | ||
| delete mg_index_ptr; | ||
| } else if (index->dtype.code == kDLInt && index->dtype.bits == 8) { | ||
| auto mg_index_ptr = reinterpret_cast< | ||
| cuvs::neighbors:: | ||
| mg_index<cuvs::neighbors::cagra::index<int8_t, uint32_t>, int8_t, uint32_t>*>( | ||
| mg_index<cuvs::neighbors::cagra::device_padded_index<int8_t, uint32_t>, int8_t, uint32_t>*>( | ||
| index->addr); | ||
| delete mg_index_ptr; | ||
| } else if (index->dtype.code == kDLUInt && index->dtype.bits == 8) { | ||
| auto mg_index_ptr = reinterpret_cast< | ||
| cuvs::neighbors:: | ||
| mg_index<cuvs::neighbors::cagra::index<uint8_t, uint32_t>, uint8_t, uint32_t>*>( | ||
| mg_index<cuvs::neighbors::cagra::device_padded_index<uint8_t, uint32_t>, uint8_t, uint32_t>*>( | ||
| index->addr); | ||
| delete mg_index_ptr; | ||
| } | ||
|
|
@@ -159,7 +159,7 @@ void* _mg_build(cuvsResources_t res, | |
| auto mds = cuvs::core::from_dlpack<mdspan_type>(dataset_tensor); | ||
|
|
||
| auto mg_index = | ||
| new cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<T, uint32_t>, T, uint32_t>( | ||
| new cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<T, uint32_t>, T, uint32_t>( | ||
| cuvs::neighbors::cagra::build(*res_ptr, mg_params, mds)); | ||
|
|
||
| return mg_index; | ||
|
|
@@ -175,7 +175,7 @@ void _mg_search(cuvsResources_t res, | |
| { | ||
| auto res_ptr = reinterpret_cast<raft::resources*>(res); | ||
| auto mg_index_ptr = reinterpret_cast< | ||
| cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<T, uint32_t>, T, uint32_t>*>( | ||
| cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<T, uint32_t>, T, uint32_t>*>( | ||
| index.addr); | ||
|
|
||
| auto mg_search_params = | ||
|
|
@@ -202,7 +202,7 @@ void _mg_extend(cuvsResources_t res, | |
| { | ||
| auto res_ptr = reinterpret_cast<raft::resources*>(res); | ||
| auto mg_index_ptr = reinterpret_cast< | ||
| cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<T, uint32_t>, T, uint32_t>*>( | ||
| cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<T, uint32_t>, T, uint32_t>*>( | ||
| index.addr); | ||
|
|
||
| using vectors_mdspan_type = raft::host_matrix_view<const T, int64_t, raft::row_major>; | ||
|
|
@@ -222,7 +222,7 @@ void _mg_serialize(cuvsResources_t res, cuvsMultiGpuCagraIndex index, const char | |
| { | ||
| auto res_ptr = reinterpret_cast<raft::resources*>(res); | ||
| auto mg_index_ptr = reinterpret_cast< | ||
| cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<T, uint32_t>, T, uint32_t>*>( | ||
| cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<T, uint32_t>, T, uint32_t>*>( | ||
| index.addr); | ||
|
|
||
| cuvs::neighbors::cagra::serialize(*res_ptr, *mg_index_ptr, std::string(filename)); | ||
|
|
@@ -233,7 +233,7 @@ void* _mg_deserialize(cuvsResources_t res, const char* filename) | |
| { | ||
| auto res_ptr = reinterpret_cast<raft::resources*>(res); | ||
| auto mg_index = | ||
| new cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<T, uint32_t>, T, uint32_t>( | ||
| new cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<T, uint32_t>, T, uint32_t>( | ||
| cuvs::neighbors::cagra::deserialize<T, uint32_t>(*res_ptr, std::string(filename))); | ||
|
|
||
| return mg_index; | ||
|
|
@@ -244,7 +244,7 @@ void* _mg_distribute(cuvsResources_t res, const char* filename) | |
| { | ||
| auto res_ptr = reinterpret_cast<raft::resources*>(res); | ||
| auto mg_index = | ||
| new cuvs::neighbors::mg_index<cuvs::neighbors::cagra::index<T, uint32_t>, T, uint32_t>( | ||
| new cuvs::neighbors::mg_index<cuvs::neighbors::cagra::device_padded_index<T, uint32_t>, T, uint32_t>( | ||
| cuvs::neighbors::cagra::distribute<T, uint32_t>(*res_ptr, std::string(filename))); | ||
|
|
||
| return mg_index; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
|
|
@@ -71,7 +71,7 @@ void* _build(cuvsResources_t res, cuvsTieredIndexParams params, DLManagedTensor* | |
| case CUVS_TIERED_INDEX_ALGO_CAGRA: { | ||
| auto build_params = tiered_index::index_params<cagra::index_params>(); | ||
| convert_c_index_params(params, dataset.shape[0], dataset.shape[1], &build_params); | ||
| return new tiered_index::index<cagra::index<T, uint32_t>>( | ||
| return new tiered_index::index<cagra::device_padded_index<T, uint32_t>>( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above. We are not enforcing that the DLPack managed tensor be a device padded type |
||
| tiered_index::build(*res_ptr, build_params, mds)); | ||
| } | ||
| case CUVS_TIERED_INDEX_ALGO_IVF_FLAT: { | ||
|
|
@@ -219,7 +219,7 @@ extern "C" cuvsError_t cuvsTieredIndexDestroy(cuvsTieredIndex_t index_c_ptr) | |
| switch (index.algo) { | ||
| case CUVS_TIERED_INDEX_ALGO_CAGRA: { | ||
| auto index_ptr = | ||
| reinterpret_cast<tiered_index::index<cagra::index<float, uint32_t>>*>(index.addr); | ||
| reinterpret_cast<tiered_index::index<cagra::device_padded_index<float, uint32_t>>*>(index.addr); | ||
| delete index_ptr; | ||
| break; | ||
| } | ||
|
|
@@ -292,7 +292,7 @@ extern "C" cuvsError_t cuvsTieredIndexSearch(cuvsResources_t res, | |
|
|
||
| switch (index.algo) { | ||
| case CUVS_TIERED_INDEX_ALGO_CAGRA: { | ||
| _search<cagra::index<float, uint32_t>>( | ||
| _search<cagra::device_padded_index<float, uint32_t>>( | ||
| res, search_params, index, queries_tensor, neighbors_tensor, distances_tensor, filter); | ||
| break; | ||
| } | ||
|
|
@@ -336,7 +336,7 @@ extern "C" cuvsError_t cuvsTieredIndexExtend(cuvsResources_t res, | |
| auto index = *index_c_ptr; | ||
| switch (index.algo) { | ||
| case CUVS_TIERED_INDEX_ALGO_CAGRA: { | ||
| _extend<cagra::index<float, uint32_t>>(res, new_vectors, index); | ||
| _extend<cagra::device_padded_index<float, uint32_t>>(res, new_vectors, index); | ||
| break; | ||
| } | ||
| case CUVS_TIERED_INDEX_ALGO_IVF_FLAT: { | ||
|
|
@@ -363,7 +363,7 @@ extern "C" cuvsError_t cuvsTieredIndexMerge(cuvsResources_t res, | |
|
|
||
| switch (indices[0]->algo) { | ||
| case CUVS_TIERED_INDEX_ALGO_CAGRA: { | ||
| _merge<cagra::index<float, uint32_t>>(res, *params, indices, num_indices, output_index); | ||
| _merge<cagra::device_padded_index<float, uint32_t>>(res, *params, indices, num_indices, output_index); | ||
| break; | ||
| } | ||
| case CUVS_TIERED_INDEX_ALGO_IVF_FLAT: { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.