Skip to content

Migrate stream APIs from rmm::cuda_stream_view to cuda::stream_ref - #5639

Open
bdice wants to merge 11 commits into
rapidsai:mainfrom
bdice:cuda-stream-ref
Open

Migrate stream APIs from rmm::cuda_stream_view to cuda::stream_ref#5639
bdice wants to merge 11 commits into
rapidsai:mainfrom
bdice:cuda-stream-ref

Conversation

@bdice

@bdice bdice commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Track the coordinated migration of stream APIs and call sites from rmm::cuda_stream_view to CCCL's cuda::stream_ref. This propagates cuda::stream_ref through RMM containers and memory resources, RAFT resource and handle APIs, downstream C++ interfaces, Python/Cython bindings, benchmarks, tests, and documentation.

This migrates affected cuGraph API signatures and call sites, including the MTMG handle stream accessor, while preserving cuda::stream_ref until a raw stream is required.

Depends on rapidsai/rmm#2372 and NVIDIA/raft#3129.

Tracked in rapidsai/build-planning#318.

Migrations

  • Pass cuda::stream_ref through stream pools, resource accessors, conditionals, and downstream APIs without converting to rmm::cuda_stream_view
  • Use cuda::stream_ref constructions for default/legacy/per-thread streams
    • rmm::cuda_stream_default ➡️ cuda::stream_ref{cudaStream_t{cudaStreamDefault}}
    • rmm::cuda_stream_legacy ➡️ cuda::stream_ref{cudaStreamLegacy}
    • rmm::cuda_stream_per_thread ➡️ cuda::stream_ref{cudaStreamPerThread}
  • Use .get() when calling an API that requires a raw cudaStream_t, including CUDA runtime, library, CUB, and legacy API boundaries (previously rmm::cuda_stream_view used value())
  • Use .sync() when synchronizing a cuda::stream_ref (previously rmm::cuda_stream_view used synchronize())
  • Update Cython declarations and call sites to pass stream references directly where supported

@copy-pr-bot

copy-pr-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

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.

@bdice bdice changed the title Use cuda::stream_ref for pooled streams Migrate stream APIs from rmm::cuda_stream_view to cuda::stream_ref Sep 2, 2026
@bdice
bdice marked this pull request as ready for review September 2, 2026 22:55
@bdice
bdice requested a review from a team as a code owner September 2, 2026 22:55
@bdice bdice added breaking Breaking change improvement Improvement / enhancement to an existing function labels Sep 3, 2026
rapids-bot Bot pushed a commit to rapidsai/cugraph-gnn that referenced this pull request Sep 3, 2026
)

## Summary

Track the coordinated migration of stream APIs and call sites from `rmm::cuda_stream_view` to CCCL's `cuda::stream_ref`. This propagates `cuda::stream_ref` through RMM containers and memory resources, RAFT resource and handle APIs, downstream C++ interfaces, Python/Cython bindings, benchmarks, tests, and documentation.

This updates the cuGraph-GNN developer guide to document `cuda::stream_ref` as the stream type used by stream-ordered operations.

Depends on rapidsai/cugraph#5639.

Tracked in rapidsai/build-planning#318.

## Migrations

- Pass `cuda::stream_ref` through stream pools, resource accessors, conditionals, and downstream APIs without converting to `rmm::cuda_stream_view`
- Use `cuda::stream_ref` constructions for default/legacy/per-thread streams
  - `rmm::cuda_stream_default` ➡️ `cuda::stream_ref{cudaStream_t{cudaStreamDefault}}`
  - `rmm::cuda_stream_legacy` ➡️ `cuda::stream_ref{cudaStreamLegacy}`
  - `rmm::cuda_stream_per_thread` ➡️ `cuda::stream_ref{cudaStreamPerThread}`
- Use `.get()` when calling an API that requires a raw `cudaStream_t`, including CUDA runtime, library, CUB, and legacy API boundaries (previously `rmm::cuda_stream_view` used `value()`)
- Use `.sync()` when synchronizing a `cuda::stream_ref` (previously `rmm::cuda_stream_view` used `synchronize()`)
- Update Cython declarations and call sites to pass stream references directly where supported

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Alex Barghi (https://github.com/alexbarghi-nv)

URL: #529

@ChuckHastings ChuckHastings left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Comment thread cpp/include/cugraph/mtmg/handle.hpp Outdated
Comment thread cpp/include/cugraph/prims/update_edge_src_dst_property.cuh Outdated
size_t mem_frugal_threshold, // take the memory frugal approach (instead of thrust::sort) if #
// elements to groupby is no smaller than this value
rmm::cuda_stream_view stream_view,
cuda::stream_ref stream_view,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have been mixing stream_view and stream. stream_view now sounds like a misnomer. Better use stream consistently?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cuda::stream_ref is still a non-owning stream view, and stream_view remains common across this codebase (159 declarations). I retained existing parameter names to keep this API migration from becoming a broad naming-only change.

Comment thread cpp/include/cugraph/utilities/shuffle_comm.cuh Outdated
Comment thread cpp/include/cugraph/prims/vertex_frontier.cuh Outdated
Comment thread cpp/include/cugraph/utilities/shuffle_comm.cuh Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change improvement Improvement / enhancement to an existing function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants