Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Optimize test_idmap and test_binaryidmap (#134)
Browse files Browse the repository at this point in the history
Signed-off-by: yudong.cai <[email protected]>
  • Loading branch information
cydrain authored Apr 14, 2022
1 parent 5b4d0ca commit d2a5ab2
Show file tree
Hide file tree
Showing 8 changed files with 441 additions and 544 deletions.
4 changes: 2 additions & 2 deletions thirdparty/faiss/faiss/IndexBinaryIVF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ struct IVFBinaryScannerJaccard: BinaryInvertedListScanner {
const idx_t *ids,
int32_t *simi, idx_t *idxi,
size_t k,
const BitsetView bitset = nullptr) const override {
const BitsetView bitset) const override {
using C = CMax<float, idx_t>;
float* psimi = (float*)simi;
size_t nup = 0;
Expand Down Expand Up @@ -601,7 +601,7 @@ void search_knn_binary_dis_heap(
idx_t* labels,
bool store_pairs,
const IVFSearchParameters* params,
const BitsetView bitset = nullptr) {
const BitsetView bitset) {
idx_t nprobe = params ? params->nprobe : ivf.nprobe;
nprobe = std::min((idx_t)ivf.nlist, nprobe);
idx_t max_codes = params ? params->max_codes : ivf.max_codes;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/faiss/faiss/IndexPQ.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct IndexPQ : IndexFlatCodes {
idx_t k,
float* distances,
idx_t* labels,
const BitsetView bitset) const override;
const BitsetView bitset = nullptr) const override;

/* The standalone codec interface */
void sa_encode(idx_t n, const float* x, uint8_t* bytes) const override;
Expand Down
8 changes: 4 additions & 4 deletions thirdparty/faiss/faiss/utils/BinaryDistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace faiss {
size_t ncodes,
std::vector<faiss::RangeSearchPartialResult*>& result,
size_t buffer_size,
const BitsetView bitset);
const BitsetView bitset = nullptr);

extern template
void binary_range_search<CMax<int, int64_t>, int>(
Expand All @@ -166,7 +166,7 @@ namespace faiss {
size_t ncodes,
std::vector<faiss::RangeSearchPartialResult*>& result,
size_t buffer_size,
const BitsetView bitset);
const BitsetView bitset = nullptr);

extern template
void binary_range_search<CMax<float, int64_t>, float>(
Expand All @@ -179,7 +179,7 @@ namespace faiss {
size_t ncodes,
std::vector<faiss::RangeSearchPartialResult*>& result,
size_t buffer_size,
const BitsetView bitset);
const BitsetView bitset = nullptr);

extern template
void binary_range_search<CMin<bool, int64_t>, bool>(
Expand All @@ -192,7 +192,7 @@ namespace faiss {
size_t ncodes,
std::vector<faiss::RangeSearchPartialResult*>& result,
size_t buffer_size,
const BitsetView bitset);
const BitsetView bitset = nullptr);

} // namespace faiss

Expand Down
10 changes: 5 additions & 5 deletions thirdparty/faiss/faiss/utils/distances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void exhaustive_parallel_on_nx(
size_t ny,
ResultHandler& res,
fvec_func_ptr dis_compute_func,
const BitsetView bitset = nullptr) {
const BitsetView bitset) {
using SingleResultHandler = typename ResultHandler::SingleResultHandler;
#pragma omp parallel
{
Expand Down Expand Up @@ -141,7 +141,7 @@ void exhaustive_parallel_on_ny(
size_t ny,
ResultHandler& res,
fvec_func_ptr dis_compute_func,
const BitsetView bitset = nullptr) {
const BitsetView bitset) {
using SingleResultHandler = typename ResultHandler::SingleResultHandler;
size_t k = res.k;
size_t thread_max_num = omp_get_max_threads();
Expand Down Expand Up @@ -206,7 +206,7 @@ void exhaustive_L2sqr_IP_seq(
size_t ny,
ResultHandler& res,
fvec_func_ptr dis_compute_func,
const BitsetView bitset = nullptr) {
const BitsetView bitset) {
size_t thread_max_num = omp_get_max_threads();
if (ny > parallel_policy_threshold || (nx < thread_max_num / 2 && ny >= thread_max_num * 32)) {
exhaustive_parallel_on_ny(x, y, d, nx, ny, res, dis_compute_func, bitset);
Expand All @@ -224,7 +224,7 @@ void exhaustive_inner_product_blas(
size_t nx,
size_t ny,
ResultHandler& res,
const BitsetView bitset = nullptr) {
const BitsetView bitset) {
// BLAS does not like empty matrices
if (nx == 0 || ny == 0)
return;
Expand Down Expand Up @@ -369,7 +369,7 @@ static void knn_jaccard_blas(
size_t ny,
ResultHandler& res,
const DistanceCorrection& corr,
const BitsetView bitset = nullptr) {
const BitsetView bitset) {
// BLAS does not like empty matrices
if (nx == 0 || ny == 0)
return;
Expand Down
Loading

0 comments on commit d2a5ab2

Please sign in to comment.