Skip to content

Remove bridge infrastructure and device_memory_resource#2324

Merged
bdice merged 4 commits intorapidsai:stagingfrom
bdice:delete-device-memory-resource
Mar 25, 2026
Merged

Remove bridge infrastructure and device_memory_resource#2324
bdice merged 4 commits intorapidsai:stagingfrom
bdice:delete-device-memory-resource

Conversation

@bdice
Copy link
Collaborator

@bdice bdice commented Mar 20, 2026

Summary

  • Delete device_memory_resource.hpp and device_memory_resource_view.hpp
  • Remove pointer-based per_device_resource APIs and bridge helpers
  • Simplify cccl_adaptors.hpp (remove DMR bridge code, retain wrapper for deletion in a follow-up)
  • Rewrite test mock resources (mock_resource.hpp, device_check_resource_adaptor.hpp) to use CCCL concepts directly
  • Update callback_memory_resource, aligned, arena, and failure_callback tests

Closes #2296
Part of #2011

@copy-pr-bot
Copy link

copy-pr-bot bot commented Mar 20, 2026

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.

Delete device_memory_resource.hpp and device_memory_resource_view.hpp.
Strip DMR bridge code from cccl_adaptors.hpp, keeping shared_resource_cast
wrappers. Inline do_allocate/do_deallocate into allocate/deallocate in
stream_ordered_memory_resource. Convert benchmarks from shared_ptr<DMR> to
any_device_resource. Rewrite test mocks to satisfy CCCL concepts directly,
with copyable forwarding wrappers to work around basic_any type-erasure
limitations with GMock types. Replace reinterpret_cast stream constructions
with cuda_stream_view{}.
@bdice bdice force-pushed the delete-device-memory-resource branch from f8c7621 to 6d1e1ee Compare March 24, 2026 23:40
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Goodbye friend, you've been a great header for so many applications. 🫶

@bdice bdice force-pushed the delete-device-memory-resource branch from 454e3ad to 7f2b7f1 Compare March 25, 2026 00:09
Copy link
Collaborator Author

@bdice bdice left a comment

Choose a reason for hiding this comment

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

There are some test issues to resolve before merging.

@bdice bdice marked this pull request as ready for review March 25, 2026 00:11
@bdice bdice requested a review from a team as a code owner March 25, 2026 00:11
@bdice bdice requested review from davidwendt and wence- and removed request for a team, davidwendt and wence- March 25, 2026 00:11
@bdice bdice requested a review from a team as a code owner March 25, 2026 01:17
@bdice bdice requested review from miscco and removed request for a team March 25, 2026 01:17
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Mostly good with one comment around the alignment propagation

@@ -83,11 +80,11 @@ inline constexpr bool is_cccl_async_resource_ref_v<cccl_async_resource_ref<R>> =

/**
* @brief A wrapper around CCCL synchronous_resource_ref that adds compatibility with
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Do these shims go away completely in a followup?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, #2325.

Comment on lines -158 to -161
RMM_EXPECTS(
alignment <= rmm::CUDA_ALLOCATION_ALIGNMENT && rmm::is_supported_alignment(alignment),
"Alignment must be less than or equal to 256 and a power of two",
rmm::bad_alloc);
Copy link
Contributor

Choose a reason for hiding this comment

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

Note (probably followup). Previously every allocation with a requested alignment would go through this method, giving us a central place to raise if the requested alignment was not satisfiable.

Now that this indirection is gone we need to:

  1. Make sure that all MRs explicitly pass alignment through to any upstream (not currently done today)
  2. Ensure all "leaf" MRs validate the alignment parameter.

Point (1) should not be done by the aligned resource adaptor (the whole point is it can change the alignment), but should be done by everyone else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, excellent callout. I knew this problem existed but I've been deferring on fixing it. There are a bunch of issues related to alignment already, and I planned to tackle it as a part of those. For now I filed a new issue issue #2336 to ensure this isn't forgotten.

@bdice bdice merged commit bee03d6 into rapidsai:staging Mar 25, 2026
84 of 85 checks passed
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

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants