-
Notifications
You must be signed in to change notification settings - Fork 198
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
Use cuda::mr::memory_resource
instead of raw device_memory_resource
#1095
Conversation
Can one of the admins verify this patch? Admins can comment |
@miscco so what's your current thinking about the steps we'd take to transition rapids libraries? Ultimately we want to get rid of the |
I guess the advantage that we have is that the new interface itself is non intrusive. So my proposal would be to expand test coverage and merge this PR right away into rmm. We can then think about which parts of rapids to move over to the new shiny. We might also want to think about adding a new interface first and then remove the old one as a second step afterwards |
0b91187
to
2c85df6
Compare
ok to test |
@miscco can you target this at branch-22.12? We don't target main with PRs, and 22.10 is entering code freeze later this week. (RAPIDS has an interesting branching model) |
You will also need to run clang-format to pass the style checks. |
Yeah, I am not fully ready with the device side memory resources. I hope to finish something this week |
2c85df6
to
777d0f0
Compare
Also `Nothing` seems to be an invalid type
5220ff7
to
c298fbc
Compare
I discussed with @harrism -- he wants to finish testing downstream RAPIDS repos with commit 41c1bea. In the meantime, I created a branch with temporary changes from my PR review. https://github.com/bdice/rmm/tree/memory_resource-bdice Feel free to merge those three commits into this PR when ready. |
We currently have no design on how we want to propagate the properties of the memory_resource, so drop this for now until have a proper design ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as-is. Let's merge tonight (in the next 5-6 hours, ideally) and let the nightlies rebuild all RAPIDS packages. We'll iron out any problems (like the potential issue with cuGraph) once we see if the nightlies pass.
/merge |
Thanks a lot for helping me getting this in 🎉 |
This introduces
cuda::mr::{async_}resource_ref
as a type erased safe resource wrapper that is meant to replace uses ofrmm::mr::{host, device}_memory_resource
pointers.We provide both async and classic allocate functions that delegate back to the original resource used to construct the
cuda::mr::{async_}resource_ref
In comparison to
{host, device}_memory_resource
the new feature provides additional compile time checks that will help users avoid common pitfalls with heterogeneous memory allocations.As a first step we provide the properties
cuda::mr::host_accessible
andcuda::mr::device_accessible
. These properties can be added to an internal or even external type through a free functionget_property
The advantage is that we can constrain interfaces based on these properties
This function will fail to compile if it is passed any resource that does not support async allocations or is not tagged as providing device accessible memory. In the same way the following function will only compile if the provided resource provides the classic allocate / deallocate interface and is tagged to provide host accessible memory
The property system is highly flexible and can easily be user provided to add their own properties as needed. That gives it both the flexibility of an inheritance based implementation and the security of a strictly type checked interface