Dynamic Batching
Source header: cuvs/neighbors/dynamic_batching.hpp
Dynamic Batching index parameters
neighbors::dynamic_batching::index_params
Dynamic Batching index parameters
Fields
Dynamic Batching search parameters
neighbors::dynamic_batching::search_params
Dynamic Batching search parameters
Fields
Dynamic Batching index type
neighbors::dynamic_batching::index
Lightweight dynamic batching index wrapper
One lightweight dynamic batching index manages a single index and a single search parameter set. This structure should be shared among multiple users via copy semantics: access to the underlying implementation is managed via a shared pointer, and concurrent search among the participants is thread-safe.
Usage example
Priority queues
The dynamic batching index has a limited support for prioritizing individual requests. There’s only one pool of queues in the batcher and no functionality to prioritize one bach over the other. The search_params::dispatch_timeout_ms parameters passed in each request are aggregated internally and the batch is dispatched no later than any of the timeouts is exceeded. In this logic, a high-priority request can never be processed earlier than any lower-priority requests submitted earlier.
However, dynamic batching indexes are lightweight and do not contain any global or static state. This means it’s easy to combine multiple batchers. As an example, you can construct one batching index per priority class:
Fields
neighbors::dynamic_batching::index::index
Construct a dynamic batching index by wrapping the upstream index.
Template Parameters
Parameters
Returns
void
Dynamic Batching search
neighbors::dynamic_batching::search
Search ANN using a dynamic batching index.
The search parameters of the upstream index and the optional filtering function are configured at the dynamic batching index construction time.
Like with many other indexes, the dynamic batching search has the stream-ordered semantics: the host function may return the control before the results are ready. Synchronize with the main CUDA stream in the given resource object to wait for arrival of the search results.
Dynamic batching search is thread-safe: call the search function with copies of the same index in multiple threads to increase the occupancy of the batches.
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void
Additional overload: neighbors::dynamic_batching::search
Parameters
Returns
void