[libc-commits] [PATCH] D147238: [libc] Support suspending threads during RPC spin loops

Jon Chesterfield via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Mar 30 09:26:50 PDT 2023


JonChesterfield accepted this revision.
JonChesterfield added a comment.

Thanks. Couple of nits above.



================
Comment at: libc/src/__support/RPC/rpc.h:105
   if (!in & out) {
-    while (!in)
+    while (!in) {
       in = inbox->load(cpp::MemoryOrder::RELAXED);
----------------
this probably gets rotated, might be better written do_while

sleep before or after load? the fence above probably takes time


================
Comment at: libc/src/__support/RPC/rpc_util.h:20
+LIBC_INLINE void sleep_briefly() {
+#if defined(LIBC_TARGET_ARCH_IS_NVPTX) && __CUDA_ARCH__ >= 700
+  asm("nanosleep.u32 64;" ::: "memory");
----------------
probably worth leaving a comment here about how the magic numbers were chosen


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147238



More information about the libc-commits mailing list