From 59ef7dc9e24714695633ff2284b197da8474b1ef Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Wed, 13 Jan 2021 11:46:42 -0500 Subject: [PATCH] Fix building mathlibs failure Add back __HIP_PLATFORM_HCC__ __HIP_PLATFORM_NVCC__ Change-Id: I1ae48678eafd849d6c25bcb204c1724b026be22f --- bin/hipconfig | 4 ++-- hip-config.cmake.in | 2 +- include/hip/hip_common.h | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/hipconfig b/bin/hipconfig index c9c5b32b15..2e75fd7706 100755 --- a/bin/hipconfig +++ b/bin/hipconfig @@ -48,11 +48,11 @@ if ($HIP_COMPILER eq "clang") { $HIP_CLANG_VERSION=~/.*clang version (\S+).*/; $HIP_CLANG_VERSION=$1; - $CPP_CONFIG = " -D__HIP_PLATFORM_AMD__= -I$HIP_PATH/include -I$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION -I$HSA_PATH/include"; + $CPP_CONFIG = " -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I$HIP_PATH/include -I$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION -I$HSA_PATH/include"; } if ($HIP_PLATFORM eq "nvidia") { - $CPP_CONFIG = " -D__HIP_PLATFORM_NVIDIA__= -I$HIP_PATH/include -I$CUDA_PATH/include"; + $CPP_CONFIG = " -D__HIP_PLATFORM_NVCC__= -D__HIP_PLATFORM_NVIDIA__= -I$HIP_PATH/include -I$CUDA_PATH/include"; }; if ($p_help) { diff --git a/hip-config.cmake.in b/hip-config.cmake.in index 4cd9e51c52..80373ce3b4 100644 --- a/hip-config.cmake.in +++ b/hip-config.cmake.in @@ -119,7 +119,7 @@ endif() # Right now this is only supported for amd platforms set_target_properties(hip::host PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "__HIP_PLATFORM_AMD__=1" + INTERFACE_COMPILE_DEFINITIONS "__HIP_PLATFORM_HCC__=1;__HIP_PLATFORM_AMD__=1" ) if(HIP_RUNTIME MATCHES "rocclr") diff --git a/include/hip/hip_common.h b/include/hip/hip_common.h index ccbab9c162..d0dc323895 100644 --- a/include/hip/hip_common.h +++ b/include/hip/hip_common.h @@ -27,6 +27,11 @@ THE SOFTWARE. // Auto enable __HIP_PLATFORM_AMD__ if compiling on AMD platform // Other compiler (GCC,ICC,etc) need to set one of these macros explicitly #if defined(__clang__) && defined(__HIP__) +// The following macro will be removed after upstream updation +#ifndef __HIP_PLATFORM_HCC__ +#define __HIP_PLATFORM_HCC__ +#endif + #ifndef __HIP_PLATFORM_AMD__ #define __HIP_PLATFORM_AMD__ #endif @@ -34,9 +39,15 @@ THE SOFTWARE. // Auto enable __HIP_PLATFORM_NVIDIA__ if compiling with NVIDIA platform #if defined(__NVCC__) || (defined(__clang__) && defined(__CUDA__) && !defined(__HIP__)) +// The following macro will be removed after upstream updation +#ifndef __HIP_PLATFORM_NVCC__ +#define __HIP_PLATFORM_NVCC__ +#endif + #ifndef __HIP_PLATFORM_NVIDIA__ #define __HIP_PLATFORM_NVIDIA__ #endif + #ifdef __CUDACC__ #define __HIPCC__ #endif