[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
Tue May 23 20:38:45 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: tra, jdoerfert, tianshilei1992, JonChesterfield, sivachandra, lntue, michaelrj.
Herald added subscribers: libc-commits, ecnelises, tschuett, tpr.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.

This patch adds the initial support required to support basic priting in
`stdio.h` via `puts` and `fputs`. This is done using the existing LLVM C
library `File` API. In this sense we can think of the RPC interface as
our system call to dump the character string to the file. We carry a
`uintptr_t` reference as our native "file descriptor" as it will be used
as an opaque reference to the host's version once functions like
`fopen` are supported.

For some unknown reason the declaration of the `StdIn` variable causes
both the AMDGPU and NVPTX backends to crash if I use the `READ` flag.
This is not used currently as we only support output now, but it needs
to be fixed


Repository:
  rG LLVM Github Monorepo

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/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.524985.patch
Type: text/x-patch
Size: 8647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230524/3fc8ccca/attachment-0001.bin>


More information about the libc-commits mailing list