Skip to content

Store any_resource in device_uvector_policy - #2917

Closed
bdice wants to merge 2 commits into
NVIDIA:mainfrom
bdice:any-resource
Closed

Store any_resource in device_uvector_policy#2917
bdice wants to merge 2 commits into
NVIDIA:mainfrom
bdice:any-resource

Conversation

@bdice

@bdice bdice commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Part of rapidsai/rmm#2011.

Depends on rapidsai/rmm#2200.

Change device_uvector_policy::mr_ from device_async_resource_ref to cuda::mr::any_resource<cuda::mr::device_accessible>.

This ensures the container policy owns its memory resource, preventing use-after-free if the original resource is destroyed while the policy still exists.

Change device_uvector_policy::mr_ from device_async_resource_ref to
cuda::mr::any_resource<cuda::mr::device_accessible>.

This ensures the container policy owns its memory resource, preventing
use-after-free if the original resource is destroyed while the policy
still exists.
@copy-pr-bot

copy-pr-bot Bot commented Jan 8, 2026

Copy link
Copy Markdown

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
bdice marked this pull request as ready for review January 10, 2026 15:10
@bdice
bdice requested a review from a team as a code owner January 10, 2026 15:10
@bdice bdice added feature request New feature or request non-breaking Non-breaking change labels Jan 10, 2026
@cjnolet cjnolet moved this from Todo to In Progress in Unstructured Data Processing Mar 24, 2026
@bdice

bdice commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing — superseded by #2996, which includes this change as part of the full RMM CCCL memory resource migration (rapidsai/rmm#2011).

@bdice bdice closed this Apr 3, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Unstructured Data Processing Apr 3, 2026
rapids-bot Bot pushed a commit that referenced this pull request Apr 21, 2026
## Summary
- Remove `device_memory_resource` base class usage, de-template all resource and adaptor types, replace pointer-based per-device resource APIs with ref-based equivalents
- Part of rapidsai/rmm#2011. Migration guide: rapidsai/rmm#2344.
- Supersedes #2917 and #2920

Depends on rapidsai/rmm#2361.
Depends on rapidsai/ucxx#636.

## Changes

### Core resource infrastructure
- **`device_memory_resource.hpp`**: Remove `any_resource_bridge` (which inherited from `rmm::mr::device_memory_resource`), remove all `shared_ptr<device_memory_resource>` constructor overloads, consolidate to `any_resource`-only path
- **`device_resources.hpp`**: Remove deprecated constructor taking `shared_ptr<device_memory_resource>`, update `get_workspace_resource()` return type (de-templated `limiting_resource_adaptor`)
- **`device_resources_snmg.hpp`**: Remove stale include, de-template `pool_memory_resource`
- **`handle.hpp`**: Remove deprecated constructors taking `shared_ptr<device_memory_resource>`
- **`device_resources_manager.hpp`**: Retype `workspace_mrs` vector from `shared_ptr<device_memory_resource>` to `raft::mr::device_resource`, update `set_workspace_memory_resource()` signature accordingly, de-template `pool_mr_` to `optional<pool_memory_resource>`, remove `dynamic_cast` for upstream type detection, replace `get/set_current_device_resource()` with `_ref` variants

### Memory tracking
- **`memory_tracking_resources.hpp`**: Remove `device_tracking_bridge` (inherited from `device_memory_resource`), use `set_current_device_resource_ref()` directly

### Call sites using `get_workspace_resource()` → `get_workspace_resource_ref()`
- `select_k-inl.cuh`, `select_radix.cuh`, `select_warpsort.cuh`, `sparse/select_k-inl.cuh`, `bitmap_to_csr.cuh`, `bitset_to_csr.cuh`

### Benchmarks
- **`benchmark.hpp`**: De-template `pool_memory_resource`, use `any_resource` for RAII restore
- **`gather.cu`**, **`subsample.cu`**: Same pattern

### Tests
- **`handle.cpp`**: Dereference `limiting_resource_adaptor*` for `device_buffer` constructor
- **`device_resources_manager.cpp`**: Remove workspace-related test code for removed APIs
- **`mdarray.cu`**: Remove `test_device_resource_bridge_unwrap` (bridge no longer exists)
- **`multi_variable_gaussian.cu`**: `get_current_device_resource()` → `get_current_device_resource_ref()`

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Divye Gala (https://github.com/divyegala)

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

Labels

feature request New feature or request non-breaking Non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants