-
Notifications
You must be signed in to change notification settings - Fork 245
Description
Delete cccl_adaptors.hpp and use raw CCCL resource_ref types
Part of #2011. Depends on removal of bridge infrastructure (#2296).
Problem
After #2296, device_memory_resource and its bridge infrastructure are deleted,
but RMM still uses wrapper types from cccl_adaptors.hpp instead of CCCL's
native resource_ref and any_resource types directly. Three issues remain:
-
cccl_adaptors.hppstill definescccl_resource_ref<T>and
cccl_async_resource_ref<T>wrappers that add an unnecessary indirection
layer. With no DMR compatibility needed, these wrappers serve no purpose. -
CCCL #8037 recursive constraint cycle: When a class has a 1-arg
constructor takingresource_reforany_resource, checking
is_move_constructible<Class>recurses infinitely. This must be fixed with
SFINAE on 1-arg constructors beforecccl_adaptors.hppcan be deleted. -
polymorphic_allocatorandthrust_allocatorstoreresource_ref
internally but should storeany_resourceto be self-contained owning types.
Goal
After this work:
cccl_adaptors.hppis deletedresource_ref.hppcontains direct type aliases to CCCL types:using device_async_resource_ref = cuda::mr::resource_ref<cuda::mr::device_accessible>;- All 1-arg constructors taking
resource_reforany_resourceuse SFINAE to
exclude the self type (CCCL #8037 workaround) polymorphic_allocatorandthrust_allocatorstoreany_resourcemembersdevice_check_resource_adaptorstoresany_resourcemember
Branch
delete-cccl-adaptors (based on delete-device-memory-resource)
9 commits (#2296's 5 + 4):
- Commits from [FEA] Remove bridge infrastructure and device_memory_resource #2296 (see that issue)
cfbbaf13Use template constructors with SFINAE to break CCCL #8037 recursive constraint cycle (49 files)cfc294d1Change polymorphic_allocator, thrust_allocator, and device_check_resource_adaptor to store any_resource members (4 files)cf79ae18Delete cccl_adaptors.hpp and use raw CCCL resource_ref types (4 files)8a3dfa67Suppress nvcc host/device diagnostic in multi_stream_allocations benchmark (1 file)
Tasks
1. Add SFINAE to 1-arg constructors (CCCL #8037 workaround)
All memory resources with a 1-arg constructor taking resource_ref or
any_resource need a template SFINAE guard to exclude construction from the
self type, preventing infinite recursion in is_move_constructible checks.
49 files across cpp/include/rmm/mr/ and impl files.
Pattern:
// Before:
explicit arena_memory_resource(device_async_resource_ref upstream, ...);
// After:
template <typename T = device_async_resource_ref,
std::enable_if_t<!std::is_same_v<std::remove_cvref_t<T>,
arena_memory_resource>, int> = 0>
explicit arena_memory_resource(T&& upstream, ...);2. Change allocators to store any_resource members
Files:
cpp/include/rmm/mr/polymorphic_allocator.hppcpp/tests/mr/thrust_allocator_tests.cu(thrust_allocator)cpp/tests/device_check_resource_adaptor.hpp
These types currently store resource_ref (non-owning) internally. Change to
any_resource (owning) so they are self-contained.
3. Delete cccl_adaptors.hpp and simplify resource_ref.hpp
Files:
- Delete
cpp/include/rmm/detail/cccl_adaptors.hpp - Simplify
cpp/include/rmm/resource_ref.hppto direct CCCL type aliases - Update
cpp/tests/mr/cccl_adaptor_tests.cpp
Replace all 6 type aliases:
| RMM alias | Final definition |
|---|---|
device_resource_ref |
cuda::mr::synchronous_resource_ref<cuda::mr::device_accessible> |
device_async_resource_ref |
cuda::mr::resource_ref<cuda::mr::device_accessible> |
host_resource_ref |
cuda::mr::synchronous_resource_ref<cuda::mr::host_accessible> |
host_async_resource_ref |
cuda::mr::resource_ref<cuda::mr::host_accessible> |
host_device_resource_ref |
cuda::mr::synchronous_resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible> |
host_device_async_resource_ref |
cuda::mr::resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible> |
4. Suppress nvcc host/device diagnostic in .cu benchmark
File: cpp/benchmarks/multi_stream_allocations/multi_stream_allocations_bench.cu
The any_resource internals use __host__ __device__ functions that call
shared_resource copy/move constructors which are __host__ only. Add
#pragma nv_diag_suppress 20011 since the factory functions are only called
from host code.
Validation
-
build-rmm-cpp -j0succeeds (with-DBUILD_BENCHMARKS=ON) - All 103 C++ tests pass (
test-rmm-cpp) -
build-rmm-python -j0succeeds - All 1781 Python tests pass (
test-rmm-python) grep -r cccl_adaptors cpp/returns no resultsgrep -r cccl_resource_ref cpp/returns no resultsgrep -r cccl_async_resource_ref cpp/returns no results
References
- Depends on [FEA] Remove bridge infrastructure and device_memory_resource #2296 (delete device_memory_resource and bridge infrastructure)
- [FEA] Remove device_memory_resource inheritance from all C++ memory resources #2295 (remove DMR inheritance)
- [FEA] Support memory resources from CCCL 3.2 #2011 (parent tracking issue)
- CCCL #8037 (recursive constraint cycle bug)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status