Author: Joachim Protze Date: 2021-09-03T15:49:31-07:00 New Revision: 7f3d00c9b49b8de4df63d51462081ce272af488d
URL: https://github.com/llvm/llvm-project/commit/7f3d00c9b49b8de4df63d51462081ce272af488d DIFF: https://github.com/llvm/llvm-project/commit/7f3d00c9b49b8de4df63d51462081ce272af488d.diff LOG: [libomptarget][amdcgn] Add build dependency for llvm-link and opt D107156 and D107320 are not sufficient when OpenMP is built as llvm runtime (LLVM_ENABLE_RUNTIMES=openmp) because dependencies only work within the same cmake instance. We could limit the dependency to cases where libomptarget/plugins are really built. But compared to the whole llvm project, building openmp runtime is negligible and postponing the build of OpenMP runtime after the dependencies are ready seems reasonable. The direct dependency introduced in D107156 and D107320 is necessary for the case where OpenMP is built as llvm project (LLVM_ENABLE_PROJECTS=openmp). Differential Revision: https://reviews.llvm.org/D108404 (cherry picked from commit 4bb36df144127c5bee6ea2607bc544c003aae446) Added: Modified: llvm/runtimes/CMakeLists.txt openmp/libomptarget/DeviceRTL/CMakeLists.txt openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt Removed: ################################################################################ diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index 2786aa45e06f2..b972933b1f795 100644 --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -350,15 +350,19 @@ if(runtimes) # Create a runtimes target that uses this file as its top-level CMake file. # The runtimes target is a configuration of all the runtime libraries # together in a single CMake invocaiton. + if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES) + message(STATUS "Adding dependencies opt llvm-link") + set(extra_deps opt llvm-link) + endif() if(NOT LLVM_RUNTIME_TARGETS) runtime_default_target( - DEPENDS ${deps} + DEPENDS ${deps} ${extra_deps} PREFIXES ${prefixes}) set(test_targets check-runtimes) else() if("default" IN_LIST LLVM_RUNTIME_TARGETS) runtime_default_target( - DEPENDS ${deps} + DEPENDS ${deps} ${extra_deps} PREFIXES ${prefixes}) list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default") else() diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt index 5e98104a46a9d..148dad2a04fc7 100644 --- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt +++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt @@ -151,6 +151,7 @@ endif() # Create target to build all Bitcode libraries. add_custom_target(omptarget-new-nvptx-bc) +add_dependencies(omptarget-new-nvptx-bc opt llvm-link) # Generate a Bitcode library for all the compute capabilities the user requested foreach(sm ${nvptx_sm_list}) @@ -197,6 +198,7 @@ foreach(sm ${nvptx_sm_list}) add_custom_target(${bclib_target_name} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}_opt) add_dependencies(omptarget-new-nvptx-bc ${bclib_target_name}) + add_dependencies(${bclib_target_name} opt llvm-link) # Copy library to destination. add_custom_command(TARGET ${bclib_target_name} POST_BUILD diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt index 4765d1989e521..6753b9708cdc4 100644 --- a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt +++ b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt @@ -157,7 +157,7 @@ foreach(mcpu ${mcpus}) add_custom_command( OUTPUT ${bc_libname} COMMAND ${LINK_TOOL} ${bc_files} | ${OPT_TOOL} --always-inline -o ${OUTPUTDIR}/${bc_libname} - DEPENDS ${bc_files} opt) + DEPENDS ${bc_files} llvm-link opt) add_custom_target(lib${libname}-${mcpu} ALL DEPENDS ${bc_libname}) _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits