Repository navigation
Refactor tracking, statistics, and aligned resource adaptors to shared CCCL MR design - #2265
Merged
Merged
Conversation
…d CCCL MR design Converts tracking_resource_adaptor, statistics_resource_adaptor, and aligned_resource_adaptor from header-only class templates to non-template classes backed by detail::*_impl held via cuda::mr::shared_resource, following the pattern established by logging_resource_adaptor (rapidsai#2246). Part of rapidsai#2011.
|
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. |
Collaborator
Author
|
/ok to test |
bdice
commented
Feb 26, 2026
| * @brief Construct an aligned resource adaptor using `upstream` to satisfy allocation requests. | ||
| * | ||
| * @throws rmm::logic_error if `alignment` is not a power of 2 | ||
| * @brief Compare two adaptors for equality (shared-impl identity). |
Collaborator
Author
There was a problem hiding this comment.
Once the legacy code is removed, any remaining equality operators should probably say they have the same upstream and adaptor state -- or something that is simpler than the impl identity.
bdice
commented
Feb 26, 2026
| static_assert(rmm::detail::polyfill::resource_with<rmm::mr::tracking_resource_adaptor<cuda_mr>, | ||
| cuda::mr::device_accessible>); | ||
|
|
||
| // static property checks — converted (non-template) adaptors |
Collaborator
Author
There was a problem hiding this comment.
These tests need to move to cccl_adaptor_tests.cpp.
bdice
marked this pull request as ready for review
February 26, 2026 17:54
bdice
requested review from
harrism and
rongou
and removed request for
a team
February 26, 2026 17:54
Collaborator
Author
|
I'm going to merge this once CI passes. I self-reviewed and this follows the same patterns as the other CCCL MR migrations. |
rongou
approved these changes
Feb 26, 2026
bdice
added a commit
that referenced
this pull request
Mar 6, 2026
## 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 |
51 tasks done
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts
tracking_resource_adaptor,statistics_resource_adaptor, andaligned_resource_adaptorfrom header-only class templates to non-template classes backed by adetail::*_implheld viacuda::mr::shared_resource, following the pattern established bylogging_resource_adaptor(#2246).Part of #2011.
Changes
New files
cpp/include/rmm/mr/detail/tracking_resource_adaptor_impl.hppcpp/include/rmm/mr/detail/statistics_resource_adaptor_impl.hppcpp/include/rmm/mr/detail/aligned_resource_adaptor_impl.hppcpp/src/mr/detail/tracking_resource_adaptor_impl.cppcpp/src/mr/detail/statistics_resource_adaptor_impl.cppcpp/src/mr/detail/aligned_resource_adaptor_impl.cppcpp/src/mr/tracking_resource_adaptor.cppcpp/src/mr/statistics_resource_adaptor.cppcpp/src/mr/aligned_resource_adaptor.cppcpp/tests/mr/mr_ref_tracking_tests.cpp—CcclMrRefTest/CcclMrRefAllocationTest/CcclMrRefTestMTinstantiationscpp/tests/mr/mr_ref_statistics_tests.cpp— samecpp/tests/mr/mr_ref_aligned_tests.cpp—CcclMrRefTest/CcclMrRefAllocationTestModified files
shared_resourceinheritance,get_propertyfriend,static_assertconcept checkcpp/CMakeLists.txt— new.cppsources addedcpp/tests/CMakeLists.txt—TRACKING_MR_REF_TEST,STATISTICS_MR_REF_TEST,ALIGNED_MR_REF_TESTtargetscpp/tests/mr/adaptor_tests.cpp— removed template/pointer-based aligned tests, updatedowning_wrapperto uselimiting_resource_adaptorcpp/tests/mr/tracking_mr_tests.cpp,statistics_mr_tests.cpp,aligned_mr_tests.cpp— template aliases removed, null/pointer constructions replaced, stacked-adaptor tests usedevice_async_resource_ref{mr}to avoid copy-constructioncpp/tests/mr/cccl_adaptor_tests.cpp— all three new adaptors added to the typed shared-ownership suitepython/rmm/rmm/librmm/memory_resource.pxd— template parameters removed fromstatistics_resource_adaptorandtracking_resource_adaptorpython/rmm/rmm/pylibrmm/memory_resource/_memory_resource.pyx— template instantiation syntax removedChecklist
detail/*_impl.hpp(class declaration)src/mr/detail/*_impl.cpp(member definitions)src/mr/*_adaptor.cpp(outer class definitions)get_property,static_assert)CMakeLists.txt.pxdand.pyxpre-commit run --all-filesbuild-rmm-cpp -j0 && test-rmm-cpp