-
Notifications
You must be signed in to change notification settings - Fork 83
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
[WIP] feature : add zero copy support for vector index #1032
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: foxspy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@foxspy 🔍 Important: PR Classification Needed! For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:
For any PR outside the kind/improvement category, ensure you link to the associated issue using the format: “issue: #”. Thanks for your efforts and contribution to the community!. |
5385cae
to
dc5a6ac
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1032 +/- ##
=========================================
+ Coverage 0 73.61% +73.61%
=========================================
Files 0 82 +82
Lines 0 7511 +7511
=========================================
+ Hits 0 5529 +5529
- Misses 0 1982 +1982 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one topic to discuss. Otherwise, lgtm
@@ -81,6 +82,8 @@ struct Index { | |||
MetricType metric_type; | |||
float metric_arg; ///< argument of the metric type | |||
|
|||
std::shared_ptr<MmappedFileMappingOwner> mmap_owner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a very tricky point. Although, I understand why this was introduced, I'd like to avoid adding it here. Basically, the approach is similar to a std::string_view, which does not have a business to maintain the memory. Similar, here: It is not Index's instance business to maintain the view.
I'm open for discussions.
} | ||
} | ||
|
||
ZeroCopyIOReader* zr = dynamic_cast<ZeroCopyIOReader*>(f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a todo for the future: basically, a reader need to instantiate an object. But this is a later business, because it needs to be properly synchronized with the vanilla faiss first.
So, let's keep the change in the way you proposed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so I put the PR up first; zero copy is needed here mainly for
- Optimizing memory expansion caused by copying during loading
- The memory will be managed uniformly through Eyrie later, and the index does not hold data, but only views
- The implementation of mmap and zero copy can be unified (mmap externally first, load through zero copy)
If you have any ideas about this, please feel free to communicate; has faiss considered supporting this mode?
Signed-off-by: xianliang.li <[email protected]>
dc5a6ac
to
7dc2032
Compare
issue: #1031