Skip to content

Remove rmm::detail::polyfill in favor of CCCL concepts, require CCCL >=3.3#2283

Merged
rapids-bot[bot] merged 2 commits intorapidsai:mainfrom
bdice:remove-polyfill
Mar 11, 2026
Merged

Remove rmm::detail::polyfill in favor of CCCL concepts, require CCCL >=3.3#2283
rapids-bot[bot] merged 2 commits intorapidsai:mainfrom
bdice:remove-polyfill

Conversation

@bdice
Copy link
Copy Markdown
Collaborator

@bdice bdice commented Mar 10, 2026

Description

Closes #2282

Remove the rmm::detail::polyfill namespace and delete rmm/detail/cuda_memory_resource.hpp. All usages are replaced with the CCCL concepts directly (cuda::mr::synchronous_resource, cuda::mr::resource, etc.). The CCCL version check is relocated to rmm/detail/export.hpp and updated to require CCCL >=3.3. (xref: rapidsai/rapids-cmake#981 -- also note that the CCCL 3.3 pre-release was the same as the final release)

Checklist

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

@bdice bdice requested a review from a team as a code owner March 10, 2026 23:22
@bdice bdice requested review from harrism and rongou March 10, 2026 23:22
@bdice bdice moved this to In Progress in RMM Project Board Mar 10, 2026
@bdice bdice self-assigned this Mar 10, 2026
@bdice bdice added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Mar 10, 2026
@bdice bdice changed the title Remove rmm::detail::polyfill in favor of CCCL concepts Remove rmm::detail::polyfill in favor of CCCL concepts, require CCCL >=3.3 Mar 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

Removes the rmm::detail::polyfill header and replaces all uses of its traits with direct CCCL cuda::mr:: concepts; relocates the CCCL version check into export.hpp and updates includes and static_asserts across headers and tests (≈13 files).

Changes

Cohort / File(s) Summary
Polyfill removal & export guard
cpp/include/rmm/detail/cuda_memory_resource.hpp, cpp/include/rmm/detail/cccl_adaptors.hpp, cpp/include/rmm/detail/export.hpp
Deleted the polyfill header; removed its include from cccl_adaptors; added <cuda/version> and a CCCL >= 3.3 compile-time check in export.hpp.
Core MR headers
cpp/include/rmm/mr/device_memory_resource.hpp, cpp/include/rmm/mr/system_memory_resource.hpp, cpp/include/rmm/mr/pinned_host_memory_resource.hpp, cpp/include/rmm/mr/cuda_async_managed_memory_resource.hpp
Replaced rmm::detail::polyfill::... trait checks with equivalent cuda::mr::... concepts and adjusted includes (added <cuda/memory_resource> where required).
Adaptor / trait utilities
cpp/include/rmm/mr/is_resource_adaptor.hpp, cpp/include/rmm/mr/thrust_allocator_adaptor.hpp
Removed polyfill include; switched trait detection to cuda::mr:: concepts and added/ reordered CUDA memory-resource include(s).
Tests - core & mocks
cpp/tests/device_scalar_tests.cpp, cpp/tests/mock_resource.hpp
Removed polyfill include, updated static_assert predicates to cuda::mr:: traits, and updated copyright years.
Tests - MR suites
cpp/tests/mr/adaptor_tests.cpp, cpp/tests/mr/arena_mr_tests.cpp, cpp/tests/mr/cuda_async_mr_tests.cpp, cpp/tests/mr/cuda_async_view_mr_tests.cpp, cpp/tests/mr/host_mr_ref_tests.cpp, cpp/tests/mr/pool_mr_tests.cpp, cpp/tests/mr/system_mr_tests.cu
Systematically replaced rmm::detail::polyfill::resource* / async_resource* usages with cuda::mr::synchronous_resource* / cuda::mr::resource* equivalents and removed polyfill includes; minor header year updates and formatting tweaks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

3 - Ready for review

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: removing the polyfill namespace and requiring a newer CCCL version.
Linked Issues check ✅ Passed The PR fully addresses issue #2282 objectives: deletes the polyfill header, replaces all polyfill usages with CCCL equivalents across headers and tests, updates version requirement to CCCL >=3.3.
Out of Scope Changes check ✅ Passed All changes are in-scope and directly support the primary objective of removing the polyfill namespace and requiring CCCL >=3.3.
Description check ✅ Passed The PR description clearly describes the objective to remove the rmm::detail::polyfill namespace and replace all usages with direct CCCL concepts, matching the changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cpp/include/rmm/mr/system_memory_resource.hpp (1)

157-158: Add #include <cuda/memory_resource> to make this public header self-contained.

This header directly uses cuda::mr::device_accessible, cuda::mr::host_accessible, and cuda::mr::resource_with in its public interface (lines 146, 149, 153, 157–158) but relies on transitive inclusion from <rmm/device_memory_resource.hpp>. Making the dependency explicit prevents brittleness if includes are reorganized.

Proposed fix
 `#include` <rmm/detail/format.hpp>
 `#include` <rmm/mr/device_memory_resource.hpp>
 
+#include <cuda/memory_resource>
+
 `#include` <cstddef>
 `#include` <string>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cpp/include/rmm/mr/system_memory_resource.hpp` around lines 157 - 158, The
header is missing an explicit include for cuda::mr types used in its public API
(static_asserts referencing cuda::mr::resource_with,
cuda::mr::device_accessible, cuda::mr::host_accessible and the
system_memory_resource type); add `#include` <cuda/memory_resource> at the top of
the header so the declarations using resource_with, device_accessible, and
host_accessible are resolved without relying on transitive includes (ensuring
the public header is self-contained).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cpp/include/rmm/mr/system_memory_resource.hpp`:
- Around line 157-158: The header is missing an explicit include for cuda::mr
types used in its public API (static_asserts referencing
cuda::mr::resource_with, cuda::mr::device_accessible, cuda::mr::host_accessible
and the system_memory_resource type); add `#include` <cuda/memory_resource> at the
top of the header so the declarations using resource_with, device_accessible,
and host_accessible are resolved without relying on transitive includes
(ensuring the public header is self-contained).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4f4c3a58-7cd8-4b1e-ad2e-78556db69ed4

📥 Commits

Reviewing files that changed from the base of the PR and between 2ba0900 and 94f2ade.

📒 Files selected for processing (18)
  • cpp/include/rmm/detail/cccl_adaptors.hpp
  • cpp/include/rmm/detail/cuda_memory_resource.hpp
  • cpp/include/rmm/detail/export.hpp
  • cpp/include/rmm/mr/cuda_async_managed_memory_resource.hpp
  • cpp/include/rmm/mr/device_memory_resource.hpp
  • cpp/include/rmm/mr/is_resource_adaptor.hpp
  • cpp/include/rmm/mr/pinned_host_memory_resource.hpp
  • cpp/include/rmm/mr/system_memory_resource.hpp
  • cpp/include/rmm/mr/thrust_allocator_adaptor.hpp
  • cpp/tests/device_scalar_tests.cpp
  • cpp/tests/mock_resource.hpp
  • cpp/tests/mr/adaptor_tests.cpp
  • cpp/tests/mr/arena_mr_tests.cpp
  • cpp/tests/mr/cuda_async_mr_tests.cpp
  • cpp/tests/mr/cuda_async_view_mr_tests.cpp
  • cpp/tests/mr/host_mr_ref_tests.cpp
  • cpp/tests/mr/pool_mr_tests.cpp
  • cpp/tests/mr/system_mr_tests.cu
💤 Files with no reviewable changes (2)
  • cpp/include/rmm/detail/cuda_memory_resource.hpp
  • cpp/include/rmm/detail/cccl_adaptors.hpp

@bdice
Copy link
Copy Markdown
Collaborator Author

bdice commented Mar 11, 2026

/merge

@rapids-bot rapids-bot bot merged commit 73ba7d7 into rapidsai:main Mar 11, 2026
85 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in RMM Project Board Mar 11, 2026
@bdice bdice mentioned this pull request Mar 11, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Remove rmm::detail::polyfill in favor of CCCL concepts

2 participants