Is this a duplicate?
Area
libcu++
Is your feature request related to a problem? Please describe.
With RMM memory resources (prior to adopting CCCL's memory resource design), we can dynamic-cast a device_memory_resource* to determine if the MR is of a given type (e.g. a pool memory resource). Today there isn't a way to do the equivalent of a dynamic-cast to find what type is contained in a resource_ref or any_resource.
Examples of current usage of dynamic_cast of RMM memory resources:
https://github.com/rapidsai/cuvs/blob/53879fd1ece6c027435b16de5307e684bd44cc81/c/src/core/c_api.cpp#L159-L164
https://github.com/rapidsai/raft/blob/3d64833ed00fb472c8f8cd366f53d0d7e4efa494/cpp/include/raft/core/device_resources_manager.hpp#L160-L173
https://github.com/rapidsai/rapidsmpf/blob/0e90bd98bb9b2a9026ad4dd6277ae2ae59c9d707/cpp/src/rmm_resource_adaptor.cpp#L125-L128
https://github.com/NVIDIA/cuCascade/blob/c32d144b94d7b27502d402284ac909904cd550d3/include/cucascade/memory/memory_reservation.hpp#L223-L228
Describe the solution you'd like
@pciolkosz mentioned that cuda::__any_cast<Tp>(&obj) exists, but it is private. This might solve our needs, if it were promoted to a public API.
Describe alternatives you've considered
No response
Additional context
No response
Is this a duplicate?
Area
libcu++
Is your feature request related to a problem? Please describe.
With RMM memory resources (prior to adopting CCCL's memory resource design), we can dynamic-cast a
device_memory_resource*to determine if the MR is of a given type (e.g. a pool memory resource). Today there isn't a way to do the equivalent of a dynamic-cast to find what type is contained in aresource_reforany_resource.Examples of current usage of
dynamic_castof RMM memory resources:https://github.com/rapidsai/cuvs/blob/53879fd1ece6c027435b16de5307e684bd44cc81/c/src/core/c_api.cpp#L159-L164
https://github.com/rapidsai/raft/blob/3d64833ed00fb472c8f8cd366f53d0d7e4efa494/cpp/include/raft/core/device_resources_manager.hpp#L160-L173
https://github.com/rapidsai/rapidsmpf/blob/0e90bd98bb9b2a9026ad4dd6277ae2ae59c9d707/cpp/src/rmm_resource_adaptor.cpp#L125-L128
https://github.com/NVIDIA/cuCascade/blob/c32d144b94d7b27502d402284ac909904cd550d3/include/cucascade/memory/memory_reservation.hpp#L223-L228
Describe the solution you'd like
@pciolkosz mentioned that
cuda::__any_cast<Tp>(&obj)exists, but it is private. This might solve our needs, if it were promoted to a public API.Describe alternatives you've considered
No response
Additional context
No response