[llvm] fbd7c50 - [libc] Repurpose `LIBC_GPU_BUILD` option to enable the new format (#82848)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 13 12:25:26 PDT 2024
Author: Joseph Huber
Date: 2024-03-13T14:25:22-05:00
New Revision: fbd7c50065705c44e1b3d39f456963810124051b
URL: https://github.com/llvm/llvm-project/commit/fbd7c50065705c44e1b3d39f456963810124051b
DIFF: https://github.com/llvm/llvm-project/commit/fbd7c50065705c44e1b3d39f456963810124051b.diff
LOG: [libc] Repurpose `LIBC_GPU_BUILD` option to enable the new format (#82848)
Summary:
We previously used the `LIBC_GPU_BUILD` option to control whether or not
the GPU build was enabled. This was recently replaced with a new format
that allows treating the GPU targets more directly. However, the new
format is somewhat difficult to use for people unfamiliar with the
runtimes builds, and the removal of this option somewhat broke backward
compatibility. This patch seeks to simplify enabling the GPU build by
repurposing the old enabling option and convert it to the new interface.
Unsure what the rules are here, since this is technically a `LIBC`
option living in the LLVM location.
Added:
Modified:
libc/CMakeLists.txt
llvm/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6edf5c656193db..7afb3c5f0faa95 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -134,7 +134,6 @@ option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc"
option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF)
-option(LIBC_GPU_BUILD "Build libc for the GPU. All CPU build options will be ignored." OFF)
set(LIBC_TARGET_TRIPLE "" CACHE STRING "The target triple for the libc build.")
option(LIBC_CONFIG_PATH "The path to user provided folder that configures the build for the target system." OFF)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index bd141619d03fd1..6f5647d70d8bc1 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -159,6 +159,18 @@ foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
endif()
endforeach()
+# Set a shorthand option to enable the GPU build of the 'libc' project.
+option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF)
+if(LIBC_GPU_BUILD)
+ if(LLVM_RUNTIME_TARGETS)
+ list(APPEND LLVM_RUNTIME_TARGETS "nvptx64-nvidia-cuda" "amdgcn-amd-amdhsa")
+ else()
+ set(LLVM_RUNTIME_TARGETS "default;nvptx64-nvidia-cuda;amdgcn-amd-amdhsa")
+ endif()
+ list(APPEND RUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES "libc")
+ list(APPEND RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES "libc")
+endif()
+
set(NEED_LIBC_HDRGEN FALSE)
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
set(NEED_LIBC_HDRGEN TRUE)
More information about the llvm-commits
mailing list