Skip to content

Commit ba2032d

Browse files
authored
Merge pull request #67 from ROCmSoftwarePlatform/bugfix/hipfc-clang-device-lib-paths
hipfc: Do not modify caller environment anymore
2 parents 0db4858 + 8d03874 commit ba2032d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

bin/hipfc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,6 @@ if [ ! $HIPFORT_GPU ] ; then
287287
fi
288288
fi
289289

290-
# Future versions of ROCm will install the device library in ROCM_PATH/amdgcn/bitcode
291-
if [ -d $ROCM_PATH/amdgcn/bitcode ] ; then
292-
DEVICE_LIB_PATH=$ROCM_PATH/amdgcn/bitcode
293-
else
294-
DEVICE_LIB_PATH=$ROCM_PATH/lib
295-
fi
296-
297290
# Handle all differences between amdgcn and nvidia here
298291
if [ "${HIPFORT_GPU:0:3}" == "sm_" ] ; then
299292
TARGET_ARCH="nvptx"
@@ -319,7 +312,18 @@ else
319312
TARGET_TRIPLE=${TARGET_TRIPLE:-amdgcn-amd-amdhsa}
320313
TARGET_ARCH="amdgcn"
321314
TARGET_LIBS="-L$ROCM_PATH/lib -lamdhip64 -Wl,-rpath=$ROCM_PATH/lib "
322-
HIPCC_ENV="HIP_PLATFORM=$HIP_PLATFORM DEVICE_LIB_PATH=$DEVICE_LIB_PATH HIP_CLANG_PATH=$ROCM_PATH/llvm/bin"
315+
HIPCC_ENV="HIP_PLATFORM=$HIP_PLATFORM"
316+
if [ -z ${HIP_CLANG_PATH+x} ]; then
317+
HIPCC_ENV+=" HIP_CLANG_PATH=$ROCM_PATH/llvm/bin"
318+
fi
319+
if [ -z ${DEVICE_LIB_PATH+x} ]; then
320+
# Future versions of ROCm will install the device library in ROCM_PATH/amdgcn/bitcode
321+
if [ -d $ROCM_PATH/amdgcn/bitcode ] ; then
322+
HIPCC_ENV+=" DEVICE_LIB_PATH=$ROCM_PATH/amdgcn/bitcode"
323+
else
324+
HIPCC_ENV+=" DEVICE_LIB_PATH=$ROCM_PATH/lib"
325+
fi
326+
fi
323327
HIPCC_OPTS="-fno-gpu-rdc -fPIC --offload-arch=$HIPFORT_GPU"
324328
fi
325329

@@ -472,9 +476,7 @@ if [ "$__HIPCC_INPUTS" != "" ] ; then
472476
echo " Please install hip"
473477
exit $DEADRC
474478
fi
475-
[ $VERBOSE ] && echo "export $HIPCC_ENV"
476-
export $HIPCC_ENV
477-
runcmd "$ROCM_PATH/bin/hipcc $HIPCC_OPTS $PASSTHRUARGS $__HIPCC_INPUTS $__HIPCC_LINKOPTS -o $__HIPCC_OUTFILE"
479+
runcmd "$HIPCC_ENV $ROCM_PATH/bin/hipcc $HIPCC_OPTS $PASSTHRUARGS $__HIPCC_INPUTS $__HIPCC_LINKOPTS -o $__HIPCC_OUTFILE"
478480
fi
479481

480482
if [ "$__INPUTS" != "" ] ; then

0 commit comments

Comments
 (0)