This repository has been archived by the owner on May 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
generate_and_run_tests.sh
executable file
·84 lines (75 loc) · 1.8 KB
/
generate_and_run_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
set -e
THIS_DIR=.
OPENHLS_DIR="$( cd "$(dirname "$0")" ; pwd -P)/.."
export OPENHLS_CONFIG_FP=$OPENHLS_DIR/openhls_config.ini
export DEBUG=0
TB_RANDOM=$((1 + $RANDOM % 1000))
sizes=(
5
6
8
#11
#14
#16
)
nets=(
max
neg
relu
sub
div
dot_product
soft_max
#double_cnn
#simple_sum
exp
linear
#linear_no_sum
small_cnn
)
width_pairs=(
#"3 3"
#"4 4"
"5 4"
"5 5"
"6 6"
"7 7"
"8 8"
#"4 10"
#"8 23"
)
function is_power_of_two () {
declare -i n=$1
(( n > 0 && (n & (n - 1)) == 0 ))
}
for size in "${sizes[@]}"; do
for net in "${nets[@]}"; do
# if ! is_power_of_two "$size" && [ $net == "softmax" ]; then
# continue
# fi
echo python $OPENHLS_DIR/examples/simple_nns.py $net --size $size --out_dir $THIS_DIR
python $OPENHLS_DIR/examples/simple_nns.py $net --size $size --out_dir $THIS_DIR
echo openhls_compiler "${net}_${size}/${net}.mlir" -t -r
openhls_compiler "${net}_${size}/${net}.mlir" -t -r
for widths in "${width_pairs[@]}"; do
set -- $widths
we=$1
wf=$2
if [ $we == "4" ] && [ $wf == "4" ] && [ $net == "soft_max" ]; then
continue
fi
if [ $we == "4" ] && [ $wf == "4" ] && [ $size == 8 ] && [ $net == "simple_sum" ]; then
continue
fi
echo WIDTH_EXPONENT=$we WIDTH_FRACTION=$wf openhls_compiler "${net}_${size}/${net}.mlir" -s
WIDTH_EXPONENT=$we WIDTH_FRACTION=$wf openhls_compiler "${net}_${size}/${net}.mlir" -s
echo TB_RANDOM=$TB_RANDOM WIDTH_EXPONENT=$we WIDTH_FRACTION=$wf openhls_compiler "${net}_${size}/${net}.mlir" -v -b -n 10 --threshold 0.1
TB_RANDOM=$TB_RANDOM WIDTH_EXPONENT=$we WIDTH_FRACTION=$wf openhls_compiler "${net}_${size}/${net}.mlir" -v -b -n 10 --threshold 0.1
# clean up duh
rm -rf "*/*.vcd"
rm -rf "*/*.vvp"
done
rm -rf "${net}_${size}"
done
done