Add support to build for multiple amd gpu targets (#17329)
authorbddppq <bai@in.tum.de>
Thu, 21 Feb 2019 02:40:31 +0000 (18:40 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 21 Feb 2019 02:45:24 +0000 (18:45 -0800)
Summary:
iotamudelta petrex
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17329

Differential Revision: D14161277

Pulled By: bddppq

fbshipit-source-id: f3eb9f52e96a8fcd779c57df0f8c9a2c54754e35

cmake/Dependencies.cmake
cmake/public/LoadHIP.cmake

index 0dca0da..148c110 100644 (file)
@@ -806,7 +806,9 @@ if(USE_ROCM)
     # Ask hcc to generate device code during compilation so we can use
     # host linker to link.
     list(APPEND HIP_HCC_FLAGS -fno-gpu-rdc)
-    list(APPEND HIP_HCC_FLAGS -amdgpu-target=${HCC_AMDGPU_TARGET})
+    foreach(hcc_amdgpu_target ${HCC_AMDGPU_TARGET})
+      list(APPEND HIP_HCC_FLAGS -amdgpu-target=${hcc_amdgpu_target})
+    endforeach()
 
     set(Caffe2_HIP_INCLUDE
       ${hip_INCLUDE_DIRS} ${hcc_INCLUDE_DIRS} ${hsa_INCLUDE_DIRS} ${rocrand_INCLUDE_DIRS} ${hiprand_INCLUDE_DIRS} ${rocblas_INCLUDE_DIRS} ${miopen_INCLUDE_DIRS} ${thrust_INCLUDE_DIRS} $<INSTALL_INTERFACE:include> ${Caffe2_HIP_INCLUDE})
index 6e9fb6e..78bbb1e 100644 (file)
@@ -95,7 +95,7 @@ ELSE()
 ENDIF()
 
 IF(NOT DEFINED ENV{HCC_AMDGPU_TARGET})
-  SET(HCC_AMDGPU_TARGET gfx900)
+  SET(HCC_AMDGPU_TARGET gfx900;gfx906)
 ELSE()
   SET(HCC_AMDGPU_TARGET $ENV{HCC_AMDGPU_TARGET})
 ENDIF()