Skip to content

Modernize the uses of raft in cuVS#1837

Merged
rapids-bot[bot] merged 11 commits intorapidsai:mainfrom
achirkin:fix-modernize-raft-uses
Feb 25, 2026
Merged

Modernize the uses of raft in cuVS#1837
rapids-bot[bot] merged 11 commits intorapidsai:mainfrom
achirkin:fix-modernize-raft-uses

Conversation

@achirkin
Copy link
Contributor

A non-breaking src-only changes to modernize the use of raft primitives across cuVS source code. The general rule applied here is to prefer raft helpers taking raft::resources as an argument over other raft helpers over third-party libraries.

  • thrust::fill / thrust::fill_n → raft::matrix::fill
  • thrust::transform → raft::linalg::map
  • thrust::sequence / thrust::tabulate → raft::linalg::map_offset
  • raft::linalg::unaryOp / raft::linalg::binaryOp → raft::linalg::map
  • raft::linalg::add (pointer-based) → raft::linalg::add (mdspan-based)
  • raft::copy (pointer-based) → raft::copy (mdspan-based)
  • raft::update_device / raft::update_host → raft::copy (mdspan-based)
  • raft::linalg::rowNorm → raft::linalg::norm
  • raft::linalg::reduce (pointer-based) → raft::linalg::reduce (mdspan-based)
  • cudaMemsetAsync → raft::matrix::fill

The purpose of this PR is to improve the consistency in using the library code (even though sometimes at the cost of a bit more auxiliary code).
This is also a prerequisite to achieving dry run compliance in cuVS if we choose to merge that in rapidsai/raft#2961

@achirkin achirkin self-assigned this Feb 23, 2026
@achirkin achirkin requested a review from a team as a code owner February 23, 2026 17:33
@achirkin achirkin added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Feb 23, 2026
Copy link
Member

@dantegd dantegd left a comment

Choose a reason for hiding this comment

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

changes look good and comprehensive to me (pending green CI), just found one small place to nitpick :P

Copy link
Contributor

@tarang-jain tarang-jain left a comment

Choose a reason for hiding this comment

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

Thanks for the meticulous effort! A bunch of comments from my end.

@achirkin
Copy link
Contributor Author

Thanks @tarang-jain for the suggestions! all addressed

@achirkin achirkin requested a review from a team as a code owner February 24, 2026 15:08
Copy link
Member

@divyegala divyegala left a comment

Choose a reason for hiding this comment

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

The FAISS patch should be created in a new file for 26.04.

@achirkin achirkin force-pushed the fix-modernize-raft-uses branch from 94713e2 to f8fb4d7 Compare February 25, 2026 05:32
@divyegala divyegala dismissed their stale review February 25, 2026 05:51

Not relevant anymore.

@achirkin
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit d7a28aa into rapidsai:main Feb 25, 2026
149 of 151 checks passed
tfeher pushed a commit to Stardust-SJF/cuvs_rabitq that referenced this pull request Mar 3, 2026
A non-breaking src-only changes to modernize the use of raft primitives across cuVS source code. The general rule applied here is to prefer raft helpers taking `raft::resources` as an argument over other raft helpers over third-party libraries.

- thrust::fill / thrust::fill_n → raft::matrix::fill
- thrust::transform → raft::linalg::map
- thrust::sequence / thrust::tabulate → raft::linalg::map_offset
- raft::linalg::unaryOp / raft::linalg::binaryOp → raft::linalg::map
- raft::linalg::add (pointer-based) → raft::linalg::add (mdspan-based)
- raft::copy (pointer-based) → raft::copy (mdspan-based)
- raft::update_device / raft::update_host → raft::copy (mdspan-based)
- raft::linalg::rowNorm → raft::linalg::norm
- raft::linalg::reduce (pointer-based) → raft::linalg::reduce (mdspan-based)
- cudaMemsetAsync → raft::matrix::fill

The purpose of this PR is to improve the consistency in using the library code (even though sometimes at the cost of a bit more auxiliary code).
This is also a prerequisite to achieving dry run compliance in cuVS if we choose to merge that in rapidsai/raft#2961

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: rapidsai#1837
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Development

Successfully merging this pull request may close these issues.

4 participants