Skip to content

Refactor arena_memory_resource to shared CCCL MR design - #2272

Merged
bdice merged 5 commits into
rapidsai:stagingfrom
bdice:detemplate-arena
Mar 6, 2026
Merged

bdice merged 5 commits into
rapidsai:stagingfrom
bdice:detemplate-arena

Conversation

@bdice

@bdice bdice commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • De-template arena_memory_resource by removing the Upstream template parameter
  • Split implementation into detail::arena_memory_resource_impl held via cuda::mr::shared_resource for reference-counted, copyable ownership
  • Retain the device_memory_resource legacy compatibility layer (do_allocate, do_deallocate, do_is_equal)
  • Update benchmarks, C++ tests, and Python (Cython) bindings to use the non-template arena_memory_resource

This follows the same pattern established in #2246, #2258, #2264, and #2265 for the other memory resources.

New files

File Contents
cpp/include/rmm/mr/detail/arena_memory_resource_impl.hpp detail::arena_memory_resource_impl class declaration
cpp/src/mr/detail/arena_memory_resource_impl.cpp Impl member function definitions
cpp/src/mr/arena_memory_resource.cpp Outer class constructor + delegating method definitions

Modified files

File Change
cpp/include/rmm/mr/arena_memory_resource.hpp De-template, shared_resource wrapping
cpp/CMakeLists.txt Add new .cpp source files
cpp/tests/mr/arena_mr_tests.cpp arena_memory_resource<device_memory_resource> → arena_memory_resource
cpp/tests/mr/mr_ref_arena_tests.cpp Add ArenaMRFixture + CcclMrRefTest/CcclMrRefAllocationTest/CcclMrRefTestMT instantiations
cpp/tests/mr/mr_ref_test.hpp Update make_arena() and arena_mr type alias
cpp/tests/mr/cccl_adaptor_tests.cpp Add arena static_assert + ArenaMRAdaptorTest
cpp/benchmarks/multi_stream_allocations/multi_stream_allocations_bench.cu Update make_arena()
cpp/benchmarks/random_allocations/random_allocations.cpp Update make_arena()
cpp/benchmarks/replay/replay.cpp Update make_arena()
python/rmm/rmm/librmm/memory_resource.pxd Remove [Upstream] template from arena_memory_resource
python/rmm/rmm/pylibrmm/memory_resource/_memory_resource.pyx Remove template instantiation syntax for arena

Remove the Upstream template parameter from arena_memory_resource and
split implementation into detail::arena_memory_resource_impl held via
cuda::mr::shared_resource for reference-counted ownership. The outer
class retains the device_memory_resource compatibility layer.

New files:
- cpp/include/rmm/mr/detail/arena_memory_resource_impl.hpp
- cpp/src/mr/detail/arena_memory_resource_impl.cpp
- cpp/src/mr/arena_memory_resource.cpp

Updates benchmarks, tests, and Python bindings to use the non-template
arena_memory_resource.
@bdice
bdice requested review from a team as code owners March 6, 2026 01:22
@bdice
bdice requested review from KyleFromNVIDIA and removed request for a team March 6, 2026 01:22
@bdice
bdice requested review from lamarrr and wence- and removed request for a team March 6, 2026 01:22
@bdice bdice added breaking Breaking change improvement Improvement / enhancement to an existing function labels Mar 6, 2026
@bdice bdice moved this to In Progress in RMM Project Board Mar 6, 2026
@bdice bdice self-assigned this Mar 6, 2026
bdice added 2 commits March 6, 2026 01:46
Use make_shared<arena_memory_resource>(...) directly instead of wrapping
in shared_ptr<device_memory_resource>{...}, matching the pool factories.
The power-law distribution and design-inspiration paragraphs were
accidentally removed during the detemplate refactor.

@bdice bdice left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Self-reviewed, all seems in line with other CCCL MR refactors. I'll admin-merge this once CI passes to keep the staging progress moving forward.

@bdice
bdice merged commit a615254 into rapidsai:staging Mar 6, 2026
77 of 79 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in RMM Project Board Mar 6, 2026
@bdice bdice mentioned this pull request Mar 10, 2026
51 tasks done
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.

1 participant