cccl icon indicating copy to clipboard operation
cccl copied to clipboard

[FEA]: optimize the case of storing a `resource_ref` in an `any_resource`

Open ericniebler opened this issue 1 year ago • 1 comments

Is this a duplicate?

  • [x] I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct

Area

libcu++

Is your feature request related to a problem? Please describe.

with the current implementation, storing a cuda::rm::resource_ref in a cuda::experimental::any_resource will double- type erase the underlying type, leading to double indirections for every function call.

Describe the solution you'd like

find a way to bring this scenario down to a single indirection per type-erased function call.

Describe alternatives you've considered

No response

Additional context

No response

ericniebler avatar Sep 12 '24 22:09 ericniebler

Yeah I was thinking about that too. I fear that the "correct" solution is to add a second non-type template argument that signals whether its a reference or owning and then conditionally do the right thing in the constructor, etc..

That would allow us to use a clean base class and implement all the interdependencies in one place

miscco avatar Sep 16 '24 08:09 miscco