1use crate::{cudaDataType_t, cudaStream_t};
4
5#[repr(u32)]
6#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
7pub enum DLDeviceType {
8 kDLCPU = 1,
9 kDLCUDA = 2,
10 kDLCUDAHost = 3,
11 kDLOpenCL = 4,
12 kDLVulkan = 7,
13 kDLMetal = 8,
14 kDLVPI = 9,
15 kDLROCM = 10,
16 kDLROCMHost = 11,
17 kDLExtDev = 12,
18 kDLCUDAManaged = 13,
19 kDLOneAPI = 14,
20 kDLWebGPU = 15,
21 kDLHexagon = 16,
22}
23#[repr(C)]
24#[derive(Debug, Copy, Clone)]
25pub struct DLDevice {
26 pub device_type: DLDeviceType,
27 pub device_id: i32,
28}
29#[allow(clippy::unnecessary_operation, clippy::identity_op)]
30const _: () = {
31 ["Size of DLDevice"][::std::mem::size_of::<DLDevice>() - 8usize];
32 ["Alignment of DLDevice"][::std::mem::align_of::<DLDevice>() - 4usize];
33 ["Offset of field: DLDevice::device_type"]
34 [::std::mem::offset_of!(DLDevice, device_type) - 0usize];
35 ["Offset of field: DLDevice::device_id"][::std::mem::offset_of!(DLDevice, device_id) - 4usize];
36};
37#[repr(u32)]
38#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
39pub enum DLDataTypeCode {
40 kDLInt = 0,
41 kDLUInt = 1,
42 kDLFloat = 2,
43 kDLOpaqueHandle = 3,
44 kDLBfloat = 4,
45 kDLComplex = 5,
46 kDLBool = 6,
47}
48#[repr(C)]
49#[derive(Debug, Copy, Clone)]
50pub struct DLDataType {
51 pub code: u8,
52 pub bits: u8,
53 pub lanes: u16,
54}
55#[allow(clippy::unnecessary_operation, clippy::identity_op)]
56const _: () = {
57 ["Size of DLDataType"][::std::mem::size_of::<DLDataType>() - 4usize];
58 ["Alignment of DLDataType"][::std::mem::align_of::<DLDataType>() - 2usize];
59 ["Offset of field: DLDataType::code"][::std::mem::offset_of!(DLDataType, code) - 0usize];
60 ["Offset of field: DLDataType::bits"][::std::mem::offset_of!(DLDataType, bits) - 1usize];
61 ["Offset of field: DLDataType::lanes"][::std::mem::offset_of!(DLDataType, lanes) - 2usize];
62};
63#[repr(C)]
64#[derive(Debug, Copy, Clone)]
65pub struct DLTensor {
66 pub data: *mut ::std::os::raw::c_void,
67 pub device: DLDevice,
68 pub ndim: i32,
69 pub dtype: DLDataType,
70 pub shape: *mut i64,
71 pub strides: *mut i64,
72 pub byte_offset: u64,
73}
74#[allow(clippy::unnecessary_operation, clippy::identity_op)]
75const _: () = {
76 ["Size of DLTensor"][::std::mem::size_of::<DLTensor>() - 48usize];
77 ["Alignment of DLTensor"][::std::mem::align_of::<DLTensor>() - 8usize];
78 ["Offset of field: DLTensor::data"][::std::mem::offset_of!(DLTensor, data) - 0usize];
79 ["Offset of field: DLTensor::device"][::std::mem::offset_of!(DLTensor, device) - 8usize];
80 ["Offset of field: DLTensor::ndim"][::std::mem::offset_of!(DLTensor, ndim) - 16usize];
81 ["Offset of field: DLTensor::dtype"][::std::mem::offset_of!(DLTensor, dtype) - 20usize];
82 ["Offset of field: DLTensor::shape"][::std::mem::offset_of!(DLTensor, shape) - 24usize];
83 ["Offset of field: DLTensor::strides"][::std::mem::offset_of!(DLTensor, strides) - 32usize];
84 ["Offset of field: DLTensor::byte_offset"]
85 [::std::mem::offset_of!(DLTensor, byte_offset) - 40usize];
86};
87#[repr(C)]
88#[derive(Debug, Copy, Clone)]
89pub struct DLManagedTensor {
90 pub dl_tensor: DLTensor,
91 pub manager_ctx: *mut ::std::os::raw::c_void,
92 pub deleter: ::std::option::Option<unsafe extern "C" fn(self_: *mut DLManagedTensor)>,
93}
94#[allow(clippy::unnecessary_operation, clippy::identity_op)]
95const _: () = {
96 ["Size of DLManagedTensor"][::std::mem::size_of::<DLManagedTensor>() - 64usize];
97 ["Alignment of DLManagedTensor"][::std::mem::align_of::<DLManagedTensor>() - 8usize];
98 ["Offset of field: DLManagedTensor::dl_tensor"]
99 [::std::mem::offset_of!(DLManagedTensor, dl_tensor) - 0usize];
100 ["Offset of field: DLManagedTensor::manager_ctx"]
101 [::std::mem::offset_of!(DLManagedTensor, manager_ctx) - 48usize];
102 ["Offset of field: DLManagedTensor::deleter"]
103 [::std::mem::offset_of!(DLManagedTensor, deleter) - 56usize];
104};
105#[repr(u32)]
106#[must_use]
107#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
108pub enum cuvsError_t {
109 CUVS_ERROR = 0,
110 CUVS_SUCCESS = 1,
111}
112unsafe extern "C" {
113 pub fn cuvsGetLastErrorText() -> *const ::std::os::raw::c_char;
114}
115unsafe extern "C" {
116 pub fn cuvsSetLastErrorText(error: *const ::std::os::raw::c_char);
117}
118#[repr(u32)]
119#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
120pub enum cuvsLogLevel_t {
121 CUVS_LOG_LEVEL_TRACE = 0,
122 CUVS_LOG_LEVEL_DEBUG = 1,
123 CUVS_LOG_LEVEL_INFO = 2,
124 CUVS_LOG_LEVEL_WARN = 3,
125 CUVS_LOG_LEVEL_ERROR = 4,
126 CUVS_LOG_LEVEL_CRITICAL = 5,
127 CUVS_LOG_LEVEL_OFF = 6,
128}
129unsafe extern "C" {
130 pub fn cuvsGetLogLevel() -> cuvsLogLevel_t;
131}
132unsafe extern "C" {
133 pub fn cuvsSetLogLevel(arg1: cuvsLogLevel_t);
134}
135pub type cuvsResources_t = usize;
136unsafe extern "C" {
137 #[must_use]
138 pub fn cuvsResourcesCreate(res: *mut cuvsResources_t) -> cuvsError_t;
139}
140unsafe extern "C" {
141 #[must_use]
142 pub fn cuvsResourcesCreateWithMemoryTracking(
143 res: *mut cuvsResources_t,
144 csv_path: *const ::std::os::raw::c_char,
145 sample_interval_ms: i64,
146 ) -> cuvsError_t;
147}
148unsafe extern "C" {
149 #[must_use]
150 pub fn cuvsResourcesDestroy(res: cuvsResources_t) -> cuvsError_t;
151}
152unsafe extern "C" {
153 #[must_use]
154 pub fn cuvsStreamSet(res: cuvsResources_t, stream: cudaStream_t) -> cuvsError_t;
155}
156unsafe extern "C" {
157 #[must_use]
158 pub fn cuvsStreamGet(res: cuvsResources_t, stream: *mut cudaStream_t) -> cuvsError_t;
159}
160unsafe extern "C" {
161 #[must_use]
162 pub fn cuvsStreamSync(res: cuvsResources_t) -> cuvsError_t;
163}
164unsafe extern "C" {
165 #[must_use]
166 pub fn cuvsDeviceIdGet(
167 res: cuvsResources_t,
168 device_id: *mut ::std::os::raw::c_int,
169 ) -> cuvsError_t;
170}
171unsafe extern "C" {
172 #[must_use]
173 pub fn cuvsResourcesSetWorkspacePool(
174 res: cuvsResources_t,
175 initial_size_bytes: usize,
176 ) -> cuvsError_t;
177}
178unsafe extern "C" {
179 #[must_use]
180 pub fn cuvsMultiGpuResourcesCreate(res: *mut cuvsResources_t) -> cuvsError_t;
181}
182unsafe extern "C" {
183 #[must_use]
184 pub fn cuvsMultiGpuResourcesCreateWithDeviceIds(
185 res: *mut cuvsResources_t,
186 device_ids: *mut DLManagedTensor,
187 ) -> cuvsError_t;
188}
189unsafe extern "C" {
190 #[must_use]
191 pub fn cuvsMultiGpuResourcesDestroy(res: cuvsResources_t) -> cuvsError_t;
192}
193unsafe extern "C" {
194 #[must_use]
195 pub fn cuvsMultiGpuResourcesSetMemoryPool(
196 res: cuvsResources_t,
197 percent_of_free_memory: ::std::os::raw::c_int,
198 ) -> cuvsError_t;
199}
200unsafe extern "C" {
201 #[must_use]
202 pub fn cuvsRMMAlloc(
203 res: cuvsResources_t,
204 ptr: *mut *mut ::std::os::raw::c_void,
205 bytes: usize,
206 ) -> cuvsError_t;
207}
208unsafe extern "C" {
209 #[must_use]
210 pub fn cuvsRMMFree(
211 res: cuvsResources_t,
212 ptr: *mut ::std::os::raw::c_void,
213 bytes: usize,
214 ) -> cuvsError_t;
215}
216unsafe extern "C" {
217 #[must_use]
218 pub fn cuvsRMMPoolMemoryResourceEnable(
219 initial_pool_size_percent: ::std::os::raw::c_int,
220 max_pool_size_percent: ::std::os::raw::c_int,
221 managed: bool,
222 ) -> cuvsError_t;
223}
224unsafe extern "C" {
225 #[must_use]
226 pub fn cuvsRMMAsyncMemoryResourceEnable() -> cuvsError_t;
227}
228unsafe extern "C" {
229 #[must_use]
230 pub fn cuvsRMMMemoryResourceReset() -> cuvsError_t;
231}
232unsafe extern "C" {
233 #[must_use]
234 pub fn cuvsRMMHostAlloc(ptr: *mut *mut ::std::os::raw::c_void, bytes: usize) -> cuvsError_t;
235}
236unsafe extern "C" {
237 #[must_use]
238 pub fn cuvsRMMHostFree(ptr: *mut ::std::os::raw::c_void, bytes: usize) -> cuvsError_t;
239}
240unsafe extern "C" {
241 #[must_use]
242 pub fn cuvsVersionGet(major: *mut u16, minor: *mut u16, patch: *mut u16) -> cuvsError_t;
243}
244unsafe extern "C" {
245 #[must_use]
246 pub fn cuvsMatrixCopy(
247 res: cuvsResources_t,
248 src: *mut DLManagedTensor,
249 dst: *mut DLManagedTensor,
250 ) -> cuvsError_t;
251}
252unsafe extern "C" {
253 #[must_use]
254 pub fn cuvsMatrixSliceRows(
255 res: cuvsResources_t,
256 src: *mut DLManagedTensor,
257 start: i64,
258 end: i64,
259 dst: *mut DLManagedTensor,
260 ) -> cuvsError_t;
261}
262#[repr(u32)]
263#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
264pub enum cuvsDatasetLayout_t {
265 CUVS_DATASET_LAYOUT_STANDARD = 0,
266 CUVS_DATASET_LAYOUT_PADDED = 1,
267}
268#[repr(u32)]
269#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
270pub enum cuvsDatasetMemType_t {
271 CUVS_DATASET_MEM_TYPE_HOST = 0,
272 CUVS_DATASET_MEM_TYPE_DEVICE = 1,
273}
274#[repr(C)]
275#[derive(Debug, Copy, Clone)]
276pub struct cuvsDataset {
277 pub addr: usize,
278 pub destroy_addr:
279 ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
280 pub dtype: DLDataType,
281 pub mem_type: cuvsDatasetMemType_t,
282 pub layout: cuvsDatasetLayout_t,
283 pub is_owning: bool,
284}
285#[allow(clippy::unnecessary_operation, clippy::identity_op)]
286const _: () = {
287 ["Size of cuvsDataset"][::std::mem::size_of::<cuvsDataset>() - 32usize];
288 ["Alignment of cuvsDataset"][::std::mem::align_of::<cuvsDataset>() - 8usize];
289 ["Offset of field: cuvsDataset::addr"][::std::mem::offset_of!(cuvsDataset, addr) - 0usize];
290 ["Offset of field: cuvsDataset::destroy_addr"]
291 [::std::mem::offset_of!(cuvsDataset, destroy_addr) - 8usize];
292 ["Offset of field: cuvsDataset::dtype"][::std::mem::offset_of!(cuvsDataset, dtype) - 16usize];
293 ["Offset of field: cuvsDataset::mem_type"]
294 [::std::mem::offset_of!(cuvsDataset, mem_type) - 20usize];
295 ["Offset of field: cuvsDataset::layout"][::std::mem::offset_of!(cuvsDataset, layout) - 24usize];
296 ["Offset of field: cuvsDataset::is_owning"]
297 [::std::mem::offset_of!(cuvsDataset, is_owning) - 28usize];
298};
299pub type cuvsDataset_t = *mut cuvsDataset;
300unsafe extern "C" {
301 #[must_use]
302 pub fn cuvsDatasetCreate(dataset: *mut cuvsDataset_t) -> cuvsError_t;
303}
304unsafe extern "C" {
305 #[must_use]
306 pub fn cuvsDatasetMakePadded(
307 res: cuvsResources_t,
308 dataset: *mut DLManagedTensor,
309 target_mem_type: cuvsDatasetMemType_t,
310 padded_dataset: *mut cuvsDataset_t,
311 ) -> cuvsError_t;
312}
313unsafe extern "C" {
314 #[must_use]
315 pub fn cuvsDatasetMakePaddedView(
316 res: cuvsResources_t,
317 dataset: *mut DLManagedTensor,
318 padded_dataset: *mut cuvsDataset_t,
319 ) -> cuvsError_t;
320}
321unsafe extern "C" {
322 #[must_use]
323 pub fn cuvsDatasetMakeStandardView(
324 res: cuvsResources_t,
325 dataset: *mut DLManagedTensor,
326 standard_dataset: *mut cuvsDataset_t,
327 ) -> cuvsError_t;
328}
329unsafe extern "C" {
330 #[must_use]
331 pub fn cuvsDatasetDestroy(dataset: cuvsDataset_t) -> cuvsError_t;
332}
333unsafe extern "C" {
334 #[must_use]
335 pub fn cuvsDatasetGetMemType(
336 dataset: cuvsDataset_t,
337 mem_type: *mut cuvsDatasetMemType_t,
338 ) -> cuvsError_t;
339}
340unsafe extern "C" {
341 #[must_use]
342 pub fn cuvsDatasetGetLayout(
343 dataset: cuvsDataset_t,
344 layout: *mut cuvsDatasetLayout_t,
345 ) -> cuvsError_t;
346}
347unsafe extern "C" {
348 #[must_use]
349 pub fn cuvsDatasetGetIsOwning(dataset: cuvsDataset_t, is_owning: *mut bool) -> cuvsError_t;
350}
351unsafe extern "C" {
352 #[must_use]
353 pub fn cuvsDatasetGetDtype(dataset: cuvsDataset_t, dtype: *mut DLDataType) -> cuvsError_t;
354}
355#[repr(u32)]
356#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
357pub enum cuvsDistanceType {
358 L2Expanded = 0,
359 L2SqrtExpanded = 1,
360 CosineExpanded = 2,
361 L1 = 3,
362 L2Unexpanded = 4,
363 L2SqrtUnexpanded = 5,
364 InnerProduct = 6,
365 Linf = 7,
366 Canberra = 8,
367 LpUnexpanded = 9,
368 CorrelationExpanded = 10,
369 JaccardExpanded = 11,
370 HellingerExpanded = 12,
371 Haversine = 13,
372 BrayCurtis = 14,
373 JensenShannon = 15,
374 HammingUnexpanded = 16,
375 KLDivergence = 17,
376 RusselRaoExpanded = 18,
377 DiceExpanded = 19,
378 BitwiseHamming = 20,
379 Precomputed = 100,
380}
381#[repr(u32)]
382#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
383pub enum cuvsKMeansInitMethod {
384 KMeansPlusPlus = 0,
385 Random = 1,
386 Array = 2,
387}
388#[repr(C)]
389#[derive(Debug, Copy, Clone)]
390pub struct cuvsKMeansParams {
391 pub metric: cuvsDistanceType,
392 pub n_clusters: ::std::os::raw::c_int,
393 pub init: cuvsKMeansInitMethod,
394 pub max_iter: ::std::os::raw::c_int,
395 pub tol: f64,
396 pub n_init: ::std::os::raw::c_int,
397 pub oversampling_factor: f64,
398 pub batch_samples: ::std::os::raw::c_int,
399 pub batch_centroids: ::std::os::raw::c_int,
400 pub hierarchical: bool,
401 pub hierarchical_n_iters: ::std::os::raw::c_int,
402 pub device_buffer_samples: i64,
403 pub init_size: i64,
404}
405#[allow(clippy::unnecessary_operation, clippy::identity_op)]
406const _: () = {
407 ["Size of cuvsKMeansParams"][::std::mem::size_of::<cuvsKMeansParams>() - 72usize];
408 ["Alignment of cuvsKMeansParams"][::std::mem::align_of::<cuvsKMeansParams>() - 8usize];
409 ["Offset of field: cuvsKMeansParams::metric"]
410 [::std::mem::offset_of!(cuvsKMeansParams, metric) - 0usize];
411 ["Offset of field: cuvsKMeansParams::n_clusters"]
412 [::std::mem::offset_of!(cuvsKMeansParams, n_clusters) - 4usize];
413 ["Offset of field: cuvsKMeansParams::init"]
414 [::std::mem::offset_of!(cuvsKMeansParams, init) - 8usize];
415 ["Offset of field: cuvsKMeansParams::max_iter"]
416 [::std::mem::offset_of!(cuvsKMeansParams, max_iter) - 12usize];
417 ["Offset of field: cuvsKMeansParams::tol"]
418 [::std::mem::offset_of!(cuvsKMeansParams, tol) - 16usize];
419 ["Offset of field: cuvsKMeansParams::n_init"]
420 [::std::mem::offset_of!(cuvsKMeansParams, n_init) - 24usize];
421 ["Offset of field: cuvsKMeansParams::oversampling_factor"]
422 [::std::mem::offset_of!(cuvsKMeansParams, oversampling_factor) - 32usize];
423 ["Offset of field: cuvsKMeansParams::batch_samples"]
424 [::std::mem::offset_of!(cuvsKMeansParams, batch_samples) - 40usize];
425 ["Offset of field: cuvsKMeansParams::batch_centroids"]
426 [::std::mem::offset_of!(cuvsKMeansParams, batch_centroids) - 44usize];
427 ["Offset of field: cuvsKMeansParams::hierarchical"]
428 [::std::mem::offset_of!(cuvsKMeansParams, hierarchical) - 48usize];
429 ["Offset of field: cuvsKMeansParams::hierarchical_n_iters"]
430 [::std::mem::offset_of!(cuvsKMeansParams, hierarchical_n_iters) - 52usize];
431 ["Offset of field: cuvsKMeansParams::device_buffer_samples"]
432 [::std::mem::offset_of!(cuvsKMeansParams, device_buffer_samples) - 56usize];
433 ["Offset of field: cuvsKMeansParams::init_size"]
434 [::std::mem::offset_of!(cuvsKMeansParams, init_size) - 64usize];
435};
436pub type cuvsKMeansParams_t = *mut cuvsKMeansParams;
437unsafe extern "C" {
438 #[must_use]
439 pub fn cuvsKMeansParamsCreate(params: *mut cuvsKMeansParams_t) -> cuvsError_t;
440}
441unsafe extern "C" {
442 #[must_use]
443 pub fn cuvsKMeansParamsDestroy(params: cuvsKMeansParams_t) -> cuvsError_t;
444}
445#[repr(u32)]
446#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
447pub enum cuvsKMeansType {
448 CUVS_KMEANS_TYPE_KMEANS = 0,
449 CUVS_KMEANS_TYPE_KMEANS_BALANCED = 1,
450}
451unsafe extern "C" {
452 #[must_use]
453 pub fn cuvsKMeansFit(
454 res: cuvsResources_t,
455 params: cuvsKMeansParams_t,
456 X: *mut DLManagedTensor,
457 sample_weight: *mut DLManagedTensor,
458 centroids: *mut DLManagedTensor,
459 inertia: *mut f64,
460 n_iter: *mut ::std::os::raw::c_int,
461 ) -> cuvsError_t;
462}
463unsafe extern "C" {
464 #[must_use]
465 pub fn cuvsKMeansPredict(
466 res: cuvsResources_t,
467 params: cuvsKMeansParams_t,
468 X: *mut DLManagedTensor,
469 sample_weight: *mut DLManagedTensor,
470 centroids: *mut DLManagedTensor,
471 labels: *mut DLManagedTensor,
472 normalize_weight: bool,
473 inertia: *mut f64,
474 ) -> cuvsError_t;
475}
476unsafe extern "C" {
477 #[must_use]
478 pub fn cuvsKMeansClusterCost(
479 res: cuvsResources_t,
480 X: *mut DLManagedTensor,
481 centroids: *mut DLManagedTensor,
482 cost: *mut f64,
483 ) -> cuvsError_t;
484}
485unsafe extern "C" {
486 #[must_use]
487 pub fn cuvsPairwiseDistance(
488 res: cuvsResources_t,
489 x: *mut DLManagedTensor,
490 y: *mut DLManagedTensor,
491 dist: *mut DLManagedTensor,
492 metric: cuvsDistanceType,
493 metric_arg: f32,
494 ) -> cuvsError_t;
495}
496#[repr(u32)]
497#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
498pub enum cuvsIvfPqCodebookGen {
499 CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE = 0,
500 CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER = 1,
501}
502#[repr(u32)]
503#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
504pub enum cuvsIvfPqListLayout {
505 CUVS_IVF_PQ_LIST_LAYOUT_FLAT = 0,
506 CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED = 1,
507}
508#[repr(C)]
509#[derive(Debug, Copy, Clone)]
510pub struct cuvsIvfPqIndexParams {
511 pub metric: cuvsDistanceType,
512 pub metric_arg: f32,
513 pub add_data_on_build: bool,
514 pub n_lists: u32,
515 pub kmeans_n_iters: u32,
516 pub kmeans_trainset_fraction: f64,
517 pub pq_bits: u32,
518 pub pq_dim: u32,
519 pub codebook_kind: cuvsIvfPqCodebookGen,
520 pub force_random_rotation: bool,
521 pub conservative_memory_allocation: bool,
522 pub max_train_points_per_pq_code: u32,
523 pub codes_layout: cuvsIvfPqListLayout,
524}
525#[allow(clippy::unnecessary_operation, clippy::identity_op)]
526const _: () = {
527 ["Size of cuvsIvfPqIndexParams"][::std::mem::size_of::<cuvsIvfPqIndexParams>() - 56usize];
528 ["Alignment of cuvsIvfPqIndexParams"][::std::mem::align_of::<cuvsIvfPqIndexParams>() - 8usize];
529 ["Offset of field: cuvsIvfPqIndexParams::metric"]
530 [::std::mem::offset_of!(cuvsIvfPqIndexParams, metric) - 0usize];
531 ["Offset of field: cuvsIvfPqIndexParams::metric_arg"]
532 [::std::mem::offset_of!(cuvsIvfPqIndexParams, metric_arg) - 4usize];
533 ["Offset of field: cuvsIvfPqIndexParams::add_data_on_build"]
534 [::std::mem::offset_of!(cuvsIvfPqIndexParams, add_data_on_build) - 8usize];
535 ["Offset of field: cuvsIvfPqIndexParams::n_lists"]
536 [::std::mem::offset_of!(cuvsIvfPqIndexParams, n_lists) - 12usize];
537 ["Offset of field: cuvsIvfPqIndexParams::kmeans_n_iters"]
538 [::std::mem::offset_of!(cuvsIvfPqIndexParams, kmeans_n_iters) - 16usize];
539 ["Offset of field: cuvsIvfPqIndexParams::kmeans_trainset_fraction"]
540 [::std::mem::offset_of!(cuvsIvfPqIndexParams, kmeans_trainset_fraction) - 24usize];
541 ["Offset of field: cuvsIvfPqIndexParams::pq_bits"]
542 [::std::mem::offset_of!(cuvsIvfPqIndexParams, pq_bits) - 32usize];
543 ["Offset of field: cuvsIvfPqIndexParams::pq_dim"]
544 [::std::mem::offset_of!(cuvsIvfPqIndexParams, pq_dim) - 36usize];
545 ["Offset of field: cuvsIvfPqIndexParams::codebook_kind"]
546 [::std::mem::offset_of!(cuvsIvfPqIndexParams, codebook_kind) - 40usize];
547 ["Offset of field: cuvsIvfPqIndexParams::force_random_rotation"]
548 [::std::mem::offset_of!(cuvsIvfPqIndexParams, force_random_rotation) - 44usize];
549 ["Offset of field: cuvsIvfPqIndexParams::conservative_memory_allocation"]
550 [::std::mem::offset_of!(cuvsIvfPqIndexParams, conservative_memory_allocation) - 45usize];
551 ["Offset of field: cuvsIvfPqIndexParams::max_train_points_per_pq_code"]
552 [::std::mem::offset_of!(cuvsIvfPqIndexParams, max_train_points_per_pq_code) - 48usize];
553 ["Offset of field: cuvsIvfPqIndexParams::codes_layout"]
554 [::std::mem::offset_of!(cuvsIvfPqIndexParams, codes_layout) - 52usize];
555};
556pub type cuvsIvfPqIndexParams_t = *mut cuvsIvfPqIndexParams;
557unsafe extern "C" {
558 #[must_use]
559 pub fn cuvsIvfPqIndexParamsCreate(index_params: *mut cuvsIvfPqIndexParams_t) -> cuvsError_t;
560}
561unsafe extern "C" {
562 #[must_use]
563 pub fn cuvsIvfPqIndexParamsDestroy(index_params: cuvsIvfPqIndexParams_t) -> cuvsError_t;
564}
565#[repr(C)]
566pub struct cuvsIvfPqSearchParams {
567 pub n_probes: u32,
568 pub lut_dtype: cudaDataType_t,
569 pub internal_distance_dtype: cudaDataType_t,
570 pub coarse_search_dtype: cudaDataType_t,
571 pub max_internal_batch_size: u32,
572 pub preferred_shmem_carveout: f64,
573}
574#[allow(clippy::unnecessary_operation, clippy::identity_op)]
575const _: () = {
576 ["Size of cuvsIvfPqSearchParams"][::std::mem::size_of::<cuvsIvfPqSearchParams>() - 32usize];
577 ["Alignment of cuvsIvfPqSearchParams"]
578 [::std::mem::align_of::<cuvsIvfPqSearchParams>() - 8usize];
579 ["Offset of field: cuvsIvfPqSearchParams::n_probes"]
580 [::std::mem::offset_of!(cuvsIvfPqSearchParams, n_probes) - 0usize];
581 ["Offset of field: cuvsIvfPqSearchParams::lut_dtype"]
582 [::std::mem::offset_of!(cuvsIvfPqSearchParams, lut_dtype) - 4usize];
583 ["Offset of field: cuvsIvfPqSearchParams::internal_distance_dtype"]
584 [::std::mem::offset_of!(cuvsIvfPqSearchParams, internal_distance_dtype) - 8usize];
585 ["Offset of field: cuvsIvfPqSearchParams::coarse_search_dtype"]
586 [::std::mem::offset_of!(cuvsIvfPqSearchParams, coarse_search_dtype) - 12usize];
587 ["Offset of field: cuvsIvfPqSearchParams::max_internal_batch_size"]
588 [::std::mem::offset_of!(cuvsIvfPqSearchParams, max_internal_batch_size) - 16usize];
589 ["Offset of field: cuvsIvfPqSearchParams::preferred_shmem_carveout"]
590 [::std::mem::offset_of!(cuvsIvfPqSearchParams, preferred_shmem_carveout) - 24usize];
591};
592pub type cuvsIvfPqSearchParams_t = *mut cuvsIvfPqSearchParams;
593unsafe extern "C" {
594 #[must_use]
595 pub fn cuvsIvfPqSearchParamsCreate(params: *mut cuvsIvfPqSearchParams_t) -> cuvsError_t;
596}
597unsafe extern "C" {
598 #[must_use]
599 pub fn cuvsIvfPqSearchParamsDestroy(params: cuvsIvfPqSearchParams_t) -> cuvsError_t;
600}
601#[repr(C)]
602#[derive(Debug, Copy, Clone)]
603pub struct cuvsIvfPqIndex {
604 pub addr: usize,
605 pub dtype: DLDataType,
606}
607#[allow(clippy::unnecessary_operation, clippy::identity_op)]
608const _: () = {
609 ["Size of cuvsIvfPqIndex"][::std::mem::size_of::<cuvsIvfPqIndex>() - 16usize];
610 ["Alignment of cuvsIvfPqIndex"][::std::mem::align_of::<cuvsIvfPqIndex>() - 8usize];
611 ["Offset of field: cuvsIvfPqIndex::addr"]
612 [::std::mem::offset_of!(cuvsIvfPqIndex, addr) - 0usize];
613 ["Offset of field: cuvsIvfPqIndex::dtype"]
614 [::std::mem::offset_of!(cuvsIvfPqIndex, dtype) - 8usize];
615};
616pub type cuvsIvfPqIndex_t = *mut cuvsIvfPqIndex;
617unsafe extern "C" {
618 #[must_use]
619 pub fn cuvsIvfPqIndexCreate(index: *mut cuvsIvfPqIndex_t) -> cuvsError_t;
620}
621unsafe extern "C" {
622 #[must_use]
623 pub fn cuvsIvfPqIndexDestroy(index: cuvsIvfPqIndex_t) -> cuvsError_t;
624}
625unsafe extern "C" {
626 #[must_use]
627 pub fn cuvsIvfPqIndexGetNLists(index: cuvsIvfPqIndex_t, n_lists: *mut i64) -> cuvsError_t;
628}
629unsafe extern "C" {
630 #[must_use]
631 pub fn cuvsIvfPqIndexGetDim(index: cuvsIvfPqIndex_t, dim: *mut i64) -> cuvsError_t;
632}
633unsafe extern "C" {
634 #[must_use]
635 pub fn cuvsIvfPqIndexGetSize(index: cuvsIvfPqIndex_t, size: *mut i64) -> cuvsError_t;
636}
637unsafe extern "C" {
638 #[must_use]
639 pub fn cuvsIvfPqIndexGetPqDim(index: cuvsIvfPqIndex_t, pq_dim: *mut i64) -> cuvsError_t;
640}
641unsafe extern "C" {
642 #[must_use]
643 pub fn cuvsIvfPqIndexGetPqBits(index: cuvsIvfPqIndex_t, pq_bits: *mut i64) -> cuvsError_t;
644}
645unsafe extern "C" {
646 #[must_use]
647 pub fn cuvsIvfPqIndexGetPqLen(index: cuvsIvfPqIndex_t, pq_len: *mut i64) -> cuvsError_t;
648}
649unsafe extern "C" {
650 #[must_use]
651 pub fn cuvsIvfPqIndexGetCenters(
652 index: cuvsIvfPqIndex_t,
653 centers: *mut DLManagedTensor,
654 ) -> cuvsError_t;
655}
656unsafe extern "C" {
657 #[must_use]
658 pub fn cuvsIvfPqIndexGetCentersPadded(
659 index: cuvsIvfPqIndex_t,
660 centers: *mut DLManagedTensor,
661 ) -> cuvsError_t;
662}
663unsafe extern "C" {
664 #[must_use]
665 pub fn cuvsIvfPqIndexGetPqCenters(
666 index: cuvsIvfPqIndex_t,
667 pq_centers: *mut DLManagedTensor,
668 ) -> cuvsError_t;
669}
670unsafe extern "C" {
671 #[must_use]
672 pub fn cuvsIvfPqIndexGetCentersRot(
673 index: cuvsIvfPqIndex_t,
674 centers_rot: *mut DLManagedTensor,
675 ) -> cuvsError_t;
676}
677unsafe extern "C" {
678 #[must_use]
679 pub fn cuvsIvfPqIndexGetRotationMatrix(
680 index: cuvsIvfPqIndex_t,
681 rotation_matrix: *mut DLManagedTensor,
682 ) -> cuvsError_t;
683}
684unsafe extern "C" {
685 #[must_use]
686 pub fn cuvsIvfPqIndexGetListSizes(
687 index: cuvsIvfPqIndex_t,
688 list_sizes: *mut DLManagedTensor,
689 ) -> cuvsError_t;
690}
691unsafe extern "C" {
692 #[must_use]
693 pub fn cuvsIvfPqIndexUnpackContiguousListData(
694 res: cuvsResources_t,
695 index: cuvsIvfPqIndex_t,
696 out_codes: *mut DLManagedTensor,
697 label: u32,
698 offset: u32,
699 ) -> cuvsError_t;
700}
701unsafe extern "C" {
702 #[must_use]
703 pub fn cuvsIvfPqIndexGetListIndices(
704 index: cuvsIvfPqIndex_t,
705 label: u32,
706 out_labels: *mut DLManagedTensor,
707 ) -> cuvsError_t;
708}
709unsafe extern "C" {
710 #[must_use]
711 pub fn cuvsIvfPqBuild(
712 res: cuvsResources_t,
713 params: cuvsIvfPqIndexParams_t,
714 dataset: *mut DLManagedTensor,
715 index: cuvsIvfPqIndex_t,
716 ) -> cuvsError_t;
717}
718unsafe extern "C" {
719 #[must_use]
720 pub fn cuvsIvfPqBuildPrecomputed(
721 res: cuvsResources_t,
722 params: cuvsIvfPqIndexParams_t,
723 dim: u32,
724 pq_centers: *mut DLManagedTensor,
725 centers: *mut DLManagedTensor,
726 centers_rot: *mut DLManagedTensor,
727 rotation_matrix: *mut DLManagedTensor,
728 index: cuvsIvfPqIndex_t,
729 ) -> cuvsError_t;
730}
731unsafe extern "C" {
732 #[must_use]
733 pub fn cuvsIvfPqSearch(
734 res: cuvsResources_t,
735 search_params: cuvsIvfPqSearchParams_t,
736 index: cuvsIvfPqIndex_t,
737 queries: *mut DLManagedTensor,
738 neighbors: *mut DLManagedTensor,
739 distances: *mut DLManagedTensor,
740 ) -> cuvsError_t;
741}
742unsafe extern "C" {
743 #[must_use]
744 pub fn cuvsIvfPqSerialize(
745 res: cuvsResources_t,
746 filename: *const ::std::os::raw::c_char,
747 index: cuvsIvfPqIndex_t,
748 ) -> cuvsError_t;
749}
750unsafe extern "C" {
751 #[must_use]
752 pub fn cuvsIvfPqDeserialize(
753 res: cuvsResources_t,
754 filename: *const ::std::os::raw::c_char,
755 index: cuvsIvfPqIndex_t,
756 ) -> cuvsError_t;
757}
758unsafe extern "C" {
759 #[must_use]
760 pub fn cuvsIvfPqExtend(
761 res: cuvsResources_t,
762 new_vectors: *mut DLManagedTensor,
763 new_indices: *mut DLManagedTensor,
764 index: cuvsIvfPqIndex_t,
765 ) -> cuvsError_t;
766}
767unsafe extern "C" {
768 #[must_use]
769 pub fn cuvsIvfPqTransform(
770 res: cuvsResources_t,
771 index: cuvsIvfPqIndex_t,
772 input_dataset: *mut DLManagedTensor,
773 output_labels: *mut DLManagedTensor,
774 output_dataset: *mut DLManagedTensor,
775 ) -> cuvsError_t;
776}
777#[repr(u32)]
778#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
779pub enum cuvsNNDescentDistCompDtype {
780 NND_DIST_COMP_AUTO = 0,
781 NND_DIST_COMP_FP32 = 1,
782 NND_DIST_COMP_FP16 = 2,
783}
784#[repr(C)]
785#[derive(Debug, Copy, Clone)]
786pub struct cuvsNNDescentIndexParams {
787 pub metric: cuvsDistanceType,
788 pub metric_arg: f32,
789 pub graph_degree: usize,
790 pub intermediate_graph_degree: usize,
791 pub max_iterations: usize,
792 pub termination_threshold: f32,
793 pub return_distances: bool,
794 pub dist_comp_dtype: cuvsNNDescentDistCompDtype,
795}
796#[allow(clippy::unnecessary_operation, clippy::identity_op)]
797const _: () = {
798 ["Size of cuvsNNDescentIndexParams"]
799 [::std::mem::size_of::<cuvsNNDescentIndexParams>() - 48usize];
800 ["Alignment of cuvsNNDescentIndexParams"]
801 [::std::mem::align_of::<cuvsNNDescentIndexParams>() - 8usize];
802 ["Offset of field: cuvsNNDescentIndexParams::metric"]
803 [::std::mem::offset_of!(cuvsNNDescentIndexParams, metric) - 0usize];
804 ["Offset of field: cuvsNNDescentIndexParams::metric_arg"]
805 [::std::mem::offset_of!(cuvsNNDescentIndexParams, metric_arg) - 4usize];
806 ["Offset of field: cuvsNNDescentIndexParams::graph_degree"]
807 [::std::mem::offset_of!(cuvsNNDescentIndexParams, graph_degree) - 8usize];
808 ["Offset of field: cuvsNNDescentIndexParams::intermediate_graph_degree"]
809 [::std::mem::offset_of!(cuvsNNDescentIndexParams, intermediate_graph_degree) - 16usize];
810 ["Offset of field: cuvsNNDescentIndexParams::max_iterations"]
811 [::std::mem::offset_of!(cuvsNNDescentIndexParams, max_iterations) - 24usize];
812 ["Offset of field: cuvsNNDescentIndexParams::termination_threshold"]
813 [::std::mem::offset_of!(cuvsNNDescentIndexParams, termination_threshold) - 32usize];
814 ["Offset of field: cuvsNNDescentIndexParams::return_distances"]
815 [::std::mem::offset_of!(cuvsNNDescentIndexParams, return_distances) - 36usize];
816 ["Offset of field: cuvsNNDescentIndexParams::dist_comp_dtype"]
817 [::std::mem::offset_of!(cuvsNNDescentIndexParams, dist_comp_dtype) - 40usize];
818};
819pub type cuvsNNDescentIndexParams_t = *mut cuvsNNDescentIndexParams;
820unsafe extern "C" {
821 #[must_use]
822 pub fn cuvsNNDescentIndexParamsCreate(
823 index_params: *mut cuvsNNDescentIndexParams_t,
824 ) -> cuvsError_t;
825}
826unsafe extern "C" {
827 #[must_use]
828 pub fn cuvsNNDescentIndexParamsDestroy(index_params: cuvsNNDescentIndexParams_t)
829 -> cuvsError_t;
830}
831#[repr(C)]
832#[derive(Debug, Copy, Clone)]
833pub struct cuvsNNDescentIndex {
834 pub addr: usize,
835 pub dtype: DLDataType,
836}
837#[allow(clippy::unnecessary_operation, clippy::identity_op)]
838const _: () = {
839 ["Size of cuvsNNDescentIndex"][::std::mem::size_of::<cuvsNNDescentIndex>() - 16usize];
840 ["Alignment of cuvsNNDescentIndex"][::std::mem::align_of::<cuvsNNDescentIndex>() - 8usize];
841 ["Offset of field: cuvsNNDescentIndex::addr"]
842 [::std::mem::offset_of!(cuvsNNDescentIndex, addr) - 0usize];
843 ["Offset of field: cuvsNNDescentIndex::dtype"]
844 [::std::mem::offset_of!(cuvsNNDescentIndex, dtype) - 8usize];
845};
846pub type cuvsNNDescentIndex_t = *mut cuvsNNDescentIndex;
847unsafe extern "C" {
848 #[must_use]
849 pub fn cuvsNNDescentIndexCreate(index: *mut cuvsNNDescentIndex_t) -> cuvsError_t;
850}
851unsafe extern "C" {
852 #[must_use]
853 pub fn cuvsNNDescentIndexDestroy(index: cuvsNNDescentIndex_t) -> cuvsError_t;
854}
855unsafe extern "C" {
856 #[must_use]
857 pub fn cuvsNNDescentBuild(
858 res: cuvsResources_t,
859 index_params: cuvsNNDescentIndexParams_t,
860 dataset: *mut DLManagedTensor,
861 graph: *mut DLManagedTensor,
862 index: cuvsNNDescentIndex_t,
863 ) -> cuvsError_t;
864}
865unsafe extern "C" {
866 #[must_use]
867 pub fn cuvsNNDescentIndexGetGraph(
868 res: cuvsResources_t,
869 index: cuvsNNDescentIndex_t,
870 graph: *mut DLManagedTensor,
871 ) -> cuvsError_t;
872}
873unsafe extern "C" {
874 #[must_use]
875 pub fn cuvsNNDescentIndexGetDistances(
876 res: cuvsResources_t,
877 index: cuvsNNDescentIndex_t,
878 distances: *mut DLManagedTensor,
879 ) -> cuvsError_t;
880}
881#[repr(u32)]
882#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
883pub enum cuvsAllNeighborsAlgo {
884 CUVS_ALL_NEIGHBORS_ALGO_BRUTE_FORCE = 0,
885 CUVS_ALL_NEIGHBORS_ALGO_IVF_PQ = 1,
886 CUVS_ALL_NEIGHBORS_ALGO_NN_DESCENT = 2,
887}
888#[repr(C)]
889#[derive(Debug, Copy, Clone)]
890pub struct cuvsAllNeighborsIndexParams {
891 pub algo: cuvsAllNeighborsAlgo,
892 pub overlap_factor: usize,
893 pub n_clusters: usize,
894 pub metric: cuvsDistanceType,
895 pub ivf_pq_params: cuvsIvfPqIndexParams_t,
896 pub nn_descent_params: cuvsNNDescentIndexParams_t,
897}
898#[allow(clippy::unnecessary_operation, clippy::identity_op)]
899const _: () = {
900 ["Size of cuvsAllNeighborsIndexParams"]
901 [::std::mem::size_of::<cuvsAllNeighborsIndexParams>() - 48usize];
902 ["Alignment of cuvsAllNeighborsIndexParams"]
903 [::std::mem::align_of::<cuvsAllNeighborsIndexParams>() - 8usize];
904 ["Offset of field: cuvsAllNeighborsIndexParams::algo"]
905 [::std::mem::offset_of!(cuvsAllNeighborsIndexParams, algo) - 0usize];
906 ["Offset of field: cuvsAllNeighborsIndexParams::overlap_factor"]
907 [::std::mem::offset_of!(cuvsAllNeighborsIndexParams, overlap_factor) - 8usize];
908 ["Offset of field: cuvsAllNeighborsIndexParams::n_clusters"]
909 [::std::mem::offset_of!(cuvsAllNeighborsIndexParams, n_clusters) - 16usize];
910 ["Offset of field: cuvsAllNeighborsIndexParams::metric"]
911 [::std::mem::offset_of!(cuvsAllNeighborsIndexParams, metric) - 24usize];
912 ["Offset of field: cuvsAllNeighborsIndexParams::ivf_pq_params"]
913 [::std::mem::offset_of!(cuvsAllNeighborsIndexParams, ivf_pq_params) - 32usize];
914 ["Offset of field: cuvsAllNeighborsIndexParams::nn_descent_params"]
915 [::std::mem::offset_of!(cuvsAllNeighborsIndexParams, nn_descent_params) - 40usize];
916};
917pub type cuvsAllNeighborsIndexParams_t = *mut cuvsAllNeighborsIndexParams;
918unsafe extern "C" {
919 #[must_use]
920 pub fn cuvsAllNeighborsIndexParamsCreate(
921 index_params: *mut cuvsAllNeighborsIndexParams_t,
922 ) -> cuvsError_t;
923}
924unsafe extern "C" {
925 #[must_use]
926 pub fn cuvsAllNeighborsIndexParamsDestroy(
927 index_params: cuvsAllNeighborsIndexParams_t,
928 ) -> cuvsError_t;
929}
930unsafe extern "C" {
931 #[must_use]
932 pub fn cuvsAllNeighborsBuild(
933 res: cuvsResources_t,
934 params: cuvsAllNeighborsIndexParams_t,
935 dataset: *mut DLManagedTensor,
936 indices: *mut DLManagedTensor,
937 distances: *mut DLManagedTensor,
938 core_distances: *mut DLManagedTensor,
939 alpha: f32,
940 ) -> cuvsError_t;
941}
942#[repr(u32)]
943#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
944pub enum cuvsFilterType {
945 NO_FILTER = 0,
946 BITSET = 1,
947 BITMAP = 2,
948}
949#[repr(C)]
950#[derive(Debug, Copy, Clone)]
951pub struct cuvsFilter {
952 pub addr: usize,
953 pub type_: cuvsFilterType,
954}
955#[allow(clippy::unnecessary_operation, clippy::identity_op)]
956const _: () = {
957 ["Size of cuvsFilter"][::std::mem::size_of::<cuvsFilter>() - 16usize];
958 ["Alignment of cuvsFilter"][::std::mem::align_of::<cuvsFilter>() - 8usize];
959 ["Offset of field: cuvsFilter::addr"][::std::mem::offset_of!(cuvsFilter, addr) - 0usize];
960 ["Offset of field: cuvsFilter::type_"][::std::mem::offset_of!(cuvsFilter, type_) - 8usize];
961};
962#[repr(u32)]
963#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
964pub enum cuvsMergeStrategy {
965 MERGE_STRATEGY_PHYSICAL = 0,
966 MERGE_STRATEGY_LOGICAL = 1,
967}
968#[repr(C)]
969#[derive(Debug, Copy, Clone)]
970pub struct cuvsBruteForceIndex {
971 pub addr: usize,
972 pub dtype: DLDataType,
973}
974#[allow(clippy::unnecessary_operation, clippy::identity_op)]
975const _: () = {
976 ["Size of cuvsBruteForceIndex"][::std::mem::size_of::<cuvsBruteForceIndex>() - 16usize];
977 ["Alignment of cuvsBruteForceIndex"][::std::mem::align_of::<cuvsBruteForceIndex>() - 8usize];
978 ["Offset of field: cuvsBruteForceIndex::addr"]
979 [::std::mem::offset_of!(cuvsBruteForceIndex, addr) - 0usize];
980 ["Offset of field: cuvsBruteForceIndex::dtype"]
981 [::std::mem::offset_of!(cuvsBruteForceIndex, dtype) - 8usize];
982};
983pub type cuvsBruteForceIndex_t = *mut cuvsBruteForceIndex;
984unsafe extern "C" {
985 #[must_use]
986 pub fn cuvsBruteForceIndexCreate(index: *mut cuvsBruteForceIndex_t) -> cuvsError_t;
987}
988unsafe extern "C" {
989 #[must_use]
990 pub fn cuvsBruteForceIndexDestroy(index: cuvsBruteForceIndex_t) -> cuvsError_t;
991}
992unsafe extern "C" {
993 #[must_use]
994 pub fn cuvsBruteForceBuild(
995 res: cuvsResources_t,
996 dataset: *mut DLManagedTensor,
997 metric: cuvsDistanceType,
998 metric_arg: f32,
999 index: cuvsBruteForceIndex_t,
1000 ) -> cuvsError_t;
1001}
1002unsafe extern "C" {
1003 #[must_use]
1004 pub fn cuvsBruteForceSearch(
1005 res: cuvsResources_t,
1006 index: cuvsBruteForceIndex_t,
1007 queries: *mut DLManagedTensor,
1008 neighbors: *mut DLManagedTensor,
1009 distances: *mut DLManagedTensor,
1010 prefilter: cuvsFilter,
1011 ) -> cuvsError_t;
1012}
1013unsafe extern "C" {
1014 #[must_use]
1015 pub fn cuvsBruteForceSerialize(
1016 res: cuvsResources_t,
1017 filename: *const ::std::os::raw::c_char,
1018 index: cuvsBruteForceIndex_t,
1019 ) -> cuvsError_t;
1020}
1021unsafe extern "C" {
1022 #[must_use]
1023 pub fn cuvsBruteForceDeserialize(
1024 res: cuvsResources_t,
1025 filename: *const ::std::os::raw::c_char,
1026 index: cuvsBruteForceIndex_t,
1027 ) -> cuvsError_t;
1028}
1029#[repr(u32)]
1030#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1031pub enum cuvsCagraGraphBuildAlgo {
1032 AUTO_SELECT = 0,
1033 IVF_PQ = 1,
1034 NN_DESCENT = 2,
1035 ITERATIVE_CAGRA_SEARCH = 3,
1036 ACE = 4,
1037}
1038#[repr(u32)]
1039#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1040pub enum cuvsCagraHnswHeuristicType {
1041 CUVS_CAGRA_HEURISTIC_SIMILAR_SEARCH_PERFORMANCE = 0,
1042 CUVS_CAGRA_HEURISTIC_SAME_GRAPH_FOOTPRINT = 1,
1043}
1044#[repr(C)]
1045#[derive(Debug, Copy, Clone)]
1046pub struct cuvsCagraCompressionParams {
1047 pub pq_bits: u32,
1048 pub pq_dim: u32,
1049 pub vq_n_centers: u32,
1050 pub kmeans_n_iters: u32,
1051 pub vq_kmeans_trainset_fraction: f64,
1052 pub pq_kmeans_trainset_fraction: f64,
1053}
1054#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1055const _: () = {
1056 ["Size of cuvsCagraCompressionParams"]
1057 [::std::mem::size_of::<cuvsCagraCompressionParams>() - 32usize];
1058 ["Alignment of cuvsCagraCompressionParams"]
1059 [::std::mem::align_of::<cuvsCagraCompressionParams>() - 8usize];
1060 ["Offset of field: cuvsCagraCompressionParams::pq_bits"]
1061 [::std::mem::offset_of!(cuvsCagraCompressionParams, pq_bits) - 0usize];
1062 ["Offset of field: cuvsCagraCompressionParams::pq_dim"]
1063 [::std::mem::offset_of!(cuvsCagraCompressionParams, pq_dim) - 4usize];
1064 ["Offset of field: cuvsCagraCompressionParams::vq_n_centers"]
1065 [::std::mem::offset_of!(cuvsCagraCompressionParams, vq_n_centers) - 8usize];
1066 ["Offset of field: cuvsCagraCompressionParams::kmeans_n_iters"]
1067 [::std::mem::offset_of!(cuvsCagraCompressionParams, kmeans_n_iters) - 12usize];
1068 ["Offset of field: cuvsCagraCompressionParams::vq_kmeans_trainset_fraction"]
1069 [::std::mem::offset_of!(cuvsCagraCompressionParams, vq_kmeans_trainset_fraction) - 16usize];
1070 ["Offset of field: cuvsCagraCompressionParams::pq_kmeans_trainset_fraction"]
1071 [::std::mem::offset_of!(cuvsCagraCompressionParams, pq_kmeans_trainset_fraction) - 24usize];
1072};
1073pub type cuvsCagraCompressionParams_t = *mut cuvsCagraCompressionParams;
1074#[repr(C)]
1075#[derive(Debug, Copy, Clone)]
1076pub struct cuvsIvfPqParams {
1077 pub ivf_pq_build_params: cuvsIvfPqIndexParams_t,
1078 pub ivf_pq_search_params: cuvsIvfPqSearchParams_t,
1079 pub refinement_rate: f32,
1080}
1081#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1082const _: () = {
1083 ["Size of cuvsIvfPqParams"][::std::mem::size_of::<cuvsIvfPqParams>() - 24usize];
1084 ["Alignment of cuvsIvfPqParams"][::std::mem::align_of::<cuvsIvfPqParams>() - 8usize];
1085 ["Offset of field: cuvsIvfPqParams::ivf_pq_build_params"]
1086 [::std::mem::offset_of!(cuvsIvfPqParams, ivf_pq_build_params) - 0usize];
1087 ["Offset of field: cuvsIvfPqParams::ivf_pq_search_params"]
1088 [::std::mem::offset_of!(cuvsIvfPqParams, ivf_pq_search_params) - 8usize];
1089 ["Offset of field: cuvsIvfPqParams::refinement_rate"]
1090 [::std::mem::offset_of!(cuvsIvfPqParams, refinement_rate) - 16usize];
1091};
1092pub type cuvsIvfPqParams_t = *mut cuvsIvfPqParams;
1093#[repr(C)]
1094#[derive(Debug, Copy, Clone)]
1095pub struct cuvsAceParams {
1096 pub npartitions: usize,
1097 pub ef_construction: usize,
1098 pub build_dir: *const ::std::os::raw::c_char,
1099 pub use_disk: bool,
1100 pub max_host_memory_gb: f64,
1101 pub max_gpu_memory_gb: f64,
1102}
1103#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1104const _: () = {
1105 ["Size of cuvsAceParams"][::std::mem::size_of::<cuvsAceParams>() - 48usize];
1106 ["Alignment of cuvsAceParams"][::std::mem::align_of::<cuvsAceParams>() - 8usize];
1107 ["Offset of field: cuvsAceParams::npartitions"]
1108 [::std::mem::offset_of!(cuvsAceParams, npartitions) - 0usize];
1109 ["Offset of field: cuvsAceParams::ef_construction"]
1110 [::std::mem::offset_of!(cuvsAceParams, ef_construction) - 8usize];
1111 ["Offset of field: cuvsAceParams::build_dir"]
1112 [::std::mem::offset_of!(cuvsAceParams, build_dir) - 16usize];
1113 ["Offset of field: cuvsAceParams::use_disk"]
1114 [::std::mem::offset_of!(cuvsAceParams, use_disk) - 24usize];
1115 ["Offset of field: cuvsAceParams::max_host_memory_gb"]
1116 [::std::mem::offset_of!(cuvsAceParams, max_host_memory_gb) - 32usize];
1117 ["Offset of field: cuvsAceParams::max_gpu_memory_gb"]
1118 [::std::mem::offset_of!(cuvsAceParams, max_gpu_memory_gb) - 40usize];
1119};
1120pub type cuvsAceParams_t = *mut cuvsAceParams;
1121#[repr(C)]
1122#[derive(Debug, Copy, Clone)]
1123pub struct cuvsCagraIndexParams {
1124 pub metric: cuvsDistanceType,
1125 pub intermediate_graph_degree: usize,
1126 pub graph_degree: usize,
1127 pub build_algo: cuvsCagraGraphBuildAlgo,
1128 pub nn_descent_niter: usize,
1129 pub graph_build_params: *mut ::std::os::raw::c_void,
1130}
1131#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1132const _: () = {
1133 ["Size of cuvsCagraIndexParams"][::std::mem::size_of::<cuvsCagraIndexParams>() - 48usize];
1134 ["Alignment of cuvsCagraIndexParams"][::std::mem::align_of::<cuvsCagraIndexParams>() - 8usize];
1135 ["Offset of field: cuvsCagraIndexParams::metric"]
1136 [::std::mem::offset_of!(cuvsCagraIndexParams, metric) - 0usize];
1137 ["Offset of field: cuvsCagraIndexParams::intermediate_graph_degree"]
1138 [::std::mem::offset_of!(cuvsCagraIndexParams, intermediate_graph_degree) - 8usize];
1139 ["Offset of field: cuvsCagraIndexParams::graph_degree"]
1140 [::std::mem::offset_of!(cuvsCagraIndexParams, graph_degree) - 16usize];
1141 ["Offset of field: cuvsCagraIndexParams::build_algo"]
1142 [::std::mem::offset_of!(cuvsCagraIndexParams, build_algo) - 24usize];
1143 ["Offset of field: cuvsCagraIndexParams::nn_descent_niter"]
1144 [::std::mem::offset_of!(cuvsCagraIndexParams, nn_descent_niter) - 32usize];
1145 ["Offset of field: cuvsCagraIndexParams::graph_build_params"]
1146 [::std::mem::offset_of!(cuvsCagraIndexParams, graph_build_params) - 40usize];
1147};
1148pub type cuvsCagraIndexParams_t = *mut cuvsCagraIndexParams;
1149unsafe extern "C" {
1150 #[must_use]
1151 pub fn cuvsCagraIndexParamsCreate(params: *mut cuvsCagraIndexParams_t) -> cuvsError_t;
1152}
1153unsafe extern "C" {
1154 #[must_use]
1155 pub fn cuvsCagraIndexParamsDestroy(params: cuvsCagraIndexParams_t) -> cuvsError_t;
1156}
1157unsafe extern "C" {
1158 #[must_use]
1159 pub fn cuvsCagraCompressionParamsCreate(
1160 params: *mut cuvsCagraCompressionParams_t,
1161 ) -> cuvsError_t;
1162}
1163unsafe extern "C" {
1164 #[must_use]
1165 pub fn cuvsCagraCompressionParamsDestroy(params: cuvsCagraCompressionParams_t) -> cuvsError_t;
1166}
1167unsafe extern "C" {
1168 #[must_use]
1169 pub fn cuvsAceParamsCreate(params: *mut cuvsAceParams_t) -> cuvsError_t;
1170}
1171unsafe extern "C" {
1172 #[must_use]
1173 pub fn cuvsAceParamsDestroy(params: cuvsAceParams_t) -> cuvsError_t;
1174}
1175unsafe extern "C" {
1176 #[must_use]
1177 pub fn cuvsCagraIndexParamsFromHnswParams(
1178 params: cuvsCagraIndexParams_t,
1179 n_rows: i64,
1180 dim: i64,
1181 M: ::std::os::raw::c_int,
1182 ef_construction: ::std::os::raw::c_int,
1183 heuristic: cuvsCagraHnswHeuristicType,
1184 metric: cuvsDistanceType,
1185 ) -> cuvsError_t;
1186}
1187unsafe extern "C" {
1188 #[must_use]
1189 pub fn cuvsCagraIndexParamsFromDataset(
1190 params: cuvsCagraIndexParams_t,
1191 n_rows: i64,
1192 dim: i64,
1193 graph_degree: usize,
1194 metric: cuvsDistanceType,
1195 build_quality: usize,
1196 ) -> cuvsError_t;
1197}
1198#[repr(C)]
1199#[derive(Debug, Copy, Clone)]
1200pub struct cuvsCagraExtendParams {
1201 pub max_chunk_size: u32,
1202}
1203#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1204const _: () = {
1205 ["Size of cuvsCagraExtendParams"][::std::mem::size_of::<cuvsCagraExtendParams>() - 4usize];
1206 ["Alignment of cuvsCagraExtendParams"]
1207 [::std::mem::align_of::<cuvsCagraExtendParams>() - 4usize];
1208 ["Offset of field: cuvsCagraExtendParams::max_chunk_size"]
1209 [::std::mem::offset_of!(cuvsCagraExtendParams, max_chunk_size) - 0usize];
1210};
1211pub type cuvsCagraExtendParams_t = *mut cuvsCagraExtendParams;
1212unsafe extern "C" {
1213 #[must_use]
1214 pub fn cuvsCagraExtendParamsCreate(params: *mut cuvsCagraExtendParams_t) -> cuvsError_t;
1215}
1216unsafe extern "C" {
1217 #[must_use]
1218 pub fn cuvsCagraExtendParamsDestroy(params: cuvsCagraExtendParams_t) -> cuvsError_t;
1219}
1220#[repr(u32)]
1221#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1222pub enum cuvsCagraSearchAlgo {
1223 SINGLE_CTA = 0,
1224 MULTI_CTA = 1,
1225 MULTI_KERNEL = 2,
1226 AUTO = 100,
1227}
1228#[repr(u32)]
1229#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1230pub enum cuvsCagraHashMode {
1231 HASH = 0,
1232 SMALL = 1,
1233 AUTO_HASH = 100,
1234}
1235#[repr(C)]
1236#[derive(Debug, Copy, Clone)]
1237pub struct cuvsCagraSearchParams {
1238 pub max_queries: usize,
1239 pub itopk_size: usize,
1240 pub max_iterations: usize,
1241 pub algo: cuvsCagraSearchAlgo,
1242 pub team_size: usize,
1243 pub search_width: usize,
1244 pub min_iterations: usize,
1245 pub thread_block_size: usize,
1246 pub hashmap_mode: cuvsCagraHashMode,
1247 pub hashmap_min_bitlen: usize,
1248 pub hashmap_max_fill_rate: f32,
1249 pub num_random_samplings: u32,
1250 pub rand_xor_mask: u64,
1251 pub persistent: bool,
1252 pub persistent_lifetime: f32,
1253 pub persistent_device_usage: f32,
1254}
1255#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1256const _: () = {
1257 ["Size of cuvsCagraSearchParams"][::std::mem::size_of::<cuvsCagraSearchParams>() - 112usize];
1258 ["Alignment of cuvsCagraSearchParams"]
1259 [::std::mem::align_of::<cuvsCagraSearchParams>() - 8usize];
1260 ["Offset of field: cuvsCagraSearchParams::max_queries"]
1261 [::std::mem::offset_of!(cuvsCagraSearchParams, max_queries) - 0usize];
1262 ["Offset of field: cuvsCagraSearchParams::itopk_size"]
1263 [::std::mem::offset_of!(cuvsCagraSearchParams, itopk_size) - 8usize];
1264 ["Offset of field: cuvsCagraSearchParams::max_iterations"]
1265 [::std::mem::offset_of!(cuvsCagraSearchParams, max_iterations) - 16usize];
1266 ["Offset of field: cuvsCagraSearchParams::algo"]
1267 [::std::mem::offset_of!(cuvsCagraSearchParams, algo) - 24usize];
1268 ["Offset of field: cuvsCagraSearchParams::team_size"]
1269 [::std::mem::offset_of!(cuvsCagraSearchParams, team_size) - 32usize];
1270 ["Offset of field: cuvsCagraSearchParams::search_width"]
1271 [::std::mem::offset_of!(cuvsCagraSearchParams, search_width) - 40usize];
1272 ["Offset of field: cuvsCagraSearchParams::min_iterations"]
1273 [::std::mem::offset_of!(cuvsCagraSearchParams, min_iterations) - 48usize];
1274 ["Offset of field: cuvsCagraSearchParams::thread_block_size"]
1275 [::std::mem::offset_of!(cuvsCagraSearchParams, thread_block_size) - 56usize];
1276 ["Offset of field: cuvsCagraSearchParams::hashmap_mode"]
1277 [::std::mem::offset_of!(cuvsCagraSearchParams, hashmap_mode) - 64usize];
1278 ["Offset of field: cuvsCagraSearchParams::hashmap_min_bitlen"]
1279 [::std::mem::offset_of!(cuvsCagraSearchParams, hashmap_min_bitlen) - 72usize];
1280 ["Offset of field: cuvsCagraSearchParams::hashmap_max_fill_rate"]
1281 [::std::mem::offset_of!(cuvsCagraSearchParams, hashmap_max_fill_rate) - 80usize];
1282 ["Offset of field: cuvsCagraSearchParams::num_random_samplings"]
1283 [::std::mem::offset_of!(cuvsCagraSearchParams, num_random_samplings) - 84usize];
1284 ["Offset of field: cuvsCagraSearchParams::rand_xor_mask"]
1285 [::std::mem::offset_of!(cuvsCagraSearchParams, rand_xor_mask) - 88usize];
1286 ["Offset of field: cuvsCagraSearchParams::persistent"]
1287 [::std::mem::offset_of!(cuvsCagraSearchParams, persistent) - 96usize];
1288 ["Offset of field: cuvsCagraSearchParams::persistent_lifetime"]
1289 [::std::mem::offset_of!(cuvsCagraSearchParams, persistent_lifetime) - 100usize];
1290 ["Offset of field: cuvsCagraSearchParams::persistent_device_usage"]
1291 [::std::mem::offset_of!(cuvsCagraSearchParams, persistent_device_usage) - 104usize];
1292};
1293pub type cuvsCagraSearchParams_t = *mut cuvsCagraSearchParams;
1294unsafe extern "C" {
1295 #[must_use]
1296 pub fn cuvsCagraSearchParamsCreate(params: *mut cuvsCagraSearchParams_t) -> cuvsError_t;
1297}
1298unsafe extern "C" {
1299 #[must_use]
1300 pub fn cuvsCagraSearchParamsDestroy(params: cuvsCagraSearchParams_t) -> cuvsError_t;
1301}
1302#[repr(C)]
1303#[derive(Debug, Copy, Clone)]
1304pub struct cuvsCagraIndex {
1305 pub addr: usize,
1306 pub dtype: DLDataType,
1307}
1308#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1309const _: () = {
1310 ["Size of cuvsCagraIndex"][::std::mem::size_of::<cuvsCagraIndex>() - 16usize];
1311 ["Alignment of cuvsCagraIndex"][::std::mem::align_of::<cuvsCagraIndex>() - 8usize];
1312 ["Offset of field: cuvsCagraIndex::addr"]
1313 [::std::mem::offset_of!(cuvsCagraIndex, addr) - 0usize];
1314 ["Offset of field: cuvsCagraIndex::dtype"]
1315 [::std::mem::offset_of!(cuvsCagraIndex, dtype) - 8usize];
1316};
1317pub type cuvsCagraIndex_t = *mut cuvsCagraIndex;
1318unsafe extern "C" {
1319 #[must_use]
1320 pub fn cuvsCagraIndexCreate(index: *mut cuvsCagraIndex_t) -> cuvsError_t;
1321}
1322unsafe extern "C" {
1323 #[must_use]
1324 pub fn cuvsCagraIndexDestroy(index: cuvsCagraIndex_t) -> cuvsError_t;
1325}
1326unsafe extern "C" {
1327 #[must_use]
1328 pub fn cuvsCagraIndexGetDims(index: cuvsCagraIndex_t, dim: *mut i64) -> cuvsError_t;
1329}
1330unsafe extern "C" {
1331 #[must_use]
1332 pub fn cuvsCagraIndexGetSize(index: cuvsCagraIndex_t, size: *mut i64) -> cuvsError_t;
1333}
1334unsafe extern "C" {
1335 #[must_use]
1336 pub fn cuvsCagraIndexGetGraphDegree(
1337 index: cuvsCagraIndex_t,
1338 graph_degree: *mut i64,
1339 ) -> cuvsError_t;
1340}
1341unsafe extern "C" {
1342 #[must_use]
1343 pub fn cuvsCagraIndexGetDataset(
1344 index: cuvsCagraIndex_t,
1345 dataset: *mut DLManagedTensor,
1346 ) -> cuvsError_t;
1347}
1348unsafe extern "C" {
1349 #[must_use]
1350 pub fn cuvsCagraIndexGetGraph(
1351 index: cuvsCagraIndex_t,
1352 graph: *mut DLManagedTensor,
1353 ) -> cuvsError_t;
1354}
1355unsafe extern "C" {
1356 #[must_use]
1357 pub fn cuvsCagraUpdateDataset(
1358 res: cuvsResources_t,
1359 device_padded_dataset: cuvsDataset_t,
1360 index: cuvsCagraIndex_t,
1361 ) -> cuvsError_t;
1362}
1363unsafe extern "C" {
1364 #[must_use]
1365 pub fn cuvsCagraBuild(
1366 res: cuvsResources_t,
1367 params: cuvsCagraIndexParams_t,
1368 dataset: cuvsDataset_t,
1369 index: cuvsCagraIndex_t,
1370 ) -> cuvsError_t;
1371}
1372unsafe extern "C" {
1373 #[must_use]
1374 pub fn cuvsCagraExtend(
1375 res: cuvsResources_t,
1376 params: cuvsCagraExtendParams_t,
1377 extended_dataset: cuvsDataset_t,
1378 new_start_row: i64,
1379 index: cuvsCagraIndex_t,
1380 ) -> cuvsError_t;
1381}
1382unsafe extern "C" {
1383 #[must_use]
1384 pub fn cuvsCagraSearch(
1385 res: cuvsResources_t,
1386 params: cuvsCagraSearchParams_t,
1387 index: cuvsCagraIndex_t,
1388 queries: *mut DLManagedTensor,
1389 neighbors: *mut DLManagedTensor,
1390 distances: *mut DLManagedTensor,
1391 filter: cuvsFilter,
1392 ) -> cuvsError_t;
1393}
1394unsafe extern "C" {
1395 #[must_use]
1396 pub fn cuvsCagraSearchMultiPartition(
1397 res: cuvsResources_t,
1398 params: cuvsCagraSearchParams_t,
1399 num_partitions: u32,
1400 indices: *mut cuvsCagraIndex_t,
1401 queries: *mut DLManagedTensor,
1402 partition_ids: *mut DLManagedTensor,
1403 neighbors: *mut DLManagedTensor,
1404 distances: *mut DLManagedTensor,
1405 filters: *mut cuvsFilter,
1406 ) -> cuvsError_t;
1407}
1408unsafe extern "C" {
1409 #[must_use]
1410 pub fn cuvsCagraSerializeGraph(
1411 res: cuvsResources_t,
1412 filename: *const ::std::os::raw::c_char,
1413 index: cuvsCagraIndex_t,
1414 ) -> cuvsError_t;
1415}
1416unsafe extern "C" {
1417 #[must_use]
1418 pub fn cuvsCagraSerializeGraphAndDataset(
1419 res: cuvsResources_t,
1420 filename: *const ::std::os::raw::c_char,
1421 index: cuvsCagraIndex_t,
1422 ) -> cuvsError_t;
1423}
1424unsafe extern "C" {
1425 #[must_use]
1426 pub fn cuvsCagraSerializeToHnswlib(
1427 res: cuvsResources_t,
1428 filename: *const ::std::os::raw::c_char,
1429 index: cuvsCagraIndex_t,
1430 ) -> cuvsError_t;
1431}
1432unsafe extern "C" {
1433 #[must_use]
1434 pub fn cuvsCagraDeserializeGraph(
1435 res: cuvsResources_t,
1436 filename: *const ::std::os::raw::c_char,
1437 index: cuvsCagraIndex_t,
1438 ) -> cuvsError_t;
1439}
1440unsafe extern "C" {
1441 #[must_use]
1442 pub fn cuvsCagraDeserializeGraphAndDataset(
1443 res: cuvsResources_t,
1444 filename: *const ::std::os::raw::c_char,
1445 index: cuvsCagraIndex_t,
1446 out_dataset: *mut cuvsDataset_t,
1447 ) -> cuvsError_t;
1448}
1449unsafe extern "C" {
1450 #[must_use]
1451 pub fn cuvsCagraIndexFromArgs(
1452 res: cuvsResources_t,
1453 metric: cuvsDistanceType,
1454 graph: *mut DLManagedTensor,
1455 dataset: *mut DLManagedTensor,
1456 index: cuvsCagraIndex_t,
1457 ) -> cuvsError_t;
1458}
1459unsafe extern "C" {
1460 #[must_use]
1461 pub fn cuvsCagraMerge(
1462 res: cuvsResources_t,
1463 params: cuvsCagraIndexParams_t,
1464 indices: *mut cuvsCagraIndex_t,
1465 num_indices: usize,
1466 filter: cuvsFilter,
1467 merged_dataset: cuvsDataset_t,
1468 output_index: cuvsCagraIndex_t,
1469 ) -> cuvsError_t;
1470}
1471#[repr(C)]
1472#[derive(Debug, Copy, Clone)]
1473pub struct cuvsIvfFlatIndexParams {
1474 pub metric: cuvsDistanceType,
1475 pub metric_arg: f32,
1476 pub add_data_on_build: bool,
1477 pub n_lists: u32,
1478 pub kmeans_n_iters: u32,
1479 pub kmeans_trainset_fraction: f64,
1480 pub adaptive_centers: bool,
1481 pub conservative_memory_allocation: bool,
1482}
1483#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1484const _: () = {
1485 ["Size of cuvsIvfFlatIndexParams"][::std::mem::size_of::<cuvsIvfFlatIndexParams>() - 40usize];
1486 ["Alignment of cuvsIvfFlatIndexParams"]
1487 [::std::mem::align_of::<cuvsIvfFlatIndexParams>() - 8usize];
1488 ["Offset of field: cuvsIvfFlatIndexParams::metric"]
1489 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, metric) - 0usize];
1490 ["Offset of field: cuvsIvfFlatIndexParams::metric_arg"]
1491 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, metric_arg) - 4usize];
1492 ["Offset of field: cuvsIvfFlatIndexParams::add_data_on_build"]
1493 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, add_data_on_build) - 8usize];
1494 ["Offset of field: cuvsIvfFlatIndexParams::n_lists"]
1495 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, n_lists) - 12usize];
1496 ["Offset of field: cuvsIvfFlatIndexParams::kmeans_n_iters"]
1497 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, kmeans_n_iters) - 16usize];
1498 ["Offset of field: cuvsIvfFlatIndexParams::kmeans_trainset_fraction"]
1499 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, kmeans_trainset_fraction) - 24usize];
1500 ["Offset of field: cuvsIvfFlatIndexParams::adaptive_centers"]
1501 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, adaptive_centers) - 32usize];
1502 ["Offset of field: cuvsIvfFlatIndexParams::conservative_memory_allocation"]
1503 [::std::mem::offset_of!(cuvsIvfFlatIndexParams, conservative_memory_allocation) - 33usize];
1504};
1505pub type cuvsIvfFlatIndexParams_t = *mut cuvsIvfFlatIndexParams;
1506unsafe extern "C" {
1507 #[must_use]
1508 pub fn cuvsIvfFlatIndexParamsCreate(index_params: *mut cuvsIvfFlatIndexParams_t)
1509 -> cuvsError_t;
1510}
1511unsafe extern "C" {
1512 #[must_use]
1513 pub fn cuvsIvfFlatIndexParamsDestroy(index_params: cuvsIvfFlatIndexParams_t) -> cuvsError_t;
1514}
1515#[repr(C)]
1516#[derive(Debug, Copy, Clone)]
1517pub struct cuvsIvfFlatSearchParams {
1518 pub n_probes: u32,
1519}
1520#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1521const _: () = {
1522 ["Size of cuvsIvfFlatSearchParams"][::std::mem::size_of::<cuvsIvfFlatSearchParams>() - 4usize];
1523 ["Alignment of cuvsIvfFlatSearchParams"]
1524 [::std::mem::align_of::<cuvsIvfFlatSearchParams>() - 4usize];
1525 ["Offset of field: cuvsIvfFlatSearchParams::n_probes"]
1526 [::std::mem::offset_of!(cuvsIvfFlatSearchParams, n_probes) - 0usize];
1527};
1528pub type cuvsIvfFlatSearchParams_t = *mut cuvsIvfFlatSearchParams;
1529unsafe extern "C" {
1530 #[must_use]
1531 pub fn cuvsIvfFlatSearchParamsCreate(params: *mut cuvsIvfFlatSearchParams_t) -> cuvsError_t;
1532}
1533unsafe extern "C" {
1534 #[must_use]
1535 pub fn cuvsIvfFlatSearchParamsDestroy(params: cuvsIvfFlatSearchParams_t) -> cuvsError_t;
1536}
1537#[repr(C)]
1538#[derive(Debug, Copy, Clone)]
1539pub struct cuvsIvfFlatIndex {
1540 pub addr: usize,
1541 pub dtype: DLDataType,
1542}
1543#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1544const _: () = {
1545 ["Size of cuvsIvfFlatIndex"][::std::mem::size_of::<cuvsIvfFlatIndex>() - 16usize];
1546 ["Alignment of cuvsIvfFlatIndex"][::std::mem::align_of::<cuvsIvfFlatIndex>() - 8usize];
1547 ["Offset of field: cuvsIvfFlatIndex::addr"]
1548 [::std::mem::offset_of!(cuvsIvfFlatIndex, addr) - 0usize];
1549 ["Offset of field: cuvsIvfFlatIndex::dtype"]
1550 [::std::mem::offset_of!(cuvsIvfFlatIndex, dtype) - 8usize];
1551};
1552pub type cuvsIvfFlatIndex_t = *mut cuvsIvfFlatIndex;
1553unsafe extern "C" {
1554 #[must_use]
1555 pub fn cuvsIvfFlatIndexCreate(index: *mut cuvsIvfFlatIndex_t) -> cuvsError_t;
1556}
1557unsafe extern "C" {
1558 #[must_use]
1559 pub fn cuvsIvfFlatIndexDestroy(index: cuvsIvfFlatIndex_t) -> cuvsError_t;
1560}
1561unsafe extern "C" {
1562 #[must_use]
1563 pub fn cuvsIvfFlatIndexGetNLists(index: cuvsIvfFlatIndex_t, n_lists: *mut i64) -> cuvsError_t;
1564}
1565unsafe extern "C" {
1566 #[must_use]
1567 pub fn cuvsIvfFlatIndexGetDim(index: cuvsIvfFlatIndex_t, dim: *mut i64) -> cuvsError_t;
1568}
1569unsafe extern "C" {
1570 #[must_use]
1571 pub fn cuvsIvfFlatIndexGetCenters(
1572 index: cuvsIvfFlatIndex_t,
1573 centers: *mut DLManagedTensor,
1574 ) -> cuvsError_t;
1575}
1576unsafe extern "C" {
1577 #[must_use]
1578 pub fn cuvsIvfFlatBuild(
1579 res: cuvsResources_t,
1580 index_params: cuvsIvfFlatIndexParams_t,
1581 dataset: *mut DLManagedTensor,
1582 index: cuvsIvfFlatIndex_t,
1583 ) -> cuvsError_t;
1584}
1585unsafe extern "C" {
1586 #[must_use]
1587 pub fn cuvsIvfFlatSearch(
1588 res: cuvsResources_t,
1589 search_params: cuvsIvfFlatSearchParams_t,
1590 index: cuvsIvfFlatIndex_t,
1591 queries: *mut DLManagedTensor,
1592 neighbors: *mut DLManagedTensor,
1593 distances: *mut DLManagedTensor,
1594 filter: cuvsFilter,
1595 ) -> cuvsError_t;
1596}
1597unsafe extern "C" {
1598 #[must_use]
1599 pub fn cuvsIvfFlatSerialize(
1600 res: cuvsResources_t,
1601 filename: *const ::std::os::raw::c_char,
1602 index: cuvsIvfFlatIndex_t,
1603 ) -> cuvsError_t;
1604}
1605unsafe extern "C" {
1606 #[must_use]
1607 pub fn cuvsIvfFlatDeserialize(
1608 res: cuvsResources_t,
1609 filename: *const ::std::os::raw::c_char,
1610 index: cuvsIvfFlatIndex_t,
1611 ) -> cuvsError_t;
1612}
1613unsafe extern "C" {
1614 #[must_use]
1615 pub fn cuvsIvfFlatExtend(
1616 res: cuvsResources_t,
1617 new_vectors: *mut DLManagedTensor,
1618 new_indices: *mut DLManagedTensor,
1619 index: cuvsIvfFlatIndex_t,
1620 ) -> cuvsError_t;
1621}
1622#[repr(C)]
1623#[derive(Debug, Copy, Clone)]
1624pub struct cuvsIvfSqIndexParams {
1625 pub metric: cuvsDistanceType,
1626 pub metric_arg: f32,
1627 pub add_data_on_build: bool,
1628 pub n_lists: u32,
1629 pub kmeans_n_iters: u32,
1630 pub max_train_points_per_cluster: u32,
1631 pub conservative_memory_allocation: bool,
1632}
1633#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1634const _: () = {
1635 ["Size of cuvsIvfSqIndexParams"][::std::mem::size_of::<cuvsIvfSqIndexParams>() - 28usize];
1636 ["Alignment of cuvsIvfSqIndexParams"][::std::mem::align_of::<cuvsIvfSqIndexParams>() - 4usize];
1637 ["Offset of field: cuvsIvfSqIndexParams::metric"]
1638 [::std::mem::offset_of!(cuvsIvfSqIndexParams, metric) - 0usize];
1639 ["Offset of field: cuvsIvfSqIndexParams::metric_arg"]
1640 [::std::mem::offset_of!(cuvsIvfSqIndexParams, metric_arg) - 4usize];
1641 ["Offset of field: cuvsIvfSqIndexParams::add_data_on_build"]
1642 [::std::mem::offset_of!(cuvsIvfSqIndexParams, add_data_on_build) - 8usize];
1643 ["Offset of field: cuvsIvfSqIndexParams::n_lists"]
1644 [::std::mem::offset_of!(cuvsIvfSqIndexParams, n_lists) - 12usize];
1645 ["Offset of field: cuvsIvfSqIndexParams::kmeans_n_iters"]
1646 [::std::mem::offset_of!(cuvsIvfSqIndexParams, kmeans_n_iters) - 16usize];
1647 ["Offset of field: cuvsIvfSqIndexParams::max_train_points_per_cluster"]
1648 [::std::mem::offset_of!(cuvsIvfSqIndexParams, max_train_points_per_cluster) - 20usize];
1649 ["Offset of field: cuvsIvfSqIndexParams::conservative_memory_allocation"]
1650 [::std::mem::offset_of!(cuvsIvfSqIndexParams, conservative_memory_allocation) - 24usize];
1651};
1652pub type cuvsIvfSqIndexParams_t = *mut cuvsIvfSqIndexParams;
1653unsafe extern "C" {
1654 #[must_use]
1655 pub fn cuvsIvfSqIndexParamsCreate(index_params: *mut cuvsIvfSqIndexParams_t) -> cuvsError_t;
1656}
1657unsafe extern "C" {
1658 #[must_use]
1659 pub fn cuvsIvfSqIndexParamsDestroy(index_params: cuvsIvfSqIndexParams_t) -> cuvsError_t;
1660}
1661#[repr(C)]
1662#[derive(Debug, Copy, Clone)]
1663pub struct cuvsIvfSqSearchParams {
1664 pub n_probes: u32,
1665}
1666#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1667const _: () = {
1668 ["Size of cuvsIvfSqSearchParams"][::std::mem::size_of::<cuvsIvfSqSearchParams>() - 4usize];
1669 ["Alignment of cuvsIvfSqSearchParams"]
1670 [::std::mem::align_of::<cuvsIvfSqSearchParams>() - 4usize];
1671 ["Offset of field: cuvsIvfSqSearchParams::n_probes"]
1672 [::std::mem::offset_of!(cuvsIvfSqSearchParams, n_probes) - 0usize];
1673};
1674pub type cuvsIvfSqSearchParams_t = *mut cuvsIvfSqSearchParams;
1675unsafe extern "C" {
1676 #[must_use]
1677 pub fn cuvsIvfSqSearchParamsCreate(params: *mut cuvsIvfSqSearchParams_t) -> cuvsError_t;
1678}
1679unsafe extern "C" {
1680 #[must_use]
1681 pub fn cuvsIvfSqSearchParamsDestroy(params: cuvsIvfSqSearchParams_t) -> cuvsError_t;
1682}
1683#[repr(C)]
1684#[derive(Debug, Copy, Clone)]
1685pub struct cuvsIvfSqIndex {
1686 pub addr: usize,
1687 pub dtype: DLDataType,
1688}
1689#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1690const _: () = {
1691 ["Size of cuvsIvfSqIndex"][::std::mem::size_of::<cuvsIvfSqIndex>() - 16usize];
1692 ["Alignment of cuvsIvfSqIndex"][::std::mem::align_of::<cuvsIvfSqIndex>() - 8usize];
1693 ["Offset of field: cuvsIvfSqIndex::addr"]
1694 [::std::mem::offset_of!(cuvsIvfSqIndex, addr) - 0usize];
1695 ["Offset of field: cuvsIvfSqIndex::dtype"]
1696 [::std::mem::offset_of!(cuvsIvfSqIndex, dtype) - 8usize];
1697};
1698pub type cuvsIvfSqIndex_t = *mut cuvsIvfSqIndex;
1699unsafe extern "C" {
1700 #[must_use]
1701 pub fn cuvsIvfSqIndexCreate(index: *mut cuvsIvfSqIndex_t) -> cuvsError_t;
1702}
1703unsafe extern "C" {
1704 #[must_use]
1705 pub fn cuvsIvfSqIndexDestroy(index: cuvsIvfSqIndex_t) -> cuvsError_t;
1706}
1707unsafe extern "C" {
1708 #[must_use]
1709 pub fn cuvsIvfSqIndexGetNLists(index: cuvsIvfSqIndex_t, n_lists: *mut i64) -> cuvsError_t;
1710}
1711unsafe extern "C" {
1712 #[must_use]
1713 pub fn cuvsIvfSqIndexGetDim(index: cuvsIvfSqIndex_t, dim: *mut i64) -> cuvsError_t;
1714}
1715unsafe extern "C" {
1716 #[must_use]
1717 pub fn cuvsIvfSqIndexGetSize(index: cuvsIvfSqIndex_t, size: *mut i64) -> cuvsError_t;
1718}
1719unsafe extern "C" {
1720 #[must_use]
1721 pub fn cuvsIvfSqIndexGetCenters(
1722 index: cuvsIvfSqIndex_t,
1723 centers: *mut DLManagedTensor,
1724 ) -> cuvsError_t;
1725}
1726unsafe extern "C" {
1727 #[must_use]
1728 pub fn cuvsIvfSqBuild(
1729 res: cuvsResources_t,
1730 index_params: cuvsIvfSqIndexParams_t,
1731 dataset: *mut DLManagedTensor,
1732 index: cuvsIvfSqIndex_t,
1733 ) -> cuvsError_t;
1734}
1735unsafe extern "C" {
1736 #[must_use]
1737 pub fn cuvsIvfSqSearch(
1738 res: cuvsResources_t,
1739 search_params: cuvsIvfSqSearchParams_t,
1740 index: cuvsIvfSqIndex_t,
1741 queries: *mut DLManagedTensor,
1742 neighbors: *mut DLManagedTensor,
1743 distances: *mut DLManagedTensor,
1744 filter: cuvsFilter,
1745 ) -> cuvsError_t;
1746}
1747unsafe extern "C" {
1748 #[must_use]
1749 pub fn cuvsIvfSqSerialize(
1750 res: cuvsResources_t,
1751 filename: *const ::std::os::raw::c_char,
1752 index: cuvsIvfSqIndex_t,
1753 ) -> cuvsError_t;
1754}
1755unsafe extern "C" {
1756 #[must_use]
1757 pub fn cuvsIvfSqDeserialize(
1758 res: cuvsResources_t,
1759 filename: *const ::std::os::raw::c_char,
1760 index: cuvsIvfSqIndex_t,
1761 ) -> cuvsError_t;
1762}
1763unsafe extern "C" {
1764 #[must_use]
1765 pub fn cuvsIvfSqExtend(
1766 res: cuvsResources_t,
1767 new_vectors: *mut DLManagedTensor,
1768 new_indices: *mut DLManagedTensor,
1769 index: cuvsIvfSqIndex_t,
1770 ) -> cuvsError_t;
1771}
1772unsafe extern "C" {
1773 #[must_use]
1774 pub fn cuvsRefine(
1775 res: cuvsResources_t,
1776 dataset: *mut DLManagedTensor,
1777 queries: *mut DLManagedTensor,
1778 candidates: *mut DLManagedTensor,
1779 metric: cuvsDistanceType,
1780 indices: *mut DLManagedTensor,
1781 distances: *mut DLManagedTensor,
1782 ) -> cuvsError_t;
1783}
1784#[repr(u32)]
1785#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1786pub enum cuvsTieredIndexANNAlgo {
1787 CUVS_TIERED_INDEX_ALGO_CAGRA = 0,
1788 CUVS_TIERED_INDEX_ALGO_IVF_FLAT = 1,
1789 CUVS_TIERED_INDEX_ALGO_IVF_PQ = 2,
1790}
1791#[repr(C)]
1792#[derive(Debug, Copy, Clone)]
1793pub struct cuvsTieredIndex {
1794 pub addr: usize,
1795 pub dtype: DLDataType,
1796 pub algo: cuvsTieredIndexANNAlgo,
1797}
1798#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1799const _: () = {
1800 ["Size of cuvsTieredIndex"][::std::mem::size_of::<cuvsTieredIndex>() - 16usize];
1801 ["Alignment of cuvsTieredIndex"][::std::mem::align_of::<cuvsTieredIndex>() - 8usize];
1802 ["Offset of field: cuvsTieredIndex::addr"]
1803 [::std::mem::offset_of!(cuvsTieredIndex, addr) - 0usize];
1804 ["Offset of field: cuvsTieredIndex::dtype"]
1805 [::std::mem::offset_of!(cuvsTieredIndex, dtype) - 8usize];
1806 ["Offset of field: cuvsTieredIndex::algo"]
1807 [::std::mem::offset_of!(cuvsTieredIndex, algo) - 12usize];
1808};
1809pub type cuvsTieredIndex_t = *mut cuvsTieredIndex;
1810unsafe extern "C" {
1811 #[must_use]
1812 pub fn cuvsTieredIndexCreate(index: *mut cuvsTieredIndex_t) -> cuvsError_t;
1813}
1814unsafe extern "C" {
1815 #[must_use]
1816 pub fn cuvsTieredIndexDestroy(index: cuvsTieredIndex_t) -> cuvsError_t;
1817}
1818#[repr(C)]
1819#[derive(Debug, Copy, Clone)]
1820pub struct cuvsTieredIndexParams {
1821 pub metric: cuvsDistanceType,
1822 pub algo: cuvsTieredIndexANNAlgo,
1823 pub min_ann_rows: i64,
1824 pub create_ann_index_on_extend: bool,
1825 pub cagra_params: cuvsCagraIndexParams_t,
1826 pub ivf_flat_params: cuvsIvfFlatIndexParams_t,
1827 pub ivf_pq_params: cuvsIvfPqIndexParams_t,
1828}
1829#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1830const _: () = {
1831 ["Size of cuvsTieredIndexParams"][::std::mem::size_of::<cuvsTieredIndexParams>() - 48usize];
1832 ["Alignment of cuvsTieredIndexParams"]
1833 [::std::mem::align_of::<cuvsTieredIndexParams>() - 8usize];
1834 ["Offset of field: cuvsTieredIndexParams::metric"]
1835 [::std::mem::offset_of!(cuvsTieredIndexParams, metric) - 0usize];
1836 ["Offset of field: cuvsTieredIndexParams::algo"]
1837 [::std::mem::offset_of!(cuvsTieredIndexParams, algo) - 4usize];
1838 ["Offset of field: cuvsTieredIndexParams::min_ann_rows"]
1839 [::std::mem::offset_of!(cuvsTieredIndexParams, min_ann_rows) - 8usize];
1840 ["Offset of field: cuvsTieredIndexParams::create_ann_index_on_extend"]
1841 [::std::mem::offset_of!(cuvsTieredIndexParams, create_ann_index_on_extend) - 16usize];
1842 ["Offset of field: cuvsTieredIndexParams::cagra_params"]
1843 [::std::mem::offset_of!(cuvsTieredIndexParams, cagra_params) - 24usize];
1844 ["Offset of field: cuvsTieredIndexParams::ivf_flat_params"]
1845 [::std::mem::offset_of!(cuvsTieredIndexParams, ivf_flat_params) - 32usize];
1846 ["Offset of field: cuvsTieredIndexParams::ivf_pq_params"]
1847 [::std::mem::offset_of!(cuvsTieredIndexParams, ivf_pq_params) - 40usize];
1848};
1849pub type cuvsTieredIndexParams_t = *mut cuvsTieredIndexParams;
1850unsafe extern "C" {
1851 #[must_use]
1852 pub fn cuvsTieredIndexParamsCreate(index_params: *mut cuvsTieredIndexParams_t) -> cuvsError_t;
1853}
1854unsafe extern "C" {
1855 #[must_use]
1856 pub fn cuvsTieredIndexParamsDestroy(index_params: cuvsTieredIndexParams_t) -> cuvsError_t;
1857}
1858unsafe extern "C" {
1859 #[must_use]
1860 pub fn cuvsTieredIndexBuild(
1861 res: cuvsResources_t,
1862 index_params: cuvsTieredIndexParams_t,
1863 dataset: *mut DLManagedTensor,
1864 index: cuvsTieredIndex_t,
1865 ) -> cuvsError_t;
1866}
1867unsafe extern "C" {
1868 #[must_use]
1869 pub fn cuvsTieredIndexSearch(
1870 res: cuvsResources_t,
1871 search_params: *mut ::std::os::raw::c_void,
1872 index: cuvsTieredIndex_t,
1873 queries: *mut DLManagedTensor,
1874 neighbors: *mut DLManagedTensor,
1875 distances: *mut DLManagedTensor,
1876 prefilter: cuvsFilter,
1877 ) -> cuvsError_t;
1878}
1879unsafe extern "C" {
1880 #[must_use]
1881 pub fn cuvsTieredIndexExtend(
1882 res: cuvsResources_t,
1883 new_vectors: *mut DLManagedTensor,
1884 index: cuvsTieredIndex_t,
1885 ) -> cuvsError_t;
1886}
1887unsafe extern "C" {
1888 #[must_use]
1889 pub fn cuvsTieredIndexMerge(
1890 res: cuvsResources_t,
1891 index_params: cuvsTieredIndexParams_t,
1892 indices: *mut cuvsTieredIndex_t,
1893 num_indices: usize,
1894 output_index: cuvsTieredIndex_t,
1895 ) -> cuvsError_t;
1896}
1897#[repr(C)]
1898#[derive(Debug, Copy, Clone)]
1899pub struct cuvsVamanaIndexParams {
1900 pub metric: cuvsDistanceType,
1901 pub graph_degree: u32,
1902 pub visited_size: u32,
1903 pub vamana_iters: f32,
1904 pub alpha: f32,
1905 pub max_fraction: f32,
1906 pub batch_base: f32,
1907 pub queue_size: u32,
1908 pub reverse_batchsize: u32,
1909}
1910#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1911const _: () = {
1912 ["Size of cuvsVamanaIndexParams"][::std::mem::size_of::<cuvsVamanaIndexParams>() - 36usize];
1913 ["Alignment of cuvsVamanaIndexParams"]
1914 [::std::mem::align_of::<cuvsVamanaIndexParams>() - 4usize];
1915 ["Offset of field: cuvsVamanaIndexParams::metric"]
1916 [::std::mem::offset_of!(cuvsVamanaIndexParams, metric) - 0usize];
1917 ["Offset of field: cuvsVamanaIndexParams::graph_degree"]
1918 [::std::mem::offset_of!(cuvsVamanaIndexParams, graph_degree) - 4usize];
1919 ["Offset of field: cuvsVamanaIndexParams::visited_size"]
1920 [::std::mem::offset_of!(cuvsVamanaIndexParams, visited_size) - 8usize];
1921 ["Offset of field: cuvsVamanaIndexParams::vamana_iters"]
1922 [::std::mem::offset_of!(cuvsVamanaIndexParams, vamana_iters) - 12usize];
1923 ["Offset of field: cuvsVamanaIndexParams::alpha"]
1924 [::std::mem::offset_of!(cuvsVamanaIndexParams, alpha) - 16usize];
1925 ["Offset of field: cuvsVamanaIndexParams::max_fraction"]
1926 [::std::mem::offset_of!(cuvsVamanaIndexParams, max_fraction) - 20usize];
1927 ["Offset of field: cuvsVamanaIndexParams::batch_base"]
1928 [::std::mem::offset_of!(cuvsVamanaIndexParams, batch_base) - 24usize];
1929 ["Offset of field: cuvsVamanaIndexParams::queue_size"]
1930 [::std::mem::offset_of!(cuvsVamanaIndexParams, queue_size) - 28usize];
1931 ["Offset of field: cuvsVamanaIndexParams::reverse_batchsize"]
1932 [::std::mem::offset_of!(cuvsVamanaIndexParams, reverse_batchsize) - 32usize];
1933};
1934pub type cuvsVamanaIndexParams_t = *mut cuvsVamanaIndexParams;
1935unsafe extern "C" {
1936 #[must_use]
1937 pub fn cuvsVamanaIndexParamsCreate(params: *mut cuvsVamanaIndexParams_t) -> cuvsError_t;
1938}
1939unsafe extern "C" {
1940 #[must_use]
1941 pub fn cuvsVamanaIndexParamsDestroy(params: cuvsVamanaIndexParams_t) -> cuvsError_t;
1942}
1943#[repr(C)]
1944#[derive(Debug, Copy, Clone)]
1945pub struct cuvsVamanaIndex {
1946 pub addr: usize,
1947 pub dtype: DLDataType,
1948}
1949#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1950const _: () = {
1951 ["Size of cuvsVamanaIndex"][::std::mem::size_of::<cuvsVamanaIndex>() - 16usize];
1952 ["Alignment of cuvsVamanaIndex"][::std::mem::align_of::<cuvsVamanaIndex>() - 8usize];
1953 ["Offset of field: cuvsVamanaIndex::addr"]
1954 [::std::mem::offset_of!(cuvsVamanaIndex, addr) - 0usize];
1955 ["Offset of field: cuvsVamanaIndex::dtype"]
1956 [::std::mem::offset_of!(cuvsVamanaIndex, dtype) - 8usize];
1957};
1958pub type cuvsVamanaIndex_t = *mut cuvsVamanaIndex;
1959unsafe extern "C" {
1960 #[must_use]
1961 pub fn cuvsVamanaIndexCreate(index: *mut cuvsVamanaIndex_t) -> cuvsError_t;
1962}
1963unsafe extern "C" {
1964 #[must_use]
1965 pub fn cuvsVamanaIndexDestroy(index: cuvsVamanaIndex_t) -> cuvsError_t;
1966}
1967unsafe extern "C" {
1968 #[must_use]
1969 pub fn cuvsVamanaIndexGetDims(
1970 index: cuvsVamanaIndex_t,
1971 dim: *mut ::std::os::raw::c_int,
1972 ) -> cuvsError_t;
1973}
1974unsafe extern "C" {
1975 #[must_use]
1976 pub fn cuvsVamanaBuild(
1977 res: cuvsResources_t,
1978 params: cuvsVamanaIndexParams_t,
1979 dataset: *mut DLManagedTensor,
1980 index: cuvsVamanaIndex_t,
1981 ) -> cuvsError_t;
1982}
1983unsafe extern "C" {
1984 #[must_use]
1985 pub fn cuvsVamanaSerialize(
1986 res: cuvsResources_t,
1987 filename: *const ::std::os::raw::c_char,
1988 index: cuvsVamanaIndex_t,
1989 include_dataset: bool,
1990 ) -> cuvsError_t;
1991}
1992#[repr(u32)]
1993#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1994pub enum cuvsHnswHierarchy {
1995 NONE = 0,
1996 CPU = 1,
1997 GPU = 2,
1998}
1999#[repr(C)]
2000#[derive(Debug, Copy, Clone)]
2001pub struct cuvsHnswAceParams {
2002 pub npartitions: usize,
2003 pub build_dir: *const ::std::os::raw::c_char,
2004 pub use_disk: bool,
2005 pub max_host_memory_gb: f64,
2006 pub max_gpu_memory_gb: f64,
2007}
2008#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2009const _: () = {
2010 ["Size of cuvsHnswAceParams"][::std::mem::size_of::<cuvsHnswAceParams>() - 40usize];
2011 ["Alignment of cuvsHnswAceParams"][::std::mem::align_of::<cuvsHnswAceParams>() - 8usize];
2012 ["Offset of field: cuvsHnswAceParams::npartitions"]
2013 [::std::mem::offset_of!(cuvsHnswAceParams, npartitions) - 0usize];
2014 ["Offset of field: cuvsHnswAceParams::build_dir"]
2015 [::std::mem::offset_of!(cuvsHnswAceParams, build_dir) - 8usize];
2016 ["Offset of field: cuvsHnswAceParams::use_disk"]
2017 [::std::mem::offset_of!(cuvsHnswAceParams, use_disk) - 16usize];
2018 ["Offset of field: cuvsHnswAceParams::max_host_memory_gb"]
2019 [::std::mem::offset_of!(cuvsHnswAceParams, max_host_memory_gb) - 24usize];
2020 ["Offset of field: cuvsHnswAceParams::max_gpu_memory_gb"]
2021 [::std::mem::offset_of!(cuvsHnswAceParams, max_gpu_memory_gb) - 32usize];
2022};
2023pub type cuvsHnswAceParams_t = *mut cuvsHnswAceParams;
2024unsafe extern "C" {
2025 #[must_use]
2026 pub fn cuvsHnswAceParamsCreate(params: *mut cuvsHnswAceParams_t) -> cuvsError_t;
2027}
2028unsafe extern "C" {
2029 #[must_use]
2030 pub fn cuvsHnswAceParamsDestroy(params: cuvsHnswAceParams_t) -> cuvsError_t;
2031}
2032#[repr(C)]
2033#[derive(Debug, Copy, Clone)]
2034pub struct cuvsHnswIndexParams {
2035 pub hierarchy: cuvsHnswHierarchy,
2036 pub ef_construction: ::std::os::raw::c_int,
2037 pub num_threads: ::std::os::raw::c_int,
2038 pub M: usize,
2039 pub metric: cuvsDistanceType,
2040 pub ace_params: cuvsHnswAceParams_t,
2041}
2042#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2043const _: () = {
2044 ["Size of cuvsHnswIndexParams"][::std::mem::size_of::<cuvsHnswIndexParams>() - 40usize];
2045 ["Alignment of cuvsHnswIndexParams"][::std::mem::align_of::<cuvsHnswIndexParams>() - 8usize];
2046 ["Offset of field: cuvsHnswIndexParams::hierarchy"]
2047 [::std::mem::offset_of!(cuvsHnswIndexParams, hierarchy) - 0usize];
2048 ["Offset of field: cuvsHnswIndexParams::ef_construction"]
2049 [::std::mem::offset_of!(cuvsHnswIndexParams, ef_construction) - 4usize];
2050 ["Offset of field: cuvsHnswIndexParams::num_threads"]
2051 [::std::mem::offset_of!(cuvsHnswIndexParams, num_threads) - 8usize];
2052 ["Offset of field: cuvsHnswIndexParams::M"]
2053 [::std::mem::offset_of!(cuvsHnswIndexParams, M) - 16usize];
2054 ["Offset of field: cuvsHnswIndexParams::metric"]
2055 [::std::mem::offset_of!(cuvsHnswIndexParams, metric) - 24usize];
2056 ["Offset of field: cuvsHnswIndexParams::ace_params"]
2057 [::std::mem::offset_of!(cuvsHnswIndexParams, ace_params) - 32usize];
2058};
2059pub type cuvsHnswIndexParams_t = *mut cuvsHnswIndexParams;
2060unsafe extern "C" {
2061 #[must_use]
2062 pub fn cuvsHnswIndexParamsCreate(params: *mut cuvsHnswIndexParams_t) -> cuvsError_t;
2063}
2064unsafe extern "C" {
2065 #[must_use]
2066 pub fn cuvsHnswIndexParamsDestroy(params: cuvsHnswIndexParams_t) -> cuvsError_t;
2067}
2068#[repr(C)]
2069#[derive(Debug, Copy, Clone)]
2070pub struct cuvsHnswIndex {
2071 pub addr: usize,
2072 pub dtype: DLDataType,
2073}
2074#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2075const _: () = {
2076 ["Size of cuvsHnswIndex"][::std::mem::size_of::<cuvsHnswIndex>() - 16usize];
2077 ["Alignment of cuvsHnswIndex"][::std::mem::align_of::<cuvsHnswIndex>() - 8usize];
2078 ["Offset of field: cuvsHnswIndex::addr"][::std::mem::offset_of!(cuvsHnswIndex, addr) - 0usize];
2079 ["Offset of field: cuvsHnswIndex::dtype"]
2080 [::std::mem::offset_of!(cuvsHnswIndex, dtype) - 8usize];
2081};
2082pub type cuvsHnswIndex_t = *mut cuvsHnswIndex;
2083unsafe extern "C" {
2084 #[must_use]
2085 pub fn cuvsHnswIndexCreate(index: *mut cuvsHnswIndex_t) -> cuvsError_t;
2086}
2087unsafe extern "C" {
2088 #[must_use]
2089 pub fn cuvsHnswIndexDestroy(index: cuvsHnswIndex_t) -> cuvsError_t;
2090}
2091#[repr(C)]
2092#[derive(Debug, Copy, Clone)]
2093pub struct cuvsHnswExtendParams {
2094 pub num_threads: ::std::os::raw::c_int,
2095}
2096#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2097const _: () = {
2098 ["Size of cuvsHnswExtendParams"][::std::mem::size_of::<cuvsHnswExtendParams>() - 4usize];
2099 ["Alignment of cuvsHnswExtendParams"][::std::mem::align_of::<cuvsHnswExtendParams>() - 4usize];
2100 ["Offset of field: cuvsHnswExtendParams::num_threads"]
2101 [::std::mem::offset_of!(cuvsHnswExtendParams, num_threads) - 0usize];
2102};
2103pub type cuvsHnswExtendParams_t = *mut cuvsHnswExtendParams;
2104unsafe extern "C" {
2105 #[must_use]
2106 pub fn cuvsHnswExtendParamsCreate(params: *mut cuvsHnswExtendParams_t) -> cuvsError_t;
2107}
2108unsafe extern "C" {
2109 #[must_use]
2110 pub fn cuvsHnswExtendParamsDestroy(params: cuvsHnswExtendParams_t) -> cuvsError_t;
2111}
2112unsafe extern "C" {
2113 #[must_use]
2114 pub fn cuvsHnswFromCagra(
2115 res: cuvsResources_t,
2116 params: cuvsHnswIndexParams_t,
2117 cagra_index: cuvsCagraIndex_t,
2118 hnsw_index: cuvsHnswIndex_t,
2119 ) -> cuvsError_t;
2120}
2121unsafe extern "C" {
2122 #[must_use]
2123 pub fn cuvsHnswFromCagraWithDataset(
2124 res: cuvsResources_t,
2125 params: cuvsHnswIndexParams_t,
2126 cagra_index: cuvsCagraIndex_t,
2127 hnsw_index: cuvsHnswIndex_t,
2128 dataset_tensor: *mut DLManagedTensor,
2129 ) -> cuvsError_t;
2130}
2131unsafe extern "C" {
2132 #[must_use]
2133 pub fn cuvsHnswBuild(
2134 res: cuvsResources_t,
2135 params: cuvsHnswIndexParams_t,
2136 dataset: *mut DLManagedTensor,
2137 index: cuvsHnswIndex_t,
2138 ) -> cuvsError_t;
2139}
2140unsafe extern "C" {
2141 #[must_use]
2142 pub fn cuvsHnswExtend(
2143 res: cuvsResources_t,
2144 params: cuvsHnswExtendParams_t,
2145 additional_dataset: *mut DLManagedTensor,
2146 index: cuvsHnswIndex_t,
2147 ) -> cuvsError_t;
2148}
2149#[repr(C)]
2150#[derive(Debug, Copy, Clone)]
2151pub struct cuvsHnswSearchParams {
2152 pub ef: i32,
2153 pub num_threads: i32,
2154}
2155#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2156const _: () = {
2157 ["Size of cuvsHnswSearchParams"][::std::mem::size_of::<cuvsHnswSearchParams>() - 8usize];
2158 ["Alignment of cuvsHnswSearchParams"][::std::mem::align_of::<cuvsHnswSearchParams>() - 4usize];
2159 ["Offset of field: cuvsHnswSearchParams::ef"]
2160 [::std::mem::offset_of!(cuvsHnswSearchParams, ef) - 0usize];
2161 ["Offset of field: cuvsHnswSearchParams::num_threads"]
2162 [::std::mem::offset_of!(cuvsHnswSearchParams, num_threads) - 4usize];
2163};
2164pub type cuvsHnswSearchParams_t = *mut cuvsHnswSearchParams;
2165unsafe extern "C" {
2166 #[must_use]
2167 pub fn cuvsHnswSearchParamsCreate(params: *mut cuvsHnswSearchParams_t) -> cuvsError_t;
2168}
2169unsafe extern "C" {
2170 #[must_use]
2171 pub fn cuvsHnswSearchParamsDestroy(params: cuvsHnswSearchParams_t) -> cuvsError_t;
2172}
2173unsafe extern "C" {
2174 #[must_use]
2175 pub fn cuvsHnswSearch(
2176 res: cuvsResources_t,
2177 params: cuvsHnswSearchParams_t,
2178 index: cuvsHnswIndex_t,
2179 queries: *mut DLManagedTensor,
2180 neighbors: *mut DLManagedTensor,
2181 distances: *mut DLManagedTensor,
2182 ) -> cuvsError_t;
2183}
2184unsafe extern "C" {
2185 #[must_use]
2186 pub fn cuvsHnswSerialize(
2187 res: cuvsResources_t,
2188 filename: *const ::std::os::raw::c_char,
2189 index: cuvsHnswIndex_t,
2190 ) -> cuvsError_t;
2191}
2192unsafe extern "C" {
2193 #[must_use]
2194 pub fn cuvsHnswDeserialize(
2195 res: cuvsResources_t,
2196 params: cuvsHnswIndexParams_t,
2197 filename: *const ::std::os::raw::c_char,
2198 dim: ::std::os::raw::c_int,
2199 metric: cuvsDistanceType,
2200 index: cuvsHnswIndex_t,
2201 ) -> cuvsError_t;
2202}
2203unsafe extern "C" {
2204 #[must_use]
2205 pub fn cuvsMultiGpuKMeansFit(
2206 res: cuvsResources_t,
2207 params: cuvsKMeansParams_t,
2208 X: *mut DLManagedTensor,
2209 sample_weight: *mut DLManagedTensor,
2210 centroids: *mut DLManagedTensor,
2211 inertia: *mut f64,
2212 n_iter: *mut ::std::os::raw::c_int,
2213 ) -> cuvsError_t;
2214}
2215#[repr(u32)]
2216#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2217pub enum cuvsMultiGpuDistributionMode {
2218 CUVS_NEIGHBORS_MG_REPLICATED = 0,
2219 CUVS_NEIGHBORS_MG_SHARDED = 1,
2220}
2221#[repr(u32)]
2222#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2223pub enum cuvsMultiGpuReplicatedSearchMode {
2224 CUVS_NEIGHBORS_MG_LOAD_BALANCER = 0,
2225 CUVS_NEIGHBORS_MG_ROUND_ROBIN = 1,
2226}
2227#[repr(u32)]
2228#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2229pub enum cuvsMultiGpuShardedMergeMode {
2230 CUVS_NEIGHBORS_MG_MERGE_ON_ROOT_RANK = 0,
2231 CUVS_NEIGHBORS_MG_TREE_MERGE = 1,
2232}
2233#[repr(C)]
2234#[derive(Debug, Copy, Clone)]
2235pub struct cuvsMultiGpuCagraIndexParams {
2236 pub base_params: cuvsCagraIndexParams_t,
2237 pub mode: cuvsMultiGpuDistributionMode,
2238}
2239#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2240const _: () = {
2241 ["Size of cuvsMultiGpuCagraIndexParams"]
2242 [::std::mem::size_of::<cuvsMultiGpuCagraIndexParams>() - 16usize];
2243 ["Alignment of cuvsMultiGpuCagraIndexParams"]
2244 [::std::mem::align_of::<cuvsMultiGpuCagraIndexParams>() - 8usize];
2245 ["Offset of field: cuvsMultiGpuCagraIndexParams::base_params"]
2246 [::std::mem::offset_of!(cuvsMultiGpuCagraIndexParams, base_params) - 0usize];
2247 ["Offset of field: cuvsMultiGpuCagraIndexParams::mode"]
2248 [::std::mem::offset_of!(cuvsMultiGpuCagraIndexParams, mode) - 8usize];
2249};
2250pub type cuvsMultiGpuCagraIndexParams_t = *mut cuvsMultiGpuCagraIndexParams;
2251unsafe extern "C" {
2252 #[must_use]
2253 pub fn cuvsMultiGpuCagraIndexParamsCreate(
2254 index_params: *mut cuvsMultiGpuCagraIndexParams_t,
2255 ) -> cuvsError_t;
2256}
2257unsafe extern "C" {
2258 #[must_use]
2259 pub fn cuvsMultiGpuCagraIndexParamsDestroy(
2260 index_params: cuvsMultiGpuCagraIndexParams_t,
2261 ) -> cuvsError_t;
2262}
2263#[repr(C)]
2264#[derive(Debug, Copy, Clone)]
2265pub struct cuvsMultiGpuCagraSearchParams {
2266 pub base_params: cuvsCagraSearchParams_t,
2267 pub search_mode: cuvsMultiGpuReplicatedSearchMode,
2268 pub merge_mode: cuvsMultiGpuShardedMergeMode,
2269 pub n_rows_per_batch: i64,
2270}
2271#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2272const _: () = {
2273 ["Size of cuvsMultiGpuCagraSearchParams"]
2274 [::std::mem::size_of::<cuvsMultiGpuCagraSearchParams>() - 24usize];
2275 ["Alignment of cuvsMultiGpuCagraSearchParams"]
2276 [::std::mem::align_of::<cuvsMultiGpuCagraSearchParams>() - 8usize];
2277 ["Offset of field: cuvsMultiGpuCagraSearchParams::base_params"]
2278 [::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, base_params) - 0usize];
2279 ["Offset of field: cuvsMultiGpuCagraSearchParams::search_mode"]
2280 [::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, search_mode) - 8usize];
2281 ["Offset of field: cuvsMultiGpuCagraSearchParams::merge_mode"]
2282 [::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, merge_mode) - 12usize];
2283 ["Offset of field: cuvsMultiGpuCagraSearchParams::n_rows_per_batch"]
2284 [::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, n_rows_per_batch) - 16usize];
2285};
2286pub type cuvsMultiGpuCagraSearchParams_t = *mut cuvsMultiGpuCagraSearchParams;
2287unsafe extern "C" {
2288 #[must_use]
2289 pub fn cuvsMultiGpuCagraSearchParamsCreate(
2290 params: *mut cuvsMultiGpuCagraSearchParams_t,
2291 ) -> cuvsError_t;
2292}
2293unsafe extern "C" {
2294 #[must_use]
2295 pub fn cuvsMultiGpuCagraSearchParamsDestroy(
2296 params: cuvsMultiGpuCagraSearchParams_t,
2297 ) -> cuvsError_t;
2298}
2299#[repr(C)]
2300#[derive(Debug, Copy, Clone)]
2301pub struct cuvsMultiGpuCagraIndex {
2302 pub addr: usize,
2303 pub dtype: DLDataType,
2304}
2305#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2306const _: () = {
2307 ["Size of cuvsMultiGpuCagraIndex"][::std::mem::size_of::<cuvsMultiGpuCagraIndex>() - 16usize];
2308 ["Alignment of cuvsMultiGpuCagraIndex"]
2309 [::std::mem::align_of::<cuvsMultiGpuCagraIndex>() - 8usize];
2310 ["Offset of field: cuvsMultiGpuCagraIndex::addr"]
2311 [::std::mem::offset_of!(cuvsMultiGpuCagraIndex, addr) - 0usize];
2312 ["Offset of field: cuvsMultiGpuCagraIndex::dtype"]
2313 [::std::mem::offset_of!(cuvsMultiGpuCagraIndex, dtype) - 8usize];
2314};
2315pub type cuvsMultiGpuCagraIndex_t = *mut cuvsMultiGpuCagraIndex;
2316unsafe extern "C" {
2317 #[must_use]
2318 pub fn cuvsMultiGpuCagraIndexCreate(index: *mut cuvsMultiGpuCagraIndex_t) -> cuvsError_t;
2319}
2320unsafe extern "C" {
2321 #[must_use]
2322 pub fn cuvsMultiGpuCagraIndexDestroy(index: cuvsMultiGpuCagraIndex_t) -> cuvsError_t;
2323}
2324unsafe extern "C" {
2325 #[must_use]
2326 pub fn cuvsMultiGpuCagraBuild(
2327 res: cuvsResources_t,
2328 params: cuvsMultiGpuCagraIndexParams_t,
2329 dataset_tensor: *mut DLManagedTensor,
2330 index: cuvsMultiGpuCagraIndex_t,
2331 ) -> cuvsError_t;
2332}
2333unsafe extern "C" {
2334 #[must_use]
2335 pub fn cuvsMultiGpuCagraUpdateDataset(
2336 res: cuvsResources_t,
2337 device_padded_dataset: cuvsDataset_t,
2338 index: cuvsMultiGpuCagraIndex_t,
2339 ) -> cuvsError_t;
2340}
2341unsafe extern "C" {
2342 #[must_use]
2343 pub fn cuvsMultiGpuCagraSearch(
2344 res: cuvsResources_t,
2345 params: cuvsMultiGpuCagraSearchParams_t,
2346 index: cuvsMultiGpuCagraIndex_t,
2347 queries_tensor: *mut DLManagedTensor,
2348 neighbors_tensor: *mut DLManagedTensor,
2349 distances_tensor: *mut DLManagedTensor,
2350 ) -> cuvsError_t;
2351}
2352unsafe extern "C" {
2353 #[must_use]
2354 pub fn cuvsMultiGpuCagraExtend(
2355 res: cuvsResources_t,
2356 index: cuvsMultiGpuCagraIndex_t,
2357 new_vectors_tensor: *mut DLManagedTensor,
2358 new_indices_tensor: *mut DLManagedTensor,
2359 ) -> cuvsError_t;
2360}
2361unsafe extern "C" {
2362 #[must_use]
2363 pub fn cuvsMultiGpuCagraSerialize(
2364 res: cuvsResources_t,
2365 index: cuvsMultiGpuCagraIndex_t,
2366 filename: *const ::std::os::raw::c_char,
2367 ) -> cuvsError_t;
2368}
2369unsafe extern "C" {
2370 #[must_use]
2371 pub fn cuvsMultiGpuCagraDeserialize(
2372 res: cuvsResources_t,
2373 filename: *const ::std::os::raw::c_char,
2374 index: cuvsMultiGpuCagraIndex_t,
2375 ) -> cuvsError_t;
2376}
2377unsafe extern "C" {
2378 #[must_use]
2379 pub fn cuvsMultiGpuCagraDistribute(
2380 res: cuvsResources_t,
2381 filename: *const ::std::os::raw::c_char,
2382 index: cuvsMultiGpuCagraIndex_t,
2383 ) -> cuvsError_t;
2384}
2385#[repr(C)]
2386#[derive(Debug, Copy, Clone)]
2387pub struct cuvsMultiGpuIvfFlatIndexParams {
2388 pub base_params: cuvsIvfFlatIndexParams_t,
2389 pub mode: cuvsMultiGpuDistributionMode,
2390}
2391#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2392const _: () = {
2393 ["Size of cuvsMultiGpuIvfFlatIndexParams"]
2394 [::std::mem::size_of::<cuvsMultiGpuIvfFlatIndexParams>() - 16usize];
2395 ["Alignment of cuvsMultiGpuIvfFlatIndexParams"]
2396 [::std::mem::align_of::<cuvsMultiGpuIvfFlatIndexParams>() - 8usize];
2397 ["Offset of field: cuvsMultiGpuIvfFlatIndexParams::base_params"]
2398 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndexParams, base_params) - 0usize];
2399 ["Offset of field: cuvsMultiGpuIvfFlatIndexParams::mode"]
2400 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndexParams, mode) - 8usize];
2401};
2402pub type cuvsMultiGpuIvfFlatIndexParams_t = *mut cuvsMultiGpuIvfFlatIndexParams;
2403unsafe extern "C" {
2404 #[must_use]
2405 pub fn cuvsMultiGpuIvfFlatIndexParamsCreate(
2406 index_params: *mut cuvsMultiGpuIvfFlatIndexParams_t,
2407 ) -> cuvsError_t;
2408}
2409unsafe extern "C" {
2410 #[must_use]
2411 pub fn cuvsMultiGpuIvfFlatIndexParamsDestroy(
2412 index_params: cuvsMultiGpuIvfFlatIndexParams_t,
2413 ) -> cuvsError_t;
2414}
2415#[repr(C)]
2416#[derive(Debug, Copy, Clone)]
2417pub struct cuvsMultiGpuIvfFlatSearchParams {
2418 pub base_params: cuvsIvfFlatSearchParams_t,
2419 pub search_mode: cuvsMultiGpuReplicatedSearchMode,
2420 pub merge_mode: cuvsMultiGpuShardedMergeMode,
2421 pub n_rows_per_batch: i64,
2422}
2423#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2424const _: () = {
2425 ["Size of cuvsMultiGpuIvfFlatSearchParams"]
2426 [::std::mem::size_of::<cuvsMultiGpuIvfFlatSearchParams>() - 24usize];
2427 ["Alignment of cuvsMultiGpuIvfFlatSearchParams"]
2428 [::std::mem::align_of::<cuvsMultiGpuIvfFlatSearchParams>() - 8usize];
2429 ["Offset of field: cuvsMultiGpuIvfFlatSearchParams::base_params"]
2430 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, base_params) - 0usize];
2431 ["Offset of field: cuvsMultiGpuIvfFlatSearchParams::search_mode"]
2432 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, search_mode) - 8usize];
2433 ["Offset of field: cuvsMultiGpuIvfFlatSearchParams::merge_mode"]
2434 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, merge_mode) - 12usize];
2435 ["Offset of field: cuvsMultiGpuIvfFlatSearchParams::n_rows_per_batch"]
2436 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, n_rows_per_batch) - 16usize];
2437};
2438pub type cuvsMultiGpuIvfFlatSearchParams_t = *mut cuvsMultiGpuIvfFlatSearchParams;
2439unsafe extern "C" {
2440 #[must_use]
2441 pub fn cuvsMultiGpuIvfFlatSearchParamsCreate(
2442 params: *mut cuvsMultiGpuIvfFlatSearchParams_t,
2443 ) -> cuvsError_t;
2444}
2445unsafe extern "C" {
2446 #[must_use]
2447 pub fn cuvsMultiGpuIvfFlatSearchParamsDestroy(
2448 params: cuvsMultiGpuIvfFlatSearchParams_t,
2449 ) -> cuvsError_t;
2450}
2451#[repr(C)]
2452#[derive(Debug, Copy, Clone)]
2453pub struct cuvsMultiGpuIvfFlatIndex {
2454 pub addr: usize,
2455 pub dtype: DLDataType,
2456}
2457#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2458const _: () = {
2459 ["Size of cuvsMultiGpuIvfFlatIndex"]
2460 [::std::mem::size_of::<cuvsMultiGpuIvfFlatIndex>() - 16usize];
2461 ["Alignment of cuvsMultiGpuIvfFlatIndex"]
2462 [::std::mem::align_of::<cuvsMultiGpuIvfFlatIndex>() - 8usize];
2463 ["Offset of field: cuvsMultiGpuIvfFlatIndex::addr"]
2464 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndex, addr) - 0usize];
2465 ["Offset of field: cuvsMultiGpuIvfFlatIndex::dtype"]
2466 [::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndex, dtype) - 8usize];
2467};
2468pub type cuvsMultiGpuIvfFlatIndex_t = *mut cuvsMultiGpuIvfFlatIndex;
2469unsafe extern "C" {
2470 #[must_use]
2471 pub fn cuvsMultiGpuIvfFlatIndexCreate(index: *mut cuvsMultiGpuIvfFlatIndex_t) -> cuvsError_t;
2472}
2473unsafe extern "C" {
2474 #[must_use]
2475 pub fn cuvsMultiGpuIvfFlatIndexDestroy(index: cuvsMultiGpuIvfFlatIndex_t) -> cuvsError_t;
2476}
2477unsafe extern "C" {
2478 #[must_use]
2479 pub fn cuvsMultiGpuIvfFlatBuild(
2480 res: cuvsResources_t,
2481 params: cuvsMultiGpuIvfFlatIndexParams_t,
2482 dataset_tensor: *mut DLManagedTensor,
2483 index: cuvsMultiGpuIvfFlatIndex_t,
2484 ) -> cuvsError_t;
2485}
2486unsafe extern "C" {
2487 #[must_use]
2488 pub fn cuvsMultiGpuIvfFlatSearch(
2489 res: cuvsResources_t,
2490 params: cuvsMultiGpuIvfFlatSearchParams_t,
2491 index: cuvsMultiGpuIvfFlatIndex_t,
2492 queries_tensor: *mut DLManagedTensor,
2493 neighbors_tensor: *mut DLManagedTensor,
2494 distances_tensor: *mut DLManagedTensor,
2495 ) -> cuvsError_t;
2496}
2497unsafe extern "C" {
2498 #[must_use]
2499 pub fn cuvsMultiGpuIvfFlatExtend(
2500 res: cuvsResources_t,
2501 index: cuvsMultiGpuIvfFlatIndex_t,
2502 new_vectors_tensor: *mut DLManagedTensor,
2503 new_indices_tensor: *mut DLManagedTensor,
2504 ) -> cuvsError_t;
2505}
2506unsafe extern "C" {
2507 #[must_use]
2508 pub fn cuvsMultiGpuIvfFlatSerialize(
2509 res: cuvsResources_t,
2510 index: cuvsMultiGpuIvfFlatIndex_t,
2511 filename: *const ::std::os::raw::c_char,
2512 ) -> cuvsError_t;
2513}
2514unsafe extern "C" {
2515 #[must_use]
2516 pub fn cuvsMultiGpuIvfFlatDeserialize(
2517 res: cuvsResources_t,
2518 filename: *const ::std::os::raw::c_char,
2519 index: cuvsMultiGpuIvfFlatIndex_t,
2520 ) -> cuvsError_t;
2521}
2522unsafe extern "C" {
2523 #[must_use]
2524 pub fn cuvsMultiGpuIvfFlatDistribute(
2525 res: cuvsResources_t,
2526 filename: *const ::std::os::raw::c_char,
2527 index: cuvsMultiGpuIvfFlatIndex_t,
2528 ) -> cuvsError_t;
2529}
2530#[repr(C)]
2531#[derive(Debug, Copy, Clone)]
2532pub struct cuvsMultiGpuIvfPqIndexParams {
2533 pub base_params: cuvsIvfPqIndexParams_t,
2534 pub mode: cuvsMultiGpuDistributionMode,
2535}
2536#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2537const _: () = {
2538 ["Size of cuvsMultiGpuIvfPqIndexParams"]
2539 [::std::mem::size_of::<cuvsMultiGpuIvfPqIndexParams>() - 16usize];
2540 ["Alignment of cuvsMultiGpuIvfPqIndexParams"]
2541 [::std::mem::align_of::<cuvsMultiGpuIvfPqIndexParams>() - 8usize];
2542 ["Offset of field: cuvsMultiGpuIvfPqIndexParams::base_params"]
2543 [::std::mem::offset_of!(cuvsMultiGpuIvfPqIndexParams, base_params) - 0usize];
2544 ["Offset of field: cuvsMultiGpuIvfPqIndexParams::mode"]
2545 [::std::mem::offset_of!(cuvsMultiGpuIvfPqIndexParams, mode) - 8usize];
2546};
2547pub type cuvsMultiGpuIvfPqIndexParams_t = *mut cuvsMultiGpuIvfPqIndexParams;
2548unsafe extern "C" {
2549 #[must_use]
2550 pub fn cuvsMultiGpuIvfPqIndexParamsCreate(
2551 index_params: *mut cuvsMultiGpuIvfPqIndexParams_t,
2552 ) -> cuvsError_t;
2553}
2554unsafe extern "C" {
2555 #[must_use]
2556 pub fn cuvsMultiGpuIvfPqIndexParamsDestroy(
2557 index_params: cuvsMultiGpuIvfPqIndexParams_t,
2558 ) -> cuvsError_t;
2559}
2560#[repr(C)]
2561#[derive(Debug, Copy, Clone)]
2562pub struct cuvsMultiGpuIvfPqSearchParams {
2563 pub base_params: cuvsIvfPqSearchParams_t,
2564 pub search_mode: cuvsMultiGpuReplicatedSearchMode,
2565 pub merge_mode: cuvsMultiGpuShardedMergeMode,
2566 pub n_rows_per_batch: i64,
2567}
2568#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2569const _: () = {
2570 ["Size of cuvsMultiGpuIvfPqSearchParams"]
2571 [::std::mem::size_of::<cuvsMultiGpuIvfPqSearchParams>() - 24usize];
2572 ["Alignment of cuvsMultiGpuIvfPqSearchParams"]
2573 [::std::mem::align_of::<cuvsMultiGpuIvfPqSearchParams>() - 8usize];
2574 ["Offset of field: cuvsMultiGpuIvfPqSearchParams::base_params"]
2575 [::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, base_params) - 0usize];
2576 ["Offset of field: cuvsMultiGpuIvfPqSearchParams::search_mode"]
2577 [::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, search_mode) - 8usize];
2578 ["Offset of field: cuvsMultiGpuIvfPqSearchParams::merge_mode"]
2579 [::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, merge_mode) - 12usize];
2580 ["Offset of field: cuvsMultiGpuIvfPqSearchParams::n_rows_per_batch"]
2581 [::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, n_rows_per_batch) - 16usize];
2582};
2583pub type cuvsMultiGpuIvfPqSearchParams_t = *mut cuvsMultiGpuIvfPqSearchParams;
2584unsafe extern "C" {
2585 #[must_use]
2586 pub fn cuvsMultiGpuIvfPqSearchParamsCreate(
2587 params: *mut cuvsMultiGpuIvfPqSearchParams_t,
2588 ) -> cuvsError_t;
2589}
2590unsafe extern "C" {
2591 #[must_use]
2592 pub fn cuvsMultiGpuIvfPqSearchParamsDestroy(
2593 params: cuvsMultiGpuIvfPqSearchParams_t,
2594 ) -> cuvsError_t;
2595}
2596#[repr(C)]
2597#[derive(Debug, Copy, Clone)]
2598pub struct cuvsMultiGpuIvfPqIndex {
2599 pub addr: usize,
2600 pub dtype: DLDataType,
2601}
2602#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2603const _: () = {
2604 ["Size of cuvsMultiGpuIvfPqIndex"][::std::mem::size_of::<cuvsMultiGpuIvfPqIndex>() - 16usize];
2605 ["Alignment of cuvsMultiGpuIvfPqIndex"]
2606 [::std::mem::align_of::<cuvsMultiGpuIvfPqIndex>() - 8usize];
2607 ["Offset of field: cuvsMultiGpuIvfPqIndex::addr"]
2608 [::std::mem::offset_of!(cuvsMultiGpuIvfPqIndex, addr) - 0usize];
2609 ["Offset of field: cuvsMultiGpuIvfPqIndex::dtype"]
2610 [::std::mem::offset_of!(cuvsMultiGpuIvfPqIndex, dtype) - 8usize];
2611};
2612pub type cuvsMultiGpuIvfPqIndex_t = *mut cuvsMultiGpuIvfPqIndex;
2613unsafe extern "C" {
2614 #[must_use]
2615 pub fn cuvsMultiGpuIvfPqIndexCreate(index: *mut cuvsMultiGpuIvfPqIndex_t) -> cuvsError_t;
2616}
2617unsafe extern "C" {
2618 #[must_use]
2619 pub fn cuvsMultiGpuIvfPqIndexDestroy(index: cuvsMultiGpuIvfPqIndex_t) -> cuvsError_t;
2620}
2621unsafe extern "C" {
2622 #[must_use]
2623 pub fn cuvsMultiGpuIvfPqBuild(
2624 res: cuvsResources_t,
2625 params: cuvsMultiGpuIvfPqIndexParams_t,
2626 dataset_tensor: *mut DLManagedTensor,
2627 index: cuvsMultiGpuIvfPqIndex_t,
2628 ) -> cuvsError_t;
2629}
2630unsafe extern "C" {
2631 #[must_use]
2632 pub fn cuvsMultiGpuIvfPqSearch(
2633 res: cuvsResources_t,
2634 params: cuvsMultiGpuIvfPqSearchParams_t,
2635 index: cuvsMultiGpuIvfPqIndex_t,
2636 queries_tensor: *mut DLManagedTensor,
2637 neighbors_tensor: *mut DLManagedTensor,
2638 distances_tensor: *mut DLManagedTensor,
2639 ) -> cuvsError_t;
2640}
2641unsafe extern "C" {
2642 #[must_use]
2643 pub fn cuvsMultiGpuIvfPqExtend(
2644 res: cuvsResources_t,
2645 index: cuvsMultiGpuIvfPqIndex_t,
2646 new_vectors_tensor: *mut DLManagedTensor,
2647 new_indices_tensor: *mut DLManagedTensor,
2648 ) -> cuvsError_t;
2649}
2650unsafe extern "C" {
2651 #[must_use]
2652 pub fn cuvsMultiGpuIvfPqSerialize(
2653 res: cuvsResources_t,
2654 index: cuvsMultiGpuIvfPqIndex_t,
2655 filename: *const ::std::os::raw::c_char,
2656 ) -> cuvsError_t;
2657}
2658unsafe extern "C" {
2659 #[must_use]
2660 pub fn cuvsMultiGpuIvfPqDeserialize(
2661 res: cuvsResources_t,
2662 filename: *const ::std::os::raw::c_char,
2663 index: cuvsMultiGpuIvfPqIndex_t,
2664 ) -> cuvsError_t;
2665}
2666unsafe extern "C" {
2667 #[must_use]
2668 pub fn cuvsMultiGpuIvfPqDistribute(
2669 res: cuvsResources_t,
2670 filename: *const ::std::os::raw::c_char,
2671 index: cuvsMultiGpuIvfPqIndex_t,
2672 ) -> cuvsError_t;
2673}
2674#[repr(u32)]
2675#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2676pub enum cuvsPcaSolver {
2677 CUVS_PCA_COV_EIG_DQ = 0,
2678 CUVS_PCA_COV_EIG_JACOBI = 1,
2679}
2680#[repr(C)]
2681#[derive(Debug, Copy, Clone)]
2682pub struct cuvsPcaParams {
2683 pub n_components: ::std::os::raw::c_int,
2684 pub copy: bool,
2685 pub whiten: bool,
2686 pub algorithm: cuvsPcaSolver,
2687 pub tol: f32,
2688 pub n_iterations: ::std::os::raw::c_int,
2689}
2690#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2691const _: () = {
2692 ["Size of cuvsPcaParams"][::std::mem::size_of::<cuvsPcaParams>() - 20usize];
2693 ["Alignment of cuvsPcaParams"][::std::mem::align_of::<cuvsPcaParams>() - 4usize];
2694 ["Offset of field: cuvsPcaParams::n_components"]
2695 [::std::mem::offset_of!(cuvsPcaParams, n_components) - 0usize];
2696 ["Offset of field: cuvsPcaParams::copy"][::std::mem::offset_of!(cuvsPcaParams, copy) - 4usize];
2697 ["Offset of field: cuvsPcaParams::whiten"]
2698 [::std::mem::offset_of!(cuvsPcaParams, whiten) - 5usize];
2699 ["Offset of field: cuvsPcaParams::algorithm"]
2700 [::std::mem::offset_of!(cuvsPcaParams, algorithm) - 8usize];
2701 ["Offset of field: cuvsPcaParams::tol"][::std::mem::offset_of!(cuvsPcaParams, tol) - 12usize];
2702 ["Offset of field: cuvsPcaParams::n_iterations"]
2703 [::std::mem::offset_of!(cuvsPcaParams, n_iterations) - 16usize];
2704};
2705pub type cuvsPcaParams_t = *mut cuvsPcaParams;
2706unsafe extern "C" {
2707 #[must_use]
2708 pub fn cuvsPcaParamsCreate(params: *mut cuvsPcaParams_t) -> cuvsError_t;
2709}
2710unsafe extern "C" {
2711 #[must_use]
2712 pub fn cuvsPcaParamsDestroy(params: cuvsPcaParams_t) -> cuvsError_t;
2713}
2714unsafe extern "C" {
2715 #[must_use]
2716 pub fn cuvsPcaFit(
2717 res: cuvsResources_t,
2718 params: cuvsPcaParams_t,
2719 input: *mut DLManagedTensor,
2720 components: *mut DLManagedTensor,
2721 explained_var: *mut DLManagedTensor,
2722 explained_var_ratio: *mut DLManagedTensor,
2723 singular_vals: *mut DLManagedTensor,
2724 mu: *mut DLManagedTensor,
2725 noise_vars: *mut DLManagedTensor,
2726 flip_signs_based_on_U: bool,
2727 ) -> cuvsError_t;
2728}
2729unsafe extern "C" {
2730 #[must_use]
2731 pub fn cuvsPcaFitTransform(
2732 res: cuvsResources_t,
2733 params: cuvsPcaParams_t,
2734 input: *mut DLManagedTensor,
2735 trans_input: *mut DLManagedTensor,
2736 components: *mut DLManagedTensor,
2737 explained_var: *mut DLManagedTensor,
2738 explained_var_ratio: *mut DLManagedTensor,
2739 singular_vals: *mut DLManagedTensor,
2740 mu: *mut DLManagedTensor,
2741 noise_vars: *mut DLManagedTensor,
2742 flip_signs_based_on_U: bool,
2743 ) -> cuvsError_t;
2744}
2745unsafe extern "C" {
2746 #[must_use]
2747 pub fn cuvsPcaTransform(
2748 res: cuvsResources_t,
2749 params: cuvsPcaParams_t,
2750 input: *mut DLManagedTensor,
2751 components: *mut DLManagedTensor,
2752 singular_vals: *mut DLManagedTensor,
2753 mu: *mut DLManagedTensor,
2754 trans_input: *mut DLManagedTensor,
2755 ) -> cuvsError_t;
2756}
2757unsafe extern "C" {
2758 #[must_use]
2759 pub fn cuvsPcaInverseTransform(
2760 res: cuvsResources_t,
2761 params: cuvsPcaParams_t,
2762 trans_input: *mut DLManagedTensor,
2763 components: *mut DLManagedTensor,
2764 singular_vals: *mut DLManagedTensor,
2765 mu: *mut DLManagedTensor,
2766 output: *mut DLManagedTensor,
2767 ) -> cuvsError_t;
2768}
2769#[repr(u32)]
2770#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2771pub enum cuvsBinaryQuantizerThreshold {
2772 ZERO = 0,
2773 MEAN = 1,
2774 SAMPLING_MEDIAN = 2,
2775}
2776#[repr(C)]
2777#[derive(Debug, Copy, Clone)]
2778pub struct cuvsBinaryQuantizerParams {
2779 pub threshold: cuvsBinaryQuantizerThreshold,
2780 pub sampling_ratio: f32,
2781}
2782#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2783const _: () = {
2784 ["Size of cuvsBinaryQuantizerParams"]
2785 [::std::mem::size_of::<cuvsBinaryQuantizerParams>() - 8usize];
2786 ["Alignment of cuvsBinaryQuantizerParams"]
2787 [::std::mem::align_of::<cuvsBinaryQuantizerParams>() - 4usize];
2788 ["Offset of field: cuvsBinaryQuantizerParams::threshold"]
2789 [::std::mem::offset_of!(cuvsBinaryQuantizerParams, threshold) - 0usize];
2790 ["Offset of field: cuvsBinaryQuantizerParams::sampling_ratio"]
2791 [::std::mem::offset_of!(cuvsBinaryQuantizerParams, sampling_ratio) - 4usize];
2792};
2793pub type cuvsBinaryQuantizerParams_t = *mut cuvsBinaryQuantizerParams;
2794unsafe extern "C" {
2795 #[must_use]
2796 pub fn cuvsBinaryQuantizerParamsCreate(params: *mut cuvsBinaryQuantizerParams_t)
2797 -> cuvsError_t;
2798}
2799unsafe extern "C" {
2800 #[must_use]
2801 pub fn cuvsBinaryQuantizerParamsDestroy(params: cuvsBinaryQuantizerParams_t) -> cuvsError_t;
2802}
2803#[repr(C)]
2804#[derive(Debug, Copy, Clone)]
2805pub struct cuvsBinaryQuantizer {
2806 pub addr: usize,
2807 pub dtype: DLDataType,
2808}
2809#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2810const _: () = {
2811 ["Size of cuvsBinaryQuantizer"][::std::mem::size_of::<cuvsBinaryQuantizer>() - 16usize];
2812 ["Alignment of cuvsBinaryQuantizer"][::std::mem::align_of::<cuvsBinaryQuantizer>() - 8usize];
2813 ["Offset of field: cuvsBinaryQuantizer::addr"]
2814 [::std::mem::offset_of!(cuvsBinaryQuantizer, addr) - 0usize];
2815 ["Offset of field: cuvsBinaryQuantizer::dtype"]
2816 [::std::mem::offset_of!(cuvsBinaryQuantizer, dtype) - 8usize];
2817};
2818pub type cuvsBinaryQuantizer_t = *mut cuvsBinaryQuantizer;
2819unsafe extern "C" {
2820 #[must_use]
2821 pub fn cuvsBinaryQuantizerCreate(quantizer: *mut cuvsBinaryQuantizer_t) -> cuvsError_t;
2822}
2823unsafe extern "C" {
2824 #[must_use]
2825 pub fn cuvsBinaryQuantizerDestroy(quantizer: cuvsBinaryQuantizer_t) -> cuvsError_t;
2826}
2827unsafe extern "C" {
2828 #[must_use]
2829 pub fn cuvsBinaryQuantizerTrain(
2830 res: cuvsResources_t,
2831 params: cuvsBinaryQuantizerParams_t,
2832 dataset: *mut DLManagedTensor,
2833 quantizer: cuvsBinaryQuantizer_t,
2834 ) -> cuvsError_t;
2835}
2836unsafe extern "C" {
2837 #[must_use]
2838 pub fn cuvsBinaryQuantizerTransform(
2839 res: cuvsResources_t,
2840 dataset: *mut DLManagedTensor,
2841 out: *mut DLManagedTensor,
2842 ) -> cuvsError_t;
2843}
2844unsafe extern "C" {
2845 #[must_use]
2846 pub fn cuvsBinaryQuantizerTransformWithParams(
2847 res: cuvsResources_t,
2848 quantizer: cuvsBinaryQuantizer_t,
2849 dataset: *mut DLManagedTensor,
2850 out: *mut DLManagedTensor,
2851 ) -> cuvsError_t;
2852}
2853#[repr(C)]
2854#[derive(Debug, Copy, Clone)]
2855pub struct cuvsProductQuantizerParams {
2856 pub pq_bits: u32,
2857 pub pq_dim: u32,
2858 pub use_subspaces: bool,
2859 pub use_vq: bool,
2860 pub vq_n_centers: u32,
2861 pub kmeans_n_iters: u32,
2862 pub pq_kmeans_type: cuvsKMeansType,
2863 pub max_train_points_per_pq_code: u32,
2864 pub max_train_points_per_vq_cluster: u32,
2865}
2866#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2867const _: () = {
2868 ["Size of cuvsProductQuantizerParams"]
2869 [::std::mem::size_of::<cuvsProductQuantizerParams>() - 32usize];
2870 ["Alignment of cuvsProductQuantizerParams"]
2871 [::std::mem::align_of::<cuvsProductQuantizerParams>() - 4usize];
2872 ["Offset of field: cuvsProductQuantizerParams::pq_bits"]
2873 [::std::mem::offset_of!(cuvsProductQuantizerParams, pq_bits) - 0usize];
2874 ["Offset of field: cuvsProductQuantizerParams::pq_dim"]
2875 [::std::mem::offset_of!(cuvsProductQuantizerParams, pq_dim) - 4usize];
2876 ["Offset of field: cuvsProductQuantizerParams::use_subspaces"]
2877 [::std::mem::offset_of!(cuvsProductQuantizerParams, use_subspaces) - 8usize];
2878 ["Offset of field: cuvsProductQuantizerParams::use_vq"]
2879 [::std::mem::offset_of!(cuvsProductQuantizerParams, use_vq) - 9usize];
2880 ["Offset of field: cuvsProductQuantizerParams::vq_n_centers"]
2881 [::std::mem::offset_of!(cuvsProductQuantizerParams, vq_n_centers) - 12usize];
2882 ["Offset of field: cuvsProductQuantizerParams::kmeans_n_iters"]
2883 [::std::mem::offset_of!(cuvsProductQuantizerParams, kmeans_n_iters) - 16usize];
2884 ["Offset of field: cuvsProductQuantizerParams::pq_kmeans_type"]
2885 [::std::mem::offset_of!(cuvsProductQuantizerParams, pq_kmeans_type) - 20usize];
2886 ["Offset of field: cuvsProductQuantizerParams::max_train_points_per_pq_code"][::std::mem::offset_of!(
2887 cuvsProductQuantizerParams,
2888 max_train_points_per_pq_code
2889 ) - 24usize];
2890 ["Offset of field: cuvsProductQuantizerParams::max_train_points_per_vq_cluster"][::std::mem::offset_of!(
2891 cuvsProductQuantizerParams,
2892 max_train_points_per_vq_cluster
2893 ) - 28usize];
2894};
2895pub type cuvsProductQuantizerParams_t = *mut cuvsProductQuantizerParams;
2896unsafe extern "C" {
2897 #[must_use]
2898 pub fn cuvsProductQuantizerParamsCreate(
2899 params: *mut cuvsProductQuantizerParams_t,
2900 ) -> cuvsError_t;
2901}
2902unsafe extern "C" {
2903 #[must_use]
2904 pub fn cuvsProductQuantizerParamsDestroy(params: cuvsProductQuantizerParams_t) -> cuvsError_t;
2905}
2906#[repr(C)]
2907#[derive(Debug, Copy, Clone)]
2908pub struct cuvsProductQuantizer {
2909 pub addr: usize,
2910 pub dtype: DLDataType,
2911}
2912#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2913const _: () = {
2914 ["Size of cuvsProductQuantizer"][::std::mem::size_of::<cuvsProductQuantizer>() - 16usize];
2915 ["Alignment of cuvsProductQuantizer"][::std::mem::align_of::<cuvsProductQuantizer>() - 8usize];
2916 ["Offset of field: cuvsProductQuantizer::addr"]
2917 [::std::mem::offset_of!(cuvsProductQuantizer, addr) - 0usize];
2918 ["Offset of field: cuvsProductQuantizer::dtype"]
2919 [::std::mem::offset_of!(cuvsProductQuantizer, dtype) - 8usize];
2920};
2921pub type cuvsProductQuantizer_t = *mut cuvsProductQuantizer;
2922unsafe extern "C" {
2923 #[must_use]
2924 pub fn cuvsProductQuantizerCreate(quantizer: *mut cuvsProductQuantizer_t) -> cuvsError_t;
2925}
2926unsafe extern "C" {
2927 #[must_use]
2928 pub fn cuvsProductQuantizerDestroy(quantizer: cuvsProductQuantizer_t) -> cuvsError_t;
2929}
2930unsafe extern "C" {
2931 #[must_use]
2932 pub fn cuvsProductQuantizerBuild(
2933 res: cuvsResources_t,
2934 params: cuvsProductQuantizerParams_t,
2935 dataset: *mut DLManagedTensor,
2936 quantizer: cuvsProductQuantizer_t,
2937 ) -> cuvsError_t;
2938}
2939unsafe extern "C" {
2940 #[must_use]
2941 pub fn cuvsProductQuantizerTransform(
2942 res: cuvsResources_t,
2943 quantizer: cuvsProductQuantizer_t,
2944 dataset: *mut DLManagedTensor,
2945 codes_out: *mut DLManagedTensor,
2946 vq_labels: *mut DLManagedTensor,
2947 ) -> cuvsError_t;
2948}
2949unsafe extern "C" {
2950 #[must_use]
2951 pub fn cuvsProductQuantizerInverseTransform(
2952 res: cuvsResources_t,
2953 quantizer: cuvsProductQuantizer_t,
2954 pq_codes: *mut DLManagedTensor,
2955 out: *mut DLManagedTensor,
2956 vq_labels: *mut DLManagedTensor,
2957 ) -> cuvsError_t;
2958}
2959unsafe extern "C" {
2960 #[must_use]
2961 pub fn cuvsProductQuantizerGetPqBits(
2962 quantizer: cuvsProductQuantizer_t,
2963 pq_bits: *mut u32,
2964 ) -> cuvsError_t;
2965}
2966unsafe extern "C" {
2967 #[must_use]
2968 pub fn cuvsProductQuantizerGetPqDim(
2969 quantizer: cuvsProductQuantizer_t,
2970 pq_dim: *mut u32,
2971 ) -> cuvsError_t;
2972}
2973unsafe extern "C" {
2974 #[must_use]
2975 pub fn cuvsProductQuantizerGetPqCodebook(
2976 quantizer: cuvsProductQuantizer_t,
2977 pq_codebook: *mut DLManagedTensor,
2978 ) -> cuvsError_t;
2979}
2980unsafe extern "C" {
2981 #[must_use]
2982 pub fn cuvsProductQuantizerGetVqCodebook(
2983 quantizer: cuvsProductQuantizer_t,
2984 vq_codebook: *mut DLManagedTensor,
2985 ) -> cuvsError_t;
2986}
2987unsafe extern "C" {
2988 #[must_use]
2989 pub fn cuvsProductQuantizerGetEncodedDim(
2990 quantizer: cuvsProductQuantizer_t,
2991 encoded_dim: *mut u32,
2992 ) -> cuvsError_t;
2993}
2994unsafe extern "C" {
2995 #[must_use]
2996 pub fn cuvsProductQuantizerGetUseVq(
2997 quantizer: cuvsProductQuantizer_t,
2998 use_vq: *mut bool,
2999 ) -> cuvsError_t;
3000}
3001#[repr(C)]
3002#[derive(Debug, Copy, Clone)]
3003pub struct cuvsScalarQuantizerParams {
3004 pub quantile: f32,
3005}
3006#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3007const _: () = {
3008 ["Size of cuvsScalarQuantizerParams"]
3009 [::std::mem::size_of::<cuvsScalarQuantizerParams>() - 4usize];
3010 ["Alignment of cuvsScalarQuantizerParams"]
3011 [::std::mem::align_of::<cuvsScalarQuantizerParams>() - 4usize];
3012 ["Offset of field: cuvsScalarQuantizerParams::quantile"]
3013 [::std::mem::offset_of!(cuvsScalarQuantizerParams, quantile) - 0usize];
3014};
3015pub type cuvsScalarQuantizerParams_t = *mut cuvsScalarQuantizerParams;
3016unsafe extern "C" {
3017 #[must_use]
3018 pub fn cuvsScalarQuantizerParamsCreate(params: *mut cuvsScalarQuantizerParams_t)
3019 -> cuvsError_t;
3020}
3021unsafe extern "C" {
3022 #[must_use]
3023 pub fn cuvsScalarQuantizerParamsDestroy(params: cuvsScalarQuantizerParams_t) -> cuvsError_t;
3024}
3025#[repr(C)]
3026#[derive(Debug, Copy, Clone)]
3027pub struct cuvsScalarQuantizer {
3028 pub min_: f64,
3029 pub max_: f64,
3030}
3031#[allow(clippy::unnecessary_operation, clippy::identity_op)]
3032const _: () = {
3033 ["Size of cuvsScalarQuantizer"][::std::mem::size_of::<cuvsScalarQuantizer>() - 16usize];
3034 ["Alignment of cuvsScalarQuantizer"][::std::mem::align_of::<cuvsScalarQuantizer>() - 8usize];
3035 ["Offset of field: cuvsScalarQuantizer::min_"]
3036 [::std::mem::offset_of!(cuvsScalarQuantizer, min_) - 0usize];
3037 ["Offset of field: cuvsScalarQuantizer::max_"]
3038 [::std::mem::offset_of!(cuvsScalarQuantizer, max_) - 8usize];
3039};
3040pub type cuvsScalarQuantizer_t = *mut cuvsScalarQuantizer;
3041unsafe extern "C" {
3042 #[must_use]
3043 pub fn cuvsScalarQuantizerCreate(quantizer: *mut cuvsScalarQuantizer_t) -> cuvsError_t;
3044}
3045unsafe extern "C" {
3046 #[must_use]
3047 pub fn cuvsScalarQuantizerDestroy(quantizer: cuvsScalarQuantizer_t) -> cuvsError_t;
3048}
3049unsafe extern "C" {
3050 #[must_use]
3051 pub fn cuvsScalarQuantizerTrain(
3052 res: cuvsResources_t,
3053 params: cuvsScalarQuantizerParams_t,
3054 dataset: *mut DLManagedTensor,
3055 quantizer: cuvsScalarQuantizer_t,
3056 ) -> cuvsError_t;
3057}
3058unsafe extern "C" {
3059 #[must_use]
3060 pub fn cuvsScalarQuantizerTransform(
3061 res: cuvsResources_t,
3062 quantizer: cuvsScalarQuantizer_t,
3063 dataset: *mut DLManagedTensor,
3064 out: *mut DLManagedTensor,
3065 ) -> cuvsError_t;
3066}
3067unsafe extern "C" {
3068 #[must_use]
3069 pub fn cuvsScalarQuantizerInverseTransform(
3070 res: cuvsResources_t,
3071 quantizer: cuvsScalarQuantizer_t,
3072 dataset: *mut DLManagedTensor,
3073 out: *mut DLManagedTensor,
3074 ) -> cuvsError_t;
3075}
3076unsafe extern "C" {
3077 #[must_use]
3078 pub fn cuvsSelectK(
3079 res: cuvsResources_t,
3080 in_val: *mut DLManagedTensor,
3081 out_val: *mut DLManagedTensor,
3082 out_idx: *mut DLManagedTensor,
3083 ) -> cuvsError_t;
3084}