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

Fix max_queries for CAGRA #2081

Merged
merged 4 commits into from
Jan 9, 2024

Conversation

lowener
Copy link
Contributor

@lowener lowener commented Jan 8, 2024

Fix for #2072: CAGRA search is launching a thread per query in single-CTA. The maximum number of thread is 65535 so the max_queries auto selection should be bounded to this number.

@lowener lowener requested review from a team as code owners January 8, 2024 12:53
@cjnolet cjnolet added bug Something isn't working non-breaking Non-breaking change labels Jan 8, 2024
@@ -118,7 +118,7 @@ void search_main(raft::resources const& res,
RAFT_EXPECTS(queries.extent(1) == index.dim(), "Queries and index dim must match");
const uint32_t topk = neighbors.extent(1);

if (params.max_queries == 0) { params.max_queries = queries.extent(0); }
if (params.max_queries == 0) { params.max_queries = std::min<size_t>(queries.extent(0), 65535); }
Copy link
Member

Choose a reason for hiding this comment

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

It would be more robust to compute the value, perhaps using std::limits for int 16, MAX_UNSIGNED_SHORT, or (1<<16)-1.

@lowener lowener requested a review from cjnolet January 9, 2024 14:22
Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

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

LGTM!

@cjnolet
Copy link
Member

cjnolet commented Jan 9, 2024

/merge

@rapids-bot rapids-bot bot merged commit 1484a03 into rapidsai:branch-24.02 Jan 9, 2024
61 checks passed
@lowener lowener deleted the 24.02-cagra-smallfix branch January 10, 2024 10:13
ChristinaZ pushed a commit to ChristinaZ/raft that referenced this pull request Jan 17, 2024
Fix for rapidsai#2072: CAGRA search is launching a thread per query in single-CTA. The maximum number of thread is 65535 so the `max_queries` auto selection should be bounded to this number.

Authors:
  - Micka (https://github.com/lowener)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#2081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp non-breaking Non-breaking change python
Projects
Development

Successfully merging this pull request may close these issues.

2 participants