-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc][gpu][NFC] Move CMake logic to prepare GPU build to a separate …
…file. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D140309
- Loading branch information
Siva Chandra Reddy
committed
Dec 19, 2022
1 parent
6a907a4
commit 8d68195
Showing
2 changed files
with
28 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Set up the target architectures to build the GPU libc for. | ||
set(all_gpu_architectures "sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62;" | ||
"sm_70;sm_72;sm_75;sm_80;sm_86;gfx700;gfx701;gfx801;" | ||
"gfx803;gfx900;gfx902;gfx906;gfx908;gfx90a;gfx90c;" | ||
"gfx940;gfx1010;gfx1030;gfx1031;gfx1032;gfx1033;" | ||
"gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;" | ||
"gfx1103") | ||
set(LIBC_GPU_ARCHITECTURES ${all_gpu_architectures} CACHE STRING | ||
"List of GPU architectures to build the libc for.") | ||
if(LIBC_GPU_ARCHITECTURES STREQUAL "all") | ||
set(LIBC_GPU_ARCHITECTURES ${all_gpu_architectures} FORCE) | ||
endif() | ||
|
||
# Ensure the compiler is a valid clang when building the GPU target. | ||
set(req_ver "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}") | ||
if(LIBC_TARGET_ARCHITECTURE_IS_GPU AND | ||
NOT (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" AND | ||
${CMAKE_CXX_COMPILER_VERSION} VERSION_EQUAL "${req_ver}")) | ||
message(FATAL_ERROR "Cannot build libc for GPU. CMake compiler " | ||
"'${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}' " | ||
" is not `Clang ${req_ver}.") | ||
endif() | ||
if(LLVM_LIBC_FULL_BUILD) | ||
message(FATAL_ERROR "LLVM_LIBC_FULL_BUILD must be enabled to build libc for " | ||
"GPU.") | ||
endif() |