The packaged version of the `libc` library does not depend on the CUDA installation because it only uses `clang` and emits LLVM-IR. However, for testing we directly need the CUDA toolkit to emit and execute the files. This patch explicitly passes `--cuda-path` to the relevant compilations for NVPTX testing. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D147653
27 lines
656 B
CMake
27 lines
656 B
CMake
if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
|
|
set(TEST_COMPILE_FLAGS
|
|
-mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
|
|
-emit-llvm # AMDGPU's intermediate object file format is bitcode.
|
|
--target=${LIBC_GPU_TARGET_TRIPLE}
|
|
)
|
|
elseif(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
|
|
set(TEST_COMPILE_FLAGS
|
|
-march=${LIBC_GPU_TARGET_ARCHITECTURE}
|
|
--target=${LIBC_GPU_TARGET_TRIPLE}
|
|
--cuda-path=${LIBC_CUDA_ROOT}
|
|
)
|
|
endif()
|
|
|
|
add_object_library(
|
|
test
|
|
SRCS
|
|
test.cpp
|
|
COMPILE_OPTIONS
|
|
${TEST_COMPILE_FLAGS}
|
|
HDRS
|
|
test.h
|
|
DEPENDS
|
|
libc.src.__support.OSUtil.osutil
|
|
NO_GPU_BUNDLE # Compile this file directly without special GPU handling.
|
|
)
|