-
Notifications
You must be signed in to change notification settings - Fork 200
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
[FEA] Change semantics of RMM memory resource equality comparison #1402
Comments
I'm not aware of any code in libcudf (or in RAPIDS generally) that depends on particular semantics of memory resource equality. I know of no issues from changing semantics as described above. Absence of evidence |
Thanks @bdice . I also did some searching of the main RAPIDS repos.
|
The usage in RAFT has been removed. |
@miscco @jrhemstad I think having a concept for |
This may be unnecessary as @miscco and I were discussing. @miscco mentioned that it would be useful for |
Part of #1443
We plan to adopt
cuda::mr::memory_resource
concepts as the basis for RMM memory resources. This refactoring will bring flexibility both in building and composing memory resources (e.g. machinery for our stream-orderedpool_memory_resource
can be reused for non-device memory as in #1392 ) and for applications by providing them the means to specify the properties of memory resources that their functions expect to be passed (via thecuda::mr::resource_ref
property interface).One effect of this is that
cuda::mr::resource_ref
equality comparison has different semantics from RMM's currentdevice_memory_resource
equality comparison, which mimicsstd::pmr::memory_resource
. The semantics of this are defined here:In contrast, two
cuda::mr::resource_ref
s compare equal only if they have the same equality function pointer, and calling that function on the tworesource_ref
s returns true.Arguably, the
std::pmr
semantics are more useful, because, for example, one might allocate memory with alogging_memory_resource<cuda_memory_resource>
(A logging MR with its upstream MR being a CUDA MR), but later need to deallocate the memory with just acuda_memory_resource
, and these two will compare equal because the upstream of the former compares equal to the latter.However, these semantics are difficult to support within the
cuda::mr
design. Because it is based on concepts, rather than inheritance, there is no base class (unlikestd::pmr
andrmm::mr::device_memory_resource
). Without a base class, we can'tdynamic_cast
, which makes it hard to do the kind of compatibility comparison described above. RTTI-based solutions may be possible, but we don't necessarily want to require RTTI for RMM.The concept-based approach does not preclude an inheritance hierarchy as we currently have in RMM. However, one of the advantages of moving to refactor to the concept approach is that libraries can provide pluggable memory interfaces based only on a (fairly lightweight) semi-standard (hopefully someday) like
cuda::mr::resource_ref
without requiring RMM and instead of defining their own plugin interface.This was discussed during the design sessions for
cuda::mr
and no strong opinions were held on the issues above and the designers felt reasonably OK with diverging fromstd::pmr
here.I wanted to open this up for discussion. First, I want to find out if anyone relies on the "compatibility" equality comparison semantics currently built in RMM. My hunch is that few if any do. Please comment below on this question and then we can move on to discussing options.
The text was updated successfully, but these errors were encountered: