[libc-commits] [PATCH] D138608: [libc] Add initial support for a libc implementation for the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Nov 23 13:48:17 PST 2022


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

This patch contains the initial support for building LLVM's libc as a
target for the GPU. Currently this only supports a handful of very basic
functions that can be implemented without an operating system. The GPU
code is build using the existing OpenMP toolchain. This allows us to
minimally change the existing codebase and get a functioning static
library. This patch allows users to create a static library called
`libcpu.a` that contains fat binaries containing device IR.

Current limitations are the lack of test support and the fact that only
one target OS can be built at a time. That is, the user cannot get a
`libc` for Linux and one for the GPU simultaneously.

This introduces two new CMake variables to control the behavior
`LLVM_LIBC_TARET_OS` is exported so the user can now specify it to equal
`"gpu"`. `LLVM_LIBC_GPU_ARCHITECTURES` is also used to configure how
many targets to build for at once.

Depends on D138607 <https://reviews.llvm.org/D138607>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138608

Files:
  libc/CMakeLists.txt
  libc/cmake/modules/LLVMLibCArchitectures.cmake
  libc/cmake/modules/LLVMLibCObjectRules.cmake
  libc/config/gpu/api.td
  libc/config/gpu/entrypoints.txt
  libc/config/gpu/headers.txt
  libc/src/__support/architectures.h
  libc/src/__support/common.h
  libc/src/string/memory_utils/bcmp_implementations.h
  libc/src/string/memory_utils/memcmp_implementations.h
  libc/src/string/memory_utils/memcpy_implementations.h
  libc/src/string/memory_utils/memmove_implementations.h
  libc/src/string/memory_utils/memset_implementations.h
  libc/utils/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138608.477599.patch
Type: text/x-patch
Size: 12137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221123/87ff0c15/attachment-0001.bin>


More information about the libc-commits mailing list