[libc-commits] [PATCH] D157427: [libc] Rework the file handling for the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 8 12:03:10 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield, lntue, michaelrj, sivachandra.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
jhuber6 requested review of this revision.

The GPU has much tighter requirements for handling IO functions.
Previously we attempted to define the GPU as one of the platform files.
Using a common interface allowed us to easily define these functions
without much extra work. However, it became more clear that this was a
poor fit for the GPU. The file interface uses function pointers, which
prevented inlining and caused bad perfromance and resource usage on the
GPU. Further, using an actual `FILE` type rather than referring to it as
a host stub prevented us from usin files coming from the host on the GPU
device.

After talking with @sivachandra, the approach now is to simply define
GPU specific versions of the functions we intend to support. Also, we
are ignoring `errno` for the time being as it is unlikely we will ever
care about supporting it fully.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157427

Files:
  libc/config/gpu/entrypoints.txt
  libc/docs/gpu/support.rst
  libc/src/__support/File/CMakeLists.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/stdio/CMakeLists.txt
  libc/src/stdio/gpu/CMakeLists.txt
  libc/src/stdio/gpu/file.h
  libc/src/stdio/gpu/fputs.cpp
  libc/src/stdio/gpu/puts.cpp
  libc/src/stdio/stderr.cpp
  libc/src/stdio/stdin.cpp
  libc/src/stdio/stdout.cpp
  libc/test/src/stdio/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157427.548308.patch
Type: text/x-patch
Size: 27173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230808/084de152/attachment-0001.bin>


More information about the libc-commits mailing list