From 338c80516bc71474b79ff3955b28196da50898a2 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 7 Jul 2023 13:18:41 -0500 Subject: [PATCH] [Libomptarget] Refine logic for determining if we support RPC 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. --- openmp/libomptarget/CMakeLists.txt | 10 ++++++++++ .../plugins-nextgen/common/PluginInterface/CMakeLists.txt | 9 ++------- openmp/libomptarget/test/lit.site.cfg.in | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt index 61bcb46..50c59cb 100644 --- a/openmp/libomptarget/CMakeLists.txt +++ b/openmp/libomptarget/CMakeLists.txt @@ -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}) diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt index 087125f..1801b0e 100644 --- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt +++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt @@ -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) diff --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in index 47bd8b6..ffe9e18 100644 --- a/openmp/libomptarget/test/lit.site.cfg.in +++ b/openmp/libomptarget/test/lit.site.cfg.in @@ -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) -- 2.7.4