Skip to content
Snippets Groups Projects
Commit 7fa7b0cb authored by Michael Kruse's avatar Michael Kruse
Browse files

[libomptarget] Add device RTL to regression test dependencies.

In a clean build directory, `check-openmp` or `check-libomptarget` will fail because of missing device RTL .bc files. Ensure that the new targets new custom targets `omptarget.devicertl.nvptx` and `omptarget.devicertl.amdgpu` (corresponding to the plugin rtl targets `omptarget.rtl.cuda`, respectively `omptarget.rlt.amdgpu` ) are dependencies of the regression tests.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D123177
parent 7ac2e30f
No related branches found
No related tags found
No related merge requests found
...@@ -225,16 +225,19 @@ function(compileDeviceRTLLibrary target_cpu target_name) ...@@ -225,16 +225,19 @@ function(compileDeviceRTLLibrary target_cpu target_name)
add_custom_command(TARGET ${bclib_target_name} POST_BUILD add_custom_command(TARGET ${bclib_target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}
${LIBOMPTARGET_LIBRARY_DIR}) ${LIBOMPTARGET_LIBRARY_DIR})
add_dependencies("omptarget.devicertl.${target_name}" "${bclib_target_name}")
# Install bitcode library under the lib destination folder. # Install bitcode library under the lib destination folder.
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} DESTINATION "${OPENMP_INSTALL_LIBDIR}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} DESTINATION "${OPENMP_INSTALL_LIBDIR}")
endfunction() endfunction()
# Generate a Bitcode library for all the compute capabilities the user requested # Generate a Bitcode library for all the compute capabilities the user requested
add_custom_target(omptarget.devicertl.nvptx)
foreach(sm ${nvptx_sm_list}) foreach(sm ${nvptx_sm_list})
compileDeviceRTLLibrary(sm_${sm} nvptx -target nvptx64-nvidia-cuda -Xclang -target-feature -Xclang +ptx61 "-D__CUDA_ARCH__=${sm}0") compileDeviceRTLLibrary(sm_${sm} nvptx -target nvptx64-nvidia-cuda -Xclang -target-feature -Xclang +ptx61 "-D__CUDA_ARCH__=${sm}0")
endforeach() endforeach()
add_custom_target(omptarget.devicertl.amdgpu)
foreach(mcpu ${amdgpu_mcpus}) foreach(mcpu ${amdgpu_mcpus})
compileDeviceRTLLibrary(${mcpu} amdgpu -target amdgcn-amd-amdhsa -D__AMDGCN__ -nogpulib) compileDeviceRTLLibrary(${mcpu} amdgpu -target amdgcn-amd-amdhsa -D__AMDGCN__ -nogpulib)
endforeach() endforeach()
...@@ -71,6 +71,7 @@ add_library(omptarget.rtl.amdgpu SHARED ...@@ -71,6 +71,7 @@ add_library(omptarget.rtl.amdgpu SHARED
src/rtl.cpp src/rtl.cpp
${LIBOMPTARGET_EXTRA_SOURCE} ${LIBOMPTARGET_EXTRA_SOURCE}
) )
add_dependencies(omptarget.rtl.amdgpu omptarget.devicertl.amdgpu)
# Install plugin under the lib destination folder. # Install plugin under the lib destination folder.
# When we build for debug, OPENMP_LIBDIR_SUFFIX get set to -debug # When we build for debug, OPENMP_LIBDIR_SUFFIX get set to -debug
...@@ -113,5 +114,7 @@ if (${amdgpu_arch_result}) ...@@ -113,5 +114,7 @@ if (${amdgpu_arch_result})
else() else()
# Report to the parent scope that we are building a plugin for amdgpu # Report to the parent scope that we are building a plugin for amdgpu
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} amdgcn-amd-amdhsa amdgcn-amd-amdhsa-newDriver" PARENT_SCOPE) set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} amdgcn-amd-amdhsa amdgcn-amd-amdhsa-newDriver" PARENT_SCOPE)
list(APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.amdgpu")
set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
endif() endif()
...@@ -52,6 +52,7 @@ else() ...@@ -52,6 +52,7 @@ else()
add_library(omptarget.rtl.cuda SHARED src/rtl.cpp dynamic_cuda/cuda.cpp) add_library(omptarget.rtl.cuda SHARED src/rtl.cpp dynamic_cuda/cuda.cpp)
set (LIBOMPTARGET_DEP_LIBRARIES ${CMAKE_DL_LIBS}) set (LIBOMPTARGET_DEP_LIBRARIES ${CMAKE_DL_LIBS})
endif() endif()
add_dependencies(omptarget.rtl.cuda omptarget.devicertl.nvptx)
# Install plugin under the lib destination folder. # Install plugin under the lib destination folder.
install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}") install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
...@@ -72,6 +73,8 @@ target_link_libraries(omptarget.rtl.cuda ...@@ -72,6 +73,8 @@ target_link_libraries(omptarget.rtl.cuda
if (LIBOMPTARGET_CAN_LINK_LIBCUDA OR LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA) if (LIBOMPTARGET_CAN_LINK_LIBCUDA OR LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA)
libomptarget_say("Enable tests using CUDA plugin") libomptarget_say("Enable tests using CUDA plugin")
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda nvptx64-nvidia-cuda-newDriver" PARENT_SCOPE) set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda nvptx64-nvidia-cuda-newDriver" PARENT_SCOPE)
list(APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.cuda")
set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
else() else()
libomptarget_say("Disabling tests using CUDA plugin as cuda may not be available") libomptarget_say("Disabling tests using CUDA plugin as cuda may not be available")
endif() endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment