diff --git a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu index 807e192785..bc9bac0be0 100644 --- a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu +++ b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu @@ -212,13 +212,11 @@ GpuIndexIVFFlat::addImpl_(int n, // Data is already resident on the GPU Tensor data(const_cast(x), {n, (int) this->d}); - auto bitset = toDevice(resources_, device_, nullptr, stream, {0}); - static_assert(sizeof(long) == sizeof(Index::idx_t), "size mismatch"); Tensor labels(const_cast(xids), {n}); // Not all vectors may be able to be added (some may contain NaNs etc) - index_->classifyAndAddVectors(data, labels, bitset); + index_->classifyAndAddVectors(data, labels); // but keep the ntotal based on the total number of vectors that we attempted // to add diff --git a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu index 8ad7bd8778..9fb52911b0 100644 --- a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu +++ b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu @@ -335,13 +335,11 @@ GpuIndexIVFPQ::addImpl_(int n, // Data is already resident on the GPU Tensor data(const_cast(x), {n, (int) this->d}); - auto bitset = toDevice(resources_, device_, nullptr, stream, {0}); - static_assert(sizeof(long) == sizeof(Index::idx_t), "size mismatch"); Tensor labels(const_cast(xids), {n}); // Not all vectors may be able to be added (some may contain NaNs etc) - index_->classifyAndAddVectors(data, labels, bitset); + index_->classifyAndAddVectors(data, labels); // but keep the ntotal based on the total number of vectors that we attempted // to add diff --git a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu index 464688b23e..bfee9bcf99 100644 --- a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu +++ b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu @@ -309,13 +309,11 @@ GpuIndexIVFSQHybrid::addImpl_(int n, // Data is already resident on the GPU Tensor data(const_cast(x), {n, (int) this->d}); - auto bitset = toDevice(resources_, device_, nullptr, stream, {0}); - static_assert(sizeof(long) == sizeof(Index::idx_t), "size mismatch"); Tensor labels(const_cast(xids), {n}); // Not all vectors may be able to be added (some may contain NaNs etc) - index_->classifyAndAddVectors(data, labels, bitset); + index_->classifyAndAddVectors(data, labels); // but keep the ntotal based on the total number of vectors that we attempted // to add diff --git a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu index 9e7f901bf5..1599cfab6a 100644 --- a/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu +++ b/core/src/index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu @@ -244,13 +244,11 @@ GpuIndexIVFScalarQuantizer::addImpl_(int n, // Data is already resident on the GPU Tensor data(const_cast(x), {n, (int) this->d}); - auto bitset = toDevice(resources_, device_, nullptr, stream, {0}); - static_assert(sizeof(long) == sizeof(Index::idx_t), "size mismatch"); Tensor labels(const_cast(xids), {n}); // Not all vectors may be able to be added (some may contain NaNs etc) - index_->classifyAndAddVectors(data, labels, bitset); + index_->classifyAndAddVectors(data, labels); // but keep the ntotal based on the total number of vectors that we attempted // to add diff --git a/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu b/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu index 742df3fcf2..5c1db4b7fb 100644 --- a/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu +++ b/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu @@ -157,14 +157,15 @@ IVFFlat::addCodeVectorsFromCpu(int listId, int IVFFlat::classifyAndAddVectors(Tensor& vecs, - Tensor& indices, - Tensor& bitset) { + Tensor& indices) { FAISS_ASSERT(vecs.getSize(0) == indices.getSize(0)); FAISS_ASSERT(vecs.getSize(1) == dim_); auto& mem = resources_->getMemoryManagerCurrentDevice(); auto stream = resources_->getDefaultStreamCurrentDevice(); + DeviceTensor bitset(mem, {0}, stream); + // Number of valid vectors that we actually add; we return this int numAdded = 0; diff --git a/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh b/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh index 4ab62a489a..1697a7b1ee 100644 --- a/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh +++ b/core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh @@ -44,8 +44,7 @@ class IVFFlat : public IVFBase { /// Returns the number of vectors successfully added. Vectors may /// not be able to be added because they contain NaNs. int classifyAndAddVectors(Tensor& vecs, - Tensor& indices, - Tensor& bitset); + Tensor& indices); /// Find the approximate k nearest neigbors for `queries` against diff --git a/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu b/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu index d665d34566..636eef78c0 100644 --- a/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu +++ b/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu @@ -110,8 +110,7 @@ IVFPQ::setPrecomputedCodes(bool enable) { int IVFPQ::classifyAndAddVectors(Tensor& vecs, - Tensor& indices, - Tensor& bitset) { + Tensor& indices) { FAISS_ASSERT(vecs.getSize(0) == indices.getSize(0)); FAISS_ASSERT(vecs.getSize(1) == dim_); @@ -119,6 +118,8 @@ IVFPQ::classifyAndAddVectors(Tensor& vecs, auto& coarseCentroids = quantizer_->getVectorsFloat32Ref(); auto& mem = resources_->getMemoryManagerCurrentDevice(); auto stream = resources_->getDefaultStreamCurrentDevice(); + + DeviceTensor bitset(mem, {0}, stream); // Number of valid vectors that we actually add; we return this int numAdded = 0; diff --git a/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh b/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh index cc231459b0..4d41d0a6a6 100644 --- a/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh +++ b/core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh @@ -52,8 +52,7 @@ class IVFPQ : public IVFBase { /// Returns the number of vectors successfully added. Vectors may /// not be able to be added because they contain NaNs. int classifyAndAddVectors(Tensor& vecs, - Tensor& indices, - Tensor& bitset); + Tensor& indices); /// Find the approximate k nearest neigbors for `queries` against /// our database