@@ -164,7 +164,8 @@ template <bool Invert> struct Process {
164164 // / lane_mask is a bitmap of the threads in the warp that would hold the
165165 // / single lock on success, e.g. the result of rpc::get_lane_mask()
166166 // / 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) {
168169 // On amdgpu, test and set to the nth lock bit and a sync_lane would suffice
169170 // On volta, need to handle differences between the threads running and
170171 // the threads that were detected in the previous call to get_lane_mask()
@@ -204,7 +205,8 @@ template <bool Invert> struct Process {
204205
205206 // / Unlock the lock at index. We need a lane sync to keep this function
206207 // / 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) {
208210 // Do not move any writes past the unlock.
209211 __atomic_thread_fence (__ATOMIC_RELEASE);
210212
@@ -517,7 +519,8 @@ LIBC_INLINE void Port<T>::recv_n(void **dst, uint64_t *size, A &&alloc) {
517519// / port. Each port instance uses an associated \p opcode to tell the server
518520// / what to do. The Client interface provides the appropriate lane size to the
519521// / 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 () {
521524 // Repeatedly perform a naive linear scan for a port that can be opened to
522525 // send data.
523526 for (uint32_t index = 0 ;; ++index) {
@@ -551,7 +554,7 @@ template <uint16_t opcode> LIBC_INLINE Client::Port Client::open() {
551554
552555// / Attempts to open a port to use as the server. The server can only open a
553556// / 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>
555558Server::try_open (uint32_t lane_size, uint32_t start) {
556559 // Perform a naive linear scan for a port that has a pending request.
557560 for (uint32_t index = start; index < process.port_count ; ++index) {
0 commit comments