[libc-commits] [PATCH] D143089: [libc] Remove OpenMP and build the GPU libc directly
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Feb 1 09:47:05 PST 2023
jhuber6 created this revision.
jhuber6 added reviewers: sivachandra, lntue, michaelrj.
Herald added subscribers: libc-commits, ecnelises, tschuett, guansong, yaxunl.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
The current `libcgpu.a` is actually an archive of fatbinaries. The host
file contains nothing but a section called `LLVM_OFFLOADING` that
contains embedded device code. This used to be handled implicitly by
borrowing the OpenMP toolchain, which did this packaging internally.
Passing the OpenMP flags causes problems with trying to move to testing.
This patch pulls this logic out into the CMake and handles it manually.
This patch is a lot of noise, but it fundamentally comes down to the
following changes.
1. Build the source for every GPU architecture (GPU architectures are generally not backwards compatible)
2. Combine all of these files into a single binary blob
3. Embed that binary blob into a host file
4. Package these host files into a `.a` archive.
5. The device code will be extracted and managed by the offloading linker.
Another important point. Right now we are maintaining an important
distinction with the GPU build. That is, when we build the exported
library we will build for many GPU architectures. However, the internal
version will only be built for a single GPU architecture, one that was
found on the user's system. This is intended to be used for internal
testing, very similar to the current path where `libc` is compiled for a
single target triple.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143089
Files:
libc/cmake/modules/LLVMLibCObjectRules.cmake
libc/cmake/modules/prepare_libc_gpu_build.cmake
libc/src/__support/common.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143089.493990.patch
Type: text/x-patch
Size: 15038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230201/e48ffa0c/attachment.bin>
More information about the libc-commits
mailing list