From e19396bcde5928a9e4e32459d8bb5561681560c5 Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Mon, 13 Jul 2020 14:03:55 -0400 Subject: [PATCH] Update to use new bitcode library structure Also, continue support for old bitcode library layout for backwards compatibility. Change-Id: Id7f164ecb989a44c22958afce78745552a4babb3 [ROCm/rocprofiler commit: a6f6a133856f3b37433f731652cf31ca23feb155] --- projects/rocprofiler/bin/build_kernel.sh | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/projects/rocprofiler/bin/build_kernel.sh b/projects/rocprofiler/bin/build_kernel.sh index 8ed0f1685f..4b2f87ddaa 100755 --- a/projects/rocprofiler/bin/build_kernel.sh +++ b/projects/rocprofiler/bin/build_kernel.sh @@ -40,8 +40,17 @@ else LIB_DIR=$LLVM_DIR/lib fi -BC_DIR=$LIB_DIR/bitcode -if [ ! -d "$BC_DIR" ] ; then BC_DIR=$LIB_DIR; fi +# Determine whether using new or old device-libs layout +if [ -e $LIB_DIR/bitcode/opencl.amdgcn.bc ]; then + BC_DIR=$LIB_DIR/bitcode +elif [ -e $LIB_DIR/opencl.amdgcn.bc ]; then + BC_DIR=$LIB_DIR +elif [ -e $ROCM_DIR/amdgcn/bitcode/opencl.bc ]; then + BC_DIR=$ROCM_DIR/amdgcn/bitcode +else + echo "Error: Cannot find amdgcn bitcode directory" + exit 1 +fi CLANG_ROOT=$LLVM_DIR/lib/clang CLANG_DIR=`ls -d $CLANG_ROOT/* | head -n 1` @@ -52,10 +61,14 @@ fi BIN_DIR=$LLVM_DIR/bin INC_DIR=$CLANG_DIR/include -BITCODE_OPTS="\ - -Xclang -mlink-bitcode-file -Xclang $BC_DIR/opencl.amdgcn.bc \ - -Xclang -mlink-bitcode-file -Xclang $BC_DIR/ockl.amdgcn.bc \ - -Xclang -mlink-bitcode-file -Xclang $BC_DIR/ocml.amdgcn.bc" +if [ -e $BC_DIR/opencl.amdgcn.bc ]; then + BITCODE_OPTS="-nogpulib \ + -Xclang -mlink-bitcode-file -Xclang $BC_DIR/opencl.amdgcn.bc \ + -Xclang -mlink-bitcode-file -Xclang $BC_DIR/ockl.amdgcn.bc \ + -Xclang -mlink-bitcode-file -Xclang $BC_DIR/ocml.amdgcn.bc" +else + BITCODE_OPTS="--hip-device-lib-path=$BC_DIR" +fi for GFXIP in $TGT_LIST ; do OBJ_PREF=$GFXIP