Skip to content

Commit

Permalink
[openmp] - Cherry pick changes for CUDA_ARCH and libclang-cpp.so.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
estewart08 authored and ronlieb committed Oct 13, 2022
1 parent 3cf23f7 commit b4eabb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ extern "C" {
#pragma omp end declare variant

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

// __NO_INLINE__ prevents some x86 optimized macro definitions in system headers
Expand Down
11 changes: 1 addition & 10 deletions openmp/libomptarget/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,7 @@ endif()

find_library(LLVM_OFFLOAD_ARCH LLVMOffloadArch HINTS ${LLVM_LIBRARY_DIR} REQUIRED)

target_include_directories(omptarget PRIVATE
${LIBOMPTARGET_INCLUDE_DIR})

# If LLVM DYLIB is off we need to link in libclang-cpp.
find_library(LLVM_DYLIB LLVM HINTS ${LLVM_LIBRARY_DIR})
if(NOT LLVM_DYLIB)
libomptarget_say("LLVM_DYLIB off: linking libclang-cpp with libomptarget.so")
find_library(CLANG_CPP clang-cpp HINTS ${LLVM_LIBRARY_DIR} REQUIRED)
target_link_libraries(omptarget PRIVATE ${CLANG_CPP})
endif()
target_include_directories(omptarget PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})

target_link_libraries(omptarget PRIVATE
${CMAKE_DL_LIBS}
Expand Down

0 comments on commit b4eabb4

Please sign in to comment.