Skip to content

Use CCCL cuda::mr resource aliases instead of RMM aliases #337

Description

@bdice

Summary

RAPIDS libraries name memory resources in their public APIs through RMM aliases such as rmm::device_async_resource_ref. These aliases are thin names over CCCL types (cuda::mr::resource_ref<...>), but spelling them through RMM forces every public header to include <rmm/resource_ref.hpp> and keeps RMM in the API surface of every library.

CCCL now provides named aliases in cuda::mr (NVIDIA/cccl#11751, available in CCCL 3.6 via rapidsai/rapids-cmake#1097). Every library should use these aliases directly, with no per-library aliases. This removes RMM headers from public APIs and gives all libraries one shared spelling, while leaving the mangled symbols unchanged, since an alias is not part of the ABI.

This is part of #321 ("Use CCCL memory resources instead of rmm memory resources") and rapidsai/rmm#2455.

Aliases

Replace With CCCL type
rmm::device_async_resource_ref cuda::mr::device_resource_ref cuda::mr::resource_ref<cuda::mr::device_accessible>
rmm::host_async_resource_ref cuda::mr::host_resource_ref cuda::mr::resource_ref<cuda::mr::host_accessible>
rmm::host_device_async_resource_ref cuda::mr::host_device_resource_ref cuda::mr::resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible>
cuda::mr::any_resource<cuda::mr::device_accessible> cuda::mr::any_device_resource
cuda::mr::any_resource<cuda::mr::host_accessible> cuda::mr::any_host_resource
cuda::mr::any_resource<cuda::mr::host_accessible, cuda::mr::device_accessible> cuda::mr::any_host_device_resource

Plain names are stream-ordered, matching CCCL where resource_ref is stream-ordered and synchronous_resource_ref is the explicit exception. CCCL does not provide synchronous aliases. Synchronous refs are spelled as cuda::mr::synchronous_resource_ref<...>, except for RAFT's host-only PMR/mmap resources, which keep raft::mr::synchronous_host_resource_ref.

RAFT migrates its pinned/managed resource APIs to cuda::mr::host_device_resource_ref and cuda::mr::any_host_device_resource. Its sync-only CCCL legacy defaults are wrapped in cuda::mr::synchronous_resource_adapter. Existing host-device aliases are deprecated and now name the stream-ordered types; custom sync-only resources require an adapter. The host-only raft::mr::host_resource_ref remains synchronous under the explicit raft::mr::synchronous_host_resource_ref name, with the old name deprecated.

RMM uses the CCCL aliases internally, and deprecates and removes its own aliases (rapidsai/rmm#2562).

Migration per library

Each library does the following in a single PR:

  • Replace rmm::*resource_ref and cuda::mr::any_resource<...> uses with the cuda::mr:: aliases in C++ (public headers, sources, tests, benchmarks, examples).
  • Replace #include <rmm/resource_ref.hpp> with #include <cuda/memory_resource>.
  • Where the library has Cython bindings, stop importing device_async_resource_ref from rmm.librmm.memory_resource, and carry a library-owned Cython declaration of the ref (a copy of RMM's default-constructible wrapper, retargeted at cuda::mr::device_resource_ref).

Validation: the exported symbols of the library's shared object are identical before and after.

Pull requests

rmm::*resource_ref uses in each repository (approximate, from main at the time of writing):

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions