[Openmp-commits] [openmp] 338c805 - [Libomptarget] Refine logic for determining if we support RPC

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Fri Jul 7 12:07:12 PDT 2023


Author: Joseph Huber
Date: 2023-07-07T14:06:58-05:00
New Revision: 338c80516bc71474b79ff3955b28196da50898a2

URL: https://github.com/llvm/llvm-project/commit/338c80516bc71474b79ff3955b28196da50898a2
DIFF: https://github.com/llvm/llvm-project/commit/338c80516bc71474b79ff3955b28196da50898a2.diff

LOG: [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.

Added: 
    

Modified: 
    openmp/libomptarget/CMakeLists.txt
    openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
    openmp/libomptarget/test/lit.site.cfg.in

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt
index 61bcb46504d43b..50c59cb2e02e14 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 087125fd8b9379..1801b0ebd7ddcb 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 47bd8b6450bc41..ffe9e182df49ec 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)


        


More information about the Openmp-commits mailing list