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

[FEA]: Expose cuda::atomic_ref<T>.data() to obtain the address of the wrapped object #1949

Open
1 task done
sleeepyjack opened this issue Jul 6, 2024 · 1 comment
Open
1 task done
Labels
feature request New feature or request.

Comments

@sleeepyjack
Copy link
Contributor

sleeepyjack commented Jul 6, 2024

Is this a duplicate?

Area

libcu++

Is your feature request related to a problem? Please describe.

I just found @gonzalobg ’s proposal for exposing std::atomic_ref<T>.data() to access the underlying memory location wrapped by the atomic_ref object when running into a similar use case as the one shown in the proposal.

Describe the solution you'd like

I know standardization might take years, but since we own the cuda:: namespace, would it be possible to expose this for device atomics in libcu++?
IIUC it would be an extension to the standard API and would not affect the current behavior.

There have been some discussions and proposed changes on how to expose the address and the committee hasn't ultimately settled on a design. We could however expose it with an experimental name for now.

Describe alternatives you've considered

There's currently no way (to my knowledge) to obtain the address of the object wrapped by an atomic_ref object.

Additional context

No response

@sleeepyjack sleeepyjack added the feature request New feature or request. label Jul 6, 2024
@bernhardmgruber
Copy link
Contributor

As discussed offline, the proposal is still in-flight and not plenary approved. However, it was forwarded by LEWG to electronic polling so they are happy with the current design and it may have settled.

Please notice that you are linking to revision 2 of the proposal, which proposes:
T const* data() const noexcept;

The latest proposal, revision 4, proposes the following API:
uintptr_t address() const noexcept; // optional

I am fine with adding the functionality from revision 4, but would like to have a second opinion. @wmaxey I think you have been working on atomics lately? What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request.
Projects
Status: Todo
Development

No branches or pull requests

2 participants