2017-02-22 23:26:44 +01:00
|
|
|
/**
|
2019-05-28 16:17:22 +02:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2017-02-22 23:26:44 +01:00
|
|
|
*
|
2019-05-28 16:17:22 +02:00
|
|
|
* This source code is licensed under the MIT license found in the
|
2017-02-22 23:26:44 +01:00
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-09-20 18:59:10 +02:00
|
|
|
#include <faiss/gpu/impl/GpuScalarQuantizer.cuh>
|
|
|
|
#include <faiss/gpu/GpuIndicesOptions.h>
|
|
|
|
#include <faiss/gpu/utils/Tensor.cuh>
|
2017-02-22 23:26:44 +01:00
|
|
|
#include <thrust/device_vector.h>
|
|
|
|
|
|
|
|
namespace faiss { namespace gpu {
|
|
|
|
|
|
|
|
/// Update device-side list pointers in a batch
|
|
|
|
void runUpdateListPointers(Tensor<int, 1, true>& listIds,
|
|
|
|
Tensor<int, 1, true>& newListLength,
|
|
|
|
Tensor<void*, 1, true>& newCodePointers,
|
|
|
|
Tensor<void*, 1, true>& newIndexPointers,
|
|
|
|
thrust::device_vector<int>& listLengths,
|
|
|
|
thrust::device_vector<void*>& listCodes,
|
|
|
|
thrust::device_vector<void*>& listIndices,
|
|
|
|
cudaStream_t stream);
|
|
|
|
|
|
|
|
/// Actually append the new codes / vector indices to the individual lists
|
|
|
|
|
|
|
|
/// IVFPQ
|
|
|
|
void runIVFPQInvertedListAppend(Tensor<int, 1, true>& listIds,
|
|
|
|
Tensor<int, 1, true>& listOffset,
|
|
|
|
Tensor<int, 2, true>& encodings,
|
|
|
|
Tensor<long, 1, true>& indices,
|
|
|
|
thrust::device_vector<void*>& listCodes,
|
|
|
|
thrust::device_vector<void*>& listIndices,
|
|
|
|
IndicesOptions indicesOptions,
|
|
|
|
cudaStream_t stream);
|
|
|
|
|
|
|
|
/// IVF flat storage
|
|
|
|
void runIVFFlatInvertedListAppend(Tensor<int, 1, true>& listIds,
|
|
|
|
Tensor<int, 1, true>& listOffset,
|
|
|
|
Tensor<float, 2, true>& vecs,
|
|
|
|
Tensor<long, 1, true>& indices,
|
2019-09-20 18:59:10 +02:00
|
|
|
bool useResidual,
|
|
|
|
Tensor<float, 2, true>& residuals,
|
|
|
|
GpuScalarQuantizer* scalarQ,
|
2017-02-22 23:26:44 +01:00
|
|
|
thrust::device_vector<void*>& listData,
|
|
|
|
thrust::device_vector<void*>& listIndices,
|
|
|
|
IndicesOptions indicesOptions,
|
|
|
|
cudaStream_t stream);
|
|
|
|
|
|
|
|
} } // namespace
|