[all-commits] [llvm/llvm-project] 791b27: [libc] Change the `puts` implementation on the GPU...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Sep 25 09:17:36 PDT 2023


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

  Changed paths:
    M libc/include/llvm-libc-types/rpc_opcodes_t.h
    M libc/src/stdio/gpu/puts.cpp
    M libc/utils/gpu/server/rpc_server.cpp
    M openmp/libomptarget/test/libc/puts.c

  Log Message:
  -----------
  [libc] Change the `puts` implementation on the GPU (#67189)

Summary:
Normally, the implementation of `puts` simply writes a second newline
charcter after printing the first string. However, because the GPU does
everything in batches of the SIMT group size, this will end up with very
poor output where you get the strings printed and then 1-64 newline
characters all in a row. Optimizations like to turn `printf` calls into
`puts` so it's a good idea to make this produce the expected output.

The least invasive way I could do this was to add a new opcode. It's a
little bloated, but it avoids an unneccessary and slow send operation to
configure this.




More information about the All-commits mailing list