Skip to content

Commit b0ff258

Browse files
committed
fix prefix compilation errors
1 parent 4551976 commit b0ff258

5 files changed

Lines changed: 30 additions & 30 deletions

File tree

c/include/cuvs/neighbors/ivf_pq.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ extern "C" {
2323
* @brief A type for specifying how PQ codebooks are created
2424
*
2525
*/
26-
enum cuvsCodebookGen {
27-
CUVS_CODEBOOK_GEN_PER_SUBSPACE = 0,
28-
CUVS_CODEBOOK_GEN_PER_CLUSTER = 1,
26+
enum cuvsIvfPqCodebookGen {
27+
CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE = 0,
28+
CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER = 1,
2929
};
3030

3131
/**
3232
* @brief A type for specifying the memory layout of IVF-PQ list data
3333
*
3434
*/
35-
enum cuvsListLayout {
36-
CUVS_LIST_LAYOUT_FLAT = 0,
37-
CUVS_LIST_LAYOUT_INTERLEAVED = 1,
35+
enum cuvsIvfPqListLayout {
36+
CUVS_IVF_PQ_LIST_LAYOUT_FLAT = 0,
37+
CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED = 1,
3838
};
3939

4040
/**
@@ -89,7 +89,7 @@ struct cuvsIvfPqIndexParams {
8989
*/
9090
uint32_t pq_dim;
9191
/** How PQ codebooks are created. */
92-
enum cuvsCodebookGen codebook_kind;
92+
enum cuvsIvfPqCodebookGen codebook_kind;
9393
/**
9494
* Apply a random rotation matrix on the input data and queries even if `dim % pq_dim == 0`.
9595
*
@@ -126,11 +126,11 @@ struct cuvsIvfPqIndexParams {
126126
/**
127127
* Memory layout of the IVF-PQ list data.
128128
*
129-
* - CUVS_LIST_LAYOUT_FLAT: Codes are stored contiguously, one vector's codes after another.
130-
* - CUVS_LIST_LAYOUT_INTERLEAVED: Codes are interleaved for optimized search performance.
129+
* - CUVS_IVF_PQ_LIST_LAYOUT_FLAT: Codes are stored contiguously, one vector's codes after another.
130+
* - CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED: Codes are interleaved for optimized search performance.
131131
* This is the default and recommended for search workloads.
132132
*/
133-
enum cuvsListLayout codes_layout;
133+
enum cuvsIvfPqListLayout codes_layout;
134134
};
135135

136136
typedef struct cuvsIvfPqIndexParams* cuvsIvfPqIndexParams_t;
@@ -311,8 +311,8 @@ cuvsError_t cuvsIvfPqIndexGetCentersPadded(cuvsIvfPqIndex_t index, DLManagedTens
311311
/**
312312
* @brief Get the PQ cluster centers
313313
*
314-
* - CUVS_CODEBOOK_GEN_PER_SUBSPACE: [pq_dim , pq_len, pq_book_size]
315-
* - CUVS_CODEBOOK_GEN_PER_CLUSTER: [n_lists, pq_len, pq_book_size]
314+
* - CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE: [pq_dim , pq_len, pq_book_size]
315+
* - CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER: [n_lists, pq_len, pq_book_size]
316316
*
317317
* @param[in] index cuvsIvfPqIndex_t Built Ivf-Pq index
318318
* @param[out] pq_centers Output tensor that will be populated with a non-owning view of the data
@@ -460,8 +460,8 @@ cuvsError_t cuvsIvfPqBuild(cuvsResources_t res,
460460
* matrices)
461461
* @param[in] dim dimensionality of the input data
462462
* @param[in] pq_centers PQ codebook on device memory with required shape:
463-
* - codebook_kind CUVS_CODEBOOK_GEN_PER_SUBSPACE: [pq_dim, pq_len, pq_book_size]
464-
* - codebook_kind CUVS_CODEBOOK_GEN_PER_CLUSTER: [n_lists, pq_len, pq_book_size]
463+
* - codebook_kind CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE: [pq_dim, pq_len, pq_book_size]
464+
* - codebook_kind CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER: [n_lists, pq_len, pq_book_size]
465465
* @param[in] centers Cluster centers in the original space [n_lists, dim_ext]
466466
* where dim_ext = round_up(dim + 1, 8)
467467
* @param[in] centers_rot Rotated cluster centers [n_lists, rot_dim]

c/src/neighbors/cagra.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static void _populate_c_ivf_pq_params(cuvsIvfPqParams* c_ivf_pq,
365365
c_ivf_pq->ivf_pq_build_params->kmeans_trainset_fraction = bp.kmeans_trainset_fraction;
366366
c_ivf_pq->ivf_pq_build_params->pq_bits = bp.pq_bits;
367367
c_ivf_pq->ivf_pq_build_params->pq_dim = bp.pq_dim;
368-
c_ivf_pq->ivf_pq_build_params->codebook_kind = static_cast<cuvsCodebookGen>(bp.codebook_kind);
368+
c_ivf_pq->ivf_pq_build_params->codebook_kind = static_cast<cuvsIvfPqCodebookGen>(bp.codebook_kind);
369369
c_ivf_pq->ivf_pq_build_params->force_random_rotation = bp.force_random_rotation;
370370
c_ivf_pq->ivf_pq_build_params->conservative_memory_allocation = bp.conservative_memory_allocation;
371371
c_ivf_pq->ivf_pq_build_params->max_train_points_per_pq_code = bp.max_train_points_per_pq_code;

c/src/neighbors/ivf_pq.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ extern "C" cuvsError_t cuvsIvfPqIndexParamsCreate(cuvsIvfPqIndexParams_t* params
334334
.kmeans_trainset_fraction = 0.5,
335335
.pq_bits = 8,
336336
.pq_dim = 0,
337-
.codebook_kind = codebook_gen::PER_SUBSPACE,
337+
.codebook_kind = CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE,
338338
.force_random_rotation = false,
339339
.conservative_memory_allocation = false,
340340
.max_train_points_per_pq_code = 256,
341-
.codes_layout = list_layout::INTERLEAVED};
341+
.codes_layout = CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED};
342342
});
343343
}
344344

python/cuvs/cuvs/neighbors/ivf_pq/ivf_pq.pxd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ cdef extern from "library_types.h":
2424

2525
cdef extern from "cuvs/neighbors/ivf_pq.h" nogil:
2626

27-
ctypedef enum cuvsCodebookGen:
28-
CUVS_CODEBOOK_GEN_PER_SUBSPACE
29-
CUVS_CODEBOOK_GEN_PER_CLUSTER
27+
ctypedef enum cuvsIvfPqCodebookGen:
28+
CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE
29+
CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER
3030

31-
ctypedef enum cuvsListLayout:
32-
CUVS_LIST_LAYOUT_FLAT
33-
CUVS_LIST_LAYOUT_INTERLEAVED
31+
ctypedef enum cuvsIvfPqListLayout:
32+
CUVS_IVF_PQ_LIST_LAYOUT_FLAT
33+
CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED
3434

3535
ctypedef struct cuvsIvfPqIndexParams:
3636
cuvsDistanceType metric
@@ -41,11 +41,11 @@ cdef extern from "cuvs/neighbors/ivf_pq.h" nogil:
4141
double kmeans_trainset_fraction
4242
uint32_t pq_bits
4343
uint32_t pq_dim
44-
cuvsCodebookGen codebook_kind
44+
cuvsIvfPqCodebookGen codebook_kind
4545
bool force_random_rotation
4646
bool conservative_memory_allocation
4747
uint32_t max_train_points_per_pq_code
48-
cuvsListLayout codes_layout
48+
cuvsIvfPqListLayout codes_layout
4949

5050
ctypedef cuvsIvfPqIndexParams* cuvsIvfPqIndexParams_t
5151

python/cuvs/cuvs/neighbors/ivf_pq/ivf_pq.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ cdef class IndexParams:
153153
self.params.pq_bits = pq_bits
154154
self.params.pq_dim = pq_dim
155155
if codebook_kind == "subspace":
156-
self.params.codebook_kind = cuvsCodebookGen.CUVS_CODEBOOK_GEN_PER_SUBSPACE
156+
self.params.codebook_kind = cuvsIvfPqCodebookGen.CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE
157157
elif codebook_kind == "cluster":
158-
self.params.codebook_kind = cuvsCodebookGen.CUVS_CODEBOOK_GEN_PER_CLUSTER
158+
self.params.codebook_kind = cuvsIvfPqCodebookGen.CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER
159159
else:
160160
raise ValueError("Incorrect codebook kind %s" % codebook_kind)
161161
self.params.force_random_rotation = force_random_rotation
@@ -165,9 +165,9 @@ cdef class IndexParams:
165165
self.params.max_train_points_per_pq_code = \
166166
max_train_points_per_pq_code
167167
if codes_layout == "flat":
168-
self.params.codes_layout = cuvsListLayout.CUVS_LIST_LAYOUT_FLAT
168+
self.params.codes_layout = cuvsIvfPqListLayout.CUVS_IVF_PQ_LIST_LAYOUT_FLAT
169169
elif codes_layout == "interleaved":
170-
self.params.codes_layout = cuvsListLayout.CUVS_LIST_LAYOUT_INTERLEAVED
170+
self.params.codes_layout = cuvsIvfPqListLayout.CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED
171171
else:
172172
raise ValueError("Incorrect codes layout %s" % codes_layout)
173173

@@ -228,7 +228,7 @@ cdef class IndexParams:
228228

229229
@property
230230
def codes_layout(self):
231-
if self.params.codes_layout == cuvsListLayout.CUVS_LIST_LAYOUT_FLAT:
231+
if self.params.codes_layout == cuvsIvfPqListLayout.CUVS_IVF_PQ_LIST_LAYOUT_FLAT:
232232
return "flat"
233233
else:
234234
return "interleaved"

0 commit comments

Comments
 (0)