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

Add iterator for ivf_sq_8 #414

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cqy123456
Copy link
Collaborator

@cqy123456 cqy123456 commented Feb 27, 2024

issue: #425

@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cqy123456

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

mergify bot commented Feb 27, 2024

@cqy123456 🔍 Important: PR Classification Needed!

For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:

  1. If you're fixing a bug, label it as kind/bug.
  2. For small tweaks (less than 20 lines without altering any functionality), please use kind/improvement.
  3. Significant changes that don't modify existing functionalities should be tagged as kind/enhancement.
  4. Adjusting APIs or changing functionality? Go with kind/feature.

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!.

: nullptr;
InvertedListScanner* scanner = get_InvertedListScanner(false, sel);
scanner->set_query(workspace->query_data);
scanner->set_list(list_no, coarse_list_centroid_dist);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add a line : add centroid id and distance for quantizer.

Copy link
Collaborator

@zhengbuqian zhengbuqian left a comment

Choose a reason for hiding this comment

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

thanks!

continue;
}
float accu = accu0 + dc.query_to_code(codes);
counter_back ++;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: space

heap_push<CMax<float, int64_t>>(counter_back, distances, labels, accu, ids[j]);
nup++;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing return statement.

InvertedLists::ScopedIds sids(
invlists, list_no, segment_offset);

size_t n_heap = scanner->scan_codes_and_push_back(
Copy link
Collaborator

Choose a reason for hiding this comment

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

temp variable n_heap is not used. discussed with @alwayslove2013 and we can remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry for being not precise in the previous comment: I meant to simply remove this local variable while scan_codes_and_push_back can still keep the return value for future use(could be used for metrics) and to have a aligned behavior with scan_codes.

}

// compute backup_count_threshold - (nprobe / nlist) * count
size_t nprobe = workspace->search_params->nprobe
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if workspace->search_params is nullptr?


std::optional<std::pair<float, idx_t>> IndexIVF::getIteratorNext(
IVFIteratorWorkspace* workspace) const {
auto scan_one_list_then_add_to_backup =
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add a check if workspace is nullptr

@@ -89,6 +90,30 @@ struct InvertedListScanner;
struct IndexIVFStats;
struct CodePacker;

struct IVFIteratorWorkspace {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add very detailed comments on what this structure does exactly and how it is used

@@ -313,6 +338,19 @@ struct IndexIVF : Index, IndexIVFInterface {
RangeSearchResult* result,
const SearchParameters* params = nullptr) const override;

std::unique_ptr<IVFIteratorWorkspace> getIteratorWorkspace(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add comments for this method about what it does

Signed-off-by: cqy123456 <qianya.cheng@zilliz.com>
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.32%. Comparing base (3c46f4c) to head (4a82b03).
Report is 43 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main     #414       +/-   ##
=========================================
+ Coverage      0   72.32%   +72.32%     
=========================================
  Files         0       63       +63     
  Lines         0     4293     +4293     
=========================================
+ Hits          0     3105     +3105     
- Misses        0     1188     +1188     

see 63 files with indirect coverage changes

@mergify mergify bot added the ci-passed label Apr 11, 2024
@zhengbuqian
Copy link
Collaborator

please hold until #501 is merged. It slightly changed how we should implement iterator for indexes. It should make this PR much simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants