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

Add device_async_resource_ref convenience alias #1441

Merged
merged 9 commits into from
Jan 31, 2024

Conversation

harrism
Copy link
Member

@harrism harrism commented Jan 29, 2024

Description

Adds a new header include/rmm/resource_ref.hpp that currently just contains a single using alias to make it easier to spell a device-accessible async_resource_ref.

Closes #1442

rmm::device_async_resource_ref is an alias for cuda::mr::async_resource_ref<cuda::mr::device_accessible>.

This is 30 characters vs. 57. It is shorter than the currently used resource pointer spelling: rmm::mr::device_memory_resource*.

Also updates tests to use this alias.

Also makes one unrelated doc change, I noticed pinned_host_memory_resource was not added to a doxygen group, so I fixed that.

I was going to put this in cuDF, but @bdice suggested maybe it would be useful to have it in RMM.

@harrism harrism added feature request New feature or request non-breaking Non-breaking change labels Jan 29, 2024
@harrism harrism self-assigned this Jan 29, 2024
@harrism harrism requested a review from a team as a code owner January 29, 2024 23:43
@harrism harrism requested review from wence- and bdice January 29, 2024 23:43
@github-actions github-actions bot added the cpp Pertains to C++ code label Jan 29, 2024
@bdice
Copy link
Contributor

bdice commented Jan 29, 2024

Want to add a test?

@jrhemstad
Copy link
Contributor

jrhemstad commented Jan 30, 2024

This is 34 characters vs. 57. I would like to make it shorter, but I think it would lose some information.

You could probably drop the "async" since RMM's allocation APIs have always been async and it's well understood at this point.

So rmm::mr::device_resource_ref.

It wouldn't hurt anything to drop the mr:: either.

@harrism
Copy link
Member Author

harrism commented Jan 30, 2024

This is 34 characters vs. 57. I would like to make it shorter, but I think it would lose some information.

You could probably drop the "async" since RMM's allocation APIs have always been async and it's well understood at this point.

So rmm::mr::device_resource_ref.

It wouldn't hurt anything to drop the mr:: either.

RMM has always had some MRs that are synchronous (e.g. cuda_memory_resource). That's what supports_streams() was for. Also host_memory_resource is synchronous. The fact that nobody has used anything non-stream-ordered from RMM so far is a different fact.

If I remove mr::, should I also move the file up a level?

@harrism
Copy link
Member Author

harrism commented Jan 30, 2024

Answered my own question. Moved the header up a level and move up to rmm:: namespace. This is now shorter spelling than the resource pointer used by RAPIDS libraries, so it's a net win:

rmm::device_async_resource_ref mr; // new
rmm::mr::device_memory_resource *mr; // old

@harrism
Copy link
Member Author

harrism commented Jan 31, 2024

/merge

@rapids-bot rapids-bot bot merged commit d32e665 into rapidsai:branch-24.04 Jan 31, 2024
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp Pertains to C++ code feature request New feature or request non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEA] Add a convenience alias in RMM for cuda::mr::async_resource_ref<cuda::mr::device_accessible>
4 participants