Repository navigation
Improve nvtext::jaccard_index performance using cuco shared-memory sets - #24698
Draft
davidwendt wants to merge 19 commits into
Draft
davidwendt wants to merge 19 commits into
davidwendt wants to merge 19 commits into
Conversation
Replaces the segmented-sort based unique/intersect counting with cuco static_set_refs in shared memory. Rows that fit are processed with a warp per row. Larger rows are partitioned by the high bits of their substring hashes and each (row, partition) is processed by a block. Also updates the benchmark so the input pairs share common text and includes longer rows, and adds a test for long rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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. |
# Conflicts: # cpp/src/text/jaccard.cu
Contributor
Author
|
/ok to test |
Contributor
Author
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Contributor
Author
|
/ok to test |
Replaces __popc with cuda::std::popcount, names the hash bit width used by partition_of, and documents why cub is used for the block-wide collectives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
/ok to test |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
/ok to test |
# Conflicts: # cpp/src/text/jaccard.cu
Contributor
Author
|
/ok to test |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
/ok to test |
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.
Description
Improves the performance of
nvtext::jaccard_indexby replacing the segmented-sort based counting of unique and intersecting substring hashes with cucostatic_set_refsets in shared memory.The substring hashes for each row are still computed once. The hash kernel now compacts the hashes using a warp ballot instead of a serial copy by lane 0. Each row is then counted by one of two kernels:
This removes the CUB segmented sort, which also removes the workaround for sorting more than 2B elements in sections.
A hash value of 0 is now stored as 1, since 0 is used as the empty-slot sentinel. Previously, substrings that hashed to 0 were dropped and their slot in the row was left uninitialized.
The benchmark is updated so that each pair of rows shares half of its text, so the intersection counts are no longer always 0. It also adds row widths of 8192 and 32768 bytes to measure long rows, and skips configurations larger than 1GB. A new gtest compares the results for rows of up to 100K characters against a host reference implementation.
Benchmark results on an RTX A6000 (
substring_width=5):The large improvement at 512 is because the CUB segmented sort handles segments of a few hundred items poorly. Peak memory is about half of before when all rows fit in a warp's sets, and about the same otherwise.
Checklist
🤖 Generated with Claude Code