[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
Fri May 26 11:16:05 PDT 2023
jhuber6 updated this revision to Diff 526135.
jhuber6 added a comment.
Updating. I decided that the most painless method would be to make a constexpr
function that the GPU can use to disable buffering features. This is a little
ugly, but not unreasonable I don't think. Previously a lot of buffering code was
either causing errors or leading to very inefficient implementations on the GPU.
Hopefully this is an acceptable amount of ugliness to implement these in
general.
For reference, the GPU doesn't support buffering for a few reasons. First, the
buffer is a global shared resource. This would require a functioning mutex which
the GPU does not have. In general locks on the GPU cannot be safely implemented
due to lack of forward progress guaruntees. I.e. one thread cannot depend on
another reliably. Even if they were to be implemented it would be undesireable
as the GPU is highly parallel with thousands of threads running at the same
time. Second, even if we did have a reliable lock, it would likely add a
significant amount of register pressure to the GPU kernel. It is quite easy to
run out of resources so we need to be sparse if possible.
Buffering in theory would be nice on the GPU as it could prevent us from
performing an RPC call in situations where the user needs to send less than 64
bits, but the rest of the cost is unlikely to make up for it.
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.cpp
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.526135.patch
Type: text/x-patch
Size: 11391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230526/c2fbbd16/attachment-0001.bin>
More information about the libc-commits
mailing list