From 43402d56023eab6be61ba96f4e86b849804a9881 Mon Sep 17 00:00:00 2001 From: Yaxun Sam Liu Date: Thu, 20 Sep 2018 21:07:28 -0400 Subject: [PATCH] Let hipcc add --hip-device-lib-path by default for hip-clang hip-clang by default assumes -fno-gpu-rdc, therefore requires --hip-device-lib-path by default. --- bin/hipcc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/hipcc b/bin/hipcc index 620a53671b..86be3db9f2 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -157,8 +157,12 @@ if ($HIP_PLATFORM eq "clang") { print ("DEVICE_LIB_PATH=$DEVICE_LIB_PATH\n"); } - $HIPCXXFLAGS .= " -std=c++11 -isystem $HIP_CLANG_INCLUDE_PATH"; - $HIPLDFLAGS .= " --hip-device-lib-path=$DEVICE_LIB_PATH -L$HIP_LIB_PATH -Wl,--rpath=$HIP_LIB_PATH -lhip_hcc"; + + # By default, hip-clang assumes -fno-gpu-rdc, therefore device lib path + # is required. + $HIP_DEVLIB_FLAGS = " --hip-device-lib-path=$DEVICE_LIB_PATH"; + $HIPCXXFLAGS .= " $HIP_DEVLIB_FLAGS -std=c++11 -isystem $HIP_CLANG_INCLUDE_PATH"; + $HIPLDFLAGS .= " $HIP_DEVLIB_FLAGS -L$HIP_LIB_PATH -Wl,--rpath=$HIP_LIB_PATH -lhip_hcc"; if ($HIP_CLANG_HCC_COMPAT_MODE) { ## Allow __fp16 as function parameter and return type. $HIPCXXFLAGS .= " -Xclang -fallow-half-arguments-and-returns -D__HIP_HCC_COMPAT_MODE__=1";