Skip to content

Remove Cython any resource helper#2440

Draft
bdice wants to merge 4 commits into
rapidsai:mainfrom
bdice:remove-cython-any-device-helper-followup
Draft

Remove Cython any resource helper#2440
bdice wants to merge 4 commits into
rapidsai:mainfrom
bdice:remove-cython-any-device-helper-followup

Conversation

@bdice

@bdice bdice commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Remove the Cython-only make_any_device_resource helper after RMM has migrated to direct any_resource[device_accessible](...) construction.

This is a follow-up to #2436.

This depends on the downstream migrations completing first:

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

copy-pr-bot Bot commented Jun 3, 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 added breaking Breaking change improvement Improvement / enhancement to an existing function labels Jun 3, 2026
@bdice bdice self-assigned this Jun 3, 2026
@bdice bdice moved this to In Progress in RMM Project Board Jun 3, 2026
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR replaces the make_any_device_resource helper function with direct any_resource[device_accessible] construction across Cython bindings. It adds a new constructor overload for any_resource accepting device_async_resource_ref, then systematically migrates DeviceBuffer and all memory resource adaptors (Pool, Arena, FixedSize, Binning, and wrapper adaptors) to use the new pattern.

Changes

Device Resource Any-Resource Constructor Refactoring

Layer / File(s) Summary
Cython contract: any_resource device_async_resource_ref constructor
python/rmm/rmm/librmm/memory_resource.pxd
Adds a new non-throwing constructor overload for any_resource[Properties] that accepts device_async_resource_ref, enabling direct construction from the wrapper type.
DeviceBuffer resource construction migration
python/rmm/rmm/pylibrmm/device_buffer.pyx
Updates module-level imports to bring in any_resource and device_accessible instead of make_any_device_resource, then replaces the helper calls with any_resource[device_accessible](self.mr.get_mr()) in DeviceBuffer.__cinit__.
Memory resource adaptors: bulk migration to any_resource
python/rmm/rmm/pylibrmm/memory_resource/_memory_resource.pyx
Extends C++ cimports to include any_resource and device_accessible, then replaces make_any_device_resource(...) with any_resource[device_accessible](...) across Pool, Arena, FixedSize, Binning, Limiting, Logging, Statistics, Tracking, FailureCallback, and Prefetch adaptor __cinit__ methods, plus the set_per_device_resource registration function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

  • rapidsai/rmm#2434: Implements the goal of removing the make_any_device_resource helper and constructing any_resource directly from device_async_resource_ref.

Possibly related PRs

  • rapidsai/rmm#2349: The Cython additions of a device_async_resource_ref constructor overload for any_resource align with the C++ fix to rework cccl_async_resource_ref so any_resource type-erasure stores the underlying resource rather than the wrapper.

Suggested labels

non-breaking, improvement

Suggested reviewers

  • rongou
  • davidwendt
  • ttnghia
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Remove Cython any resource helper' directly and clearly describes the main objective of the pull request—removing a Cython helper function after migration to direct any_resource construction.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly explains the purpose: removing a Cython helper after migration to direct any_resource[device_accessible](...) construction, with context about dependencies and related PRs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

breaking Breaking change improvement Improvement / enhancement to an existing function

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant