From 4b94f25d08530781e7831ab3cb2a488f3e181b72 Mon Sep 17 00:00:00 2001 From: Michael LIAO Date: Tue, 22 Oct 2019 17:10:07 -0400 Subject: [PATCH] [cmake] Allow GPU targets to be parameterized with `AMDGPU_TARGETS`. [ROCm/rccl commit: ec10a5cf14d2e40204079e3284e846c7dafe5c0c] --- projects/rccl/CMakeLists.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/projects/rccl/CMakeLists.txt b/projects/rccl/CMakeLists.txt index cebeb18642..18f21aa6fd 100644 --- a/projects/rccl/CMakeLists.txt +++ b/projects/rccl/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "") project(rccl CXX) +set(AMDGPU_TARGETS gfx803;gfx900;gfx906;gfx908 CACHE STRING "List of specific machine types for library to target") + find_package(ROCM REQUIRED PATHS @@ -134,19 +136,14 @@ if(PROFILE) add_definitions(-DENABLE_PROFILING) endif() -target_link_libraries(rccl - PRIVATE --amdgpu-target=gfx803 - PRIVATE --amdgpu-target=gfx900 - PRIVATE --amdgpu-target=gfx906 - PRIVATE --amdgpu-target=gfx908) +foreach(target ${AMDGPU_TARGETS}) +target_link_libraries(rccl PRIVATE --amdgpu-target=${target}) +endforeach() if("${HIP_COMPILER}" MATCHES "clang") - target_compile_options(rccl - PRIVATE --amdgpu-target=gfx803 - PRIVATE --amdgpu-target=gfx900 - PRIVATE --amdgpu-target=gfx906 - PRIVATE --amdgpu-target=gfx908 - PRIVATE -fgpu-rdc) + foreach(target ${AMDGPU_TARGETS}) + target_compile_options(rccl PRIVATE --amdgpu-target=${target} PRIVATE -fgpu-rdc) + endforeach() target_link_libraries(rccl PRIVATE -fgpu-rdc) target_include_directories(rccl PRIVATE /opt/rocm/hsa/include) endif()