Skip to content

Commit

Permalink
[fix] Adapt tests for new features
Browse files Browse the repository at this point in the history
  • Loading branch information
gamzeisl committed Oct 16, 2024
1 parent 0076abc commit 41d6265
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
15 changes: 9 additions & 6 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 30 additions & 12 deletions tests/run_loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 41d6265

Please sign in to comment.