NVIDIA / NVIDIA/cccl

[FEA]: Provide a way proper way to use `construct_at` at compile time on device

Open
#2,627 0 comments 0 reactions 1 assignee Claimed by @miscco View on GitHub
libcu++
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [ ] 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.

Currently there is no proper way of using `construct_at` at compile time on device.

The issue is that we *must* use `std::construct_at` as per the C++ standard and that is not under our constrol. However, we also cannot just slam an `#pragma nv_exec_check_disable` on it because e.g in libstdc++ it does call a subsequent function which is also not host_device.

### Describe the solution you'd like

The solution we discussed with the compiler team is to add a special function `cuda::std::__device_construct_at` that the compiler will recognize as equivalent to `std::construct_at`

That way we do not need to do any hacks with the host standard library but get the behavior we want.

@dkolsen-pgi for visibility

### Describe alternatives you've considered

_No response_

### 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.