Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump faiss lib commit to 32f0e8cf92cd2275b60364517bb1cce67aa29a55 #1443

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

heemin32
Copy link
Collaborator

@heemin32 heemin32 commented Feb 1, 2024

Description

In #1398, we introduced a custom patch on faiss library to support multi-vector feature. After that, faiss refactored HNSW by generalizing ResultHandler which caused a conflict with the previous custom patch and blocking us from updating faiss library beyond commit# 32f0e8cf92cd2275b60364517bb1cce67aa29a55.

This PR is to resolve the conflict and keep the supporting of multi-vector feature as it is on top of faiss's commit number 32f0e8cf92cd2275b60364517bb1cce67aa29a55 so that we are unblocked for future faiss library update.

Patch file is from facebookresearch/faiss#3227

Issues Resolved

#1409

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@naveentatikonda
Copy link
Member

@heemin32 Can we hold this PR from merging into main branch and 2.x until 2.12 code freeze ?

@heemin32 heemin32 changed the title Update faiss commit and resolve conflict Resolve conflict on multi-vector custom patch of faiss Feb 1, 2024
@heemin32 heemin32 changed the title Resolve conflict on multi-vector custom patch of faiss Bump faiss lib commit to 32f0e8cf92cd2275b60364517bb1cce67aa29a55 Feb 1, 2024
@heemin32
Copy link
Collaborator Author

heemin32 commented Feb 1, 2024

@heemin32 Can we hold this PR from merging into main branch and 2.x until 2.12 code freeze ?

We can.

@heemin32 heemin32 added backport 2.x v2.13.0 Maintenance Add support for new versions of OpenSearch/Dashboards from upstream labels Feb 1, 2024
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (06ccdbc) 85.02% compared to head (c674058) 85.05%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1443      +/-   ##
============================================
+ Coverage     85.02%   85.05%   +0.03%     
  Complexity     1277     1277              
============================================
  Files           167      167              
  Lines          5207     5207              
  Branches        493      493              
============================================
+ Hits           4427     4429       +2     
+ Misses          572      570       -2     
  Partials        208      208              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +513 to -518
std::unique_ptr<faiss::IDGrouperBitmap> buildIDGrouperBitmap(knn_jni::JNIUtilInterface * jniUtil, JNIEnv *env, jintArray parentIdsJ, std::vector<uint64_t>* bitmap) {
int *parentIdsArray = jniUtil->GetIntArrayElements(env, parentIdsJ, nullptr);
int parentIdsLength = jniUtil->GetJavaIntArrayLength(env, parentIdsJ);
auto* parent_id_filter = new FixedBitSet(parentIdsArray, parentIdsLength);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should pass parentIdsArray and parentIdsLength directly to this function rather than pass JNIUtilInterface, JNIEnv, parentIdsJ

Copy link
Collaborator Author

@heemin32 heemin32 Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faiss_wrapper already has methods which uses JNI objects. Therefore, I moved the core logic into a new file faiss_util which will contain only methods agnostic to JNI.

@heemin32 heemin32 force-pushed the faiss-conflict branch 3 times, most recently from e3bca97 to 896b58a Compare February 2, 2024 23:12
@heemin32 heemin32 requested a review from navneet1v February 2, 2024 23:13
@heemin32 heemin32 force-pushed the faiss-conflict branch 4 times, most recently from 2794e0c to a4f22e1 Compare February 4, 2024 05:45
@heemin32 heemin32 force-pushed the faiss-conflict branch 2 times, most recently from da6f77d to 1b09e12 Compare February 9, 2024 23:03
@heemin32
Copy link
Collaborator Author

heemin32 commented Feb 13, 2024

Create GH issue for rolling upgrade bwc test failure which is not related with this PR. #1481

Rolling upgrade bwc is failing in other PRs as well.
#1393
#1402

@heemin32 heemin32 merged commit ced1ff2 into opensearch-project:main Feb 13, 2024
47 of 49 checks passed
@heemin32 heemin32 deleted the faiss-conflict branch February 13, 2024 22:19
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 13, 2024
Signed-off-by: Heemin Kim <[email protected]>
(cherry picked from commit ced1ff2)
heemin32 added a commit that referenced this pull request Feb 13, 2024
Signed-off-by: Heemin Kim <[email protected]>
(cherry picked from commit ced1ff2)

Co-authored-by: Heemin Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Maintenance Add support for new versions of OpenSearch/Dashboards from upstream v2.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants