-
Notifications
You must be signed in to change notification settings - Fork 184
CosineExpanded Distance Metric for CAGRA #197
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
Merged
rapids-bot
merged 113 commits into
rapidsai:branch-25.12
from
tarang-jain:cagra-dist-metric
Oct 3, 2025
Merged
Changes from 4 commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
07dbefe
initial
tarang-jain b5c1f2c
Merge branch 'branch-24.08' of https://github.com/rapidsai/cuvs into …
tarang-jain 2387a15
Merge branch 'branch-24.08' of https://github.com/rapidsai/cuvs into …
tarang-jain 6156cf5
update postprocess_distances
tarang-jain 79de8a8
resolve merge conflicts
tarang-jain cff7494
update tests
tarang-jain a38b92b
update instantiations
tarang-jain 0e1c980
re-update cagra-search
tarang-jain 2f19510
corrections
tarang-jain 93a9944
correct
tarang-jain c732eca
correct query normalization
tarang-jain ccfda68
correct template type
tarang-jain 954e417
use ip dist_op
tarang-jain 7dd97fe
cleanup
tarang-jain b753ceb
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 56a2a81
cleanup
tarang-jain c166424
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain 6cddce9
style
tarang-jain 7ca1936
only float and half
tarang-jain 8586fc4
compute dataset norm
tarang-jain 8e185dd
fix errors
tarang-jain a828f7d
compilation errors
tarang-jain c148ac6
fix compilation errors
tarang-jain 9bc030b
compilation errors
tarang-jain f292a49
error instead of warning
tarang-jain 667c2bb
fix error
tarang-jain b7fe9ec
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 4a20ade
Merge branch 'branch-25.10' into cagra-dist-metric
cjnolet 290fc18
fix compilation;add cmake targets for spec
tarang-jain 59b6333
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain 91a3306
debug
tarang-jain 2a9789e
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 9fe270f
everything seems to be working for cosine metric
tarang-jain 002dbf7
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 40a392a
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain b7be4fe
move norm computation to helper
tarang-jain a24ba7c
separate out compute_dataset_norms;style
tarang-jain 32f02bc
rm log statements
tarang-jain d85f526
cmake c flags,copyright
tarang-jain b56931f
rm extra files
tarang-jain 40fcdab
cleanup docs'rm unused headers
tarang-jain ffb4d8d
assertion
tarang-jain 2d7bd0d
cleanup tests
tarang-jain abb2e10
fix bad optional access
tarang-jain 137c5c8
update python tests
tarang-jain 684b465
update python tests
tarang-jain 12d6d31
fix failing py tests
tarang-jain b871a80
style
tarang-jain 926dc39
allow nnd and interative
tarang-jain 5f52b84
compute_distance types for uint8 and int8
tarang-jain 0ce20c7
clang format
tarang-jain b62c55c
add int8 and uint8 src files to CMakeLists.txt
tarang-jain d673179
update norm computation for iterative
tarang-jain f88a4ec
fix norm scaling
tarang-jain 30d3882
style
tarang-jain 40880ef
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 0b5c183
compose_op with scale
tarang-jain dd9bb33
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 7ee4eaf
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain 9aae03b
correct test skips
tarang-jain a1f0689
compute scaled norms
tarang-jain 215cbc5
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain c660038
debug
tarang-jain 5731bd8
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain 1084bc9
checkzero div
tarang-jain e6faf97
update tests; rm iterative
tarang-jain 13431cb
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 6e6bfb2
update skip conditions
tarang-jain 7650ef5
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain ffd8d44
shorten diff
tarang-jain 134b257
rm debug prints;docs
tarang-jain 9507cf6
rm double computation of norms
tarang-jain b01d54f
rm unused header
tarang-jain e548e09
rm set_dataset_norms;simplify compute_dataset_norms
tarang-jain 7ec1263
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 03e2f79
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain eb94316
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain fcb0c8e
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain b3bef25
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain d6ddce9
Merge branch 'branch-25.10' into cagra-dist-metric
cjnolet 38e2549
compute_dataset_norms private function
tarang-jain 9424bf6
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain 538d792
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain ca0b7c2
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 2e6fe2f
update cagra python test
tarang-jain de4fbdc
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 2222009
Update cpp/src/neighbors/cagra.cuh
tarang-jain f180794
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 0b9c9e1
deallocate norms
tarang-jain 2e60619
pull origin
tarang-jain fc7fdde
ivfpq cosine support for int types
tarang-jain 66adf7b
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 2f51b66
rm gtest filter for ivfpq
tarang-jain 405c21f
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain 9080462
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 5a7a694
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 887d82b
Update cpp/src/neighbors/ivf_pq/ivf_pq_build.cuh
tarang-jain d4d2cff
style
tarang-jain c0801ac
update cagra tests
tarang-jain accd841
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 1c33e17
fix cpp warning
tarang-jain 5da970a
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 544dd8d
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain eec8c04
update tests
tarang-jain b416b81
Merge branch 'cagra-dist-metric' of https://github.com/tarang-jain/cu…
tarang-jain c5089f7
update tests
tarang-jain d689129
fix syntax
tarang-jain a6c6592
fix compilation errors
tarang-jain 99f1317
fix cosine docstring
tarang-jain c17f380
fix cosine docstring
tarang-jain f4c8d82
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain da6ea75
Merge branch 'branch-25.10' into cagra-dist-metric
tarang-jain 883d368
Merge branch 'branch-25.12' into cagra-dist-metric
tarang-jain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tarang-jain, a heads up here: #296 does a major refactoring of related code; let's have a look together how we can proceed with this PR once you're back to it, ok?
I have similar performance concerns as the ones we discussed on IVF-PQ; maybe it makes sense to keep the dataset normalized for cosine distance (and reuse the inner-product code path)?
Then we can either normalize the query at the time we copy it to the shared memory (pre-processing) or divide by the query norm at the post-processing/filtering step at the end of the kernel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored this PR to do the divide by query norm at the very end (postprocessing stage)-