2020-09-15 18:55:51 -05:00
|
|
|
#!/bin/bash -x
|
2018-09-04 19:10:19 -05:00
|
|
|
|
2018-06-25 19:22:36 -05:00
|
|
|
################################################################################
|
2018-08-19 04:11:04 -05:00
|
|
|
# Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
#
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
#
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
# THE SOFTWARE.
|
2018-06-25 19:22:36 -05:00
|
|
|
################################################################################
|
2017-11-09 17:26:19 -06:00
|
|
|
|
2023-06-06 21:41:47 +00:00
|
|
|
BIN_NAME=`basename $0`
|
|
|
|
|
BIN_DIR=`dirname $0`
|
|
|
|
|
|
2023-07-12 10:17:45 +05:30
|
|
|
#To enable symbol lookup in .dynsyn section after llvm-strip
|
|
|
|
|
export LOADER_USE_DYNSYM=1
|
|
|
|
|
|
2019-07-18 00:41:49 -05:00
|
|
|
# test filter input
|
2019-05-31 20:20:28 -05:00
|
|
|
test_filter=-1
|
|
|
|
|
if [ -n "$1" ] ; then
|
|
|
|
|
test_filter=$1
|
|
|
|
|
fi
|
|
|
|
|
|
2019-03-03 01:04:00 -06:00
|
|
|
# test check routin
|
|
|
|
|
test_status=0
|
2019-07-27 03:06:10 -05:00
|
|
|
test_runnum=0
|
2019-03-13 15:17:56 -05:00
|
|
|
test_number=0
|
2020-04-08 04:27:50 -05:00
|
|
|
failed_tests="Failed tests:"
|
|
|
|
|
|
2019-05-31 20:20:28 -05:00
|
|
|
xeval_test() {
|
|
|
|
|
test_number=$test_number
|
|
|
|
|
}
|
2020-04-08 04:27:50 -05:00
|
|
|
|
2019-03-03 01:04:00 -06:00
|
|
|
eval_test() {
|
|
|
|
|
label=$1
|
|
|
|
|
cmdline=$2
|
2019-05-31 20:20:28 -05:00
|
|
|
if [ $test_filter = -1 -o $test_filter = $test_number ] ; then
|
|
|
|
|
echo "$label: \"$cmdline\""
|
2019-07-27 03:06:10 -05:00
|
|
|
test_runnum=$((test_runnum + 1))
|
2019-05-31 20:20:28 -05:00
|
|
|
eval "$cmdline"
|
|
|
|
|
if [ $? != 0 ] ; then
|
|
|
|
|
echo "$label: FAILED"
|
2020-04-08 04:27:50 -05:00
|
|
|
failed_tests="$failed_tests\n $test_number: \"$label\""
|
2019-05-31 20:20:28 -05:00
|
|
|
test_status=$(($test_status + 1))
|
|
|
|
|
else
|
|
|
|
|
echo "$label: PASSED"
|
|
|
|
|
fi
|
2019-03-03 01:04:00 -06:00
|
|
|
fi
|
2019-05-31 20:20:28 -05:00
|
|
|
test_number=$((test_number + 1))
|
2019-03-03 01:04:00 -06:00
|
|
|
}
|
|
|
|
|
|
2017-11-29 17:42:36 -06:00
|
|
|
# paths to ROC profiler and oher libraries
|
2023-06-06 21:41:47 +00:00
|
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD:$PWD/../../lib:$BIN_DIR/../../../lib:$BIN_DIR/../../../lib/rocprofiler:/opt/rocm/lib:/opt/rocm/lib/rocprofiler
|
2018-08-08 12:32:46 -05:00
|
|
|
|
|
|
|
|
# enable tools load failure reporting
|
|
|
|
|
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
|
2018-09-18 16:52:05 -05:00
|
|
|
# enable error messages logging to '/tmp/rocprofiler_log.txt'
|
|
|
|
|
export ROCPROFILER_LOG=1
|
2018-08-08 12:32:46 -05:00
|
|
|
# enable error messages logging to '/tmp/aql_profile_log.txt'
|
|
|
|
|
export HSA_VEN_AMD_AQLPROFILE_LOG=1
|
|
|
|
|
# test trace
|
|
|
|
|
export ROC_TEST_TRACE=1
|
2020-09-15 18:55:51 -05:00
|
|
|
# enable V3 code object support
|
|
|
|
|
export ROCP_OBJ_TRACKING=1
|
2018-08-08 12:32:46 -05:00
|
|
|
|
|
|
|
|
# Disabple profiler own proxy queue
|
2017-11-15 20:59:24 -06:00
|
|
|
unset ROCP_PROXY_QUEUE
|
2017-11-29 17:42:36 -06:00
|
|
|
# ROC profiler metrics config file
|
2023-06-06 21:41:47 +00:00
|
|
|
export ROCP_METRICS=$BIN_DIR/metrics.xml
|
2018-09-18 16:52:05 -05:00
|
|
|
|
2019-12-29 05:01:18 -06:00
|
|
|
## C test
|
2023-06-06 21:41:47 +00:00
|
|
|
eval_test "C test" $BIN_DIR/test/c_test
|
2019-12-29 05:01:18 -06:00
|
|
|
|
2024-06-04 15:02:51 +05:30
|
|
|
#export HSACO_OBJ_FILES_PATH="$BIN_DIR/test/"
|
|
|
|
|
export HSACO_OBJ_FILES_PATH="$BIN_DIR/"
|
2024-05-12 16:43:26 +00:00
|
|
|
|
|
|
|
|
if test -f "$BIN_DIR/test/librocprof-tool.so" ; then
|
|
|
|
|
export ROCPROF_TOOL_PATH="$BIN_DIR/test/"
|
|
|
|
|
else
|
|
|
|
|
export ROCPROF_TOOL_PATH="$BIN_DIR/../../../lib/rocprofiler/"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test -f "$BIN_DIR/test/rocprof-ctrl" ; then
|
|
|
|
|
export ROCPROF_CTRL_PATH="$BIN_DIR/test/"
|
|
|
|
|
else
|
|
|
|
|
export ROCPROF_CTRL_PATH="$BIN_DIR/../../../lib/rocprofiler/"
|
|
|
|
|
fi
|
|
|
|
|
|
2019-12-29 05:01:18 -06:00
|
|
|
## Standalone sampling usage model test
|
|
|
|
|
unset HSA_TOOLS_LIB
|
|
|
|
|
unset ROCP_TOOL_LIB
|
2023-06-06 21:41:47 +00:00
|
|
|
eval_test "Standalone sampling usage model test" $BIN_DIR/test/standalone_test
|
2020-04-08 04:27:50 -05:00
|
|
|
# Standalone intercepting test
|
|
|
|
|
# ROC profiler library loaded by HSA runtime
|
2023-06-06 21:41:47 +00:00
|
|
|
if test -f "$BIN_DIR/../../../lib/librocprofiler64.so.1" ; then
|
|
|
|
|
export HSA_TOOLS_LIB="$BIN_DIR/../../../lib/librocprofiler64.so.1"
|
|
|
|
|
else
|
|
|
|
|
export HSA_TOOLS_LIB=librocprofiler64.so.1
|
|
|
|
|
fi
|
2020-04-27 13:05:47 -05:00
|
|
|
# enable intercepting mode in rocprofiler
|
2020-04-08 04:27:50 -05:00
|
|
|
export ROCP_HSA_INTERCEPT=2
|
2020-04-27 13:05:47 -05:00
|
|
|
# test macro for kernel iterations number
|
2020-07-07 16:18:29 -05:00
|
|
|
export ROCP_KITER=20
|
2020-04-27 13:05:47 -05:00
|
|
|
# test macro for per-kernel dispatching number
|
2020-04-08 04:27:50 -05:00
|
|
|
export ROCP_DITER=10
|
2023-06-06 21:41:47 +00:00
|
|
|
eval_test "Standalone intercepting test" $BIN_DIR/test/stand_intercept_test
|
2020-04-08 04:27:50 -05:00
|
|
|
unset ROCP_HSA_INTERCEPT
|
2019-03-03 01:04:00 -06:00
|
|
|
|
2019-12-29 05:01:18 -06:00
|
|
|
## Intercepting usage model test
|
2018-10-16 19:33:48 -05:00
|
|
|
# tool library loaded by ROC profiler
|
2023-06-06 21:41:47 +00:00
|
|
|
export ROCP_TOOL_LIB=$BIN_DIR/test/libintercept_test.so
|
2020-07-07 16:18:29 -05:00
|
|
|
export ROCP_KITER=20
|
|
|
|
|
export ROCP_DITER=20
|
2019-03-03 01:04:00 -06:00
|
|
|
export ROCP_AGENTS=1
|
2019-11-19 20:18:09 -06:00
|
|
|
export ROCP_THRS=3
|
2024-05-12 16:43:26 +00:00
|
|
|
eval_test "Intercepting usage model test" ${ROCPROF_CTRL_PATH}rocprof-ctrl
|
2019-03-03 01:04:00 -06:00
|
|
|
|
|
|
|
|
## Libtool test
|
2018-09-18 16:52:05 -05:00
|
|
|
# tool library loaded by ROC profiler
|
2024-05-12 16:43:26 +00:00
|
|
|
export ROCP_TOOL_LIB="${ROCPROF_TOOL_PATH}librocprof-tool.so"
|
2018-07-09 20:33:58 -05:00
|
|
|
# ROC profiler kernels timing
|
|
|
|
|
export ROCP_TIMESTAMP_ON=1
|
2017-11-29 17:42:36 -06:00
|
|
|
# output directory for the tool library, for metrics results file 'results.txt'
|
2023-06-06 21:41:47 +00:00
|
|
|
mkdir -p /tmp/rocprofiler/RESULTS
|
|
|
|
|
export ROCP_OUTPUT_DIR=/tmp/rocprofiler/RESULTS
|
2017-11-09 17:26:19 -06:00
|
|
|
|
2020-07-07 16:18:29 -05:00
|
|
|
export ROCP_KITER=20
|
|
|
|
|
export ROCP_DITER=20
|
2018-10-30 14:19:45 -05:00
|
|
|
export ROCP_AGENTS=1
|
|
|
|
|
export ROCP_THRS=1
|
2023-06-06 21:41:47 +00:00
|
|
|
export ROCP_INPUT=$BIN_DIR/pmc_input.xml
|
2024-05-12 16:43:26 +00:00
|
|
|
eval_test "'rocprof' rocprof-tool PMC test" ${ROCPROF_CTRL_PATH}rocprof-ctrl
|
2019-03-03 01:04:00 -06:00
|
|
|
|
2020-07-07 16:18:29 -05:00
|
|
|
export ROCP_KITER=20
|
|
|
|
|
export ROCP_DITER=20
|
|
|
|
|
export ROCP_AGENTS=1
|
|
|
|
|
export ROCP_THRS=10
|
2023-06-06 21:41:47 +00:00
|
|
|
export ROCP_INPUT=$BIN_DIR/pmc_input.xml
|
2024-05-12 16:43:26 +00:00
|
|
|
eval_test "'rocprof' rocprof-tool PMC n-thread test" ${ROCPROF_CTRL_PATH}rocprof-ctrl
|
2020-07-07 16:18:29 -05:00
|
|
|
|
|
|
|
|
export ROCP_KITER=20
|
|
|
|
|
export ROCP_DITER=20
|
|
|
|
|
export ROCP_AGENTS=1
|
|
|
|
|
export ROCP_THRS=1
|
2023-06-06 21:41:47 +00:00
|
|
|
export ROCP_INPUT=$BIN_DIR/pmc_input1.xml
|
2024-05-12 16:43:26 +00:00
|
|
|
eval_test "'rocprof' rocprof-tool PMC test1" ${ROCPROF_CTRL_PATH}rocprof-ctrl
|
2020-07-07 16:18:29 -05:00
|
|
|
|
|
|
|
|
export ROCP_KITER=20
|
|
|
|
|
export ROCP_DITER=20
|
2019-03-06 13:41:54 -06:00
|
|
|
export ROCP_AGENTS=1
|
|
|
|
|
export ROCP_THRS=10
|
2023-06-06 21:41:47 +00:00
|
|
|
export ROCP_INPUT=$BIN_DIR/pmc_input1.xml
|
2024-05-12 16:43:26 +00:00
|
|
|
eval_test "'rocprof' rocprof-tool PMC n-thread test1" ${ROCPROF_CTRL_PATH}rocprof-ctrl
|
2020-07-07 16:18:29 -05:00
|
|
|
|
2020-02-14 00:22:36 -06:00
|
|
|
unset ROCP_MCOPY_TRACKING
|
|
|
|
|
# enable HSA intercepting
|
|
|
|
|
export ROCP_HSA_INTERC=1
|
|
|
|
|
|
|
|
|
|
export ROCP_KITER=10
|
|
|
|
|
export ROCP_DITER=10
|
2024-05-12 16:43:26 +00:00
|
|
|
eval_test "rocprof-tool test, counter sets" ${ROCPROF_CTRL_PATH}rocprof-ctrl
|
2020-02-14 00:22:36 -06:00
|
|
|
|
|
|
|
|
## OpenCL test
|
2020-06-01 18:07:52 -05:00
|
|
|
#eval_test "libtool test, OpenCL sample" ./test/ocl/SimpleConvolution
|
2020-02-14 00:22:36 -06:00
|
|
|
|
2018-02-12 15:00:20 -06:00
|
|
|
#valgrind --leak-check=full $tbin
|
|
|
|
|
#valgrind --tool=massif $tbin
|
|
|
|
|
#ms_print massif.out.<N>
|
2017-11-09 17:26:19 -06:00
|
|
|
|
2019-07-27 03:06:10 -05:00
|
|
|
echo "$test_number tests total / $test_runnum tests run / $test_status tests failed"
|
2020-04-08 04:27:50 -05:00
|
|
|
if [ $test_status != 0 ] ; then
|
|
|
|
|
echo $failed_tests
|
|
|
|
|
fi
|
2019-03-03 01:04:00 -06:00
|
|
|
exit $test_status
|