[libc-commits] [PATCH] D151282: [libc] Add initial support for 'puts' and 'fputs' to the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 24 11:20:02 PDT 2023


jhuber6 updated this revision to Diff 525275.
jhuber6 added a comment.

Fix the issue with `stdin`. This requires removing `constexpr` from this function and I'm unsure why it's problematic, maybe someone can help me understand why it would caue an infinite reference and crash the GPU backend.

Overall, the precense of all the buffering code in this implementation is detrimental to implementing this on the GPU. The register usage for `puts` is currently ~70 registers while the basic `write_to_stderr` is only ~25. There could be some discussions on how to best optionally disable the buffering, but as it stands I don't think the runtime configuration is enough. A templated class would be ideal, but then we'd have a hard time keeping compatibility with user's custom streams for the `Linux` case. Worst case scenario we have a separate implementation just for GPUs to use. It would be very short and unlikely to change so it might be the easiest solution rather than to force the other targets into this very specific mold.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151282

Files:
  libc/config/gpu/api.td
  libc/config/gpu/entrypoints.txt
  libc/config/gpu/headers.txt
  libc/src/__support/File/file.h
  libc/src/__support/File/gpu/CMakeLists.txt
  libc/src/__support/File/gpu/dir.cpp
  libc/src/__support/File/gpu/file.cpp
  libc/src/__support/RPC/rpc.h
  libc/test/src/stdio/CMakeLists.txt
  libc/utils/gpu/loader/Server.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151282.525275.patch
Type: text/x-patch
Size: 9124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230524/627f0069/attachment.bin>


More information about the libc-commits mailing list