Skip to content

[ENH] Consider switching to cuda::managed_memory_pool / cuda::pinned_memory_pool as the default managed/pinned resources #2976

Description

@achirkin

Raft supports pinned_mdarray and managed_mdarray along with associated container policies since 24.02
These are hard-coded to use cudaMallocHost cudaMallocManaged under the hood and have host-synchronous semantics.

There are a few places in raft and cuvs where we explicitly use these mdarrays (raft::make_pinned_xxx / raft::make_managed_xxx) for host-device communication.

PR #2968 introduces first-class raft resource objects allowing the user to explicitly set/replace the memory resources associated with the raft::resources handle. These are used under the hood in the mdarray constructor helpers. Hence they give the user explicit control over the pinned/managed memory allocation. By default, we use cuda::mr::legacy_pinned_memory_resource and cuda::mr::legacy_managed_memory_resource, which preserve the original sync behavior.

Now the question: shall we switch the default behavior to use cuda::pinned_memory_pool and cuda::managed_memory_pool when available? They are directly pluggable in place of the cuda::mr::legacy_xxx_memory_resource, but should yield better performance and stream-ordered semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Todo
    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions