|
XVector
|
IVF-RaBitQ (Inverted File with Random Bit Quantization) index interface. More...
#include "xvec_types.h"Go to the source code of this file.
Classes | |
| struct | xvecIvfRaBitQDescriptor |
| FAISS-free description of an IVF-RaBitQ index. More... | |
Typedefs | |
| typedef struct xvecIvfRaBitQSearchTiming | xvecIvfRaBitQSearchTiming |
| typedef struct xvecIvfRaBitQDescriptor | xvecIvfRaBitQDescriptor |
| FAISS-free description of an IVF-RaBitQ index. More... | |
Functions | |
| xvecStatus | xvecIvfRaBitQLoadIndexFromFaissFile (xvecExecutionContextTag *context, const char *indexFilePath, xvecIvfRaBitQIndexTag **outIndexHandle) |
| Loads an IVF-RaBitQ index from a Faiss index file. More... | |
| xvecStatus | xvecIvfRaBitQLoadIndexFromDescriptor (xvecExecutionContextTag *context, const xvecIvfRaBitQDescriptor *descriptor, xvecIvfRaBitQIndexTag **outIndexHandle) |
| Loads an IVF-RaBitQ index from a FAISS-free descriptor. More... | |
| xvecStatus | xvecIvfRaBitQDestroyIndex (xvecExecutionContextTag *context, xvecIvfRaBitQIndexTag *indexHandle) |
| Destroys an IVF-RaBitQ index handle and releases its host-side data. More... | |
| xvecStatus | xvecIvfRaBitQPrepareKernel (xvecExecutionContextTag *context) |
| Pre-initializes PXL resources (Job, Module, Function) for IVF-RaBitQ search. More... | |
| xvecStatus | xvecIvfRaBitQSearchFineSearchOnly (xvecExecutionContextTag *context, xvecIvfRaBitQIndexTag *indexHandle, xvecIvfRaBitQFineSearchQueryFloat32 *fineSearchQuery, xvecBufferTag *resultsBufferHandle, xvecIvfRaBitQSearchTiming *outTiming) |
| Performs an IVF-RaBitQ fine search only (skips coarse search). More... | |
IVF-RaBitQ (Inverted File with Random Bit Quantization) index interface.
This header provides the API for loading and searching IVF-RaBitQ indices. IVF-RaBitQ uses binary quantization for ultra-compact vector representation, enabling very fast approximate nearest neighbor search with low memory footprint.
Definition in file xvec_ivf_rabitq.h.
| typedef struct xvecIvfRaBitQDescriptor xvecIvfRaBitQDescriptor |
FAISS-free description of an IVF-RaBitQ index.
Fully describes an IVF-RaBitQ index using plain C arrays, with no dependency on FAISS types or ABI. Per-vector data (binary codes, factors, ids) is grouped by cluster: the first listSizes[0] vectors belong to cluster 0, the next listSizes[1] to cluster 1, and so on.
The binary codes and the distance factors are supplied as separate arrays (rather than the FAISS-packed code blob) so the layout carries no dependency on FAISS's internal factor representation.
A multi-bit index (nbBits > 1) additionally supplies exCodes and exFactors. These fields are appended at the end of the struct, so a caller that zero-initializes the descriptor and leaves them unset describes a 1-bit index exactly as before.
All pointers are borrowed for the duration of the load call only; the caller retains ownership and may free them once the call returns.
| typedef struct xvecIvfRaBitQSearchTiming xvecIvfRaBitQSearchTiming |
Definition at line 1 of file xvec_ivf_rabitq.h.
| xvecStatus xvecIvfRaBitQDestroyIndex | ( | xvecExecutionContextTag * | context, |
| xvecIvfRaBitQIndexTag * | indexHandle | ||
| ) |
Destroys an IVF-RaBitQ index handle and releases its host-side data.
| [in] | context | Execution context for device operations |
| [in] | indexHandle | Handle to the index to destroy |
| xvecStatus xvecIvfRaBitQLoadIndexFromDescriptor | ( | xvecExecutionContextTag * | context, |
| const xvecIvfRaBitQDescriptor * | descriptor, | ||
| xvecIvfRaBitQIndexTag ** | outIndexHandle | ||
| ) |
Loads an IVF-RaBitQ index from a FAISS-free descriptor.
Builds an IVF-RaBitQ index directly from caller-supplied arrays, with no FAISS dependency. This is the recommended way to construct an index from a custom or pre-extracted source. See xvecIvfRaBitQDescriptor for the required memory layout.
| [in] | context | Execution context for device operations |
| [in] | descriptor | Fully-populated index descriptor (borrowed for the call) |
| [out] | outIndexHandle | Pointer to receive the handle to the loaded index. The caller is responsible for destroying this index using xvecIvfRaBitQDestroyIndex. |
| xvecStatus xvecIvfRaBitQLoadIndexFromFaissFile | ( | xvecExecutionContextTag * | context, |
| const char * | indexFilePath, | ||
| xvecIvfRaBitQIndexTag ** | outIndexHandle | ||
| ) |
Loads an IVF-RaBitQ index from a Faiss index file.
Loads an IndexIVFRaBitQ from a Faiss .faiss file, extracting binary codes, RaBitQ factors, coarse centroids, and inverted list structure.
| [in] | context | Execution context for device operations |
| [in] | indexFilePath | Path to the Faiss .faiss index file |
| [out] | outIndexHandle | Pointer to receive the handle to the loaded index. The caller is responsible for destroying this index using xvecIvfRaBitQDestroyIndex. |
| xvecStatus xvecIvfRaBitQPrepareKernel | ( | xvecExecutionContextTag * | context | ) |
Pre-initializes PXL resources (Job, Module, Function) for IVF-RaBitQ search.
Eagerly creates and caches the PXL Job and Function objects so that the first search call does not pay the lazy-initialization cost. Uses the same Sub count a search would: the "numSub" property if set, else whatever the device reports. Fails with XVEC_ERROR_DEVICE_NOT_SUPPORTED on a device that has no search path, rather than reserving Subs for a search that would then be refused. Fails with XVEC_ERROR_PXL_JOB_CREATE_FAILED when the device has fewer free Subs than the Job needs, because another process or context holds them. Safe to call more than once; subsequent calls are no-ops if numSub has not changed.
| [in] | context | Execution context. Setting "numSub" is optional. |
| xvecStatus xvecIvfRaBitQSearchFineSearchOnly | ( | xvecExecutionContextTag * | context, |
| xvecIvfRaBitQIndexTag * | indexHandle, | ||
| xvecIvfRaBitQFineSearchQueryFloat32 * | fineSearchQuery, | ||
| xvecBufferTag * | resultsBufferHandle, | ||
| xvecIvfRaBitQSearchTiming * | outTiming | ||
| ) |
Performs an IVF-RaBitQ fine search only (skips coarse search).
This function performs only the fine search phase using pre-computed nearest cluster IDs. Use this when the coarse search has already been performed externally (e.g., by FAISS) and only the fine search needs to be offloaded to XVector.
The typical use case is XFaiss integration where:
| [in] | context | Execution context for device operations |
| [in] | indexHandle | Handle to the IVF-RaBitQ index containing binary codes and factors |
| [in] | fineSearchQuery | Fine search query containing query vectors and pre-computed nearest cluster IDs (from external coarse search) |
| [out] | resultsBufferHandle | Buffer to receive search results. Must be pre-allocated with size: queryVectorCount * topK * sizeof(xvecIvfRaBitQSearchResultFloat32) |
| [out] | outTiming | Pointer to receive timing information (can be NULL) |