Skip to content

Commit

Permalink
Merge branch 'facebookresearch:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
guangzegu authored Feb 21, 2025
2 parents 78857d9 + 1fe8b8b commit fc447da
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build_conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ runs:
# Ensure starting packages are from conda-forge.
conda list --show-channel-urls
conda install -y -q "conda!=24.11.0"
conda install -y -q "conda-build!=24.11.0"
conda install -y -q "conda-build!=24.11.0" "liblief=0.14.1"
conda list --show-channel-urls
- name: Enable anaconda uploads
if: inputs.label != ''
Expand Down
2 changes: 2 additions & 0 deletions conda/faiss-gpu-cuvs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ outputs:
- mkl =2023 # [x86_64]
- cuda-toolkit {{ cudatoolkit }}
host:
- mkl =2023 # [x86_64]
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- python {{ python }}
- numpy >=1.19,<2
- {{ pin_subpackage('libfaiss', exact=True) }}
run:
- mkl =2023 # [x86_64]
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- python {{ python }}
- numpy >=1.19,<2
Expand Down
3 changes: 3 additions & 0 deletions conda/faiss-gpu/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ outputs:
- make =4.4 # [osx and arm64]
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win]
- cuda-toolkit {{ cudatoolkit }}
- mkl-devel =2023.0 # [x86_64]
host:
- mkl =2023.0 # [x86_64]
- python {{ python }}
- numpy >=1.19,<2
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win]
- {{ pin_subpackage('libfaiss', exact=True) }}
run:
- mkl =2023.0 # [x86_64]
- python {{ python }}
- numpy >=1.19,<2
- packaging
Expand Down
2 changes: 2 additions & 0 deletions faiss/gpu/impl/CuvsCagra.cu
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ CuvsCagra::CuvsCagra(

index_params_.intermediate_graph_degree = intermediate_graph_degree;
index_params_.graph_degree = graph_degree;
index_params_.attach_dataset_on_build = store_dataset;

if (!ivf_pq_search_params_) {
ivf_pq_search_params_ =
Expand Down Expand Up @@ -243,6 +244,7 @@ void CuvsCagra::search(
storage_, n_, dim_);
cuvs_index->update_dataset(raft_handle, dataset);
}
store_dataset_ = true;
}

auto queries_view = raft::make_device_matrix_view<const float, int64_t>(
Expand Down
1 change: 1 addition & 0 deletions faiss/impl/HNSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace faiss {
**************************************************************/

int HNSW::nb_neighbors(int layer_no) const {
FAISS_THROW_IF_NOT(layer_no + 1 < cum_nneighbor_per_level.size());
return cum_nneighbor_per_level[layer_no + 1] -
cum_nneighbor_per_level[layer_no];
}
Expand Down
2 changes: 0 additions & 2 deletions faiss/impl/code_distance/code_distance-sve.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ static void distance_four_codes_sve_for_small_m(

const auto offsets_0 = svindex_u32(0, static_cast<uint32_t>(ksub));

const auto quad_lanes = svcntw();

// loop
const auto pg = svwhilelt_b32_u64(0, M);

Expand Down
10 changes: 10 additions & 0 deletions tests/test_hnsw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,16 @@ TEST_F(HNSWTest, TEST_search_neighbors_to_add) {
}
}

TEST_F(HNSWTest, TEST_nb_neighbors_bound) {
omp_set_num_threads(1);
EXPECT_EQ(index->hnsw.nb_neighbors(0), 8);
EXPECT_EQ(index->hnsw.nb_neighbors(1), 4);
EXPECT_EQ(index->hnsw.nb_neighbors(2), 4);
EXPECT_EQ(index->hnsw.nb_neighbors(3), 4);
// picking a large number to trigger an exception based on checking bounds
EXPECT_THROW(index->hnsw.nb_neighbors(100), faiss::FaissException);
}

TEST_F(HNSWTest, TEST_search_level_0) {
omp_set_num_threads(1);
std::vector<faiss::idx_t> I(k * nq);
Expand Down

0 comments on commit fc447da

Please sign in to comment.