Skip to content

cuda::barrier::try_wait* should be const #280

@ahendriksen

Description

@ahendriksen

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

template <class CF>
bool barrier<CF>::try_wait(arrival_token& tok) const; // <-- const
template <class CF, class Rep, class Period>
bool barrier<CF>::try_wait_for(arrival_token& tok, duration<Rep, Period> const& rel_time) const; // <-- const
template <class CF, class Clock, class Duration>
bool barrier<CF>::try_wait_until(arrival_token& tok, time_point<Clock, Duration> const& abs_time) const; // <-- const

// Available since C++20
// bool latch::try_wait() const noexcept;
template <class Rep, class Period>
bool latch::try_wait_for(duration<Rep, Period> const& rel_time) const;
template <class Clock, class Duration>
bool latch::try_wait_until(time_point<Clock, Duration> 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.

Metadata

Metadata

Assignees

Labels

needs triageIssues that require the team's attention

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions