Skip to content

Migrate thrust_allocator to modern thrust::mr::allocator API#2204

Draft
bdice wants to merge 1 commit into
rapidsai:mainfrom
bdice:update-thrust-allocator-api
Draft

Migrate thrust_allocator to modern thrust::mr::allocator API#2204
bdice wants to merge 1 commit into
rapidsai:mainfrom
bdice:update-thrust-allocator-api

Conversation

@bdice
Copy link
Copy Markdown
Collaborator

@bdice bdice commented Jan 9, 2026

This PR contributes to issue #2193 by migrating rmm::mr::thrust_allocator from the deprecated thrust::device_malloc_allocator to the modern thrust::mr::allocator API.

Changes

  • Added rmm_thrust_device_resource: A thrust::mr::memory_resource adapter that wraps RMM's device_async_resource_ref with stream support
  • Migrated thrust_allocator: Now inherits from thrust::mr::allocator instead of the deprecated thrust::device_malloc_allocator
  • Fixed initialization order: Implemented thrust_allocator_resource_holder helper base class to ensure correct initialization order (resource before allocator base class)
  • Added device() accessor: For consistency with the resource API

This commit contributes to issue rapidsai#2193 by migrating
rmm::mr::thrust_allocator from the deprecated
thrust::device_malloc_allocator to the modern thrust::mr::allocator API.

Changes:
- Added rmm_thrust_device_resource: A thrust::mr::memory_resource adapter
  that wraps RMM's device_async_resource_ref with stream support
- Migrated thrust_allocator to inherit from thrust::mr::allocator instead
  of the deprecated thrust::device_malloc_allocator
- Implemented thrust_allocator_resource_holder helper base class to ensure
  correct initialization order (resource before allocator base class)
- Added device() accessor method for consistency

All existing API is preserved for backward compatibility. The allocator
remains stream-aware and properly manages per-allocator resource state.
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Jan 9, 2026

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.

@bdice
Copy link
Copy Markdown
Collaborator Author

bdice commented Jan 9, 2026

This is a low priority task and will need testing across all of RAPIDS before merging. This may slip to 26.04.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant