[all-commits] [llvm/llvm-project] a39215: [libc] Rework the 'fgets' implementation on the GP...

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu Oct 19 14:00:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a39215768b58bb39716820959cedf82c76648770
      https://github.com/llvm/llvm-project/commit/a39215768b58bb39716820959cedf82c76648770
  Author: Joseph Huber <35342157+jhuber6 at users.noreply.github.com>
  Date:   2023-10-19 (Thu, 19 Oct 2023)

  Changed paths:
    M libc/include/llvm-libc-types/rpc_opcodes_t.h
    M libc/src/stdio/gpu/fgets.cpp
    M libc/utils/gpu/server/rpc_server.cpp

  Log Message:
  -----------
  [libc] Rework the 'fgets' implementation on the GPU (#69635)

Summary:
The `fgets` function as implemented is not functional currently when
called with multiple threads. This is because we rely on reapeatedly
polling the character to detect EOF. This doesn't work when there are
multiple threads that may with to poll the characters. this patch pulls
out the logic into a standalone RPC call to handle this in a single
operation such that calling it from multiple threads functions as
expected. It also makes it less slow because we no longer make N RPC
calls for N characters.




More information about the All-commits mailing list