[all-commits] [llvm/llvm-project] 1a5d3b: [libc] Scan the ports more fairly in the RPC serve...

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Sep 26 14:10:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a5d3b6cda2c56a39bbe2a529db4d3ac3d5ffa0f
      https://github.com/llvm/llvm-project/commit/1a5d3b6cda2c56a39bbe2a529db4d3ac3d5ffa0f
  Author: Joseph Huber <35342157+jhuber6 at users.noreply.github.com>
  Date:   2023-09-26 (Tue, 26 Sep 2023)

  Changed paths:
    M libc/src/__support/RPC/rpc.h
    M libc/utils/gpu/server/rpc_server.cpp

  Log Message:
  -----------
  [libc] Scan the ports more fairly in the RPC server (#66680)

Summary:
Currently, we use the RPC server to respond to different ports which
each contain a request from some client thread wishing to do work on the
server. This scan starts at zero and continues until its checked all
ports at which point it resets. If we find an active port, we service it
and then restart the search.

This is bad for two reasons. First, it means that we will always bias
the lower ports. If a thread grabs a high port it will be stuck for a
very long time until all the other work is done. Second, it means that
the `handle_server` function can technically run indefinitely as long as
the client is always pushing new work. Because the OpenMP implementation
uses the user thread to service the kernel, this means that it could be
stalled with another asyncrhonous device's kernels.

This patch addresses this by making the server restart at the next port
over. This means we will always do a full scan of the ports before
quitting.




More information about the All-commits mailing list