@@ -164,7 +164,8 @@ template <bool Invert> struct Process {
164
164
// / lane_mask is a bitmap of the threads in the warp that would hold the
165
165
// / single lock on success, e.g. the result of rpc::get_lane_mask()
166
166
// / The lock is held when the n-th bit of the lock bitfield is set.
167
- LIBC_INLINE bool try_lock (uint64_t lane_mask, uint32_t index) {
167
+ [[clang::convergent]] LIBC_INLINE bool try_lock (uint64_t lane_mask,
168
+ uint32_t index) {
168
169
// On amdgpu, test and set to the nth lock bit and a sync_lane would suffice
169
170
// On volta, need to handle differences between the threads running and
170
171
// the threads that were detected in the previous call to get_lane_mask()
@@ -204,7 +205,8 @@ template <bool Invert> struct Process {
204
205
205
206
// / Unlock the lock at index. We need a lane sync to keep this function
206
207
// / convergent, otherwise the compiler will sink the store and deadlock.
207
- LIBC_INLINE void unlock (uint64_t lane_mask, uint32_t index) {
208
+ [[clang::convergent]] LIBC_INLINE void unlock (uint64_t lane_mask,
209
+ uint32_t index) {
208
210
// Do not move any writes past the unlock.
209
211
__atomic_thread_fence (__ATOMIC_RELEASE);
210
212
@@ -517,7 +519,8 @@ LIBC_INLINE void Port<T>::recv_n(void **dst, uint64_t *size, A &&alloc) {
517
519
// / port. Each port instance uses an associated \p opcode to tell the server
518
520
// / what to do. The Client interface provides the appropriate lane size to the
519
521
// / port using the platform's returned value.
520
- template <uint16_t opcode> LIBC_INLINE Client::Port Client::open () {
522
+ template <uint16_t opcode>
523
+ [[clang::convergent]] LIBC_INLINE Client::Port Client::open () {
521
524
// Repeatedly perform a naive linear scan for a port that can be opened to
522
525
// send data.
523
526
for (uint32_t index = 0 ;; ++index) {
@@ -551,7 +554,7 @@ template <uint16_t opcode> LIBC_INLINE Client::Port Client::open() {
551
554
552
555
// / Attempts to open a port to use as the server. The server can only open a
553
556
// / port if it has a pending receive operation
554
- LIBC_INLINE cpp::optional<typename Server::Port>
557
+ [[clang::convergent]] LIBC_INLINE cpp::optional<typename Server::Port>
555
558
Server::try_open (uint32_t lane_size, uint32_t start) {
556
559
// Perform a naive linear scan for a port that has a pending request.
557
560
for (uint32_t index = start; index < process.port_count ; ++index) {
0 commit comments