use crate::{cudaDataType_t, cudaStream_t};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum DLDeviceType {
kDLCPU = 1,
kDLCUDA = 2,
kDLCUDAHost = 3,
kDLOpenCL = 4,
kDLVulkan = 7,
kDLMetal = 8,
kDLVPI = 9,
kDLROCM = 10,
kDLROCMHost = 11,
kDLExtDev = 12,
kDLCUDAManaged = 13,
kDLOneAPI = 14,
kDLWebGPU = 15,
kDLHexagon = 16,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DLDevice {
pub device_type: DLDeviceType,
pub device_id: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of DLDevice"][::std::mem::size_of::<DLDevice>() - 8usize];
["Alignment of DLDevice"][::std::mem::align_of::<DLDevice>() - 4usize];
["Offset of field: DLDevice::device_type"]
[::std::mem::offset_of!(DLDevice, device_type) - 0usize];
["Offset of field: DLDevice::device_id"][::std::mem::offset_of!(DLDevice, device_id) - 4usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum DLDataTypeCode {
kDLInt = 0,
kDLUInt = 1,
kDLFloat = 2,
kDLOpaqueHandle = 3,
kDLBfloat = 4,
kDLComplex = 5,
kDLBool = 6,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DLDataType {
pub code: u8,
pub bits: u8,
pub lanes: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of DLDataType"][::std::mem::size_of::<DLDataType>() - 4usize];
["Alignment of DLDataType"][::std::mem::align_of::<DLDataType>() - 2usize];
["Offset of field: DLDataType::code"][::std::mem::offset_of!(DLDataType, code) - 0usize];
["Offset of field: DLDataType::bits"][::std::mem::offset_of!(DLDataType, bits) - 1usize];
["Offset of field: DLDataType::lanes"][::std::mem::offset_of!(DLDataType, lanes) - 2usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DLTensor {
pub data: *mut ::std::os::raw::c_void,
pub device: DLDevice,
pub ndim: i32,
pub dtype: DLDataType,
pub shape: *mut i64,
pub strides: *mut i64,
pub byte_offset: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of DLTensor"][::std::mem::size_of::<DLTensor>() - 48usize];
["Alignment of DLTensor"][::std::mem::align_of::<DLTensor>() - 8usize];
["Offset of field: DLTensor::data"][::std::mem::offset_of!(DLTensor, data) - 0usize];
["Offset of field: DLTensor::device"][::std::mem::offset_of!(DLTensor, device) - 8usize];
["Offset of field: DLTensor::ndim"][::std::mem::offset_of!(DLTensor, ndim) - 16usize];
["Offset of field: DLTensor::dtype"][::std::mem::offset_of!(DLTensor, dtype) - 20usize];
["Offset of field: DLTensor::shape"][::std::mem::offset_of!(DLTensor, shape) - 24usize];
["Offset of field: DLTensor::strides"][::std::mem::offset_of!(DLTensor, strides) - 32usize];
["Offset of field: DLTensor::byte_offset"]
[::std::mem::offset_of!(DLTensor, byte_offset) - 40usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DLManagedTensor {
pub dl_tensor: DLTensor,
pub manager_ctx: *mut ::std::os::raw::c_void,
pub deleter: ::std::option::Option<unsafe extern "C" fn(self_: *mut DLManagedTensor)>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of DLManagedTensor"][::std::mem::size_of::<DLManagedTensor>() - 64usize];
["Alignment of DLManagedTensor"][::std::mem::align_of::<DLManagedTensor>() - 8usize];
["Offset of field: DLManagedTensor::dl_tensor"]
[::std::mem::offset_of!(DLManagedTensor, dl_tensor) - 0usize];
["Offset of field: DLManagedTensor::manager_ctx"]
[::std::mem::offset_of!(DLManagedTensor, manager_ctx) - 48usize];
["Offset of field: DLManagedTensor::deleter"]
[::std::mem::offset_of!(DLManagedTensor, deleter) - 56usize];
};
#[repr(u32)]
#[must_use]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsError_t {
CUVS_ERROR = 0,
CUVS_SUCCESS = 1,
}
unsafe extern "C" {
pub fn cuvsGetLastErrorText() -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn cuvsSetLastErrorText(error: *const ::std::os::raw::c_char);
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsLogLevel_t {
CUVS_LOG_LEVEL_TRACE = 0,
CUVS_LOG_LEVEL_DEBUG = 1,
CUVS_LOG_LEVEL_INFO = 2,
CUVS_LOG_LEVEL_WARN = 3,
CUVS_LOG_LEVEL_ERROR = 4,
CUVS_LOG_LEVEL_CRITICAL = 5,
CUVS_LOG_LEVEL_OFF = 6,
}
unsafe extern "C" {
pub fn cuvsGetLogLevel() -> cuvsLogLevel_t;
}
unsafe extern "C" {
pub fn cuvsSetLogLevel(arg1: cuvsLogLevel_t);
}
pub type cuvsResources_t = usize;
unsafe extern "C" {
#[must_use]
pub fn cuvsResourcesCreate(res: *mut cuvsResources_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsResourcesCreateWithMemoryTracking(
res: *mut cuvsResources_t,
csv_path: *const ::std::os::raw::c_char,
sample_interval_ms: i64,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsResourcesDestroy(res: cuvsResources_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsStreamSet(res: cuvsResources_t, stream: cudaStream_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsStreamGet(res: cuvsResources_t, stream: *mut cudaStream_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsStreamSync(res: cuvsResources_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDeviceIdGet(
res: cuvsResources_t,
device_id: *mut ::std::os::raw::c_int,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsResourcesSetWorkspacePool(
res: cuvsResources_t,
initial_size_bytes: usize,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuResourcesCreate(res: *mut cuvsResources_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuResourcesCreateWithDeviceIds(
res: *mut cuvsResources_t,
device_ids: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuResourcesDestroy(res: cuvsResources_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuResourcesSetMemoryPool(
res: cuvsResources_t,
percent_of_free_memory: ::std::os::raw::c_int,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMAlloc(
res: cuvsResources_t,
ptr: *mut *mut ::std::os::raw::c_void,
bytes: usize,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMFree(
res: cuvsResources_t,
ptr: *mut ::std::os::raw::c_void,
bytes: usize,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMPoolMemoryResourceEnable(
initial_pool_size_percent: ::std::os::raw::c_int,
max_pool_size_percent: ::std::os::raw::c_int,
managed: bool,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMAsyncMemoryResourceEnable() -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMMemoryResourceReset() -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMHostAlloc(ptr: *mut *mut ::std::os::raw::c_void, bytes: usize) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRMMHostFree(ptr: *mut ::std::os::raw::c_void, bytes: usize) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsVersionGet(major: *mut u16, minor: *mut u16, patch: *mut u16) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMatrixCopy(
res: cuvsResources_t,
src: *mut DLManagedTensor,
dst: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMatrixSliceRows(
res: cuvsResources_t,
src: *mut DLManagedTensor,
start: i64,
end: i64,
dst: *mut DLManagedTensor,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsDatasetLayout_t {
CUVS_DATASET_LAYOUT_STANDARD = 0,
CUVS_DATASET_LAYOUT_PADDED = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsDatasetMemType_t {
CUVS_DATASET_MEM_TYPE_HOST = 0,
CUVS_DATASET_MEM_TYPE_DEVICE = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsDataset {
pub addr: usize,
pub destroy_addr:
::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
pub dtype: DLDataType,
pub mem_type: cuvsDatasetMemType_t,
pub layout: cuvsDatasetLayout_t,
pub is_owning: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsDataset"][::std::mem::size_of::<cuvsDataset>() - 32usize];
["Alignment of cuvsDataset"][::std::mem::align_of::<cuvsDataset>() - 8usize];
["Offset of field: cuvsDataset::addr"][::std::mem::offset_of!(cuvsDataset, addr) - 0usize];
["Offset of field: cuvsDataset::destroy_addr"]
[::std::mem::offset_of!(cuvsDataset, destroy_addr) - 8usize];
["Offset of field: cuvsDataset::dtype"][::std::mem::offset_of!(cuvsDataset, dtype) - 16usize];
["Offset of field: cuvsDataset::mem_type"]
[::std::mem::offset_of!(cuvsDataset, mem_type) - 20usize];
["Offset of field: cuvsDataset::layout"][::std::mem::offset_of!(cuvsDataset, layout) - 24usize];
["Offset of field: cuvsDataset::is_owning"]
[::std::mem::offset_of!(cuvsDataset, is_owning) - 28usize];
};
pub type cuvsDataset_t = *mut cuvsDataset;
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetCreate(dataset: *mut cuvsDataset_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetMakePadded(
res: cuvsResources_t,
dataset: *mut DLManagedTensor,
target_mem_type: cuvsDatasetMemType_t,
padded_dataset: *mut cuvsDataset_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetMakePaddedView(
res: cuvsResources_t,
dataset: *mut DLManagedTensor,
padded_dataset: *mut cuvsDataset_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetMakeStandardView(
res: cuvsResources_t,
dataset: *mut DLManagedTensor,
standard_dataset: *mut cuvsDataset_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetDestroy(dataset: cuvsDataset_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetGetMemType(
dataset: cuvsDataset_t,
mem_type: *mut cuvsDatasetMemType_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetGetLayout(
dataset: cuvsDataset_t,
layout: *mut cuvsDatasetLayout_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetGetIsOwning(dataset: cuvsDataset_t, is_owning: *mut bool) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsDatasetGetDtype(dataset: cuvsDataset_t, dtype: *mut DLDataType) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsDistanceType {
L2Expanded = 0,
L2SqrtExpanded = 1,
CosineExpanded = 2,
L1 = 3,
L2Unexpanded = 4,
L2SqrtUnexpanded = 5,
InnerProduct = 6,
Linf = 7,
Canberra = 8,
LpUnexpanded = 9,
CorrelationExpanded = 10,
JaccardExpanded = 11,
HellingerExpanded = 12,
Haversine = 13,
BrayCurtis = 14,
JensenShannon = 15,
HammingUnexpanded = 16,
KLDivergence = 17,
RusselRaoExpanded = 18,
DiceExpanded = 19,
BitwiseHamming = 20,
Precomputed = 100,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsKMeansInitMethod {
KMeansPlusPlus = 0,
Random = 1,
Array = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsKMeansParams {
pub metric: cuvsDistanceType,
pub n_clusters: ::std::os::raw::c_int,
pub init: cuvsKMeansInitMethod,
pub max_iter: ::std::os::raw::c_int,
pub tol: f64,
pub n_init: ::std::os::raw::c_int,
pub oversampling_factor: f64,
pub batch_samples: ::std::os::raw::c_int,
pub batch_centroids: ::std::os::raw::c_int,
pub hierarchical: bool,
pub hierarchical_n_iters: ::std::os::raw::c_int,
pub device_buffer_samples: i64,
pub init_size: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsKMeansParams"][::std::mem::size_of::<cuvsKMeansParams>() - 72usize];
["Alignment of cuvsKMeansParams"][::std::mem::align_of::<cuvsKMeansParams>() - 8usize];
["Offset of field: cuvsKMeansParams::metric"]
[::std::mem::offset_of!(cuvsKMeansParams, metric) - 0usize];
["Offset of field: cuvsKMeansParams::n_clusters"]
[::std::mem::offset_of!(cuvsKMeansParams, n_clusters) - 4usize];
["Offset of field: cuvsKMeansParams::init"]
[::std::mem::offset_of!(cuvsKMeansParams, init) - 8usize];
["Offset of field: cuvsKMeansParams::max_iter"]
[::std::mem::offset_of!(cuvsKMeansParams, max_iter) - 12usize];
["Offset of field: cuvsKMeansParams::tol"]
[::std::mem::offset_of!(cuvsKMeansParams, tol) - 16usize];
["Offset of field: cuvsKMeansParams::n_init"]
[::std::mem::offset_of!(cuvsKMeansParams, n_init) - 24usize];
["Offset of field: cuvsKMeansParams::oversampling_factor"]
[::std::mem::offset_of!(cuvsKMeansParams, oversampling_factor) - 32usize];
["Offset of field: cuvsKMeansParams::batch_samples"]
[::std::mem::offset_of!(cuvsKMeansParams, batch_samples) - 40usize];
["Offset of field: cuvsKMeansParams::batch_centroids"]
[::std::mem::offset_of!(cuvsKMeansParams, batch_centroids) - 44usize];
["Offset of field: cuvsKMeansParams::hierarchical"]
[::std::mem::offset_of!(cuvsKMeansParams, hierarchical) - 48usize];
["Offset of field: cuvsKMeansParams::hierarchical_n_iters"]
[::std::mem::offset_of!(cuvsKMeansParams, hierarchical_n_iters) - 52usize];
["Offset of field: cuvsKMeansParams::device_buffer_samples"]
[::std::mem::offset_of!(cuvsKMeansParams, device_buffer_samples) - 56usize];
["Offset of field: cuvsKMeansParams::init_size"]
[::std::mem::offset_of!(cuvsKMeansParams, init_size) - 64usize];
};
pub type cuvsKMeansParams_t = *mut cuvsKMeansParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsKMeansParamsCreate(params: *mut cuvsKMeansParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsKMeansParamsDestroy(params: cuvsKMeansParams_t) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsKMeansType {
CUVS_KMEANS_TYPE_KMEANS = 0,
CUVS_KMEANS_TYPE_KMEANS_BALANCED = 1,
}
unsafe extern "C" {
#[must_use]
pub fn cuvsKMeansFit(
res: cuvsResources_t,
params: cuvsKMeansParams_t,
X: *mut DLManagedTensor,
sample_weight: *mut DLManagedTensor,
centroids: *mut DLManagedTensor,
inertia: *mut f64,
n_iter: *mut ::std::os::raw::c_int,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsKMeansPredict(
res: cuvsResources_t,
params: cuvsKMeansParams_t,
X: *mut DLManagedTensor,
sample_weight: *mut DLManagedTensor,
centroids: *mut DLManagedTensor,
labels: *mut DLManagedTensor,
normalize_weight: bool,
inertia: *mut f64,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsKMeansClusterCost(
res: cuvsResources_t,
X: *mut DLManagedTensor,
centroids: *mut DLManagedTensor,
cost: *mut f64,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsPairwiseDistance(
res: cuvsResources_t,
x: *mut DLManagedTensor,
y: *mut DLManagedTensor,
dist: *mut DLManagedTensor,
metric: cuvsDistanceType,
metric_arg: f32,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsIvfPqCodebookGen {
CUVS_IVF_PQ_CODEBOOK_GEN_PER_SUBSPACE = 0,
CUVS_IVF_PQ_CODEBOOK_GEN_PER_CLUSTER = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsIvfPqListLayout {
CUVS_IVF_PQ_LIST_LAYOUT_FLAT = 0,
CUVS_IVF_PQ_LIST_LAYOUT_INTERLEAVED = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfPqIndexParams {
pub metric: cuvsDistanceType,
pub metric_arg: f32,
pub add_data_on_build: bool,
pub n_lists: u32,
pub kmeans_n_iters: u32,
pub kmeans_trainset_fraction: f64,
pub pq_bits: u32,
pub pq_dim: u32,
pub codebook_kind: cuvsIvfPqCodebookGen,
pub force_random_rotation: bool,
pub conservative_memory_allocation: bool,
pub max_train_points_per_pq_code: u32,
pub codes_layout: cuvsIvfPqListLayout,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfPqIndexParams"][::std::mem::size_of::<cuvsIvfPqIndexParams>() - 56usize];
["Alignment of cuvsIvfPqIndexParams"][::std::mem::align_of::<cuvsIvfPqIndexParams>() - 8usize];
["Offset of field: cuvsIvfPqIndexParams::metric"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, metric) - 0usize];
["Offset of field: cuvsIvfPqIndexParams::metric_arg"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, metric_arg) - 4usize];
["Offset of field: cuvsIvfPqIndexParams::add_data_on_build"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, add_data_on_build) - 8usize];
["Offset of field: cuvsIvfPqIndexParams::n_lists"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, n_lists) - 12usize];
["Offset of field: cuvsIvfPqIndexParams::kmeans_n_iters"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, kmeans_n_iters) - 16usize];
["Offset of field: cuvsIvfPqIndexParams::kmeans_trainset_fraction"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, kmeans_trainset_fraction) - 24usize];
["Offset of field: cuvsIvfPqIndexParams::pq_bits"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, pq_bits) - 32usize];
["Offset of field: cuvsIvfPqIndexParams::pq_dim"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, pq_dim) - 36usize];
["Offset of field: cuvsIvfPqIndexParams::codebook_kind"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, codebook_kind) - 40usize];
["Offset of field: cuvsIvfPqIndexParams::force_random_rotation"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, force_random_rotation) - 44usize];
["Offset of field: cuvsIvfPqIndexParams::conservative_memory_allocation"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, conservative_memory_allocation) - 45usize];
["Offset of field: cuvsIvfPqIndexParams::max_train_points_per_pq_code"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, max_train_points_per_pq_code) - 48usize];
["Offset of field: cuvsIvfPqIndexParams::codes_layout"]
[::std::mem::offset_of!(cuvsIvfPqIndexParams, codes_layout) - 52usize];
};
pub type cuvsIvfPqIndexParams_t = *mut cuvsIvfPqIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexParamsCreate(index_params: *mut cuvsIvfPqIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexParamsDestroy(index_params: cuvsIvfPqIndexParams_t) -> cuvsError_t;
}
#[repr(C)]
pub struct cuvsIvfPqSearchParams {
pub n_probes: u32,
pub lut_dtype: cudaDataType_t,
pub internal_distance_dtype: cudaDataType_t,
pub coarse_search_dtype: cudaDataType_t,
pub max_internal_batch_size: u32,
pub preferred_shmem_carveout: f64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfPqSearchParams"][::std::mem::size_of::<cuvsIvfPqSearchParams>() - 32usize];
["Alignment of cuvsIvfPqSearchParams"]
[::std::mem::align_of::<cuvsIvfPqSearchParams>() - 8usize];
["Offset of field: cuvsIvfPqSearchParams::n_probes"]
[::std::mem::offset_of!(cuvsIvfPqSearchParams, n_probes) - 0usize];
["Offset of field: cuvsIvfPqSearchParams::lut_dtype"]
[::std::mem::offset_of!(cuvsIvfPqSearchParams, lut_dtype) - 4usize];
["Offset of field: cuvsIvfPqSearchParams::internal_distance_dtype"]
[::std::mem::offset_of!(cuvsIvfPqSearchParams, internal_distance_dtype) - 8usize];
["Offset of field: cuvsIvfPqSearchParams::coarse_search_dtype"]
[::std::mem::offset_of!(cuvsIvfPqSearchParams, coarse_search_dtype) - 12usize];
["Offset of field: cuvsIvfPqSearchParams::max_internal_batch_size"]
[::std::mem::offset_of!(cuvsIvfPqSearchParams, max_internal_batch_size) - 16usize];
["Offset of field: cuvsIvfPqSearchParams::preferred_shmem_carveout"]
[::std::mem::offset_of!(cuvsIvfPqSearchParams, preferred_shmem_carveout) - 24usize];
};
pub type cuvsIvfPqSearchParams_t = *mut cuvsIvfPqSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqSearchParamsCreate(params: *mut cuvsIvfPqSearchParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqSearchParamsDestroy(params: cuvsIvfPqSearchParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfPqIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfPqIndex"][::std::mem::size_of::<cuvsIvfPqIndex>() - 16usize];
["Alignment of cuvsIvfPqIndex"][::std::mem::align_of::<cuvsIvfPqIndex>() - 8usize];
["Offset of field: cuvsIvfPqIndex::addr"]
[::std::mem::offset_of!(cuvsIvfPqIndex, addr) - 0usize];
["Offset of field: cuvsIvfPqIndex::dtype"]
[::std::mem::offset_of!(cuvsIvfPqIndex, dtype) - 8usize];
};
pub type cuvsIvfPqIndex_t = *mut cuvsIvfPqIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexCreate(index: *mut cuvsIvfPqIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexDestroy(index: cuvsIvfPqIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetNLists(index: cuvsIvfPqIndex_t, n_lists: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetDim(index: cuvsIvfPqIndex_t, dim: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetSize(index: cuvsIvfPqIndex_t, size: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetPqDim(index: cuvsIvfPqIndex_t, pq_dim: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetPqBits(index: cuvsIvfPqIndex_t, pq_bits: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetPqLen(index: cuvsIvfPqIndex_t, pq_len: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetCenters(
index: cuvsIvfPqIndex_t,
centers: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetCentersPadded(
index: cuvsIvfPqIndex_t,
centers: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetPqCenters(
index: cuvsIvfPqIndex_t,
pq_centers: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetCentersRot(
index: cuvsIvfPqIndex_t,
centers_rot: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetRotationMatrix(
index: cuvsIvfPqIndex_t,
rotation_matrix: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetListSizes(
index: cuvsIvfPqIndex_t,
list_sizes: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexUnpackContiguousListData(
res: cuvsResources_t,
index: cuvsIvfPqIndex_t,
out_codes: *mut DLManagedTensor,
label: u32,
offset: u32,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqIndexGetListIndices(
index: cuvsIvfPqIndex_t,
label: u32,
out_labels: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqBuild(
res: cuvsResources_t,
params: cuvsIvfPqIndexParams_t,
dataset: *mut DLManagedTensor,
index: cuvsIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqBuildPrecomputed(
res: cuvsResources_t,
params: cuvsIvfPqIndexParams_t,
dim: u32,
pq_centers: *mut DLManagedTensor,
centers: *mut DLManagedTensor,
centers_rot: *mut DLManagedTensor,
rotation_matrix: *mut DLManagedTensor,
index: cuvsIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqSearch(
res: cuvsResources_t,
search_params: cuvsIvfPqSearchParams_t,
index: cuvsIvfPqIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqSerialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqExtend(
res: cuvsResources_t,
new_vectors: *mut DLManagedTensor,
new_indices: *mut DLManagedTensor,
index: cuvsIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfPqTransform(
res: cuvsResources_t,
index: cuvsIvfPqIndex_t,
input_dataset: *mut DLManagedTensor,
output_labels: *mut DLManagedTensor,
output_dataset: *mut DLManagedTensor,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsNNDescentDistCompDtype {
NND_DIST_COMP_AUTO = 0,
NND_DIST_COMP_FP32 = 1,
NND_DIST_COMP_FP16 = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsNNDescentIndexParams {
pub metric: cuvsDistanceType,
pub metric_arg: f32,
pub graph_degree: usize,
pub intermediate_graph_degree: usize,
pub max_iterations: usize,
pub termination_threshold: f32,
pub return_distances: bool,
pub dist_comp_dtype: cuvsNNDescentDistCompDtype,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsNNDescentIndexParams"]
[::std::mem::size_of::<cuvsNNDescentIndexParams>() - 48usize];
["Alignment of cuvsNNDescentIndexParams"]
[::std::mem::align_of::<cuvsNNDescentIndexParams>() - 8usize];
["Offset of field: cuvsNNDescentIndexParams::metric"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, metric) - 0usize];
["Offset of field: cuvsNNDescentIndexParams::metric_arg"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, metric_arg) - 4usize];
["Offset of field: cuvsNNDescentIndexParams::graph_degree"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, graph_degree) - 8usize];
["Offset of field: cuvsNNDescentIndexParams::intermediate_graph_degree"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, intermediate_graph_degree) - 16usize];
["Offset of field: cuvsNNDescentIndexParams::max_iterations"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, max_iterations) - 24usize];
["Offset of field: cuvsNNDescentIndexParams::termination_threshold"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, termination_threshold) - 32usize];
["Offset of field: cuvsNNDescentIndexParams::return_distances"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, return_distances) - 36usize];
["Offset of field: cuvsNNDescentIndexParams::dist_comp_dtype"]
[::std::mem::offset_of!(cuvsNNDescentIndexParams, dist_comp_dtype) - 40usize];
};
pub type cuvsNNDescentIndexParams_t = *mut cuvsNNDescentIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentIndexParamsCreate(
index_params: *mut cuvsNNDescentIndexParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentIndexParamsDestroy(index_params: cuvsNNDescentIndexParams_t)
-> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsNNDescentIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsNNDescentIndex"][::std::mem::size_of::<cuvsNNDescentIndex>() - 16usize];
["Alignment of cuvsNNDescentIndex"][::std::mem::align_of::<cuvsNNDescentIndex>() - 8usize];
["Offset of field: cuvsNNDescentIndex::addr"]
[::std::mem::offset_of!(cuvsNNDescentIndex, addr) - 0usize];
["Offset of field: cuvsNNDescentIndex::dtype"]
[::std::mem::offset_of!(cuvsNNDescentIndex, dtype) - 8usize];
};
pub type cuvsNNDescentIndex_t = *mut cuvsNNDescentIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentIndexCreate(index: *mut cuvsNNDescentIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentIndexDestroy(index: cuvsNNDescentIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentBuild(
res: cuvsResources_t,
index_params: cuvsNNDescentIndexParams_t,
dataset: *mut DLManagedTensor,
graph: *mut DLManagedTensor,
index: cuvsNNDescentIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentIndexGetGraph(
res: cuvsResources_t,
index: cuvsNNDescentIndex_t,
graph: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsNNDescentIndexGetDistances(
res: cuvsResources_t,
index: cuvsNNDescentIndex_t,
distances: *mut DLManagedTensor,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsAllNeighborsAlgo {
CUVS_ALL_NEIGHBORS_ALGO_BRUTE_FORCE = 0,
CUVS_ALL_NEIGHBORS_ALGO_IVF_PQ = 1,
CUVS_ALL_NEIGHBORS_ALGO_NN_DESCENT = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsAllNeighborsIndexParams {
pub algo: cuvsAllNeighborsAlgo,
pub overlap_factor: usize,
pub n_clusters: usize,
pub metric: cuvsDistanceType,
pub ivf_pq_params: cuvsIvfPqIndexParams_t,
pub nn_descent_params: cuvsNNDescentIndexParams_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsAllNeighborsIndexParams"]
[::std::mem::size_of::<cuvsAllNeighborsIndexParams>() - 48usize];
["Alignment of cuvsAllNeighborsIndexParams"]
[::std::mem::align_of::<cuvsAllNeighborsIndexParams>() - 8usize];
["Offset of field: cuvsAllNeighborsIndexParams::algo"]
[::std::mem::offset_of!(cuvsAllNeighborsIndexParams, algo) - 0usize];
["Offset of field: cuvsAllNeighborsIndexParams::overlap_factor"]
[::std::mem::offset_of!(cuvsAllNeighborsIndexParams, overlap_factor) - 8usize];
["Offset of field: cuvsAllNeighborsIndexParams::n_clusters"]
[::std::mem::offset_of!(cuvsAllNeighborsIndexParams, n_clusters) - 16usize];
["Offset of field: cuvsAllNeighborsIndexParams::metric"]
[::std::mem::offset_of!(cuvsAllNeighborsIndexParams, metric) - 24usize];
["Offset of field: cuvsAllNeighborsIndexParams::ivf_pq_params"]
[::std::mem::offset_of!(cuvsAllNeighborsIndexParams, ivf_pq_params) - 32usize];
["Offset of field: cuvsAllNeighborsIndexParams::nn_descent_params"]
[::std::mem::offset_of!(cuvsAllNeighborsIndexParams, nn_descent_params) - 40usize];
};
pub type cuvsAllNeighborsIndexParams_t = *mut cuvsAllNeighborsIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsAllNeighborsIndexParamsCreate(
index_params: *mut cuvsAllNeighborsIndexParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsAllNeighborsIndexParamsDestroy(
index_params: cuvsAllNeighborsIndexParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsAllNeighborsBuild(
res: cuvsResources_t,
params: cuvsAllNeighborsIndexParams_t,
dataset: *mut DLManagedTensor,
indices: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
core_distances: *mut DLManagedTensor,
alpha: f32,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsFilterType {
NO_FILTER = 0,
BITSET = 1,
BITMAP = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsFilter {
pub addr: usize,
pub type_: cuvsFilterType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsFilter"][::std::mem::size_of::<cuvsFilter>() - 16usize];
["Alignment of cuvsFilter"][::std::mem::align_of::<cuvsFilter>() - 8usize];
["Offset of field: cuvsFilter::addr"][::std::mem::offset_of!(cuvsFilter, addr) - 0usize];
["Offset of field: cuvsFilter::type_"][::std::mem::offset_of!(cuvsFilter, type_) - 8usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsMergeStrategy {
MERGE_STRATEGY_PHYSICAL = 0,
MERGE_STRATEGY_LOGICAL = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsBruteForceIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsBruteForceIndex"][::std::mem::size_of::<cuvsBruteForceIndex>() - 16usize];
["Alignment of cuvsBruteForceIndex"][::std::mem::align_of::<cuvsBruteForceIndex>() - 8usize];
["Offset of field: cuvsBruteForceIndex::addr"]
[::std::mem::offset_of!(cuvsBruteForceIndex, addr) - 0usize];
["Offset of field: cuvsBruteForceIndex::dtype"]
[::std::mem::offset_of!(cuvsBruteForceIndex, dtype) - 8usize];
};
pub type cuvsBruteForceIndex_t = *mut cuvsBruteForceIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsBruteForceIndexCreate(index: *mut cuvsBruteForceIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBruteForceIndexDestroy(index: cuvsBruteForceIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBruteForceBuild(
res: cuvsResources_t,
dataset: *mut DLManagedTensor,
metric: cuvsDistanceType,
metric_arg: f32,
index: cuvsBruteForceIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBruteForceSearch(
res: cuvsResources_t,
index: cuvsBruteForceIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
prefilter: cuvsFilter,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBruteForceSerialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsBruteForceIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBruteForceDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsBruteForceIndex_t,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsCagraGraphBuildAlgo {
AUTO_SELECT = 0,
IVF_PQ = 1,
NN_DESCENT = 2,
ITERATIVE_CAGRA_SEARCH = 3,
ACE = 4,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsCagraHnswHeuristicType {
CUVS_CAGRA_HEURISTIC_SIMILAR_SEARCH_PERFORMANCE = 0,
CUVS_CAGRA_HEURISTIC_SAME_GRAPH_FOOTPRINT = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsCagraCompressionParams {
pub pq_bits: u32,
pub pq_dim: u32,
pub vq_n_centers: u32,
pub kmeans_n_iters: u32,
pub vq_kmeans_trainset_fraction: f64,
pub pq_kmeans_trainset_fraction: f64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsCagraCompressionParams"]
[::std::mem::size_of::<cuvsCagraCompressionParams>() - 32usize];
["Alignment of cuvsCagraCompressionParams"]
[::std::mem::align_of::<cuvsCagraCompressionParams>() - 8usize];
["Offset of field: cuvsCagraCompressionParams::pq_bits"]
[::std::mem::offset_of!(cuvsCagraCompressionParams, pq_bits) - 0usize];
["Offset of field: cuvsCagraCompressionParams::pq_dim"]
[::std::mem::offset_of!(cuvsCagraCompressionParams, pq_dim) - 4usize];
["Offset of field: cuvsCagraCompressionParams::vq_n_centers"]
[::std::mem::offset_of!(cuvsCagraCompressionParams, vq_n_centers) - 8usize];
["Offset of field: cuvsCagraCompressionParams::kmeans_n_iters"]
[::std::mem::offset_of!(cuvsCagraCompressionParams, kmeans_n_iters) - 12usize];
["Offset of field: cuvsCagraCompressionParams::vq_kmeans_trainset_fraction"]
[::std::mem::offset_of!(cuvsCagraCompressionParams, vq_kmeans_trainset_fraction) - 16usize];
["Offset of field: cuvsCagraCompressionParams::pq_kmeans_trainset_fraction"]
[::std::mem::offset_of!(cuvsCagraCompressionParams, pq_kmeans_trainset_fraction) - 24usize];
};
pub type cuvsCagraCompressionParams_t = *mut cuvsCagraCompressionParams;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfPqParams {
pub ivf_pq_build_params: cuvsIvfPqIndexParams_t,
pub ivf_pq_search_params: cuvsIvfPqSearchParams_t,
pub refinement_rate: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfPqParams"][::std::mem::size_of::<cuvsIvfPqParams>() - 24usize];
["Alignment of cuvsIvfPqParams"][::std::mem::align_of::<cuvsIvfPqParams>() - 8usize];
["Offset of field: cuvsIvfPqParams::ivf_pq_build_params"]
[::std::mem::offset_of!(cuvsIvfPqParams, ivf_pq_build_params) - 0usize];
["Offset of field: cuvsIvfPqParams::ivf_pq_search_params"]
[::std::mem::offset_of!(cuvsIvfPqParams, ivf_pq_search_params) - 8usize];
["Offset of field: cuvsIvfPqParams::refinement_rate"]
[::std::mem::offset_of!(cuvsIvfPqParams, refinement_rate) - 16usize];
};
pub type cuvsIvfPqParams_t = *mut cuvsIvfPqParams;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsAceParams {
pub npartitions: usize,
pub ef_construction: usize,
pub build_dir: *const ::std::os::raw::c_char,
pub use_disk: bool,
pub max_host_memory_gb: f64,
pub max_gpu_memory_gb: f64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsAceParams"][::std::mem::size_of::<cuvsAceParams>() - 48usize];
["Alignment of cuvsAceParams"][::std::mem::align_of::<cuvsAceParams>() - 8usize];
["Offset of field: cuvsAceParams::npartitions"]
[::std::mem::offset_of!(cuvsAceParams, npartitions) - 0usize];
["Offset of field: cuvsAceParams::ef_construction"]
[::std::mem::offset_of!(cuvsAceParams, ef_construction) - 8usize];
["Offset of field: cuvsAceParams::build_dir"]
[::std::mem::offset_of!(cuvsAceParams, build_dir) - 16usize];
["Offset of field: cuvsAceParams::use_disk"]
[::std::mem::offset_of!(cuvsAceParams, use_disk) - 24usize];
["Offset of field: cuvsAceParams::max_host_memory_gb"]
[::std::mem::offset_of!(cuvsAceParams, max_host_memory_gb) - 32usize];
["Offset of field: cuvsAceParams::max_gpu_memory_gb"]
[::std::mem::offset_of!(cuvsAceParams, max_gpu_memory_gb) - 40usize];
};
pub type cuvsAceParams_t = *mut cuvsAceParams;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsCagraIndexParams {
pub metric: cuvsDistanceType,
pub intermediate_graph_degree: usize,
pub graph_degree: usize,
pub build_algo: cuvsCagraGraphBuildAlgo,
pub nn_descent_niter: usize,
pub graph_build_params: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsCagraIndexParams"][::std::mem::size_of::<cuvsCagraIndexParams>() - 48usize];
["Alignment of cuvsCagraIndexParams"][::std::mem::align_of::<cuvsCagraIndexParams>() - 8usize];
["Offset of field: cuvsCagraIndexParams::metric"]
[::std::mem::offset_of!(cuvsCagraIndexParams, metric) - 0usize];
["Offset of field: cuvsCagraIndexParams::intermediate_graph_degree"]
[::std::mem::offset_of!(cuvsCagraIndexParams, intermediate_graph_degree) - 8usize];
["Offset of field: cuvsCagraIndexParams::graph_degree"]
[::std::mem::offset_of!(cuvsCagraIndexParams, graph_degree) - 16usize];
["Offset of field: cuvsCagraIndexParams::build_algo"]
[::std::mem::offset_of!(cuvsCagraIndexParams, build_algo) - 24usize];
["Offset of field: cuvsCagraIndexParams::nn_descent_niter"]
[::std::mem::offset_of!(cuvsCagraIndexParams, nn_descent_niter) - 32usize];
["Offset of field: cuvsCagraIndexParams::graph_build_params"]
[::std::mem::offset_of!(cuvsCagraIndexParams, graph_build_params) - 40usize];
};
pub type cuvsCagraIndexParams_t = *mut cuvsCagraIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexParamsCreate(params: *mut cuvsCagraIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexParamsDestroy(params: cuvsCagraIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraCompressionParamsCreate(
params: *mut cuvsCagraCompressionParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraCompressionParamsDestroy(params: cuvsCagraCompressionParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsAceParamsCreate(params: *mut cuvsAceParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsAceParamsDestroy(params: cuvsAceParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexParamsFromHnswParams(
params: cuvsCagraIndexParams_t,
n_rows: i64,
dim: i64,
M: ::std::os::raw::c_int,
ef_construction: ::std::os::raw::c_int,
heuristic: cuvsCagraHnswHeuristicType,
metric: cuvsDistanceType,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexParamsFromDataset(
params: cuvsCagraIndexParams_t,
n_rows: i64,
dim: i64,
graph_degree: usize,
metric: cuvsDistanceType,
build_quality: usize,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsCagraExtendParams {
pub max_chunk_size: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsCagraExtendParams"][::std::mem::size_of::<cuvsCagraExtendParams>() - 4usize];
["Alignment of cuvsCagraExtendParams"]
[::std::mem::align_of::<cuvsCagraExtendParams>() - 4usize];
["Offset of field: cuvsCagraExtendParams::max_chunk_size"]
[::std::mem::offset_of!(cuvsCagraExtendParams, max_chunk_size) - 0usize];
};
pub type cuvsCagraExtendParams_t = *mut cuvsCagraExtendParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraExtendParamsCreate(params: *mut cuvsCagraExtendParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraExtendParamsDestroy(params: cuvsCagraExtendParams_t) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsCagraSearchAlgo {
SINGLE_CTA = 0,
MULTI_CTA = 1,
MULTI_KERNEL = 2,
AUTO = 100,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsCagraHashMode {
HASH = 0,
SMALL = 1,
AUTO_HASH = 100,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsCagraSearchParams {
pub max_queries: usize,
pub itopk_size: usize,
pub max_iterations: usize,
pub algo: cuvsCagraSearchAlgo,
pub team_size: usize,
pub search_width: usize,
pub min_iterations: usize,
pub thread_block_size: usize,
pub hashmap_mode: cuvsCagraHashMode,
pub hashmap_min_bitlen: usize,
pub hashmap_max_fill_rate: f32,
pub num_random_samplings: u32,
pub rand_xor_mask: u64,
pub persistent: bool,
pub persistent_lifetime: f32,
pub persistent_device_usage: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsCagraSearchParams"][::std::mem::size_of::<cuvsCagraSearchParams>() - 112usize];
["Alignment of cuvsCagraSearchParams"]
[::std::mem::align_of::<cuvsCagraSearchParams>() - 8usize];
["Offset of field: cuvsCagraSearchParams::max_queries"]
[::std::mem::offset_of!(cuvsCagraSearchParams, max_queries) - 0usize];
["Offset of field: cuvsCagraSearchParams::itopk_size"]
[::std::mem::offset_of!(cuvsCagraSearchParams, itopk_size) - 8usize];
["Offset of field: cuvsCagraSearchParams::max_iterations"]
[::std::mem::offset_of!(cuvsCagraSearchParams, max_iterations) - 16usize];
["Offset of field: cuvsCagraSearchParams::algo"]
[::std::mem::offset_of!(cuvsCagraSearchParams, algo) - 24usize];
["Offset of field: cuvsCagraSearchParams::team_size"]
[::std::mem::offset_of!(cuvsCagraSearchParams, team_size) - 32usize];
["Offset of field: cuvsCagraSearchParams::search_width"]
[::std::mem::offset_of!(cuvsCagraSearchParams, search_width) - 40usize];
["Offset of field: cuvsCagraSearchParams::min_iterations"]
[::std::mem::offset_of!(cuvsCagraSearchParams, min_iterations) - 48usize];
["Offset of field: cuvsCagraSearchParams::thread_block_size"]
[::std::mem::offset_of!(cuvsCagraSearchParams, thread_block_size) - 56usize];
["Offset of field: cuvsCagraSearchParams::hashmap_mode"]
[::std::mem::offset_of!(cuvsCagraSearchParams, hashmap_mode) - 64usize];
["Offset of field: cuvsCagraSearchParams::hashmap_min_bitlen"]
[::std::mem::offset_of!(cuvsCagraSearchParams, hashmap_min_bitlen) - 72usize];
["Offset of field: cuvsCagraSearchParams::hashmap_max_fill_rate"]
[::std::mem::offset_of!(cuvsCagraSearchParams, hashmap_max_fill_rate) - 80usize];
["Offset of field: cuvsCagraSearchParams::num_random_samplings"]
[::std::mem::offset_of!(cuvsCagraSearchParams, num_random_samplings) - 84usize];
["Offset of field: cuvsCagraSearchParams::rand_xor_mask"]
[::std::mem::offset_of!(cuvsCagraSearchParams, rand_xor_mask) - 88usize];
["Offset of field: cuvsCagraSearchParams::persistent"]
[::std::mem::offset_of!(cuvsCagraSearchParams, persistent) - 96usize];
["Offset of field: cuvsCagraSearchParams::persistent_lifetime"]
[::std::mem::offset_of!(cuvsCagraSearchParams, persistent_lifetime) - 100usize];
["Offset of field: cuvsCagraSearchParams::persistent_device_usage"]
[::std::mem::offset_of!(cuvsCagraSearchParams, persistent_device_usage) - 104usize];
};
pub type cuvsCagraSearchParams_t = *mut cuvsCagraSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSearchParamsCreate(params: *mut cuvsCagraSearchParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSearchParamsDestroy(params: cuvsCagraSearchParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsCagraIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsCagraIndex"][::std::mem::size_of::<cuvsCagraIndex>() - 16usize];
["Alignment of cuvsCagraIndex"][::std::mem::align_of::<cuvsCagraIndex>() - 8usize];
["Offset of field: cuvsCagraIndex::addr"]
[::std::mem::offset_of!(cuvsCagraIndex, addr) - 0usize];
["Offset of field: cuvsCagraIndex::dtype"]
[::std::mem::offset_of!(cuvsCagraIndex, dtype) - 8usize];
};
pub type cuvsCagraIndex_t = *mut cuvsCagraIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexCreate(index: *mut cuvsCagraIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexDestroy(index: cuvsCagraIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexGetDims(index: cuvsCagraIndex_t, dim: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexGetSize(index: cuvsCagraIndex_t, size: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexGetGraphDegree(
index: cuvsCagraIndex_t,
graph_degree: *mut i64,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexGetDataset(
index: cuvsCagraIndex_t,
dataset: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexGetGraph(
index: cuvsCagraIndex_t,
graph: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraUpdateDataset(
res: cuvsResources_t,
device_padded_dataset: cuvsDataset_t,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraBuild(
res: cuvsResources_t,
params: cuvsCagraIndexParams_t,
dataset: cuvsDataset_t,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraExtend(
res: cuvsResources_t,
params: cuvsCagraExtendParams_t,
extended_dataset: cuvsDataset_t,
new_start_row: i64,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSearch(
res: cuvsResources_t,
params: cuvsCagraSearchParams_t,
index: cuvsCagraIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
filter: cuvsFilter,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSearchMultiPartition(
res: cuvsResources_t,
params: cuvsCagraSearchParams_t,
num_partitions: u32,
indices: *mut cuvsCagraIndex_t,
queries: *mut DLManagedTensor,
partition_ids: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
filters: *mut cuvsFilter,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSerializeGraph(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSerializeGraphAndDataset(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraSerializeToHnswlib(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraDeserializeGraph(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraDeserializeGraphAndDataset(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsCagraIndex_t,
out_dataset: *mut cuvsDataset_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraIndexFromArgs(
res: cuvsResources_t,
metric: cuvsDistanceType,
graph: *mut DLManagedTensor,
dataset: *mut DLManagedTensor,
index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsCagraMerge(
res: cuvsResources_t,
params: cuvsCagraIndexParams_t,
indices: *mut cuvsCagraIndex_t,
num_indices: usize,
filter: cuvsFilter,
merged_dataset: cuvsDataset_t,
output_index: cuvsCagraIndex_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfFlatIndexParams {
pub metric: cuvsDistanceType,
pub metric_arg: f32,
pub add_data_on_build: bool,
pub n_lists: u32,
pub kmeans_n_iters: u32,
pub kmeans_trainset_fraction: f64,
pub adaptive_centers: bool,
pub conservative_memory_allocation: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfFlatIndexParams"][::std::mem::size_of::<cuvsIvfFlatIndexParams>() - 40usize];
["Alignment of cuvsIvfFlatIndexParams"]
[::std::mem::align_of::<cuvsIvfFlatIndexParams>() - 8usize];
["Offset of field: cuvsIvfFlatIndexParams::metric"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, metric) - 0usize];
["Offset of field: cuvsIvfFlatIndexParams::metric_arg"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, metric_arg) - 4usize];
["Offset of field: cuvsIvfFlatIndexParams::add_data_on_build"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, add_data_on_build) - 8usize];
["Offset of field: cuvsIvfFlatIndexParams::n_lists"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, n_lists) - 12usize];
["Offset of field: cuvsIvfFlatIndexParams::kmeans_n_iters"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, kmeans_n_iters) - 16usize];
["Offset of field: cuvsIvfFlatIndexParams::kmeans_trainset_fraction"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, kmeans_trainset_fraction) - 24usize];
["Offset of field: cuvsIvfFlatIndexParams::adaptive_centers"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, adaptive_centers) - 32usize];
["Offset of field: cuvsIvfFlatIndexParams::conservative_memory_allocation"]
[::std::mem::offset_of!(cuvsIvfFlatIndexParams, conservative_memory_allocation) - 33usize];
};
pub type cuvsIvfFlatIndexParams_t = *mut cuvsIvfFlatIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexParamsCreate(index_params: *mut cuvsIvfFlatIndexParams_t)
-> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexParamsDestroy(index_params: cuvsIvfFlatIndexParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfFlatSearchParams {
pub n_probes: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfFlatSearchParams"][::std::mem::size_of::<cuvsIvfFlatSearchParams>() - 4usize];
["Alignment of cuvsIvfFlatSearchParams"]
[::std::mem::align_of::<cuvsIvfFlatSearchParams>() - 4usize];
["Offset of field: cuvsIvfFlatSearchParams::n_probes"]
[::std::mem::offset_of!(cuvsIvfFlatSearchParams, n_probes) - 0usize];
};
pub type cuvsIvfFlatSearchParams_t = *mut cuvsIvfFlatSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatSearchParamsCreate(params: *mut cuvsIvfFlatSearchParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatSearchParamsDestroy(params: cuvsIvfFlatSearchParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfFlatIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfFlatIndex"][::std::mem::size_of::<cuvsIvfFlatIndex>() - 16usize];
["Alignment of cuvsIvfFlatIndex"][::std::mem::align_of::<cuvsIvfFlatIndex>() - 8usize];
["Offset of field: cuvsIvfFlatIndex::addr"]
[::std::mem::offset_of!(cuvsIvfFlatIndex, addr) - 0usize];
["Offset of field: cuvsIvfFlatIndex::dtype"]
[::std::mem::offset_of!(cuvsIvfFlatIndex, dtype) - 8usize];
};
pub type cuvsIvfFlatIndex_t = *mut cuvsIvfFlatIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexCreate(index: *mut cuvsIvfFlatIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexDestroy(index: cuvsIvfFlatIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexGetNLists(index: cuvsIvfFlatIndex_t, n_lists: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexGetDim(index: cuvsIvfFlatIndex_t, dim: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatIndexGetCenters(
index: cuvsIvfFlatIndex_t,
centers: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatBuild(
res: cuvsResources_t,
index_params: cuvsIvfFlatIndexParams_t,
dataset: *mut DLManagedTensor,
index: cuvsIvfFlatIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatSearch(
res: cuvsResources_t,
search_params: cuvsIvfFlatSearchParams_t,
index: cuvsIvfFlatIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
filter: cuvsFilter,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatSerialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsIvfFlatIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsIvfFlatIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfFlatExtend(
res: cuvsResources_t,
new_vectors: *mut DLManagedTensor,
new_indices: *mut DLManagedTensor,
index: cuvsIvfFlatIndex_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfSqIndexParams {
pub metric: cuvsDistanceType,
pub metric_arg: f32,
pub add_data_on_build: bool,
pub n_lists: u32,
pub kmeans_n_iters: u32,
pub max_train_points_per_cluster: u32,
pub conservative_memory_allocation: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfSqIndexParams"][::std::mem::size_of::<cuvsIvfSqIndexParams>() - 28usize];
["Alignment of cuvsIvfSqIndexParams"][::std::mem::align_of::<cuvsIvfSqIndexParams>() - 4usize];
["Offset of field: cuvsIvfSqIndexParams::metric"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, metric) - 0usize];
["Offset of field: cuvsIvfSqIndexParams::metric_arg"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, metric_arg) - 4usize];
["Offset of field: cuvsIvfSqIndexParams::add_data_on_build"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, add_data_on_build) - 8usize];
["Offset of field: cuvsIvfSqIndexParams::n_lists"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, n_lists) - 12usize];
["Offset of field: cuvsIvfSqIndexParams::kmeans_n_iters"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, kmeans_n_iters) - 16usize];
["Offset of field: cuvsIvfSqIndexParams::max_train_points_per_cluster"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, max_train_points_per_cluster) - 20usize];
["Offset of field: cuvsIvfSqIndexParams::conservative_memory_allocation"]
[::std::mem::offset_of!(cuvsIvfSqIndexParams, conservative_memory_allocation) - 24usize];
};
pub type cuvsIvfSqIndexParams_t = *mut cuvsIvfSqIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexParamsCreate(index_params: *mut cuvsIvfSqIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexParamsDestroy(index_params: cuvsIvfSqIndexParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfSqSearchParams {
pub n_probes: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfSqSearchParams"][::std::mem::size_of::<cuvsIvfSqSearchParams>() - 4usize];
["Alignment of cuvsIvfSqSearchParams"]
[::std::mem::align_of::<cuvsIvfSqSearchParams>() - 4usize];
["Offset of field: cuvsIvfSqSearchParams::n_probes"]
[::std::mem::offset_of!(cuvsIvfSqSearchParams, n_probes) - 0usize];
};
pub type cuvsIvfSqSearchParams_t = *mut cuvsIvfSqSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqSearchParamsCreate(params: *mut cuvsIvfSqSearchParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqSearchParamsDestroy(params: cuvsIvfSqSearchParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsIvfSqIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsIvfSqIndex"][::std::mem::size_of::<cuvsIvfSqIndex>() - 16usize];
["Alignment of cuvsIvfSqIndex"][::std::mem::align_of::<cuvsIvfSqIndex>() - 8usize];
["Offset of field: cuvsIvfSqIndex::addr"]
[::std::mem::offset_of!(cuvsIvfSqIndex, addr) - 0usize];
["Offset of field: cuvsIvfSqIndex::dtype"]
[::std::mem::offset_of!(cuvsIvfSqIndex, dtype) - 8usize];
};
pub type cuvsIvfSqIndex_t = *mut cuvsIvfSqIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexCreate(index: *mut cuvsIvfSqIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexDestroy(index: cuvsIvfSqIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexGetNLists(index: cuvsIvfSqIndex_t, n_lists: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexGetDim(index: cuvsIvfSqIndex_t, dim: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexGetSize(index: cuvsIvfSqIndex_t, size: *mut i64) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqIndexGetCenters(
index: cuvsIvfSqIndex_t,
centers: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqBuild(
res: cuvsResources_t,
index_params: cuvsIvfSqIndexParams_t,
dataset: *mut DLManagedTensor,
index: cuvsIvfSqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqSearch(
res: cuvsResources_t,
search_params: cuvsIvfSqSearchParams_t,
index: cuvsIvfSqIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
filter: cuvsFilter,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqSerialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsIvfSqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsIvfSqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsIvfSqExtend(
res: cuvsResources_t,
new_vectors: *mut DLManagedTensor,
new_indices: *mut DLManagedTensor,
index: cuvsIvfSqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsRefine(
res: cuvsResources_t,
dataset: *mut DLManagedTensor,
queries: *mut DLManagedTensor,
candidates: *mut DLManagedTensor,
metric: cuvsDistanceType,
indices: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsTieredIndexANNAlgo {
CUVS_TIERED_INDEX_ALGO_CAGRA = 0,
CUVS_TIERED_INDEX_ALGO_IVF_FLAT = 1,
CUVS_TIERED_INDEX_ALGO_IVF_PQ = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsTieredIndex {
pub addr: usize,
pub dtype: DLDataType,
pub algo: cuvsTieredIndexANNAlgo,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsTieredIndex"][::std::mem::size_of::<cuvsTieredIndex>() - 16usize];
["Alignment of cuvsTieredIndex"][::std::mem::align_of::<cuvsTieredIndex>() - 8usize];
["Offset of field: cuvsTieredIndex::addr"]
[::std::mem::offset_of!(cuvsTieredIndex, addr) - 0usize];
["Offset of field: cuvsTieredIndex::dtype"]
[::std::mem::offset_of!(cuvsTieredIndex, dtype) - 8usize];
["Offset of field: cuvsTieredIndex::algo"]
[::std::mem::offset_of!(cuvsTieredIndex, algo) - 12usize];
};
pub type cuvsTieredIndex_t = *mut cuvsTieredIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexCreate(index: *mut cuvsTieredIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexDestroy(index: cuvsTieredIndex_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsTieredIndexParams {
pub metric: cuvsDistanceType,
pub algo: cuvsTieredIndexANNAlgo,
pub min_ann_rows: i64,
pub create_ann_index_on_extend: bool,
pub cagra_params: cuvsCagraIndexParams_t,
pub ivf_flat_params: cuvsIvfFlatIndexParams_t,
pub ivf_pq_params: cuvsIvfPqIndexParams_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsTieredIndexParams"][::std::mem::size_of::<cuvsTieredIndexParams>() - 48usize];
["Alignment of cuvsTieredIndexParams"]
[::std::mem::align_of::<cuvsTieredIndexParams>() - 8usize];
["Offset of field: cuvsTieredIndexParams::metric"]
[::std::mem::offset_of!(cuvsTieredIndexParams, metric) - 0usize];
["Offset of field: cuvsTieredIndexParams::algo"]
[::std::mem::offset_of!(cuvsTieredIndexParams, algo) - 4usize];
["Offset of field: cuvsTieredIndexParams::min_ann_rows"]
[::std::mem::offset_of!(cuvsTieredIndexParams, min_ann_rows) - 8usize];
["Offset of field: cuvsTieredIndexParams::create_ann_index_on_extend"]
[::std::mem::offset_of!(cuvsTieredIndexParams, create_ann_index_on_extend) - 16usize];
["Offset of field: cuvsTieredIndexParams::cagra_params"]
[::std::mem::offset_of!(cuvsTieredIndexParams, cagra_params) - 24usize];
["Offset of field: cuvsTieredIndexParams::ivf_flat_params"]
[::std::mem::offset_of!(cuvsTieredIndexParams, ivf_flat_params) - 32usize];
["Offset of field: cuvsTieredIndexParams::ivf_pq_params"]
[::std::mem::offset_of!(cuvsTieredIndexParams, ivf_pq_params) - 40usize];
};
pub type cuvsTieredIndexParams_t = *mut cuvsTieredIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexParamsCreate(index_params: *mut cuvsTieredIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexParamsDestroy(index_params: cuvsTieredIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexBuild(
res: cuvsResources_t,
index_params: cuvsTieredIndexParams_t,
dataset: *mut DLManagedTensor,
index: cuvsTieredIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexSearch(
res: cuvsResources_t,
search_params: *mut ::std::os::raw::c_void,
index: cuvsTieredIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
prefilter: cuvsFilter,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexExtend(
res: cuvsResources_t,
new_vectors: *mut DLManagedTensor,
index: cuvsTieredIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsTieredIndexMerge(
res: cuvsResources_t,
index_params: cuvsTieredIndexParams_t,
indices: *mut cuvsTieredIndex_t,
num_indices: usize,
output_index: cuvsTieredIndex_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsVamanaIndexParams {
pub metric: cuvsDistanceType,
pub graph_degree: u32,
pub visited_size: u32,
pub vamana_iters: f32,
pub alpha: f32,
pub max_fraction: f32,
pub batch_base: f32,
pub queue_size: u32,
pub reverse_batchsize: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsVamanaIndexParams"][::std::mem::size_of::<cuvsVamanaIndexParams>() - 36usize];
["Alignment of cuvsVamanaIndexParams"]
[::std::mem::align_of::<cuvsVamanaIndexParams>() - 4usize];
["Offset of field: cuvsVamanaIndexParams::metric"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, metric) - 0usize];
["Offset of field: cuvsVamanaIndexParams::graph_degree"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, graph_degree) - 4usize];
["Offset of field: cuvsVamanaIndexParams::visited_size"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, visited_size) - 8usize];
["Offset of field: cuvsVamanaIndexParams::vamana_iters"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, vamana_iters) - 12usize];
["Offset of field: cuvsVamanaIndexParams::alpha"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, alpha) - 16usize];
["Offset of field: cuvsVamanaIndexParams::max_fraction"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, max_fraction) - 20usize];
["Offset of field: cuvsVamanaIndexParams::batch_base"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, batch_base) - 24usize];
["Offset of field: cuvsVamanaIndexParams::queue_size"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, queue_size) - 28usize];
["Offset of field: cuvsVamanaIndexParams::reverse_batchsize"]
[::std::mem::offset_of!(cuvsVamanaIndexParams, reverse_batchsize) - 32usize];
};
pub type cuvsVamanaIndexParams_t = *mut cuvsVamanaIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaIndexParamsCreate(params: *mut cuvsVamanaIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaIndexParamsDestroy(params: cuvsVamanaIndexParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsVamanaIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsVamanaIndex"][::std::mem::size_of::<cuvsVamanaIndex>() - 16usize];
["Alignment of cuvsVamanaIndex"][::std::mem::align_of::<cuvsVamanaIndex>() - 8usize];
["Offset of field: cuvsVamanaIndex::addr"]
[::std::mem::offset_of!(cuvsVamanaIndex, addr) - 0usize];
["Offset of field: cuvsVamanaIndex::dtype"]
[::std::mem::offset_of!(cuvsVamanaIndex, dtype) - 8usize];
};
pub type cuvsVamanaIndex_t = *mut cuvsVamanaIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaIndexCreate(index: *mut cuvsVamanaIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaIndexDestroy(index: cuvsVamanaIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaIndexGetDims(
index: cuvsVamanaIndex_t,
dim: *mut ::std::os::raw::c_int,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaBuild(
res: cuvsResources_t,
params: cuvsVamanaIndexParams_t,
dataset: *mut DLManagedTensor,
index: cuvsVamanaIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsVamanaSerialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsVamanaIndex_t,
include_dataset: bool,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsHnswHierarchy {
NONE = 0,
CPU = 1,
GPU = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsHnswAceParams {
pub npartitions: usize,
pub build_dir: *const ::std::os::raw::c_char,
pub use_disk: bool,
pub max_host_memory_gb: f64,
pub max_gpu_memory_gb: f64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsHnswAceParams"][::std::mem::size_of::<cuvsHnswAceParams>() - 40usize];
["Alignment of cuvsHnswAceParams"][::std::mem::align_of::<cuvsHnswAceParams>() - 8usize];
["Offset of field: cuvsHnswAceParams::npartitions"]
[::std::mem::offset_of!(cuvsHnswAceParams, npartitions) - 0usize];
["Offset of field: cuvsHnswAceParams::build_dir"]
[::std::mem::offset_of!(cuvsHnswAceParams, build_dir) - 8usize];
["Offset of field: cuvsHnswAceParams::use_disk"]
[::std::mem::offset_of!(cuvsHnswAceParams, use_disk) - 16usize];
["Offset of field: cuvsHnswAceParams::max_host_memory_gb"]
[::std::mem::offset_of!(cuvsHnswAceParams, max_host_memory_gb) - 24usize];
["Offset of field: cuvsHnswAceParams::max_gpu_memory_gb"]
[::std::mem::offset_of!(cuvsHnswAceParams, max_gpu_memory_gb) - 32usize];
};
pub type cuvsHnswAceParams_t = *mut cuvsHnswAceParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswAceParamsCreate(params: *mut cuvsHnswAceParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswAceParamsDestroy(params: cuvsHnswAceParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsHnswIndexParams {
pub hierarchy: cuvsHnswHierarchy,
pub ef_construction: ::std::os::raw::c_int,
pub num_threads: ::std::os::raw::c_int,
pub M: usize,
pub metric: cuvsDistanceType,
pub ace_params: cuvsHnswAceParams_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsHnswIndexParams"][::std::mem::size_of::<cuvsHnswIndexParams>() - 40usize];
["Alignment of cuvsHnswIndexParams"][::std::mem::align_of::<cuvsHnswIndexParams>() - 8usize];
["Offset of field: cuvsHnswIndexParams::hierarchy"]
[::std::mem::offset_of!(cuvsHnswIndexParams, hierarchy) - 0usize];
["Offset of field: cuvsHnswIndexParams::ef_construction"]
[::std::mem::offset_of!(cuvsHnswIndexParams, ef_construction) - 4usize];
["Offset of field: cuvsHnswIndexParams::num_threads"]
[::std::mem::offset_of!(cuvsHnswIndexParams, num_threads) - 8usize];
["Offset of field: cuvsHnswIndexParams::M"]
[::std::mem::offset_of!(cuvsHnswIndexParams, M) - 16usize];
["Offset of field: cuvsHnswIndexParams::metric"]
[::std::mem::offset_of!(cuvsHnswIndexParams, metric) - 24usize];
["Offset of field: cuvsHnswIndexParams::ace_params"]
[::std::mem::offset_of!(cuvsHnswIndexParams, ace_params) - 32usize];
};
pub type cuvsHnswIndexParams_t = *mut cuvsHnswIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswIndexParamsCreate(params: *mut cuvsHnswIndexParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswIndexParamsDestroy(params: cuvsHnswIndexParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsHnswIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsHnswIndex"][::std::mem::size_of::<cuvsHnswIndex>() - 16usize];
["Alignment of cuvsHnswIndex"][::std::mem::align_of::<cuvsHnswIndex>() - 8usize];
["Offset of field: cuvsHnswIndex::addr"][::std::mem::offset_of!(cuvsHnswIndex, addr) - 0usize];
["Offset of field: cuvsHnswIndex::dtype"]
[::std::mem::offset_of!(cuvsHnswIndex, dtype) - 8usize];
};
pub type cuvsHnswIndex_t = *mut cuvsHnswIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswIndexCreate(index: *mut cuvsHnswIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswIndexDestroy(index: cuvsHnswIndex_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsHnswExtendParams {
pub num_threads: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsHnswExtendParams"][::std::mem::size_of::<cuvsHnswExtendParams>() - 4usize];
["Alignment of cuvsHnswExtendParams"][::std::mem::align_of::<cuvsHnswExtendParams>() - 4usize];
["Offset of field: cuvsHnswExtendParams::num_threads"]
[::std::mem::offset_of!(cuvsHnswExtendParams, num_threads) - 0usize];
};
pub type cuvsHnswExtendParams_t = *mut cuvsHnswExtendParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswExtendParamsCreate(params: *mut cuvsHnswExtendParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswExtendParamsDestroy(params: cuvsHnswExtendParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswFromCagra(
res: cuvsResources_t,
params: cuvsHnswIndexParams_t,
cagra_index: cuvsCagraIndex_t,
hnsw_index: cuvsHnswIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswFromCagraWithDataset(
res: cuvsResources_t,
params: cuvsHnswIndexParams_t,
cagra_index: cuvsCagraIndex_t,
hnsw_index: cuvsHnswIndex_t,
dataset_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswBuild(
res: cuvsResources_t,
params: cuvsHnswIndexParams_t,
dataset: *mut DLManagedTensor,
index: cuvsHnswIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswExtend(
res: cuvsResources_t,
params: cuvsHnswExtendParams_t,
additional_dataset: *mut DLManagedTensor,
index: cuvsHnswIndex_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsHnswSearchParams {
pub ef: i32,
pub num_threads: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsHnswSearchParams"][::std::mem::size_of::<cuvsHnswSearchParams>() - 8usize];
["Alignment of cuvsHnswSearchParams"][::std::mem::align_of::<cuvsHnswSearchParams>() - 4usize];
["Offset of field: cuvsHnswSearchParams::ef"]
[::std::mem::offset_of!(cuvsHnswSearchParams, ef) - 0usize];
["Offset of field: cuvsHnswSearchParams::num_threads"]
[::std::mem::offset_of!(cuvsHnswSearchParams, num_threads) - 4usize];
};
pub type cuvsHnswSearchParams_t = *mut cuvsHnswSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswSearchParamsCreate(params: *mut cuvsHnswSearchParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswSearchParamsDestroy(params: cuvsHnswSearchParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswSearch(
res: cuvsResources_t,
params: cuvsHnswSearchParams_t,
index: cuvsHnswIndex_t,
queries: *mut DLManagedTensor,
neighbors: *mut DLManagedTensor,
distances: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswSerialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsHnswIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsHnswDeserialize(
res: cuvsResources_t,
params: cuvsHnswIndexParams_t,
filename: *const ::std::os::raw::c_char,
dim: ::std::os::raw::c_int,
metric: cuvsDistanceType,
index: cuvsHnswIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuKMeansFit(
res: cuvsResources_t,
params: cuvsKMeansParams_t,
X: *mut DLManagedTensor,
sample_weight: *mut DLManagedTensor,
centroids: *mut DLManagedTensor,
inertia: *mut f64,
n_iter: *mut ::std::os::raw::c_int,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsMultiGpuDistributionMode {
CUVS_NEIGHBORS_MG_REPLICATED = 0,
CUVS_NEIGHBORS_MG_SHARDED = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsMultiGpuReplicatedSearchMode {
CUVS_NEIGHBORS_MG_LOAD_BALANCER = 0,
CUVS_NEIGHBORS_MG_ROUND_ROBIN = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsMultiGpuShardedMergeMode {
CUVS_NEIGHBORS_MG_MERGE_ON_ROOT_RANK = 0,
CUVS_NEIGHBORS_MG_TREE_MERGE = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuCagraIndexParams {
pub base_params: cuvsCagraIndexParams_t,
pub mode: cuvsMultiGpuDistributionMode,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuCagraIndexParams"]
[::std::mem::size_of::<cuvsMultiGpuCagraIndexParams>() - 16usize];
["Alignment of cuvsMultiGpuCagraIndexParams"]
[::std::mem::align_of::<cuvsMultiGpuCagraIndexParams>() - 8usize];
["Offset of field: cuvsMultiGpuCagraIndexParams::base_params"]
[::std::mem::offset_of!(cuvsMultiGpuCagraIndexParams, base_params) - 0usize];
["Offset of field: cuvsMultiGpuCagraIndexParams::mode"]
[::std::mem::offset_of!(cuvsMultiGpuCagraIndexParams, mode) - 8usize];
};
pub type cuvsMultiGpuCagraIndexParams_t = *mut cuvsMultiGpuCagraIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraIndexParamsCreate(
index_params: *mut cuvsMultiGpuCagraIndexParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraIndexParamsDestroy(
index_params: cuvsMultiGpuCagraIndexParams_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuCagraSearchParams {
pub base_params: cuvsCagraSearchParams_t,
pub search_mode: cuvsMultiGpuReplicatedSearchMode,
pub merge_mode: cuvsMultiGpuShardedMergeMode,
pub n_rows_per_batch: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuCagraSearchParams"]
[::std::mem::size_of::<cuvsMultiGpuCagraSearchParams>() - 24usize];
["Alignment of cuvsMultiGpuCagraSearchParams"]
[::std::mem::align_of::<cuvsMultiGpuCagraSearchParams>() - 8usize];
["Offset of field: cuvsMultiGpuCagraSearchParams::base_params"]
[::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, base_params) - 0usize];
["Offset of field: cuvsMultiGpuCagraSearchParams::search_mode"]
[::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, search_mode) - 8usize];
["Offset of field: cuvsMultiGpuCagraSearchParams::merge_mode"]
[::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, merge_mode) - 12usize];
["Offset of field: cuvsMultiGpuCagraSearchParams::n_rows_per_batch"]
[::std::mem::offset_of!(cuvsMultiGpuCagraSearchParams, n_rows_per_batch) - 16usize];
};
pub type cuvsMultiGpuCagraSearchParams_t = *mut cuvsMultiGpuCagraSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraSearchParamsCreate(
params: *mut cuvsMultiGpuCagraSearchParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraSearchParamsDestroy(
params: cuvsMultiGpuCagraSearchParams_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuCagraIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuCagraIndex"][::std::mem::size_of::<cuvsMultiGpuCagraIndex>() - 16usize];
["Alignment of cuvsMultiGpuCagraIndex"]
[::std::mem::align_of::<cuvsMultiGpuCagraIndex>() - 8usize];
["Offset of field: cuvsMultiGpuCagraIndex::addr"]
[::std::mem::offset_of!(cuvsMultiGpuCagraIndex, addr) - 0usize];
["Offset of field: cuvsMultiGpuCagraIndex::dtype"]
[::std::mem::offset_of!(cuvsMultiGpuCagraIndex, dtype) - 8usize];
};
pub type cuvsMultiGpuCagraIndex_t = *mut cuvsMultiGpuCagraIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraIndexCreate(index: *mut cuvsMultiGpuCagraIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraIndexDestroy(index: cuvsMultiGpuCagraIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraBuild(
res: cuvsResources_t,
params: cuvsMultiGpuCagraIndexParams_t,
dataset_tensor: *mut DLManagedTensor,
index: cuvsMultiGpuCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraUpdateDataset(
res: cuvsResources_t,
device_padded_dataset: cuvsDataset_t,
index: cuvsMultiGpuCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraSearch(
res: cuvsResources_t,
params: cuvsMultiGpuCagraSearchParams_t,
index: cuvsMultiGpuCagraIndex_t,
queries_tensor: *mut DLManagedTensor,
neighbors_tensor: *mut DLManagedTensor,
distances_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraExtend(
res: cuvsResources_t,
index: cuvsMultiGpuCagraIndex_t,
new_vectors_tensor: *mut DLManagedTensor,
new_indices_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraSerialize(
res: cuvsResources_t,
index: cuvsMultiGpuCagraIndex_t,
filename: *const ::std::os::raw::c_char,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsMultiGpuCagraIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuCagraDistribute(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsMultiGpuCagraIndex_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuIvfFlatIndexParams {
pub base_params: cuvsIvfFlatIndexParams_t,
pub mode: cuvsMultiGpuDistributionMode,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuIvfFlatIndexParams"]
[::std::mem::size_of::<cuvsMultiGpuIvfFlatIndexParams>() - 16usize];
["Alignment of cuvsMultiGpuIvfFlatIndexParams"]
[::std::mem::align_of::<cuvsMultiGpuIvfFlatIndexParams>() - 8usize];
["Offset of field: cuvsMultiGpuIvfFlatIndexParams::base_params"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndexParams, base_params) - 0usize];
["Offset of field: cuvsMultiGpuIvfFlatIndexParams::mode"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndexParams, mode) - 8usize];
};
pub type cuvsMultiGpuIvfFlatIndexParams_t = *mut cuvsMultiGpuIvfFlatIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatIndexParamsCreate(
index_params: *mut cuvsMultiGpuIvfFlatIndexParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatIndexParamsDestroy(
index_params: cuvsMultiGpuIvfFlatIndexParams_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuIvfFlatSearchParams {
pub base_params: cuvsIvfFlatSearchParams_t,
pub search_mode: cuvsMultiGpuReplicatedSearchMode,
pub merge_mode: cuvsMultiGpuShardedMergeMode,
pub n_rows_per_batch: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuIvfFlatSearchParams"]
[::std::mem::size_of::<cuvsMultiGpuIvfFlatSearchParams>() - 24usize];
["Alignment of cuvsMultiGpuIvfFlatSearchParams"]
[::std::mem::align_of::<cuvsMultiGpuIvfFlatSearchParams>() - 8usize];
["Offset of field: cuvsMultiGpuIvfFlatSearchParams::base_params"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, base_params) - 0usize];
["Offset of field: cuvsMultiGpuIvfFlatSearchParams::search_mode"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, search_mode) - 8usize];
["Offset of field: cuvsMultiGpuIvfFlatSearchParams::merge_mode"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, merge_mode) - 12usize];
["Offset of field: cuvsMultiGpuIvfFlatSearchParams::n_rows_per_batch"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatSearchParams, n_rows_per_batch) - 16usize];
};
pub type cuvsMultiGpuIvfFlatSearchParams_t = *mut cuvsMultiGpuIvfFlatSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatSearchParamsCreate(
params: *mut cuvsMultiGpuIvfFlatSearchParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatSearchParamsDestroy(
params: cuvsMultiGpuIvfFlatSearchParams_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuIvfFlatIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuIvfFlatIndex"]
[::std::mem::size_of::<cuvsMultiGpuIvfFlatIndex>() - 16usize];
["Alignment of cuvsMultiGpuIvfFlatIndex"]
[::std::mem::align_of::<cuvsMultiGpuIvfFlatIndex>() - 8usize];
["Offset of field: cuvsMultiGpuIvfFlatIndex::addr"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndex, addr) - 0usize];
["Offset of field: cuvsMultiGpuIvfFlatIndex::dtype"]
[::std::mem::offset_of!(cuvsMultiGpuIvfFlatIndex, dtype) - 8usize];
};
pub type cuvsMultiGpuIvfFlatIndex_t = *mut cuvsMultiGpuIvfFlatIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatIndexCreate(index: *mut cuvsMultiGpuIvfFlatIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatIndexDestroy(index: cuvsMultiGpuIvfFlatIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatBuild(
res: cuvsResources_t,
params: cuvsMultiGpuIvfFlatIndexParams_t,
dataset_tensor: *mut DLManagedTensor,
index: cuvsMultiGpuIvfFlatIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatSearch(
res: cuvsResources_t,
params: cuvsMultiGpuIvfFlatSearchParams_t,
index: cuvsMultiGpuIvfFlatIndex_t,
queries_tensor: *mut DLManagedTensor,
neighbors_tensor: *mut DLManagedTensor,
distances_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatExtend(
res: cuvsResources_t,
index: cuvsMultiGpuIvfFlatIndex_t,
new_vectors_tensor: *mut DLManagedTensor,
new_indices_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatSerialize(
res: cuvsResources_t,
index: cuvsMultiGpuIvfFlatIndex_t,
filename: *const ::std::os::raw::c_char,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsMultiGpuIvfFlatIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfFlatDistribute(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsMultiGpuIvfFlatIndex_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuIvfPqIndexParams {
pub base_params: cuvsIvfPqIndexParams_t,
pub mode: cuvsMultiGpuDistributionMode,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuIvfPqIndexParams"]
[::std::mem::size_of::<cuvsMultiGpuIvfPqIndexParams>() - 16usize];
["Alignment of cuvsMultiGpuIvfPqIndexParams"]
[::std::mem::align_of::<cuvsMultiGpuIvfPqIndexParams>() - 8usize];
["Offset of field: cuvsMultiGpuIvfPqIndexParams::base_params"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqIndexParams, base_params) - 0usize];
["Offset of field: cuvsMultiGpuIvfPqIndexParams::mode"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqIndexParams, mode) - 8usize];
};
pub type cuvsMultiGpuIvfPqIndexParams_t = *mut cuvsMultiGpuIvfPqIndexParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqIndexParamsCreate(
index_params: *mut cuvsMultiGpuIvfPqIndexParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqIndexParamsDestroy(
index_params: cuvsMultiGpuIvfPqIndexParams_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuIvfPqSearchParams {
pub base_params: cuvsIvfPqSearchParams_t,
pub search_mode: cuvsMultiGpuReplicatedSearchMode,
pub merge_mode: cuvsMultiGpuShardedMergeMode,
pub n_rows_per_batch: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuIvfPqSearchParams"]
[::std::mem::size_of::<cuvsMultiGpuIvfPqSearchParams>() - 24usize];
["Alignment of cuvsMultiGpuIvfPqSearchParams"]
[::std::mem::align_of::<cuvsMultiGpuIvfPqSearchParams>() - 8usize];
["Offset of field: cuvsMultiGpuIvfPqSearchParams::base_params"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, base_params) - 0usize];
["Offset of field: cuvsMultiGpuIvfPqSearchParams::search_mode"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, search_mode) - 8usize];
["Offset of field: cuvsMultiGpuIvfPqSearchParams::merge_mode"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, merge_mode) - 12usize];
["Offset of field: cuvsMultiGpuIvfPqSearchParams::n_rows_per_batch"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqSearchParams, n_rows_per_batch) - 16usize];
};
pub type cuvsMultiGpuIvfPqSearchParams_t = *mut cuvsMultiGpuIvfPqSearchParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqSearchParamsCreate(
params: *mut cuvsMultiGpuIvfPqSearchParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqSearchParamsDestroy(
params: cuvsMultiGpuIvfPqSearchParams_t,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsMultiGpuIvfPqIndex {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsMultiGpuIvfPqIndex"][::std::mem::size_of::<cuvsMultiGpuIvfPqIndex>() - 16usize];
["Alignment of cuvsMultiGpuIvfPqIndex"]
[::std::mem::align_of::<cuvsMultiGpuIvfPqIndex>() - 8usize];
["Offset of field: cuvsMultiGpuIvfPqIndex::addr"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqIndex, addr) - 0usize];
["Offset of field: cuvsMultiGpuIvfPqIndex::dtype"]
[::std::mem::offset_of!(cuvsMultiGpuIvfPqIndex, dtype) - 8usize];
};
pub type cuvsMultiGpuIvfPqIndex_t = *mut cuvsMultiGpuIvfPqIndex;
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqIndexCreate(index: *mut cuvsMultiGpuIvfPqIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqIndexDestroy(index: cuvsMultiGpuIvfPqIndex_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqBuild(
res: cuvsResources_t,
params: cuvsMultiGpuIvfPqIndexParams_t,
dataset_tensor: *mut DLManagedTensor,
index: cuvsMultiGpuIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqSearch(
res: cuvsResources_t,
params: cuvsMultiGpuIvfPqSearchParams_t,
index: cuvsMultiGpuIvfPqIndex_t,
queries_tensor: *mut DLManagedTensor,
neighbors_tensor: *mut DLManagedTensor,
distances_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqExtend(
res: cuvsResources_t,
index: cuvsMultiGpuIvfPqIndex_t,
new_vectors_tensor: *mut DLManagedTensor,
new_indices_tensor: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqSerialize(
res: cuvsResources_t,
index: cuvsMultiGpuIvfPqIndex_t,
filename: *const ::std::os::raw::c_char,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqDeserialize(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsMultiGpuIvfPqIndex_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsMultiGpuIvfPqDistribute(
res: cuvsResources_t,
filename: *const ::std::os::raw::c_char,
index: cuvsMultiGpuIvfPqIndex_t,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsPcaSolver {
CUVS_PCA_COV_EIG_DQ = 0,
CUVS_PCA_COV_EIG_JACOBI = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsPcaParams {
pub n_components: ::std::os::raw::c_int,
pub copy: bool,
pub whiten: bool,
pub algorithm: cuvsPcaSolver,
pub tol: f32,
pub n_iterations: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsPcaParams"][::std::mem::size_of::<cuvsPcaParams>() - 20usize];
["Alignment of cuvsPcaParams"][::std::mem::align_of::<cuvsPcaParams>() - 4usize];
["Offset of field: cuvsPcaParams::n_components"]
[::std::mem::offset_of!(cuvsPcaParams, n_components) - 0usize];
["Offset of field: cuvsPcaParams::copy"][::std::mem::offset_of!(cuvsPcaParams, copy) - 4usize];
["Offset of field: cuvsPcaParams::whiten"]
[::std::mem::offset_of!(cuvsPcaParams, whiten) - 5usize];
["Offset of field: cuvsPcaParams::algorithm"]
[::std::mem::offset_of!(cuvsPcaParams, algorithm) - 8usize];
["Offset of field: cuvsPcaParams::tol"][::std::mem::offset_of!(cuvsPcaParams, tol) - 12usize];
["Offset of field: cuvsPcaParams::n_iterations"]
[::std::mem::offset_of!(cuvsPcaParams, n_iterations) - 16usize];
};
pub type cuvsPcaParams_t = *mut cuvsPcaParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsPcaParamsCreate(params: *mut cuvsPcaParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsPcaParamsDestroy(params: cuvsPcaParams_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsPcaFit(
res: cuvsResources_t,
params: cuvsPcaParams_t,
input: *mut DLManagedTensor,
components: *mut DLManagedTensor,
explained_var: *mut DLManagedTensor,
explained_var_ratio: *mut DLManagedTensor,
singular_vals: *mut DLManagedTensor,
mu: *mut DLManagedTensor,
noise_vars: *mut DLManagedTensor,
flip_signs_based_on_U: bool,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsPcaFitTransform(
res: cuvsResources_t,
params: cuvsPcaParams_t,
input: *mut DLManagedTensor,
trans_input: *mut DLManagedTensor,
components: *mut DLManagedTensor,
explained_var: *mut DLManagedTensor,
explained_var_ratio: *mut DLManagedTensor,
singular_vals: *mut DLManagedTensor,
mu: *mut DLManagedTensor,
noise_vars: *mut DLManagedTensor,
flip_signs_based_on_U: bool,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsPcaTransform(
res: cuvsResources_t,
params: cuvsPcaParams_t,
input: *mut DLManagedTensor,
components: *mut DLManagedTensor,
singular_vals: *mut DLManagedTensor,
mu: *mut DLManagedTensor,
trans_input: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsPcaInverseTransform(
res: cuvsResources_t,
params: cuvsPcaParams_t,
trans_input: *mut DLManagedTensor,
components: *mut DLManagedTensor,
singular_vals: *mut DLManagedTensor,
mu: *mut DLManagedTensor,
output: *mut DLManagedTensor,
) -> cuvsError_t;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum cuvsBinaryQuantizerThreshold {
ZERO = 0,
MEAN = 1,
SAMPLING_MEDIAN = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsBinaryQuantizerParams {
pub threshold: cuvsBinaryQuantizerThreshold,
pub sampling_ratio: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsBinaryQuantizerParams"]
[::std::mem::size_of::<cuvsBinaryQuantizerParams>() - 8usize];
["Alignment of cuvsBinaryQuantizerParams"]
[::std::mem::align_of::<cuvsBinaryQuantizerParams>() - 4usize];
["Offset of field: cuvsBinaryQuantizerParams::threshold"]
[::std::mem::offset_of!(cuvsBinaryQuantizerParams, threshold) - 0usize];
["Offset of field: cuvsBinaryQuantizerParams::sampling_ratio"]
[::std::mem::offset_of!(cuvsBinaryQuantizerParams, sampling_ratio) - 4usize];
};
pub type cuvsBinaryQuantizerParams_t = *mut cuvsBinaryQuantizerParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerParamsCreate(params: *mut cuvsBinaryQuantizerParams_t)
-> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerParamsDestroy(params: cuvsBinaryQuantizerParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsBinaryQuantizer {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsBinaryQuantizer"][::std::mem::size_of::<cuvsBinaryQuantizer>() - 16usize];
["Alignment of cuvsBinaryQuantizer"][::std::mem::align_of::<cuvsBinaryQuantizer>() - 8usize];
["Offset of field: cuvsBinaryQuantizer::addr"]
[::std::mem::offset_of!(cuvsBinaryQuantizer, addr) - 0usize];
["Offset of field: cuvsBinaryQuantizer::dtype"]
[::std::mem::offset_of!(cuvsBinaryQuantizer, dtype) - 8usize];
};
pub type cuvsBinaryQuantizer_t = *mut cuvsBinaryQuantizer;
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerCreate(quantizer: *mut cuvsBinaryQuantizer_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerDestroy(quantizer: cuvsBinaryQuantizer_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerTrain(
res: cuvsResources_t,
params: cuvsBinaryQuantizerParams_t,
dataset: *mut DLManagedTensor,
quantizer: cuvsBinaryQuantizer_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerTransform(
res: cuvsResources_t,
dataset: *mut DLManagedTensor,
out: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsBinaryQuantizerTransformWithParams(
res: cuvsResources_t,
quantizer: cuvsBinaryQuantizer_t,
dataset: *mut DLManagedTensor,
out: *mut DLManagedTensor,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsProductQuantizerParams {
pub pq_bits: u32,
pub pq_dim: u32,
pub use_subspaces: bool,
pub use_vq: bool,
pub vq_n_centers: u32,
pub kmeans_n_iters: u32,
pub pq_kmeans_type: cuvsKMeansType,
pub max_train_points_per_pq_code: u32,
pub max_train_points_per_vq_cluster: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsProductQuantizerParams"]
[::std::mem::size_of::<cuvsProductQuantizerParams>() - 32usize];
["Alignment of cuvsProductQuantizerParams"]
[::std::mem::align_of::<cuvsProductQuantizerParams>() - 4usize];
["Offset of field: cuvsProductQuantizerParams::pq_bits"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, pq_bits) - 0usize];
["Offset of field: cuvsProductQuantizerParams::pq_dim"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, pq_dim) - 4usize];
["Offset of field: cuvsProductQuantizerParams::use_subspaces"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, use_subspaces) - 8usize];
["Offset of field: cuvsProductQuantizerParams::use_vq"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, use_vq) - 9usize];
["Offset of field: cuvsProductQuantizerParams::vq_n_centers"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, vq_n_centers) - 12usize];
["Offset of field: cuvsProductQuantizerParams::kmeans_n_iters"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, kmeans_n_iters) - 16usize];
["Offset of field: cuvsProductQuantizerParams::pq_kmeans_type"]
[::std::mem::offset_of!(cuvsProductQuantizerParams, pq_kmeans_type) - 20usize];
["Offset of field: cuvsProductQuantizerParams::max_train_points_per_pq_code"][::std::mem::offset_of!(
cuvsProductQuantizerParams,
max_train_points_per_pq_code
) - 24usize];
["Offset of field: cuvsProductQuantizerParams::max_train_points_per_vq_cluster"][::std::mem::offset_of!(
cuvsProductQuantizerParams,
max_train_points_per_vq_cluster
) - 28usize];
};
pub type cuvsProductQuantizerParams_t = *mut cuvsProductQuantizerParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerParamsCreate(
params: *mut cuvsProductQuantizerParams_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerParamsDestroy(params: cuvsProductQuantizerParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsProductQuantizer {
pub addr: usize,
pub dtype: DLDataType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsProductQuantizer"][::std::mem::size_of::<cuvsProductQuantizer>() - 16usize];
["Alignment of cuvsProductQuantizer"][::std::mem::align_of::<cuvsProductQuantizer>() - 8usize];
["Offset of field: cuvsProductQuantizer::addr"]
[::std::mem::offset_of!(cuvsProductQuantizer, addr) - 0usize];
["Offset of field: cuvsProductQuantizer::dtype"]
[::std::mem::offset_of!(cuvsProductQuantizer, dtype) - 8usize];
};
pub type cuvsProductQuantizer_t = *mut cuvsProductQuantizer;
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerCreate(quantizer: *mut cuvsProductQuantizer_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerDestroy(quantizer: cuvsProductQuantizer_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerBuild(
res: cuvsResources_t,
params: cuvsProductQuantizerParams_t,
dataset: *mut DLManagedTensor,
quantizer: cuvsProductQuantizer_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerTransform(
res: cuvsResources_t,
quantizer: cuvsProductQuantizer_t,
dataset: *mut DLManagedTensor,
codes_out: *mut DLManagedTensor,
vq_labels: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerInverseTransform(
res: cuvsResources_t,
quantizer: cuvsProductQuantizer_t,
pq_codes: *mut DLManagedTensor,
out: *mut DLManagedTensor,
vq_labels: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerGetPqBits(
quantizer: cuvsProductQuantizer_t,
pq_bits: *mut u32,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerGetPqDim(
quantizer: cuvsProductQuantizer_t,
pq_dim: *mut u32,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerGetPqCodebook(
quantizer: cuvsProductQuantizer_t,
pq_codebook: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerGetVqCodebook(
quantizer: cuvsProductQuantizer_t,
vq_codebook: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerGetEncodedDim(
quantizer: cuvsProductQuantizer_t,
encoded_dim: *mut u32,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsProductQuantizerGetUseVq(
quantizer: cuvsProductQuantizer_t,
use_vq: *mut bool,
) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsScalarQuantizerParams {
pub quantile: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsScalarQuantizerParams"]
[::std::mem::size_of::<cuvsScalarQuantizerParams>() - 4usize];
["Alignment of cuvsScalarQuantizerParams"]
[::std::mem::align_of::<cuvsScalarQuantizerParams>() - 4usize];
["Offset of field: cuvsScalarQuantizerParams::quantile"]
[::std::mem::offset_of!(cuvsScalarQuantizerParams, quantile) - 0usize];
};
pub type cuvsScalarQuantizerParams_t = *mut cuvsScalarQuantizerParams;
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerParamsCreate(params: *mut cuvsScalarQuantizerParams_t)
-> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerParamsDestroy(params: cuvsScalarQuantizerParams_t) -> cuvsError_t;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct cuvsScalarQuantizer {
pub min_: f64,
pub max_: f64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of cuvsScalarQuantizer"][::std::mem::size_of::<cuvsScalarQuantizer>() - 16usize];
["Alignment of cuvsScalarQuantizer"][::std::mem::align_of::<cuvsScalarQuantizer>() - 8usize];
["Offset of field: cuvsScalarQuantizer::min_"]
[::std::mem::offset_of!(cuvsScalarQuantizer, min_) - 0usize];
["Offset of field: cuvsScalarQuantizer::max_"]
[::std::mem::offset_of!(cuvsScalarQuantizer, max_) - 8usize];
};
pub type cuvsScalarQuantizer_t = *mut cuvsScalarQuantizer;
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerCreate(quantizer: *mut cuvsScalarQuantizer_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerDestroy(quantizer: cuvsScalarQuantizer_t) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerTrain(
res: cuvsResources_t,
params: cuvsScalarQuantizerParams_t,
dataset: *mut DLManagedTensor,
quantizer: cuvsScalarQuantizer_t,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerTransform(
res: cuvsResources_t,
quantizer: cuvsScalarQuantizer_t,
dataset: *mut DLManagedTensor,
out: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsScalarQuantizerInverseTransform(
res: cuvsResources_t,
quantizer: cuvsScalarQuantizer_t,
dataset: *mut DLManagedTensor,
out: *mut DLManagedTensor,
) -> cuvsError_t;
}
unsafe extern "C" {
#[must_use]
pub fn cuvsSelectK(
res: cuvsResources_t,
in_val: *mut DLManagedTensor,
out_val: *mut DLManagedTensor,
out_idx: *mut DLManagedTensor,
) -> cuvsError_t;
}