8b445d2c00
To validate cache and memory blocks profiling, this patch prepares tests to profile dedicated kernels using specified counters, to compare the profiled results against expected ones, and further show the test is a fail or pass. Tests here are focusing on cache hit/miss, memory fetch/write size. Change-Id: Icbc8096a6e15256dec66297597a57c7665a533b8
51 строка
1.2 KiB
INI
51 строка
1.2 KiB
INI
#-- profiler path
|
|
#-- specify the path to your rocprofiler here, ow default one will be used
|
|
ROCP_PATH=""
|
|
|
|
#-- benchmark path
|
|
#-- the one used for cache/mem validation
|
|
PATH_CACHE_BENCH="benches/test_cache"
|
|
|
|
#-- colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
|
|
#-- function to do some initializations
|
|
function initialize
|
|
{
|
|
cd ${BASE_DIR}/../$PATH_CACHE_BENCH/
|
|
# Build the benchmark
|
|
make
|
|
cd ${BASE_DIR}/../
|
|
|
|
ELEMENT_SIZE=4
|
|
#-- extract TCP parameters from rocminfo
|
|
TCP_SIZE=`rocminfo | grep "L1:" | tail -n1 | awk '{print $NF}'`
|
|
LINE_SIZE=`rocminfo | grep "Cacheline Size:" | tail -n1 | awk '{print $NF}'`
|
|
if [[ $TCP_SIZE == *KB ]]; then TCP_SIZE=`echo "${TCP_SIZE//KB}"`; fi
|
|
C_tcp=`echo "$TCP_SIZE*1024/$ELEMENT_SIZE" | bc`
|
|
b_tcp=`echo "$LINE_SIZE/$ELEMENT_SIZE" | bc`
|
|
}
|
|
|
|
#-- function to list columns in profiling file
|
|
function getColIds
|
|
{
|
|
local file=$1
|
|
local counterline=`head -n1 $file`
|
|
|
|
IFS=',' read -ra CARR <<< "$counterline"
|
|
local colIds=""
|
|
for srch in $headers
|
|
do
|
|
local colId=1
|
|
for ele in "${CARR[@]}"; do
|
|
if [[ $srch == $ele ]]; then break; fi
|
|
colId=$(( $colId+1 ))
|
|
done
|
|
colIds=$colIds" "$colId"|$srch"
|
|
done
|
|
echo $colIds
|
|
}
|
|
|