Skip to content

Commit b4eabb4

Browse files
estewart08ronlieb
authored andcommitted
[openmp] - Cherry pick changes for CUDA_ARCH and libclang-cpp.so.
38e2804 [openmp] - Remove linking of libclang-cpp.so with libomptarget.so. Now that libomptarget is a LLVM library we no longer need to link in libclang-cpp.so. be30280 [openmp] - undef __CUDA_ARCH__ When -fcuda-is-device is passed on the clang device pass, __CUDA_ARCH__ is defined. When __AMDGCN__ is defined, ensure __CUDA_ARCH__ is undefined. Change-Id: Icc0a8675b085b670d314b08cf4bfca04b6037ef1
1 parent 3cf23f7 commit b4eabb4

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ extern "C" {
4242
#pragma omp end declare variant
4343

4444
#ifdef __AMDGCN__
45+
// -fcuda-is-device defines __CUDA_ARCH__
46+
#undef __CUDA_ARCH__
4547
#pragma omp begin declare variant match(device = {arch(amdgcn)})
4648

4749
// __NO_INLINE__ prevents some x86 optimized macro definitions in system headers

openmp/libomptarget/src/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,7 @@ endif()
4848

4949
find_library(LLVM_OFFLOAD_ARCH LLVMOffloadArch HINTS ${LLVM_LIBRARY_DIR} REQUIRED)
5050

51-
target_include_directories(omptarget PRIVATE
52-
${LIBOMPTARGET_INCLUDE_DIR})
53-
54-
# If LLVM DYLIB is off we need to link in libclang-cpp.
55-
find_library(LLVM_DYLIB LLVM HINTS ${LLVM_LIBRARY_DIR})
56-
if(NOT LLVM_DYLIB)
57-
libomptarget_say("LLVM_DYLIB off: linking libclang-cpp with libomptarget.so")
58-
find_library(CLANG_CPP clang-cpp HINTS ${LLVM_LIBRARY_DIR} REQUIRED)
59-
target_link_libraries(omptarget PRIVATE ${CLANG_CPP})
60-
endif()
51+
target_include_directories(omptarget PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})
6152

6253
target_link_libraries(omptarget PRIVATE
6354
${CMAKE_DL_LIBS}

0 commit comments

Comments
 (0)