[all-commits] [llvm/llvm-project] d04494: [libc] Rework the file handling for the GPU

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Aug 9 12:42:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d04494ccc913d0fa0aba914d2336619ad03fa3b0
      https://github.com/llvm/llvm-project/commit/d04494ccc913d0fa0aba914d2336619ad03fa3b0
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
    M libc/config/gpu/entrypoints.txt
    M libc/docs/gpu/support.rst
    M libc/src/__support/File/CMakeLists.txt
    M libc/src/__support/File/file.cpp
    M libc/src/__support/File/file.h
    R libc/src/__support/File/gpu/CMakeLists.txt
    R libc/src/__support/File/gpu/dir.cpp
    R libc/src/__support/File/gpu/file.cpp
    M libc/src/stdio/CMakeLists.txt
    A libc/src/stdio/gpu/CMakeLists.txt
    A libc/src/stdio/gpu/file.h
    A libc/src/stdio/gpu/fputs.cpp
    A libc/src/stdio/gpu/puts.cpp
    A libc/src/stdio/gpu/stderr.cpp
    A libc/src/stdio/gpu/stdin.cpp
    A libc/src/stdio/gpu/stdout.cpp
    M libc/test/src/stdio/CMakeLists.txt

  Log Message:
  -----------
  [libc] Rework the file handling for the GPU

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.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D157427




More information about the All-commits mailing list