Replace O(N*degree^2) CPU dedup with GPU warp-ballot kernel - #2437
Draft
jamxia155 wants to merge 1 commit into
Draft
Replace O(N*degree^2) CPU dedup with GPU warp-ballot kernel#2437jamxia155 wants to merge 1 commit into
jamxia155 wants to merge 1 commit into
Conversation
The graph shrink step in GNND::build() copied the NN-descent output while removing duplicate and self-referencing neighbor IDs using a nested scan: for each of the N nodes, each of the `node_degree` candidates was checked against all already-placed entries, giving O(N*degree^2) CPU work that scales poorly with graph degree and dataset size. Replace with a GPU kernel (dedup_graph_kernel) that runs one warp per node. The warp scans InternalID_t neighbors in original order, using __ballot_sync for O(warp-width) duplicate detection, and fills any remaining slots with xorshift64 random nodes. Original neighbor order is preserved, avoiding the recall regression seen with sort-based approaches. The H2D/D2H transfers are O(N*degree) -- the same order as a single pass over the graph -- while the replaced CPU work is O(N*degree^2), so the transfers are dominated by the savings at any practical degree.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The graph shrink step in
GNND::build()copied the NN-descent output while removing duplicate and self-referencing neighbor IDs using a nested scan: for each of the N nodes, each of thenode_degreecandidates was checked against all already-placed entries, givingO(N*degree^2)CPU work that scales poorly with graph degree and dataset size.Replace with a GPU
dedup_graph_kernelthat runs one warp per node. The warp scans neighbors in original order, using__ballot_syncforO(warp-width)duplicate detection, and fills any remaining slots withxorshift64random nodes. The H2D/D2H transfers areO(N*degree)-- the same order as a single pass over the graph -- while the replaced CPU work isO(N*degree^2), so the transfers are dominated by the savings at any practical degree.Tested on 32-core AMD + H100 with
n_rows=2.5Mandgraph_degree=56, this change reduces runtime by about 6 seconds.