brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 47cd2fe Raw
33 lines · plain
1# As of rocm-3.7, hsa is installed with cmake packages and kmt is found via hsa2find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)3 4# Create the library and add the default arguments.5add_target_library(omptarget.rtl.amdgpu AMDGPU)6 7target_sources(omptarget.rtl.amdgpu PRIVATE src/rtl.cpp)8target_include_directories(omptarget.rtl.amdgpu PRIVATE9                           ${CMAKE_CURRENT_SOURCE_DIR}/utils)10 11if(hsa-runtime64_FOUND AND NOT "amdgpu" IN_LIST LIBOMPTARGET_DLOPEN_PLUGINS)12  message(STATUS "Building AMDGPU plugin linked against libhsa")13  target_link_libraries(omptarget.rtl.amdgpu PRIVATE hsa-runtime64::hsa-runtime64)14else()15  message(STATUS "Building AMDGPU plugin for dlopened libhsa")16  target_include_directories(omptarget.rtl.amdgpu PRIVATE dynamic_hsa)17  target_sources(omptarget.rtl.amdgpu PRIVATE dynamic_hsa/hsa.cpp)18endif()19 20# Configure testing for the AMDGPU plugin. We will build tests if we could a21# functional AMD GPU on the system, or if manually specifies by the user.22option(LIBOMPTARGET_FORCE_AMDGPU_TESTS "Build AMDGPU libomptarget tests" OFF)23if (LIBOMPTARGET_FOUND_AMDGPU_GPU OR LIBOMPTARGET_FORCE_AMDGPU_TESTS)24  # Report to the parent scope that we are building a plugin for amdgpu25  set(LIBOMPTARGET_SYSTEM_TARGETS26      "${LIBOMPTARGET_SYSTEM_TARGETS} amdgcn-amd-amdhsa" PARENT_SCOPE)27  list(APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.amdgpu")28  set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)29else()30  message(STATUS "Not generating AMDGPU tests, no supported devices detected."31                   " Use 'LIBOMPTARGET_FORCE_AMDGPU_TESTS' to override.")32endif()33