Skip to content

Commit

Permalink
[Libomptarget] Refine logic for determining if we support RPC
Browse files Browse the repository at this point in the history
Summary:
Add a requirement for the GPU libc to only be on if its enabled
explicitly. Fix the logic around the pythonification of the variable.
  • Loading branch information
jhuber6 committed Jul 7, 2023
1 parent 9ab3468 commit 338c805
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
10 changes: 10 additions & 0 deletions openmp/libomptarget/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ endif()

pythonize_bool(LIBOMPTARGET_OMPT_SUPPORT)

# Check if this build supports the GPU libc.
set(LIBC_GPU_SUPPORT FALSE)
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND (LIBC_GPU_BUILD OR
LIBC_GPU_ARCHITECTURES))
set(LIBC_GPU_SUPPORT TRUE)
endif()
set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${LIBC_GPU_SUPPORT} CACHE BOOL
"Libomptarget support for the GPU libc")
pythonize_bool(LIBOMPTARGET_GPU_LIBC_SUPPORT)

set(LIBOMPTARGET_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
message(STATUS "OpenMP tools dir in libomptarget: ${LIBOMP_OMP_TOOLS_INCLUDE_DIR}")
include_directories(${LIBOMP_OMP_TOOLS_INCLUDE_DIR})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,18 @@ target_link_libraries(PluginInterface
)

# Include the RPC server from the `libc` project if availible.
set(libomptarget_supports_rpc FALSE)
if(TARGET llvmlibc_rpc_server)
if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
target_link_libraries(PluginInterface PRIVATE llvmlibc_rpc_server)
target_compile_definitions(PluginInterface PRIVATE LIBOMPTARGET_RPC_SUPPORT)
set(libomptarget_supports_rpc TRUE)
else()
elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server
PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
if(llvmlibc_rpc_server)
message(WARNING ${llvmlibc_rpc_server})
target_link_libraries(PluginInterface PRIVATE llvmlibc_rpc_server)
target_compile_definitions(PluginInterface PRIVATE LIBOMPTARGET_RPC_SUPPORT)
set(libomptarget_supports_rpc TRUE)
endif()
endif()
set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${libomptarget_supports_rpc} CACHE BOOL
"Libomptarget support for the GPU libc")

if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
target_link_libraries(PluginInterface PUBLIC OMPT)
Expand Down
2 changes: 1 addition & 1 deletion openmp/libomptarget/test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ config.libomptarget_not = "@OPENMP_NOT_EXECUTABLE@"
config.libomptarget_debug = @LIBOMPTARGET_DEBUG@
config.has_libomptarget_ompt = @LIBOMPTARGET_OMPT_SUPPORT@
config.llvm_enabled_projects = "@LLVM_ENABLE_PROJECTS@".split(";")
config.libomptarget_has_libc = "@LIBOMPTARGET_GPU_LIBC_SUPPORT@"
config.libomptarget_has_libc = @LIBOMPTARGET_GPU_LIBC_SUPPORT@

import lit.llvm
lit.llvm.initialize(lit_config, config)
Expand Down

0 comments on commit 338c805

Please sign in to comment.