From 41d6265d17f3e1512ee9407c5c832641d63795a6 Mon Sep 17 00:00:00 2001 From: gamzeisl Date: Wed, 16 Oct 2024 10:27:47 +0200 Subject: [PATCH] [fix] Adapt tests for new features --- tests/run.sh | 15 +++++++++------ tests/run_loop.sh | 42 ++++++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index ca1c5d7..bf2201e 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -12,25 +12,28 @@ export buildpath=build export SIM_PATH=modelsim/$buildpath # Set to -gui to use the GUI of QuestaSim -export VSIM_FLAGS=-c +export vsim_flags=-c +export target=ita_tb export no_stalls=0 export s=64 export e=64 export p=64 +export f=64 export bias=1 +export activation=identity # Create test vectors if don't exist -if [ ! -d simvectors/data_S${s}_E${e}_P${p}_H1_B${bias} ] +if [ ! -d simvectors/data_S${s}_E${e}_P${p}_F${f}_H1_B${bias}_${activation^} ] then if [ $bias -eq 1 ] then - python testGenerator.py -S $s -P $p -E $e -H 1 + python testGenerator.py -H 1 -S $s -P $p -E $e -F $f --activation $activation else - python testGenerator.py -S $s -P $p -E $e -H 1 --no-bias + python testGenerator.py -H 1 -S $s -P $p -E $e -F $f --activation $activation --no-bias fi fi # Run the test -make sim VSIM_FLAGS=-c no_stalls=$no_stalls s=$s e=$e p=$p bias=$bias -./modelsim/return_status.sh ${SIM_PATH}/transcript $s $e ita_tb +make sim VSIM_FLAGS=$vsim_flags DEBUG=OFF target=sim_$target no_stalls=$no_stalls s=$s e=$e p=$p f=$f bias=$bias activation=$activation +./modelsim/return_status.sh ${SIM_PATH}/transcript $s $e $p $f $target diff --git a/tests/run_loop.sh b/tests/run_loop.sh index bf8b368..2b563e1 100755 --- a/tests/run_loop.sh +++ b/tests/run_loop.sh @@ -16,6 +16,13 @@ touch $log_file # Activate the virtual environment source venv/bin/activate +# Set the simulation path +export buildpath=build +export SIM_PATH=modelsim/$buildpath + +# Set to -gui to use the GUI of QuestaSim +export vsim_flags=-c + # Set the no_stalls if not set if [ -z "$no_stalls" ] then @@ -48,21 +55,32 @@ do do for p in $(eval echo "{$granularity..512..$granularity}") do - # Create test vectors - python testGenerator.py -S $s -E $e -P $p -H 1 --no-bias - python testGenerator.py -S $s -E $e -P $p -H 1 - - for bias in {0..1} + for f in $(eval echo "{$granularity..512..$granularity}") do - # Log the test - echo "Testing S=$s E=$e P=$p bias=$bias" >> $log_file + for activation in {identity,relu,gelu} + do + # Create test vectors + python testGenerator.py -H 1 -S $s -P $p -E $e -F $f --activation $activation --no-bias + python testGenerator.py -H 1 -S $s -P $p -E $e -F $f --activation $activation + + for target in {ita_tb,ita_hwpe_tb} + do + for bias in {0..1} + do + # Log the test + echo "Testing $target: S=$s E=$e P=$p F=$f Activation=$activation bias=$bias" >> $log_file + + # Run the test + make sim VSIM_FLAGS=$vsim_flags DEBUG=OFF target=sim_$target no_stalls=$no_stalls s=$s e=$e p=$p f=$f bias=$bias activation=$activation + ./modelsim/return_status.sh ${SIM_PATH}/transcript $s $e $p $f $target >> $log_file - # Run the test - make sim VSIM_FLAGS=-c no_stalls=$no_stalls s=$s e=$e p=$p bias=$bias - ./modelsim/return_status.sh modelsim/build/transcript $s $e ita_tb >> $log_file + # read -p "Press Enter to continue" - # Remove the test vectors - rm -rf simvectors/data_S${s}_E${e}_P${p}_H1_B${bias} + # Remove the test vectors + rm -rf simvectors/data_S${s}_E${e}_P${p}_F${f}_H1_B${bias}_${activation^} + done + done + done done done done