[libc-commits] [PATCH] D153571: [libc] Add memory fences to device-local locking calls

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jun 22 09:38:48 PDT 2023


jhuber6 accepted this revision.
jhuber6 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/src/__support/RPC/rpc.h:188-194
+    if (holding_lock) {
+      // Then the caller can load values knowing said loads won't move past
+      // the lock. No such guarantee is needed if the lock acquire failed.
+      // This conditional branch is expected to fold in the caller after
+      // inlining the current function.
+      atomic_thread_fence(cpp::MemoryOrder::ACQUIRE);
+    }
----------------
LLVM style has no braces around single line ifs.


================
Comment at: libc/src/__support/RPC/rpc.h:531
     uint64_t lane_mask = gpu::get_lane_mask();
-    // Attempt to acquire the lock on this index.
     if (!this->try_lock(lane_mask, index))
----------------
Why was this removed


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153571/new/

https://reviews.llvm.org/D153571



More information about the libc-commits mailing list