[llvm] [offload] - Fix issue with standalone debug offload build (PR #104647)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 14:50:14 PDT 2024
https://github.com/estewart08 updated https://github.com/llvm/llvm-project/pull/104647
>From ef15d8946e449ab0cc73182cbf7283fd7d0c1223 Mon Sep 17 00:00:00 2001
From: Ethan Stewart <ethan.stewart at amd.com>
Date: Fri, 16 Aug 2024 18:59:24 -0400
Subject: [PATCH 1/2] [offload] - Fix issue with standalone debug offload build
Error: CommandLine Error: Option 'attributor-manifest-internal'
registered more than once
During the standalone debug build of offload the above error is seen
at app runtime when using a prebuilt llvm with LLVM_LINK_LLVM_DYLIB=ON. This
is caused by linking both libLLVM.so and various archives that
are found via llvm_map_components_to_libnames for jit support.
---
offload/plugins-nextgen/common/CMakeLists.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt
index 284f98875170cd..fb3bf9591b1429 100644
--- a/offload/plugins-nextgen/common/CMakeLists.txt
+++ b/offload/plugins-nextgen/common/CMakeLists.txt
@@ -13,8 +13,12 @@ add_dependencies(PluginCommon intrinsics_gen)
set(supported_jit_targets AMDGPU NVPTX)
foreach(target IN LISTS supported_jit_targets)
if("${target}" IN_LIST LLVM_TARGETS_TO_BUILD)
- target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
- llvm_map_components_to_libnames(llvm_libs ${target})
+ target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
+ if (LLVM_LINK_LLVM_DYLIB)
+ set(llvm_libs LLVM)
+ else()
+ llvm_map_components_to_libnames(llvm_libs ${target})
+ endif()
target_link_libraries(PluginCommon PRIVATE ${llvm_libs})
endif()
endforeach()
>From 0c5934436b8125ef2f20c3166439980666677637 Mon Sep 17 00:00:00 2001
From: Ethan Stewart <ethan.stewart at amd.com>
Date: Mon, 19 Aug 2024 17:49:44 -0400
Subject: [PATCH 2/2] [offload] - Move LLVM_DYLIB check to outside jit support
loop.
---
offload/plugins-nextgen/common/CMakeLists.txt | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt
index fb3bf9591b1429..aea20c6ec31435 100644
--- a/offload/plugins-nextgen/common/CMakeLists.txt
+++ b/offload/plugins-nextgen/common/CMakeLists.txt
@@ -11,17 +11,15 @@ add_dependencies(PluginCommon intrinsics_gen)
# Only enable JIT for those targets that LLVM can support.
set(supported_jit_targets AMDGPU NVPTX)
-foreach(target IN LISTS supported_jit_targets)
- if("${target}" IN_LIST LLVM_TARGETS_TO_BUILD)
- target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
- if (LLVM_LINK_LLVM_DYLIB)
- set(llvm_libs LLVM)
- else()
+if (NOT LLVM_LINK_LLVM_DYLIB)
+ foreach(target IN LISTS supported_jit_targets)
+ if("${target}" IN_LIST LLVM_TARGETS_TO_BUILD)
+ target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
llvm_map_components_to_libnames(llvm_libs ${target})
+ target_link_libraries(PluginCommon PRIVATE ${llvm_libs})
endif()
- target_link_libraries(PluginCommon PRIVATE ${llvm_libs})
- endif()
-endforeach()
+ endforeach()
+endif()
# Include the RPC server from the `libc` project if availible.
if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
More information about the llvm-commits
mailing list