NVIDIA / NVIDIA/cccl

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

Open
#1,949 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Area

libcu++

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

I just found @gonzalobg ’s [proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2835r2.html) for exposing `std::atomic_ref.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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.