[all-commits] [llvm/llvm-project] dad744: [compiler-rt] Initial support for builtins on GPU ...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Jul 10 13:07:32 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dad7442aff5c85ff9141b0d0f231bcd731cbadc6
      https://github.com/llvm/llvm-project/commit/dad7442aff5c85ff9141b0d0f231bcd731cbadc6
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-07-10 (Wed, 10 Jul 2024)

  Changed paths:
    M compiler-rt/cmake/Modules/AddCompilerRT.cmake
    M compiler-rt/cmake/Modules/BuiltinTests.cmake
    M compiler-rt/cmake/Modules/CompilerRTUtils.cmake
    M compiler-rt/cmake/base-config-ix.cmake
    M compiler-rt/cmake/builtin-config-ix.cmake
    A compiler-rt/cmake/caches/GPU.cmake
    M compiler-rt/lib/builtins/CMakeLists.txt

  Log Message:
  -----------
  [compiler-rt] Initial support for builtins on GPU targets (#95304)

Summary:
This patch adds initial support to build the `builtins` library for GPU
targets. Primarily this requires adding a few new architectures for
`amdgcn` and `nvptx64`. I built this using the following invocations.

```console
$ cmake ../compiler-rt -DCMAKE_C_COMPILER=clang
  -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja
  -DCMAKE_C_COMPILER_TARGET=<nvptx64-nvidia-cuda|amdgcn-amd-amdhsa>
  -DCMAKE_CXX_COMPILER_TARGET=<nvptx64-nvidia-cuda|amdgcn-amd-amdhsa>
  -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1
  -DLLVM_CMAKE_DIR=../cmake/Modules -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
  -C ../compiler-rt/cmake/caches/GPU.cmake
```

Some pointers would be appreciated for how to test this using a standard
(non-default target only) build.

GPU builds are somewhat finnicky. We only expect this to be built with a
sufficiently new clang, as it's the only compiler that supports the
target and output we distribute. Distribution is done as LLVM-IR blobs
for now.
GPUs have little backward compatibility, so linking object files is
left to a future patch.

More work is necessary to build correctly for all targets and ship into
the correct clang resource directory. Additionally we need to use the
`libc` project's support for running unit tests.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list