Skip to content

Commit b85c561

Browse files
cjnoletHowardHuang1aamijardivyegalayan-zaretskiy
authored
Main merge release/26.08 (#2392)
<!-- Thank you for contributing to cuvs :) Here are some guidelines to help the review process go smoothly. 1. Please write a description in this text box of the changes that are being made. 2. Please ensure that you have written units tests for the changes made/features added. 3. If you are closing an issue please use one of the automatic closing words as noted here: https://help.github.com/articles/closing-issues-using-keywords/ 4. If your pull request is not ready for review but you want to make use of the continuous integration testing facilities please label it with `[WIP]`. 5. If your pull request is ready to be reviewed without requiring additional work on top of it, then remove the `[WIP]` label (if present) and replace it with `[REVIEW]`. If assistance is required to complete the functionality, for example when the C/C++ code of a feature is complete but Python bindings are still required, then add the label `[HELP-REQ]` so that others can triage and assist. The additional changes then can be implemented on top of the same PR. If the assistance is done by members of the rapidsAI team, then no additional actions are required by the creator of the original PR for this, otherwise the original author of the PR needs to give permission to the person(s) assisting to commit to their personal fork of the project. If that doesn't happen then a new PR based on the code of the original PR can be opened by the person assisting, which then will be the PR that will be merged. 6. Once all work has been done and review has taken place please do not add features or make changes out of the scope of those requested by the reviewer (doing this just add delays as already reviewed code ends up having to be re-reviewed/it is hard to tell what is new etc!). Further, please do not rebase your branch on master/force push/rewrite history, doing any of these causes the context of any comments made by reviewers to be lost. If conflicts occur against master they should be resolved by merging master into the branch used for making the pull request. Many thanks in advance for your cooperation! --> --------- Co-authored-by: Howard Huang <howardhuangb@gmail.com> Co-authored-by: aamijar <aamijar230@gmail.com> Co-authored-by: divyegala <divyegala@gmail.com> Co-authored-by: Yan Zaretskiy <yzaretskiy@nvidia.com> Co-authored-by: Artem M. Chirkin <9253178+achirkin@users.noreply.github.com> Co-authored-by: tarangj <jaintarang2015@gmail.com> Co-authored-by: Tarang Jain <40517122+tarang-jain@users.noreply.github.com> Co-authored-by: Igor Motov <igor@motovs.org>
1 parent f72199e commit b85c561

132 files changed

Lines changed: 13518 additions & 5414 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ cuvsResourcesCreate(&res);
132132
cuvsCagraIndexParamsCreate(&index_params);
133133
cuvsCagraIndexCreate(&index);
134134
135-
cuvsCagraBuild(res, index_params, dataset, index);
135+
cuvsDataset_t dataset_view;
136+
cuvsDatasetMakeStandardView(res, dataset, &dataset_view);
136137
138+
cuvsCagraBuild(res, index_params, dataset_view, index);
139+
140+
cuvsDatasetDestroy(dataset_view);
137141
cuvsCagraIndexDestroy(index);
138142
cuvsCagraIndexParamsDestroy(index_params);
139143
cuvsResourcesDestroy(res);

‎c/include/cuvs/core/all.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <cuvs/core/c_config.h>
1212
#include <cuvs/core/export.h>
1313
#include <cuvs/core/c_api.h>
14+
#include <cuvs/core/dataset.h>
1415

1516
#include <cuvs/cluster/kmeans.h>
1617

