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

CAGRA graph optimizer: clamp rev_graph_count #1987

Merged

Conversation

tfeher
Copy link
Contributor

@tfeher tfeher commented Nov 13, 2023

This PR fixes a potential out of bounds access.

While building the reverse graph, we count the number of potential edges in rev_graph_count

const uint32_t pos = atomicAdd(rev_graph_count + dest_id, 1);
if (pos < degree) { rev_graph[pos + ((uint64_t)degree * dest_id)] = src_id; }

While we store only max output_graph_degree neighbors, the rev_graph_count can be larger than output_graph_degree. The loop that uses rev_graph is updated to take this limit into account.

@tfeher tfeher added bug Something isn't working non-breaking Non-breaking change Vector Search labels Nov 13, 2023
@tfeher tfeher requested a review from a team as a code owner November 13, 2023 11:08
@github-actions github-actions bot added the cpp label Nov 13, 2023
@tfeher tfeher requested a review from enp1s0 November 13, 2023 11:08
@tfeher tfeher self-assigned this Nov 13, 2023
@cjnolet
Copy link
Member

cjnolet commented Nov 13, 2023

/merge

@rapids-bot rapids-bot bot merged commit 9110531 into rapidsai:branch-23.12 Nov 13, 2023
58 checks passed
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 Vector Search
Projects
Development

Successfully merging this pull request may close these issues.

3 participants