From 077e789db5a8a41885a8b7c369ca86351cac363b Mon Sep 17 00:00:00 2001 From: pensun Date: Tue, 28 Feb 2017 16:20:48 -0600 Subject: [PATCH] Define __HIPCC__ flag at compile time when using HIPCC on HCC path Change-Id: I5e967e0e2327264d5d3b0ca705c2504fcd33d75e [ROCm/clr commit: be95cc914f993c6657fe5fa4f631278b66aab89b] --- projects/clr/hipamd/bin/hipcc | 2 +- projects/clr/hipamd/include/hip/hip_common.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/clr/hipamd/bin/hipcc b/projects/clr/hipamd/bin/hipcc index 0dccb9bbc1..00018e5f04 100755 --- a/projects/clr/hipamd/bin/hipcc +++ b/projects/clr/hipamd/bin/hipcc @@ -92,7 +92,7 @@ if ($HIP_PLATFORM eq "hcc") { # HCC* may be used to compile src/hip_hcc.o (and also feed the HIPCXXFLAGS below) $HCC = "$HCC_HOME/bin/hcc"; - $HCCFLAGS = "-hc -I$HCC_HOME/include "; + $HCCFLAGS = "-hc -D__HIPCC__ -I$HCC_HOME/include "; $HIPCC=$HCC; $HIPCXXFLAGS = $HCCFLAGS; diff --git a/projects/clr/hipamd/include/hip/hip_common.h b/projects/clr/hipamd/include/hip/hip_common.h index ffedac5fa3..6223a2fe9e 100644 --- a/projects/clr/hipamd/include/hip/hip_common.h +++ b/projects/clr/hipamd/include/hip/hip_common.h @@ -27,14 +27,14 @@ THE SOFTWARE. // Other compiler (GCC,ICC,etc) need to set one of these macros explicitly #if defined(__HCC__) #define __HIP_PLATFORM_HCC__ -#define __HIPCC__ #if defined(__HCC_ACCELERATOR__) && (__HCC_ACCELERATOR__ != 0) #define __HIP_DEVICE_COMPILE__ 1 #else #define __HIP_DEVICE_COMPILE__ 0 #endif -#endif + +#endif //__HCC__ // Auto enable __HIP_PLATFORM_NVCC__ if compiling with NVCC #if defined(__NVCC__) @@ -48,7 +48,8 @@ THE SOFTWARE. #else #define __HIP_DEVICE_COMPILE__ 0 #endif -#endif + +#endif //__NVCC__ #if __HIP_DEVICE_COMPILE__ == 0