From a0bd7aac694cd43e3ba0a371cbd7bacf31ded564 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Sun, 26 Oct 2025 23:40:59 -0700 Subject: [PATCH] clang-format | Format fbsource with clang-format 21. Reviewed By: ChristianK275 Differential Revision: D85317706 fbshipit-source-id: b399c5c4b75252999442b7d7d2778e7a241b0025 --- demos/rocksdb_ivf/RocksDBInvertedLists.cpp | 11 +- faiss/IndexBinaryHNSW.cpp | 4 +- faiss/IndexBinaryIVF.cpp | 13 +- faiss/IndexFastScan.cpp | 42 +++---- faiss/IndexHNSW.cpp | 4 +- faiss/IndexIVFPQ.cpp | 4 +- faiss/gpu/GpuIcmEncoder.cu | 7 +- faiss/gpu/impl/GeneralDistance.cuh | 5 +- faiss/gpu/impl/GpuScalarQuantizer.cuh | 9 +- faiss/gpu/impl/IVFBase.cu | 10 +- faiss/gpu/utils/DeviceTensor-inl.cuh | 33 ++---- faiss/gpu/utils/HostTensor-inl.cuh | 36 ++---- faiss/gpu/utils/Tensor-inl.cuh | 111 ++++++------------ faiss/gpu/utils/Tensor.cuh | 19 ++- faiss/gpu/utils/warpselect/WarpSelectImpl.cuh | 5 +- faiss/impl/ThreadedIndex-inl.h | 9 +- faiss/utils/hamming.cpp | 13 +- faiss/utils/simdlib_neon.h | 4 +- tests/test_common_ivf_empty_index.cpp | 5 +- tests/test_transfer_invlists.cpp | 4 +- 20 files changed, 153 insertions(+), 195 deletions(-) diff --git a/demos/rocksdb_ivf/RocksDBInvertedLists.cpp b/demos/rocksdb_ivf/RocksDBInvertedLists.cpp index a72ec75e2..1135620a0 100644 --- a/demos/rocksdb_ivf/RocksDBInvertedLists.cpp +++ b/demos/rocksdb_ivf/RocksDBInvertedLists.cpp @@ -22,14 +22,17 @@ RocksDBInvertedListsIterator::RocksDBInvertedListsIterator( list_no(list_no), code_size(code_size), codes(code_size) { - it->Seek(rocksdb::Slice( - reinterpret_cast(&list_no), sizeof(size_t))); + it->Seek( + rocksdb::Slice( + reinterpret_cast(&list_no), sizeof(size_t))); } bool RocksDBInvertedListsIterator::is_available() const { return it->Valid() && - it->key().starts_with(rocksdb::Slice( - reinterpret_cast(&list_no), sizeof(size_t))); + it->key().starts_with( + rocksdb::Slice( + reinterpret_cast(&list_no), + sizeof(size_t))); } void RocksDBInvertedListsIterator::next() { diff --git a/faiss/IndexBinaryHNSW.cpp b/faiss/IndexBinaryHNSW.cpp index 41ee003db..dabaa5829 100644 --- a/faiss/IndexBinaryHNSW.cpp +++ b/faiss/IndexBinaryHNSW.cpp @@ -290,7 +290,9 @@ struct FlatHammingDis : DistanceComputer { ~FlatHammingDis() override { #pragma omp critical - { hnsw_stats.ndis += ndis; } + { + hnsw_stats.ndis += ndis; + } } }; diff --git a/faiss/IndexBinaryIVF.cpp b/faiss/IndexBinaryIVF.cpp index b0edf0914..fbd0423fa 100644 --- a/faiss/IndexBinaryIVF.cpp +++ b/faiss/IndexBinaryIVF.cpp @@ -492,12 +492,13 @@ void search_knn_hamming_count( std::vector> cs; for (size_t i = 0; i < nx; ++i) { - cs.push_back(HCounterState( - all_counters.data() + i * nBuckets, - all_ids_per_dis.get() + i * nBuckets * k, - x + i * ivf->code_size, - ivf->d, - k)); + cs.push_back( + HCounterState( + all_counters.data() + i * nBuckets, + all_ids_per_dis.get() + i * nBuckets * k, + x + i * ivf->code_size, + ivf->d, + k)); } size_t nlistv = 0, ndis = 0; diff --git a/faiss/IndexFastScan.cpp b/faiss/IndexFastScan.cpp index 4165f8cd2..f324d19ad 100644 --- a/faiss/IndexFastScan.cpp +++ b/faiss/IndexFastScan.cpp @@ -506,16 +506,17 @@ void IndexFastScan::search_implem_12( pq4_pack_LUT_qbs(qbs, M2, quantized_dis_tables.get(), LUT.get()); FAISS_THROW_IF_NOT(LUT_nq == n); - std::unique_ptr handler(static_cast(make_knn_handler( - C::is_max, - impl, - n, - k, - ntotal, - distances, - labels, - nullptr, - context))); + std::unique_ptr handler( + static_cast(make_knn_handler( + C::is_max, + impl, + n, + k, + ntotal, + distances, + labels, + nullptr, + context))); handler->disable = bool(skip & 2); handler->normalizers = normalizers.get(); @@ -588,16 +589,17 @@ void IndexFastScan::search_implem_14( AlignedTable LUT(n * dim12); pq4_pack_LUT(n, M2, quantized_dis_tables.get(), LUT.get()); - std::unique_ptr handler(static_cast(make_knn_handler( - C::is_max, - impl, - n, - k, - ntotal, - distances, - labels, - nullptr, - context))); + std::unique_ptr handler( + static_cast(make_knn_handler( + C::is_max, + impl, + n, + k, + ntotal, + distances, + labels, + nullptr, + context))); handler->disable = bool(skip & 2); handler->normalizers = normalizers.get(); diff --git a/faiss/IndexHNSW.cpp b/faiss/IndexHNSW.cpp index c2b20ddad..b7c3bfe10 100644 --- a/faiss/IndexHNSW.cpp +++ b/faiss/IndexHNSW.cpp @@ -450,7 +450,9 @@ void IndexHNSW::search_level_0( vt.advance(); } #pragma omp critical - { hnsw_stats.combine(search_stats); } + { + hnsw_stats.combine(search_stats); + } } if (is_similarity_metric(this->metric_type)) { // we need to revert the negated distances diff --git a/faiss/IndexIVFPQ.cpp b/faiss/IndexIVFPQ.cpp index 41e0192ff..7218c7941 100644 --- a/faiss/IndexIVFPQ.cpp +++ b/faiss/IndexIVFPQ.cpp @@ -1163,7 +1163,9 @@ struct IVFPQScannerT : QueryTables { } #pragma omp critical - { indexIVFPQ_stats.n_hamming_pass += n_hamming_pass; } + { + indexIVFPQ_stats.n_hamming_pass += n_hamming_pass; + } } template diff --git a/faiss/gpu/GpuIcmEncoder.cu b/faiss/gpu/GpuIcmEncoder.cu index 84202aeb7..831f65318 100644 --- a/faiss/gpu/GpuIcmEncoder.cu +++ b/faiss/gpu/GpuIcmEncoder.cu @@ -24,9 +24,10 @@ struct IcmEncoderShards { workers; void add(IcmEncoderImpl* encoder) { - workers.emplace_back(std::make_pair( - std::unique_ptr(encoder), - std::unique_ptr(new WorkerThread))); + workers.emplace_back( + std::make_pair( + std::unique_ptr(encoder), + std::unique_ptr(new WorkerThread))); } IcmEncoderImpl* at(int idx) { diff --git a/faiss/gpu/impl/GeneralDistance.cuh b/faiss/gpu/impl/GeneralDistance.cuh index 208d3a81b..8f53dff5b 100644 --- a/faiss/gpu/impl/GeneralDistance.cuh +++ b/faiss/gpu/impl/GeneralDistance.cuh @@ -137,8 +137,9 @@ __launch_bounds__(TILE_SIZE* TILE_SIZE) __global__ void generalDistance( __syncthreads(); // thread (y, x) does (query y, vec x) - acc.combine(reduce( - op, queryTile, vecTile)); + acc.combine( + reduce( + op, queryTile, vecTile)); __syncthreads(); } diff --git a/faiss/gpu/impl/GpuScalarQuantizer.cuh b/faiss/gpu/impl/GpuScalarQuantizer.cuh index 186ecac1c..581632138 100644 --- a/faiss/gpu/impl/GpuScalarQuantizer.cuh +++ b/faiss/gpu/impl/GpuScalarQuantizer.cuh @@ -37,10 +37,11 @@ inline bool isSQSupported(ScalarQuantizer::QuantizerType qtype) { struct GpuScalarQuantizer : public ScalarQuantizer { GpuScalarQuantizer(GpuResources* res, const ScalarQuantizer& sq) : ScalarQuantizer(sq), - gpuTrained(DeviceTensor( - res, - makeDevAlloc(AllocType::Quantizer, 0), - {(idx_t)sq.trained.size()})) { + gpuTrained( + DeviceTensor( + res, + makeDevAlloc(AllocType::Quantizer, 0), + {(idx_t)sq.trained.size()})) { HostTensor cpuTrained( (float*)sq.trained.data(), {(idx_t)sq.trained.size()}); diff --git a/faiss/gpu/impl/IVFBase.cu b/faiss/gpu/impl/IVFBase.cu index 4023aac39..5f0484c37 100644 --- a/faiss/gpu/impl/IVFBase.cu +++ b/faiss/gpu/impl/IVFBase.cu @@ -119,11 +119,13 @@ void IVFBase::reset() { AllocInfo(AllocType::IVFLists, getCurrentDevice(), space_, stream); for (idx_t i = 0; i < numLists_; ++i) { - deviceListData_.emplace_back(std::unique_ptr( - new DeviceIVFList(resources_, info))); + deviceListData_.emplace_back( + std::unique_ptr( + new DeviceIVFList(resources_, info))); - deviceListIndices_.emplace_back(std::unique_ptr( - new DeviceIVFList(resources_, info))); + deviceListIndices_.emplace_back( + std::unique_ptr( + new DeviceIVFList(resources_, info))); listOffsetToUserIndex_.emplace_back(std::vector()); } diff --git a/faiss/gpu/utils/DeviceTensor-inl.cuh b/faiss/gpu/utils/DeviceTensor-inl.cuh index cae4aa6f9..6dda31a26 100644 --- a/faiss/gpu/utils/DeviceTensor-inl.cuh +++ b/faiss/gpu/utils/DeviceTensor-inl.cuh @@ -15,8 +15,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor() : Tensor() {} @@ -25,8 +24,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( DeviceTensor&& t) : Tensor() { @@ -38,8 +36,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor& DeviceTensor< T, Dim, @@ -59,8 +56,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::~DeviceTensor() { } @@ -69,8 +65,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( GpuResources* res, const AllocInfo& info, @@ -88,8 +83,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( GpuResources* res, const AllocInfo& info, @@ -107,8 +101,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( DataPtrType data, const IndexT sizes[Dim]) @@ -119,8 +112,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( DataPtrType data, std::initializer_list sizes) @@ -131,8 +123,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( DataPtrType data, const IndexT sizes[Dim], @@ -145,8 +136,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor::DeviceTensor( GpuResources* res, const AllocInfo& info, @@ -169,8 +159,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ DeviceTensor& DeviceTensor< T, Dim, diff --git a/faiss/gpu/utils/HostTensor-inl.cuh b/faiss/gpu/utils/HostTensor-inl.cuh index 9a6083ea9..29c4a78fe 100644 --- a/faiss/gpu/utils/HostTensor-inl.cuh +++ b/faiss/gpu/utils/HostTensor-inl.cuh @@ -13,8 +13,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor() : Tensor(), state_(AllocState::NotOwner) {} @@ -24,8 +23,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::~HostTensor() { if (state_ == AllocState::Owner) { FAISS_ASSERT(this->data_ != nullptr); @@ -39,8 +37,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( HostTensor&& t) : Tensor(), @@ -53,8 +50,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor& HostTensor< T, Dim, @@ -82,8 +78,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( const IndexT sizes[Dim]) : Tensor(nullptr, sizes), @@ -97,8 +92,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( std::initializer_list sizes) : Tensor(nullptr, sizes), @@ -112,8 +106,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( DataPtrType data, const IndexT sizes[Dim]) @@ -125,8 +118,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( DataPtrType data, std::initializer_list sizes) @@ -138,8 +130,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( DataPtrType data, const IndexT sizes[Dim], @@ -152,8 +143,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor::HostTensor( const Tensor& t, cudaStream_t stream) @@ -175,8 +165,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ HostTensor& HostTensor< T, Dim, @@ -198,8 +187,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ T HostTensor::maxDiff( const HostTensor& t) const { auto size = this->numElements(); diff --git a/faiss/gpu/utils/Tensor-inl.cuh b/faiss/gpu/utils/Tensor-inl.cuh index 6f575cfb7..036ea8de4 100644 --- a/faiss/gpu/utils/Tensor-inl.cuh +++ b/faiss/gpu/utils/Tensor-inl.cuh @@ -18,8 +18,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor::Tensor() : data_(nullptr) { static_assert(Dim > 0, "must have > 0 dimensions"); @@ -35,8 +34,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor::Tensor( Tensor& t) { this->operator=(t); @@ -47,8 +45,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor::Tensor( Tensor&& t) { this->operator=(std::move(t)); @@ -59,8 +56,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor& Tensor< T, Dim, @@ -82,8 +78,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor& Tensor< T, Dim, @@ -108,8 +103,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor::Tensor( DataPtrType data, const IndexT sizes[Dim]) @@ -131,8 +125,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor::Tensor( DataPtrType data, std::initializer_list sizes) @@ -156,8 +149,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor::Tensor( DataPtrType data, const IndexT sizes[Dim], @@ -176,8 +168,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ void Tensor::copyFrom( const Tensor& t, cudaStream_t stream) { @@ -221,8 +212,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ void Tensor::copyTo( Tensor& t, cudaStream_t stream) { @@ -266,8 +256,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ void Tensor::copyFrom( const std::vector& v, cudaStream_t stream) { @@ -295,8 +284,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ std::vector Tensor:: copyToVector(cudaStream_t stream) { // The tensor must be fully contiguous @@ -328,8 +316,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ bool Tensor::isSame( const Tensor& rhs) @@ -356,8 +343,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ bool Tensor:: isSameSize( @@ -381,8 +367,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -401,8 +386,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ const Tensor Tensor< T, @@ -421,8 +405,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -455,8 +438,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ const Tensor Tensor< T, @@ -473,8 +455,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ bool Tensor:: canCastResize() const { @@ -510,8 +491,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ Tensor Tensor< T, @@ -539,8 +519,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ bool Tensor::canUseIndexType() const { @@ -571,8 +550,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ IndexT Tensor::numElements() const { auto size = getSize(0); @@ -589,8 +567,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ bool Tensor:: isContiguous() const { IndexT prevSize = 1; @@ -613,8 +590,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ bool Tensor:: isConsistentlySized(int i) const { if (i == 0 && getStride(i) > 0 && getSize(i) > 0) { @@ -633,8 +609,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ bool Tensor:: isConsistentlySized() const { for (int i = 0; i < Dim; ++i) { @@ -651,8 +626,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ bool Tensor:: isContiguousDim(int i) const { return (i == Dim - 1) || // just in case @@ -665,8 +639,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor Tensor< T, Dim, @@ -706,8 +679,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor Tensor< T, Dim, @@ -743,8 +715,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -781,8 +752,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -817,8 +787,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -871,8 +840,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -923,8 +891,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -952,8 +919,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, @@ -969,8 +935,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor Tensor< T, Dim, @@ -985,8 +950,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ Tensor Tensor< T, Dim, @@ -1022,8 +986,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> template __host__ __device__ Tensor Tensor< T, diff --git a/faiss/gpu/utils/Tensor.cuh b/faiss/gpu/utils/Tensor.cuh index 37c0e919d..d4e2904ee 100644 --- a/faiss/gpu/utils/Tensor.cuh +++ b/faiss/gpu/utils/Tensor.cuh @@ -28,8 +28,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> class Tensor; /// Type of a subspace of a tensor @@ -37,8 +36,7 @@ namespace detail { template < typename TensorType, int SubDim, - template - class PtrTraits> + template class PtrTraits> class SubTensor; } @@ -412,12 +410,12 @@ class SubTensor { } // operator T& - __host__ __device__ operator typename TensorType::DataType &() { + __host__ __device__ operator typename TensorType::DataType&() { return *data_; } // const operator T& returning const T& - __host__ __device__ operator const typename TensorType::DataType &() const { + __host__ __device__ operator const typename TensorType::DataType&() const { return *data_; } @@ -514,8 +512,7 @@ class SubTensor { template < typename TensorType, int SubDim, - template - class PtrTraits> + template class PtrTraits> class SubTensor { public: /// Returns a view of the data located at our offset (the dimension @@ -664,8 +661,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ inline detail::SubTensor< Tensor, Dim - 1, @@ -680,8 +676,7 @@ template < int Dim, bool InnerContig, typename IndexT, - template - class PtrTraits> + template class PtrTraits> __host__ __device__ inline const detail::SubTensor< Tensor, Dim - 1, diff --git a/faiss/gpu/utils/warpselect/WarpSelectImpl.cuh b/faiss/gpu/utils/warpselect/WarpSelectImpl.cuh index 3db7b4096..76670144d 100644 --- a/faiss/gpu/utils/warpselect/WarpSelectImpl.cuh +++ b/faiss/gpu/utils/warpselect/WarpSelectImpl.cuh @@ -27,8 +27,9 @@ cudaStream_t stream) { \ int warpSize = getWarpSizeCurrentDevice(); \ constexpr int kWarpSelectNumThreads = 128; \ - auto grid = dim3(utils::divUp( \ - in.getSize(0), (kWarpSelectNumThreads / warpSize))); \ + auto grid = \ + dim3(utils::divUp( \ + in.getSize(0), (kWarpSelectNumThreads / warpSize))); \ auto block = dim3(kWarpSelectNumThreads); \ \ FAISS_ASSERT(k <= WARP_Q); \ diff --git a/faiss/impl/ThreadedIndex-inl.h b/faiss/impl/ThreadedIndex-inl.h index ccb2d51eb..29caeb3fd 100644 --- a/faiss/impl/ThreadedIndex-inl.h +++ b/faiss/impl/ThreadedIndex-inl.h @@ -77,10 +77,11 @@ void ThreadedIndex::addIndex(IndexT* index) { } } - indices_.emplace_back(std::make_pair( - index, - std::unique_ptr( - isThreaded_ ? new WorkerThread : nullptr))); + indices_.emplace_back( + std::make_pair( + index, + std::unique_ptr( + isThreaded_ ? new WorkerThread : nullptr))); onAfterAddIndex(index); } diff --git a/faiss/utils/hamming.cpp b/faiss/utils/hamming.cpp index f609d90ab..a0a73721a 100644 --- a/faiss/utils/hamming.cpp +++ b/faiss/utils/hamming.cpp @@ -257,12 +257,13 @@ void hammings_knn_mc( std::vector> cs; for (size_t i = 0; i < na; ++i) { - cs.push_back(HCounterState( - all_counters.data() + i * nBuckets, - all_ids_per_dis.get() + i * nBuckets * k, - a + i * bytes_per_code, - 8 * bytes_per_code, - k)); + cs.push_back( + HCounterState( + all_counters.data() + i * nBuckets, + all_ids_per_dis.get() + i * nBuckets * k, + a + i * bytes_per_code, + 8 * bytes_per_code, + k)); } const size_t block_size = hamming_batch_size; diff --git a/faiss/utils/simdlib_neon.h b/faiss/utils/simdlib_neon.h index 10adc222e..8b8c16200 100644 --- a/faiss/utils/simdlib_neon.h +++ b/faiss/utils/simdlib_neon.h @@ -805,8 +805,8 @@ struct simd32uint8 { uint8_t bytes[32]; store(bytes); detail::simdlib::bin( - const_cast( - reinterpret_cast(bytes)), + const_cast( + reinterpret_cast(bytes)), bits); } diff --git a/tests/test_common_ivf_empty_index.cpp b/tests/test_common_ivf_empty_index.cpp index eeaa83976..99b8823a9 100644 --- a/tests/test_common_ivf_empty_index.cpp +++ b/tests/test_common_ivf_empty_index.cpp @@ -76,8 +76,9 @@ TEST(COMMON, test_common_trained_index) { // construct and build an "empty index": a trained index that does not // itself hold any data - std::unique_ptr empty_index(dynamic_cast( - faiss::index_factory(d, "IVF32,PQ8np"))); + std::unique_ptr empty_index( + dynamic_cast( + faiss::index_factory(d, "IVF32,PQ8np"))); auto xt = get_random_vectors(nt, 123); empty_index->train(nt, xt.data()); empty_index->nprobe = 4; diff --git a/tests/test_transfer_invlists.cpp b/tests/test_transfer_invlists.cpp index a2ac6e170..95ce4e510 100644 --- a/tests/test_transfer_invlists.cpp +++ b/tests/test_transfer_invlists.cpp @@ -125,7 +125,9 @@ void test_index_type(const char* factory_string) { read_InvertedLists(&reader))); // swap inverted lists. Block searches here! - { ivflib::set_invlist_range(dst_index.get(), i0, i1, il.get()); } + { + ivflib::set_invlist_range(dst_index.get(), i0, i1, il.get()); + } } } EXPECT_EQ(dst_index->ntotal, src_index->ntotal);