Skip to content

Commit cc0742a

Browse files
committed
Merge remote-tracking branch 'upstream/release/26.10' into HH-cagra-q-restore-26_08
2 parents 71bdef3 + d09b235 commit cc0742a

53 files changed

Lines changed: 2852 additions & 776 deletions

Some content is hidden

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

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ CUVS_EXPORT cuvsError_t cuvsDatasetMakePadded(cuvsResources_t res,
7676
cuvsDatasetMemType_t target_mem_type,
7777
cuvsDataset_t* padded_dataset);
7878

79+
/**
80+
* @brief Compress a dense dataset into a device PQ dataset.
81+
*
82+
* Only device output is currently supported.
83+
*/
84+
CUVS_EXPORT cuvsError_t cuvsDatasetMakePQ(cuvsResources_t res,
85+
cuvsPqParams_t params,
86+
cuvsDataset_t dataset,
87+
cuvsDatasetMemType_t target_mem_type,
88+
cuvsDataset_t* pq_dataset);
89+
7990
/**
8091
* @brief Create a non-owning padded dataset view from a host- or device-resident tensor.
8192
*

‎c/include/cuvs/neighbors/cagra.h‎

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,19 @@ enum cuvsCagraHnswHeuristicType {
8181
CUVS_CAGRA_HEURISTIC_SAME_GRAPH_FOOTPRINT = 1
8282
};
8383

84-
/** Parameters for VPQ compression. */
84+
/**
85+
* Parameters for PQ dataset compression.
86+
*
87+
* The `cuvsCagraCompressionParams` name is retained for ABI compatibility and is planned for
88+
* removal in the 27.02 ABI-breaking release. Use `cuvsPqParams` in new code.
89+
*/
8590
struct cuvsCagraCompressionParams {
8691
/**
8792
* The bit length of the vector element after compression by PQ.
8893
*
8994
* Possible values: [4, 5, 6, 7, 8].
9095
*
91-
* Hint: the smaller the 'pq_bits', the smaller the index size and the better the search
96+
* Hint: the smaller the `pq_bits`, the smaller the index size and the better the search
9297
* performance, but the lower the recall.
9398
*/
9499
uint32_t pq_bits;
@@ -118,8 +123,6 @@ struct cuvsCagraCompressionParams {
118123
double pq_kmeans_trainset_fraction;
119124
};
120125

121-
typedef struct cuvsCagraCompressionParams* cuvsCagraCompressionParams_t;
122-
123126
struct cuvsIvfPqParams {
124127
cuvsIvfPqIndexParams_t ivf_pq_build_params;
125128
cuvsIvfPqSearchParams_t ivf_pq_search_params;
@@ -270,15 +273,21 @@ CUVS_EXPORT cuvsError_t cuvsCagraMergeParamsCreate(cuvsCagraMergeParams_t* param
270273
CUVS_EXPORT cuvsError_t cuvsCagraMergeParamsDestroy(cuvsCagraMergeParams_t params);
271274

272275
/**
273-
* @brief Allocate CAGRA Compression params, and populate with default values
276+
* @brief Allocate CAGRA Compression params, and populate with default values.
277+
*
278+
* Deprecated: Use `cuvsPqParamsCreate`. This compatibility API is planned for removal in
279+
* the 27.02 ABI-breaking release.
274280
*
275281
* @param[in] params cuvsCagraCompressionParams_t to allocate
276282
* @return cuvsError_t
277283
*/
278284
CUVS_EXPORT cuvsError_t cuvsCagraCompressionParamsCreate(cuvsCagraCompressionParams_t* params);
279285

280286
/**
281-
* @brief De-allocate CAGRA Compression params
287+
* @brief De-allocate CAGRA Compression params.
288+
*
289+
* Deprecated: Use `cuvsPqParamsDestroy`. This compatibility API is planned for removal in
290+
* the 27.02 ABI-breaking release.
282291
*
283292
* @param[in] params
284293
* @return cuvsError_t
@@ -610,17 +619,15 @@ CUVS_EXPORT cuvsError_t cuvsCagraIndexGetDataset(cuvsCagraIndex_t index, DLManag
610619
CUVS_EXPORT cuvsError_t cuvsCagraIndexGetGraph(cuvsCagraIndex_t index, DLManagedTensor* graph);
611620

612621
/**
613-
* @brief Update a CAGRA index with a device dataset (padded or PQ).
622+
* @brief Update a CAGRA index with a device-padded or device-PQ dataset.
614623
*
615624
* This is the centralized dataset update/attach operation for C callers.
625+
* The index is rebound to the supplied layout. Device-padded and device-PQ
626+
* datasets can be attached to any supported index layout.
616627
*
617-
* - Device-padded dataset: if \p index is already device-padded, its dataset view is replaced in
618-
* place (same index object); otherwise the index is converted via attach and rebound.
619-
* - Device PQ dataset (from `cuvsDatasetMakePq`): if \p index is already PQ-typed, its
620-
* dataset view is replaced in place; otherwise the graph is copied into a new PQ-typed index
621-
* (CAGRA-Q). Search requires metric `L2Expanded`. The PQ handle must be owning.
622-
*
623-
* Caller retains ownership of \p dataset and must keep it alive while \p index uses it.
628+
* Device PQ datasets come from `cuvsDatasetMakePq`. Search requires metric
629+
* `L2Expanded`. Caller retains ownership of \p dataset and must keep it
630+
* alive while \p index uses it.
624631
*
625632
* @param[in] res cuvsResources_t opaque C handle
626633
* @param[in] dataset device-padded or owning device PQ dataset handle
@@ -689,6 +696,10 @@ CUVS_EXPORT cuvsError_t cuvsCagraUpdateDataset(cuvsResources_t res,
689696
* cuvsError_t res_destroy_status = cuvsResourcesDestroy(res);
690697
* @endcode
691698
*
699+
* A `CUVS_DATASET_LAYOUT_PQ` dataset created by `cuvsDatasetMakePQ` builds an iterative CAGRA-Q
700+
* index. VPQ input requires `L2Expanded` and `ITERATIVE_CAGRA_SEARCH` (or `AUTO_SELECT`), and the
701+
* VPQ dataset must outlive the index because the index stores a non-owning view.
702+
*
692703
* @param[in] res cuvsResources_t opaque C handle
693704
* @param[in] params cuvsCagraIndexParams_t used to build CAGRA index
694705
* @param[in] dataset cuvsDataset_t training dataset or dataset view
@@ -852,6 +863,9 @@ CUVS_EXPORT cuvsError_t cuvsCagraSearchMultiPartition(cuvsResources_t res,
852863
/**
853864
* Save the CAGRA graph to file without its dataset.
854865
*
866+
* This supports dense and PQ-backed indexes. The dataset must be attached separately after loading
867+
* the graph.
868+
*
855869
* Experimental, both the API and the serialization format are subject to change.
856870
*
857871
* @param[in] res cuvsResources_t opaque C handle
@@ -867,7 +881,7 @@ CUVS_EXPORT cuvsError_t cuvsCagraSerializeGraph(cuvsResources_t res,
867881
*
868882
* The index stores a non-owning dataset view. The caller must keep the dataset backing that view
869883
* alive while this function runs. Returns CUVS_ERROR without modifying the destination file if
870-
* the index has no attached dataset.
884+
* the index has no attached dataset. PQ datasets are not serialized by this function.
871885
*
872886
* Experimental, both the API and the serialization format are subject to change.
873887
*
@@ -911,7 +925,7 @@ CUVS_EXPORT cuvsError_t cuvsCagraSerializeToHnswlib(cuvsResources_t res,
911925
* Load the CAGRA graph from file without retaining a serialized dataset.
912926
*
913927
* This succeeds whether or not the file contains a dataset. Use cuvsCagraUpdateDataset to attach a
914-
* caller-owned device-padded dataset view before searching the graph-only index.
928+
* caller-owned device-padded or device-PQ dataset before searching the graph-only index.
915929
*
916930
* Experimental, both the API and the serialization format are subject to change.
917931
*

0 commit comments

Comments
 (0)