‎c/include/cuvs/core/dataset.h‎

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#pragma once
7+
8+
#include <cuvs/core/c_api.h>
9+
10+
#include <dlpack/dlpack.h>
11+
#include <stdbool.h>
12+
#include <stdint.h>
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif
17+
18+
/**
19+
* @brief Generic dataset layout kind for C API dataset handles.
20+
*/
21+
typedef enum {
22+
CUVS_DATASET_LAYOUT_STANDARD = 0,
23+
CUVS_DATASET_LAYOUT_PADDED = 1
24+
} cuvsDatasetLayout_t;
25+
26+
/**
27+
* @brief Memory space holding a C API dataset handle's data.
28+
*/
29+
typedef enum {
30+
CUVS_DATASET_MEM_TYPE_HOST = 0,
31+
CUVS_DATASET_MEM_TYPE_DEVICE = 1
32+
} cuvsDatasetMemType_t;
33+
34+
/**
35+
* @brief Dataset handle representing owning storage or a non-owning view.
36+
*
37+
* `addr` points to C++ dataset storage or view metadata managed by the C API. `mem_type`
38+
* identifies the memory space, `layout` identifies the data layout, and `is_owning` indicates
39+
* whether the handle owns its backing data.
40+
*/
41+
typedef struct {
42+
uintptr_t addr;
43+
void (*destroy_addr)(void*);
44+
DLDataType dtype;
45+
cuvsDatasetMemType_t mem_type;
46+
cuvsDatasetLayout_t layout;
47+
bool is_owning;
48+
} cuvsDataset;
49+
typedef cuvsDataset* cuvsDataset_t;
50+
51+
/**
52+
* @brief Create an empty owning dataset handle.
53+
*
54+
* The dataset storage, memory type, layout, and dtype are populated by the operation that fills
55+
* this handle.
56+
*/
57+
CUVS_EXPORT cuvsError_t cuvsDatasetCreate(cuvsDataset_t* dataset);
58+
59+
/**
60+
* @brief Create an owning padded dataset in the requested memory space.
61+
*
62+
* The source tensor may reside in host- or device-accessible memory. Its contents are copied into
63+
* newly allocated padded storage in `target_mem_type`.
64+
*
65+
* @param[in] res cuVS resources
66+
* @param[in] dataset source tensor
67+
* @param[in] target_mem_type memory space in which to allocate the padded dataset
68+
* @param[out] padded_dataset newly allocated owning padded dataset
69+
*/
70+
CUVS_EXPORT cuvsError_t cuvsDatasetMakePadded(cuvsResources_t res,
71+
DLManagedTensor* dataset,
72+
cuvsDatasetMemType_t target_mem_type,
73+
cuvsDataset_t* padded_dataset);
74+
75+
/**
76+
* @brief Create a non-owning padded dataset view from a host- or device-resident tensor.
77+
*
78+
* Memory residency is inferred from the tensor.
79+
*/
80+
CUVS_EXPORT cuvsError_t cuvsDatasetMakePaddedView(cuvsResources_t res,
81+
DLManagedTensor* dataset,
82+
cuvsDataset_t* padded_dataset);
83+
84+
/**
85+
* @brief Create a non-owning standard dataset view from a host- or device-resident tensor.
86+
*
87+
* Memory residency is inferred from the tensor.
88+
*/
89+
CUVS_EXPORT cuvsError_t cuvsDatasetMakeStandardView(cuvsResources_t res,
90+
DLManagedTensor* dataset,
91+
cuvsDataset_t* standard_dataset);
92+
93+
/** @brief Destroy a dataset handle created by a `cuvsDatasetMake*` function. */
94+
CUVS_EXPORT cuvsError_t cuvsDatasetDestroy(cuvsDataset_t dataset);
95+
96+
/** @brief Get the memory residency of a dataset handle. */
97+
CUVS_EXPORT cuvsError_t cuvsDatasetGetMemType(cuvsDataset_t dataset,
98+
cuvsDatasetMemType_t* mem_type);
99+
100+
/** @brief Get the layout of a dataset handle. */
101+
CUVS_EXPORT cuvsError_t cuvsDatasetGetLayout(cuvsDataset_t dataset, cuvsDatasetLayout_t* layout);
102+
103+
/** @brief Get whether a dataset handle owns its backing storage. */
104+
CUVS_EXPORT cuvsError_t cuvsDatasetGetIsOwning(cuvsDataset_t dataset, bool* is_owning);
105+
106+
/** @brief Get the element dtype of a dataset handle. */
107+
CUVS_EXPORT cuvsError_t cuvsDatasetGetDtype(cuvsDataset_t dataset, DLDataType* dtype);
108+
109+
#ifdef __cplusplus
110+
}
111+
#endif

0 commit comments

Comments
 (0)