Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor mr_ref_tests to not depend on MR base classes #1589

Merged

Conversation

harrism
Copy link
Member

@harrism harrism commented Jun 25, 2024

Description

Fixes #1444

Refactors mr_ref_tests.hpp and the .cpp files that include it to use a hierarchy of factory classes in which the base class contains a resource_ref and the derived classes are templated on the actual resource type and own the MR under test to maintain its lifetime. This way the tests can still be value parameterized (by name) and the test machinery can be type erased. In the future, if CCCL adds an any_resource type-erased owning resource container, we can use that to simplify this machinery.

Note that until #1598 merges, this PR necessarily disables (comments out) tests of set_current_device_resource(). This is because the test only has a resource_ref, so it can't set_current_device_resource(ref). #1598 adds set_current_device_resource_ref() which reenables this testing.

Checklist

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

@harrism harrism added feature request New feature or request non-breaking Non-breaking change labels Jun 25, 2024
@harrism harrism self-assigned this Jun 25, 2024
@github-actions github-actions bot added the cpp Pertains to C++ code label Jun 25, 2024
@harrism harrism changed the title Refactor mr_ref_tests to not depend on MR base classes Add resource_ref versions of current_device_resource functions, refactor mr_ref_tests to not depend on MR base classes Jun 27, 2024
@harrism harrism force-pushed the fea-baseclassless-device-mr-tests branch from 4e90eeb to 78520cd Compare June 27, 2024 11:01
@harrism harrism marked this pull request as ready for review June 27, 2024 11:17
@harrism harrism requested a review from a team as a code owner June 27, 2024 11:17
@harrism harrism requested review from vyasr and bdice June 27, 2024 11:17
@harrism harrism changed the title Add resource_ref versions of current_device_resource functions, refactor mr_ref_tests to not depend on MR base classes Refactor mr_ref_tests to not depend on MR base classes Jun 27, 2024
@harrism harrism requested review from miscco and jrhemstad June 27, 2024 11:19
tests/mr/device/mr_ref_test.hpp Outdated Show resolved Hide resolved
@harrism
Copy link
Member Author

harrism commented Jul 2, 2024

/merge

@rapids-bot rapids-bot bot merged commit d71f9e1 into rapidsai:branch-24.08 Jul 2, 2024
58 checks passed
rapids-bot bot pushed a commit that referenced this pull request Aug 28, 2024
Fixes #1597

Adds new` get_per_device_resource_ref()`, `set_per_device_resource_ref()` and `current_device` versions of these, intended to replace `get_per_device_resource()`. The new functions deal in `device_async_resource_ref`, while the old functions deal in `device_memory_resource` pointers. Tests are updated to use the new functions.
  
Note that I have also added `reset_per_device_resource_ref()` and `reset_current_device_resource_ref()` which are necessary because previously we implemented the resetting behavior by passing `nullptr` to `set_current_device_resource()`, which doesn't work with `resource_ref` because it can't refer to `nullptr` (no such thing as a null reference).

Updates tests to cover the new functionality, and re-enables tests of `set_current_device_resource_ref()` which were disabled in #1589.

Authors:
  - Mark Harris (https://github.com/harrism)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Rong Ou (https://github.com/rongou)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #1598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp Pertains to C++ code feature request New feature or request non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Refactor RMM tests to use cuda::resource_ref instead of device_memory_resource pointers.
3 participants