[libc-commits] [libc] 0c13988 - [libc] Fix server code when GPU is acting as the server

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri Aug 8 17:16:11 PDT 2025


Author: Joseph Huber
Date: 2025-08-08T19:15:13-05:00
New Revision: 0c139883f4c086444e816f607105a96b617eb4a7

URL: https://github.com/llvm/llvm-project/commit/0c139883f4c086444e816f607105a96b617eb4a7
DIFF: https://github.com/llvm/llvm-project/commit/0c139883f4c086444e816f607105a96b617eb4a7.diff

LOG: [libc] Fix server code when GPU is acting as the server

Summary:
Small fix that just ignores all the extra lanes if we're running the
server from a platform that potentially has more.

Added: 
    

Modified: 
    libc/shared/rpc.h

Removed: 
    


################################################################################
diff  --git a/libc/shared/rpc.h b/libc/shared/rpc.h
index 7295efd4eee33..dac2a7949a906 100644
--- a/libc/shared/rpc.h
+++ b/libc/shared/rpc.h
@@ -551,6 +551,9 @@ template <uint32_t opcode> RPC_ATTRS Client::Port Client::open() {
 /// port if it has a pending receive operation
 RPC_ATTRS rpc::optional<typename Server::Port>
 Server::try_open(uint32_t lane_size, uint32_t start) {
+  if (rpc::get_lane_id() >= lane_size)
+    return rpc::nullopt;
+
   // Perform a naive linear scan for a port that has a pending request.
   for (uint32_t index = start; index < process.port_count; ++index) {
     uint64_t lane_mask = rpc::get_lane_mask();


        


More information about the libc-commits mailing list