Skip to content

Migrate from rmm::cuda_stream_view to cuda::stream_ref - #5014

Open
bdice wants to merge 6 commits into
NVIDIA:mainfrom
bdice:cuda-stream-ref
Open

Migrate from rmm::cuda_stream_view to cuda::stream_ref#5014
bdice wants to merge 6 commits into
NVIDIA:mainfrom
bdice:cuda-stream-ref

Conversation

@bdice

@bdice bdice commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Migrate all JNI uses of rmm::cuda_stream_view to cuda::stream_ref.
  • Replace the legacy stream-view header with <cuda/stream> and use stream.get() and stream.sync() with the new API.

Closes NVIDIA/cudf-spark#15685

Related to NVIDIA/cudf#23636

@bdice bdice changed the title Replace RMM CUDA stream views with stream refs Migrate from rmm::cuda_stream_view to cuda::stream_ref Aug 17, 2026
@sameerz
sameerz requested a review from a team August 17, 2026 21:51
@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR migrates native CUDA stream handling from rmm::cuda_stream_view to cuda::stream_ref across GPU primitives, tests, and benchmarks.

  • Updates native interfaces and raw CUDA calls to use cuda::stream_ref, stream.get(), and stream.sync().
  • Advances the cuDF submodule and native dependency pins to support the migrated API.
  • Preserves the existing JNI-facing operation and result contracts.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains in the reviewed follow-up scope.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/cpp/src/bloom_filter.cu Migrates stream parameters, raw CUDA operations, kernel launches, and explicit synchronization to the new stream API without changing Bloom filter behavior.
src/main/cpp/src/protobuf/protobuf_kernels.cu Updates Protobuf CUDA kernel plumbing to accept and propagate cuda::stream_ref.
src/main/cpp/src/row_conversion.cu Migrates row-conversion stream propagation and raw stream access while retaining existing data-conversion logic.
src/main/cpp/src/shuffle_split.cu Updates shuffle stream interfaces and CUDA operation submission to the new stream representation.
src/main/cpp/src/cast_string.hpp Changes public native helper declarations and defaults from the legacy RMM stream view to cuda::stream_ref.
thirdparty/cudf-pins/versions.json Updates pinned native dependencies alongside the cuDF revision used by the stream API migration.
thirdparty/cudf Advances the cuDF submodule revision supporting the migrated native stream interfaces.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[JNI and native callers] --> B[cuda::stream_ref]
  B --> C[cuDF and RMM operations]
  B --> D[Raw CUDA APIs via stream.get]
  B --> E[Host synchronization via stream.sync]
  F[cuDF submodule and dependency pins] --> C
  F --> D
Loading

Reviews (7): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Signed-off-by: Bradley Dice <bdice@bradleydice.com>
@mythrocks

Copy link
Copy Markdown
Collaborator

Build

@mythrocks

Copy link
Copy Markdown
Collaborator

For the record, the immediate problem of the build-error in hll++ was already addressed by @vyasr as part of #5003. That explains why I didn't run into this failure when testing #5012. (I thought I might've missed something when merging #5003 on Friday.)

All that said, switching to the new cuda::stream_ref is still valuable.

ttnghia
ttnghia previously approved these changes Aug 18, 2026
Comment thread src/main/cpp/src/bloom_filter.cu Outdated
Resolve the stream_ref conflicts to match d4f603d9027baa31556a2522baa6ca2e0231d5a0, including thirdparty/cudf at 5316f3696226.
Signed-off-by: MithunR <mithunr@nvidia.com>
@mythrocks

Copy link
Copy Markdown
Collaborator

Build

@mythrocks

Copy link
Copy Markdown
Collaborator

I have resolved conflicts, and updated to latest.

@mythrocks

Copy link
Copy Markdown
Collaborator

Now that I've laid a hand on it, I'm not sure if I can approve this PR. 🤦

@thirtiseven

Copy link
Copy Markdown
Collaborator

pre-commit.ci autofix

Comment thread thirdparty/cudf-pins/versions.json Outdated
"always_download" : true,
"git_shallow" : false,
"git_tag" : "9af39e27161d680083b8c309b9040f8c944d68ad",
"git_tag" : "26bd4831585ce34294bce6bb3324d648cfd31747",

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.

why is kvikio tag updated?

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.

That should not have been. That's a rogue edit. I'm testing with a corrected version.

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.

Thank you for catching that, @pmattione-nvidia.

@igorpeshansky

Copy link
Copy Markdown
Collaborator

Looks like there are still merge conflicts?..

@mythrocks mythrocks self-assigned this Aug 27, 2026
@mythrocks

Copy link
Copy Markdown
Collaborator

Looks like there are still merge conflicts?

Yep. It's a little surprising. I'm sorting them out now.

@mythrocks

Copy link
Copy Markdown
Collaborator

It appears the CI failure results from NVIDIA/cudf#23803, and is being addressed in NVIDIA/cudf#23862.

I'll update the thirdparty/cudf pointer to exclude NVIDIA/cudf/pull/23803.

1. Moved thirdparty/cudf to exclude NVIDIA/cudf/pull/23803.
2. Corrected kvikio version tag.

Signed-off-by: MithunR <mithunr@nvidia.com>
@mythrocks

Copy link
Copy Markdown
Collaborator

Build

@mythrocks

Copy link
Copy Markdown
Collaborator

Sorry this took so long. thirdparty/cudf kept moving, confusing the merge.

@igorpeshansky / @pmattione-nvidia: Would either of you mind having another look?

void generate_buckets(GeneratorFunc generator,
cudf::mutable_column_view output,
rmm::cuda_stream_view stream)
cuda::stream_ref stream)

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.

[Optional] Do we want to #include <cuda/stream> (IWYU)? Or do we not add one if we pick it up transitively through our own header?

Also in iceberg/iceberg_datetime_util.cu, iceberg/iceberg_truncate.cu, protobuf/protobuf.cu, protobuf/protobuf_builders.cu, protobuf/protobuf_kernels.cu, aggregation64_utils.cu, case_when.cu, cast_string.cu, cast_string_to_float.cu, charset_decode.cu, datetime_rebase.cu, decimal_utils.cu, exception_with_row_index_utilities.cu, get_json_object.cu, histogram.cu, map.cu, map_zip_with_utils.cu, multiply.cu, number_converter.cu, uuid.cu.

Comment thread thirdparty/cudf

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.

This is behind main. I realize you wanted to rewind past NVIDIA/cudf#23803 (per #5014 (comment)), but since the submodule-sync bot advanced it there already, nothing stops it from doing that again, so it won't protect main from breakage. But I guess this is independent of the NVIDIA/cudf#23862 fix, so I won't hold the PR on that.

Ditto for the rmm downgrade in thirdparty/cudf-pins/versions.json

int const start,
int const end,
rmm::cuda_stream_view stream = rmm::cuda_stream_default,
cuda::stream_ref stream = rmm::cuda_stream_default,

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.

Do we also want to switch from rmm::cuda_stream_default to cudf::get_default_stream() here?

Suggested change
cuda::stream_ref stream = rmm::cuda_stream_default,
cuda::stream_ref stream = cudf::get_default_stream(),

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.

Yeah, I can fix this too.

@vyasr

vyasr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

JFYI I'm working on migrating cudf::get_default_stream to cuda::stream_ref as well in NVIDIA/cudf#23770. I won't merge anything there that breaks Spark until this PR is solidified though since it looks like we can get this PR green without that one and then just do one final migration after.

@vyasr

vyasr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

My agent opened #5053 as part of getting NVIDIA/cudf#23770 working, feel free to grab any changes you need from there or just switch to that PR if you would like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants