[Openmp-commits] [openmp] 4e9054d - [Libomptarget] Fix lookup of the `libcgpu.a` library
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Thu Oct 5 08:49:03 PDT 2023
Author: Joseph Huber
Date: 2023-10-05T10:48:56-05:00
New Revision: 4e9054d3914a7095e28a9ba4e26a80b10bcc6c3d
URL: https://github.com/llvm/llvm-project/commit/4e9054d3914a7095e28a9ba4e26a80b10bcc6c3d
DIFF: https://github.com/llvm/llvm-project/commit/4e9054d3914a7095e28a9ba4e26a80b10bcc6c3d.diff
LOG: [Libomptarget] Fix lookup of the `libcgpu.a` library
Summary:
The `libcgpu.a` library was added to support certain libc functions. A
recent patch made us pass its location directly on the commandline,
however it used `find_library`. This doesn't work because the ordering
of CMake might run `fine_library` before it builds the library we're
trying to find. This patch changes this to just use the destimation we
know it will end up in and checks it manually.
Added:
Modified:
openmp/libomptarget/CMakeLists.txt
openmp/libomptarget/test/lit.cfg
openmp/libomptarget/test/lit.site.cfg.in
Removed:
################################################################################
diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt
index 0414b1d911523ad..5f592f46c8ffa54 100644
--- a/openmp/libomptarget/CMakeLists.txt
+++ b/openmp/libomptarget/CMakeLists.txt
@@ -96,15 +96,6 @@ if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND (LIBC_GPU_BUILD OR
set(LIBC_GPU_SUPPORT TRUE)
endif()
-# Find the path of the GPU libc static library.
-find_library(GPU_LIBC_PATH NAMES cgpu
- PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
-if((NOT GPU_LIBC_PATH) OR (NOT LIBC_GPU_SUPPORT))
- set(GPU_LIBC_PATH "")
-endif()
-
-set(LIBOMPTARGET_GPU_LIBC_PATH ${GPU_LIBC_PATH} CACHE STRING
- "Location of the 'libcgpu.a' library ")
set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${LIBC_GPU_SUPPORT} CACHE BOOL
"Libomptarget support for the GPU libc")
pythonize_bool(LIBOMPTARGET_GPU_LIBC_SUPPORT)
diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg
index 323a5b58a2652e4..80a3c10d3a949f5 100644
--- a/openmp/libomptarget/test/lit.cfg
+++ b/openmp/libomptarget/test/lit.cfg
@@ -153,8 +153,10 @@ def remove_suffix_if_present(name):
return name
def add_libraries(source):
- return source + " " + config.libomptarget_libc_path + " " + \
- config.library_dir + "/libomptarget.devicertl.a"
+ if config.libomptarget_has_libc:
+ return source + " " + config.llvm_library_dir + "/libcgpu.a " + \
+ config.library_dir + "/libomptarget.devicertl.a"
+ return source + " " + config.library_dir + "/libomptarget.devicertl.a"
# substitutions
# - for targets that exist in the system create the actual command.
diff --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in
index 3d345d3012ec3ab..2c6b90ad46019b2 100644
--- a/openmp/libomptarget/test/lit.site.cfg.in
+++ b/openmp/libomptarget/test/lit.site.cfg.in
@@ -12,6 +12,7 @@ config.cuda_libdir = "@CUDA_LIBDIR@"
config.cuda_test_arch = "@LIBOMPTARGET_DEP_CUDA_ARCH@"
config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@/@CURRENT_TARGET@"
config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
+config.llvm_library_dir = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@"
config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"
config.omp_host_rtl_directory = "@LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER@"
config.llvm_lib_directory = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@"
@@ -23,7 +24,6 @@ config.libomptarget_not = "@OPENMP_NOT_EXECUTABLE@"
config.libomptarget_debug = @LIBOMPTARGET_DEBUG@
config.has_libomptarget_ompt = @LIBOMPTARGET_OMPT_SUPPORT@
config.libomptarget_has_libc = @LIBOMPTARGET_GPU_LIBC_SUPPORT@
-config.libomptarget_libc_path = "@LIBOMPTARGET_GPU_LIBC_PATH@"
# Let the main config do the real work.
lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
More information about the Openmp-commits
mailing list