rmm icon indicating copy to clipboard operation
rmm copied to clipboard

Turn resource adaptors into alias templates

Open miscco opened this issue 1 year ago • 8 comments

Currently all resource adaptors are templated on their upstream resource.

Transitioning to resource_ref this is superfluous, as we do not need to know the upstream type anymore.

However, we cannot simply remove the template argument, as that would break user code. So we need to first introduce an indirection using an alias:


template<class>
struct resource_adaptor_impl{};

template<class Upstream>
[[deprecated("Use resource_adaptor_ref instead")]] using resource_adaptor = resource_adaptor_impl<Upstream>;

using resource_adaptor_ref = resource_adaptor_impl<int>;

miscco avatar Feb 05 '24 07:02 miscco

I'm confused by the ref here, because I don't think this is intended to be a reference. Am I correct? Is the idea to make the alias match the name we intend the caller to eventually use?

harrism avatar Feb 06 '24 02:02 harrism

The issue is how to transition something that is a template to something that is not. I am all ears on how to switch names

miscco avatar Feb 06 '24 07:02 miscco

I don't have any ideas but answers to my questions might give me some. :) I still have the same questions I wrote above.

harrism avatar Feb 06 '24 21:02 harrism

I think there's an easier way to make this change (though it will take at least 2 releases).

  1. Create new (duplicate) adaptor classes (and factory functions as necessary) that don't have the upstream template parameter.
  2. Convert downstream RAPIDS libs to use the new classes instead of the old ones.
  3. Deprecate the old classes.
  4. Remove the old classes.

harrism avatar Jul 02 '24 23:07 harrism