diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-05-15 14:13:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-15 14:13:50 -0500 |
commit | 64b3cdc0220174c1af236a42b227a5226f0f12c5 (patch) | |
tree | 83ad9aa60d261bbe57985c3863287c93b752df8d /libc/cmake | |
parent | d542eb7aa830e94490b943a3ea0937506fece15b (diff) | |
download | llvm-64b3cdc0220174c1af236a42b227a5226f0f12c5.zip llvm-64b3cdc0220174c1af236a42b227a5226f0f12c5.tar.gz llvm-64b3cdc0220174c1af236a42b227a5226f0f12c5.tar.bz2 |
[libc] Fix GPU handling for unsupported backends (#92271)
Summary:
If the user does not have the selected backend enabled, we should still
be able to build the LLVM-IR an ddistribute it. This patch makes logic
to suppress tests if the backend can't build it, as well as removing a
flag for the building that's only present int he NVPTX backend.
Diffstat (limited to 'libc/cmake')
-rw-r--r-- | libc/cmake/modules/LLVMLibCCompileOptionRules.cmake | 1 | ||||
-rw-r--r-- | libc/cmake/modules/prepare_libc_gpu_build.cmake | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake index 5b3a10d..3bf4293 100644 --- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake +++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake @@ -101,7 +101,6 @@ function(_get_common_compile_options output_var flags) if(LIBC_TARGET_ARCHITECTURE_IS_NVPTX) list(APPEND compile_options "-Wno-unknown-cuda-version") - list(APPEND compile_options "SHELL:-mllvm -nvptx-emit-init-fini-kernel=false") list(APPEND compile_options "--cuda-feature=+ptx63") if(LIBC_CUDA_ROOT) list(APPEND compile_options "--cuda-path=${LIBC_CUDA_ROOT}") diff --git a/libc/cmake/modules/prepare_libc_gpu_build.cmake b/libc/cmake/modules/prepare_libc_gpu_build.cmake index 20aca16..88538ca 100644 --- a/libc/cmake/modules/prepare_libc_gpu_build.cmake +++ b/libc/cmake/modules/prepare_libc_gpu_build.cmake @@ -76,7 +76,15 @@ elseif(LIBC_TARGET_ARCHITECTURE_IS_NVPTX) endif() set(gpu_test_architecture "") -if(LIBC_GPU_TEST_ARCHITECTURE) +if(DEFINED LLVM_TARGETS_TO_BUILD AND LIBC_TARGET_ARCHITECTURE_IS_AMDGPU + AND NOT "AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD) + set(LIBC_GPU_TESTS_DISABLED TRUE) + message(STATUS "AMDGPU backend is not available, tests will not be built") +elseif(DEFINED LLVM_TARGETS_TO_BUILD AND LIBC_TARGET_ARCHITECTURE_IS_AMDGPU + AND NOT "NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) + set(LIBC_GPU_TESTS_DISABLED TRUE) + message(STATUS "NVPTX backend is not available, tests will not be built") +elseif(LIBC_GPU_TEST_ARCHITECTURE) set(LIBC_GPU_TESTS_DISABLED FALSE) set(gpu_test_architecture ${LIBC_GPU_TEST_ARCHITECTURE}) message(STATUS "Using user-specified GPU architecture for testing: " |