Skip to content
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

[EPIC] Roadmap for cuda/memory_resource #1502

Open
12 tasks
jrhemstad opened this issue Mar 6, 2024 · 9 comments
Open
12 tasks

[EPIC] Roadmap for cuda/memory_resource #1502

jrhemstad opened this issue Mar 6, 2024 · 9 comments
Assignees
Labels
CUDA Next Feature intended for the Cuda Next experimental library feature request New feature or request. libcu++ For all items related to libcu++

Comments

@jrhemstad
Copy link
Collaborator

jrhemstad commented Mar 6, 2024

cuda::mr is intended to be the future of heterogenous memory allocation in CUDA C++. It is inspired heavily by lessons learned in RMM and our experience with the device_memory_resource* and friends. cuda::mr does not seek to replace RMM, but instead distill and standardize the best parts of RMM into a more central location. Furthermore, RMM is already in the process of rebasing on top of using the cuda::mr interface.

What we have today is the cuda/memory_resource header that provides

  • [async_]resource concepts
  • Property system
  • [async_]resource_ref polymorphic type

In essence, this just provides the top-level interface for memory allocation and defining properties of the allocated memory.

Implementation plan

Misc

Concrete types that satisfy the C++ allocator requirements

  • A cuda::mr::allocator<T, Properties...> capable of preserving concrete type of the resource (no type-erasure)
  • A cuda::mr::polymorphic_allocator<T, Properties...> constructible from a resource_ref<Properties...>

Questions we'll need to answer along the way:

@miscco
Copy link
Collaborator

miscco commented Mar 7, 2024

@harrism You might be interested in this

@miscco miscco added feature request New feature or request. libcu++ For all items related to libcu++ labels Mar 7, 2024
@miscco miscco moved this from Todo to In Progress in CCCL Mar 7, 2024
@vyasr
Copy link
Contributor

vyasr commented Mar 8, 2024

Is there a long-term plan to pull more of the concrete implementations from rmm into CCCL? That seems like the best way to broaden adoption and usage of these allocators and would satisfy some of the new features mentioned above IIRC.

@miscco
Copy link
Collaborator

miscco commented Mar 8, 2024

@vyasr yes I believe we want to pull some of the foundational features into cccl. Definitely not all but some

@jrhemstad
Copy link
Collaborator Author

Is there a long-term plan to pull more of the concrete implementations from rmm into CCCL? That seems like the best way to broaden adoption and usage of these allocators and would satisfy some of the new features mentioned above IIRC.

Yes, that is what we mean by "Concrete types that satisfy the resource and async_resource concepts"

@fbusato
Copy link
Contributor

fbusato commented Mar 8, 2024

our RFE:

  • deallocate/deallocate_async functions should accept const void* to skip const_cast<T*>() on the user side

  • Allow cuda::mr::* functions in device code

  • Clarify (or fix) the expected behavior of allocate() deallocate() for async_resource

    • Personal thought: remove _async() version of the API and add the stream to allocate/deallocate

@jrhemstad
Copy link
Collaborator Author

Clarify (or fix) the expected behavior of allocate() deallocate() for async_resource

Can you elaborate on what you mean? allocate() and deallocate() are expected to always be synchronous.

@fbusato
Copy link
Contributor

fbusato commented Mar 8, 2024

Can you elaborate on what you mean? allocate() and deallocate() are expected to always be synchronous.

Yes, but what is their purpose if the code uses an async_resource with _async() API. They look redundant and confusing in this case

@jrhemstad
Copy link
Collaborator Author

Yes, but what is their purpose if the code uses an async_resource with _async() API. They look redundant and confusing in this case

The thinking is that the async_resource concept is a strict superset of the resource concept. This way, if you have an async_resource object, you can still conveniently pass it to a function that expects a resource.

@fbusato
Copy link
Contributor

fbusato commented Mar 8, 2024

ok, I didn't interpret async_resource as a superset of the resource concept. In this case, can we please just clarify this point on the doc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CUDA Next Feature intended for the Cuda Next experimental library feature request New feature or request. libcu++ For all items related to libcu++
Projects
Status: In Progress
Development

No branches or pull requests

5 participants