Skip to content

Add resource_cast coverage for RMM resources - #2386

Merged
rapids-bot[bot] merged 2 commits into
rapidsai:release/26.06from
bdice:test-resource-cast
May 18, 2026
Merged

rapids-bot[bot] merged 2 commits into
rapidsai:release/26.06from
bdice:test-resource-cast

Conversation

@bdice

@bdice bdice commented May 15, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds C++ test coverage for cuda::mr::resource_cast with RMM concrete resources. The tests verify successful recovery from cuda::mr::any_resource<cuda::mr::device_accessible> and rmm::device_async_resource_ref, and verify wrong-type casts return nullptr.

Follow-up from #2011.

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 May 15, 2026 17:51
@bdice
bdice requested review from PointKernel and davidwendt May 15, 2026 17:51
@bdice bdice mentioned this pull request May 15, 2026
51 tasks done
@coderabbitai

coderabbitai Bot commented May 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 24144d57-c9c6-495c-8bd1-f4dc9bc6f142

📥 Commits

Reviewing files that changed from the base of the PR and between 6a2d391 and ea21a24.

📒 Files selected for processing (1)
  • cpp/tests/mr/resource_ref_conversion_tests.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/tests/mr/resource_ref_conversion_tests.cpp

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Added test cases validating resource type casting and discovery mechanisms, ensuring correct identification of concrete resources within wrapped resource containers, accurate allocation limit verification, and proper handling of unsupported type conversions.

Walkthrough

Added two test cases to resource_ref_conversion_tests.cpp validating that cuda::mr::resource_cast correctly locates a limiting_resource_adaptor inside both an any_resource and a device_async_resource_ref, with a new include for the adaptor header.

Changes

Resource Cast with Limiting Adaptor Tests

Layer / File(s) Summary
Tests for resource_cast with limiting_resource_adaptor
cpp/tests/mr/resource_ref_conversion_tests.cpp
Added rmm/mr/limiting_resource_adaptor.hpp include and two ResourceCast test cases that verify cuda::mr::resource_cast extracts a limiting_resource_adaptor from both any_resource and device_async_resource_ref, validates the allocation limit, and confirms invalid casts return nullptr.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • rapidsai/rmm#2349: The new ResourceCast tests align with #2349's fix to ensure cccl_async_resource_ref is erased as the underlying ResourceType, which enables resource_cast to correctly find the limiting_resource_adaptor.

Suggested reviewers

  • ttnghia
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 'Add resource_cast coverage for RMM resources' directly matches the main change: adding C++ test coverage for cuda::mr::resource_cast with RMM concrete resources.
Description check ✅ Passed The description is directly related to the changeset, explaining that C++ test coverage for cuda::mr::resource_cast with RMM concrete resources was added, with specific test details matching the actual changes.
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.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cpp/tests/mr/resource_ref_conversion_tests.cpp`:
- Around line 222-247: Rename the two Google Test cases and the constexpr locals
to follow repository naming rules: change TEST(ResourceCast,
FindsConcreteResourceInAnyResource) to TEST(ResourceCast,
finds_concrete_resource_in_any_resource) and TEST(ResourceCast,
FindsConcreteResourceInDeviceAsyncResourceRef) to TEST(ResourceCast,
finds_concrete_resource_in_device_async_resource_ref); also rename the constexpr
std::size_t local named limit to SCREAMING_SNAKE_CASE (e.g., LIMIT) in both
tests so all usages (ASSERT/EXPECT comparisons and limiter construction) are
updated accordingly; leave other local variable names (cuda_mr, limiter,
resource, ref) and the resource_cast calls unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 495cb8e2-fcae-4fe2-add2-e3059161ddd8

📥 Commits

Reviewing files that changed from the base of the PR and between b187020 and 6a2d391.

📒 Files selected for processing (1)
  • cpp/tests/mr/resource_ref_conversion_tests.cpp

@bdice bdice added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels May 15, 2026
@bdice bdice self-assigned this May 15, 2026
@bdice
bdice changed the base branch from main to release/26.06 May 15, 2026 17:57
@bdice
bdice force-pushed the test-resource-cast branch from 6a2d391 to ea21a24 Compare May 15, 2026 22:47
@bdice

bdice commented May 15, 2026

Copy link
Copy Markdown
Collaborator Author

/merge

@rapids-bot
rapids-bot Bot merged commit b52ff08 into rapidsai:release/26.06 May 18, 2026
79 checks passed
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.

2 participants