Skip to content

Commit

Permalink
[scripts] Fix benchmark script with verilator
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-17 committed Nov 29, 2023
1 parent 22d5941 commit 598ee89
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 7 additions & 2 deletions scripts/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ extract_performance() {
$python ./scripts/check_cycles.py $kernel $hw_cycles $sw_cycles || exit
fi
echo "Extracting performance from cycle count"
echo "$python ./scripts/performance.py \"$metadata\" \"$args\" $hw_cycles >> $outfile"
$python ./scripts/performance.py "$metadata" "$args" $hw_cycles $dcache_stalls $icache_stalls $sb_full_stalls >> $outfile || exit
if [[ "$ci" == 0 ]]; then
echo "$python ./scripts/performance.py \"$metadata\" \"$args\" $hw_cycles $dcache_stalls $icache_stalls $sb_full_stalls >> $outfile"
$python ./scripts/performance.py "$metadata" "$args" $hw_cycles $dcache_stalls $icache_stalls $sb_full_stalls >> $outfile || exit
else
echo "$python ./scripts/performance.py \"$metadata\" \"$args\" $hw_cycles >> $outfile"
$python ./scripts/performance.py "$metadata" "$args" $hw_cycles >> $outfile || exit
fi
}

extract_performance_dotp() {
Expand Down
12 changes: 8 additions & 4 deletions scripts/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ def main():
metadata = str(sys.argv[1]).split()
args = str(sys.argv[2]).split()
cycles = int(sys.argv[3])
dcache_stall= int(sys.argv[4])
icache_stall= int(sys.argv[5])
sb_full = int(sys.argv[6])
if len(sys.argv) > 4:
dcache_stall= int(sys.argv[4])
icache_stall= int(sys.argv[5])
sb_full = int(sys.argv[6])
# Extract performance information
try:
result = perfExtr[metadata[0]](args, cycles)
Expand All @@ -189,7 +190,10 @@ def main():

# Print performance information on file
# kernel, lanes, vsize, sew, perf, max_perf, ideal_disp
print(metadata[0], metadata[1], result[0], metadata[3], result[1], real_max_perf, metadata[4], dcache_stall, icache_stall, sb_full)
if len(sys.argv) > 4:
print(metadata[0], metadata[1], result[0], metadata[3], result[1], real_max_perf, metadata[4], dcache_stall, icache_stall, sb_full)
else:
print(metadata[0], metadata[1], result[0], metadata[3], result[1], real_max_perf, metadata[4])

if __name__ == '__main__':
main()

0 comments on commit 598ee89

Please sign in to comment.