rapidsai / rmm

RAPIDS Memory Manager
https://docs.rapids.ai/api/rmm/stable/
Apache License 2.0
446 stars 188 forks source link

Refactor mr_ref_tests to not depend on MR base classes #1589

Closed harrism closed 1 week ago

harrism commented 2 weeks ago

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

harrism commented 1 week ago

/merge