From a407995955b5da7d241020e484a284a07da56042 Mon Sep 17 00:00:00 2001 From: Ashutosh Misra Date: Mon, 24 May 2021 11:25:08 +0530 Subject: [PATCH] rocprofiler:using right rocm lib(s) path Correcting thunklib preload with tested absolute path SWDEV-285578 Change-Id: I8aa8205a6886d2101cf66016d307ff8a7c86257b [ROCm/rocprofiler commit: f3c80f645a33a9ac942eafdb5d59850758379847] --- projects/rocprofiler/bin/rpl_run.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/projects/rocprofiler/bin/rpl_run.sh b/projects/rocprofiler/bin/rpl_run.sh index 7700750f2b..8fd2e681cc 100755 --- a/projects/rocprofiler/bin/rpl_run.sh +++ b/projects/rocprofiler/bin/rpl_run.sh @@ -34,6 +34,7 @@ DATA_DIR="rpl_data_${time_stamp}_$$" RPL_PATH=$PKG_DIR/lib TLIB_PATH=$PKG_DIR/tool TTLIB_PATH=$TT_DIR/tool +ROCM_LIB_PATH=$ROOT_DIR/lib GFX=`/opt/rocm/bin/rocm_agent_enumerator | tail -1` @@ -208,12 +209,30 @@ usage() { } # checking for availability of rocminfo utility -`which rocminfo >/dev/null 2>&1` -if [ $? != 0 ]; then error "'rocminfo' utility is not found: please add ROCM bin path to PATH env var."; fi +if !command -v rocminfo > /dev/null 2>&1 ; then + error "'rocminfo' utility is not found: please add ROCM bin path to PATH env var."; +fi + +# setting ROCM_LIB_PATH +set_rocm_lib_path() { + + for ROCM_LIB_PATH in "$ROOT_DIR/lib" "$ROOT_DIR/lib64" ; do + if [ -f "$ROCM_LIB_PATH/libhsakmt.so.1" ]; then + return 0 + fi + done + + #error + return 255 #FF +} # profiling run method OUTPUT_LIST="" run() { + if ! set_rocm_lib_path ; then + echo " Fatal could not find libhsakmt " + fatal + fi export ROCP_INPUT="$1" OUTPUT_DIR="$2" shift @@ -251,7 +270,7 @@ run() { fi if [ "$KFD_TRACE" = 1 ] ; then API_TRACE=${API_TRACE}":kfd" - MY_LD_PRELOAD="$TT_DIR/lib/libkfdwrapper64.so libhsakmt.so.1 $MY_LD_PRELOAD" + MY_LD_PRELOAD="$TT_DIR/lib/libkfdwrapper64.so $ROCM_LIB_PATH/libhsakmt.so.1 $MY_LD_PRELOAD" fi if [ "$HIP_TRACE" = 1 ] ; then API_TRACE=${API_TRACE}":hip"