NVIDIA / NVIDIA/cccl

cuda::barrier::try_wait* should be const

Open
#280 1 comment 0 reactions 1 assignee Claimed by @jrhemstad View on GitHub
needs triage
Dominant language
C++
Stars
2.5k
Forks
487
Avg merge
2d 7h
Merged PRs (30d)
296

Description

From https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2643r1.html:

```
template
bool barrier::try_wait(arrival_token& tok) const; // <-- const
template
bool barrier::try_wait_for(arrival_token& tok, duration const& rel_time) const; // <-- const
template
bool barrier::try_wait_until(arrival_token& tok, time_point const& abs_time) const; // <-- const

// Available since C++20
// bool latch::try_wait() const noexcept;
template
bool latch::try_wait_for(duration const& rel_time) const;
template
bool latch::try_wait_until(time_point const& abs_time) const;
```

The current implementation of these functions is not `const`: https://github.com/NVIDIA/libcudacxx/blob/a57dbed580e49b14ac1ad7f98496176407208aa4/include/cuda/std/detail/libcxx/include/__cuda/barrier.h#L528

The functions should also take the arrival token by reference (instead of moving). I filed PR NVIDIA/libcudacxx#499 for that.

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.