Skip to content

Commit

Permalink
Merge branch 'sirius_spadv2' of github.com:ucb-bar/gemmini into siriu…
Browse files Browse the repository at this point in the history
…s_spadv2
  • Loading branch information
vikramjain236 committed Aug 2, 2024
2 parents d2f893d + e5739c1 commit 8659877
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 0 deletions.
79 changes: 79 additions & 0 deletions scripts/run-vcs_0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# Array of binaries to run in parallel
binaries=(
"mvin_mvout"
"mvin_mvout_zeros"
"mvin_mvout_block_stride"
"mvin_mvout_acc_zero_stride"
"mvin_mvout_stride"
"mvin_mvout_acc"
"mvin_mvout_acc_full"
"mvin_mvout_acc_stride"
"mvin_mvout_acc_full_stride"
"mvin_scale"
"matmul_os"
"matmul_ws"
"matmul"
"raw_hazard"
"aligned"
"padded"
"conv"
"conv_stride"
"conv_rect"
"conv_rect_pool"
"conv_with_pool"
"conv_with_rot180"
"conv_with_kernel_dilation"
"conv_with_input_dilation"
"conv_with_input_dilation_and_rot180"
"conv_with_input_dilation_and_neg_padding"
"conv_trans_output_1203"
"conv_trans_weight_1203"
"conv_trans_weight_0132"
"conv_trans_input_3120"
"conv_trans_input_3120_with_kernel_dilation"
"conv_first_layer"
"conv_dw"
"conv_perf"
"conv_dw_perf"
"tiled_matmul_os"
"tiled_matmul_ws"
"tiled_matmul_ws_At"
"tiled_matmul_ws_Bt"
"tiled_matmul_ws_full_C"
"tiled_matmul_ws_low_D"
"tiled_matmul_ws_igelu"
"tiled_matmul_ws_layernorm"
"tiled_matmul_ws_softmax"
"tiled_matmul_ws_perf"
"tiled_matmul_cpu"
"tiled_matmul_option"
"transpose"
"matrix_add"
"resadd"
"resadd_stride"
"global_average"
"gemmini_counter"
"identity"
"template"
"lut_template"
)

# Function to run each binary in parallel
run_binary() {
binary="$1"
./scripts/run-vcs_1.sh "$binary" &
pid=$!
echo "Running $binary (PID: $pid)"
}

# Iterate through the array and run each binary in parallel
for binary in "${binaries[@]}"; do
run_binary "$binary"
done

# Wait for all background jobs to finish
wait

echo "All binaries have been launched."
92 changes: 92 additions & 0 deletions scripts/run-vcs_1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash

ROOT="$PWD/"

WAVEFORM="waveforms/waveform.fsdb"

help () {
echo "Run a RISCV Gemmini program on VCS, a cycle-accurate simulator"
echo
echo "Usage: $0 [--pk] [--debug] BINARY"
echo
echo "Options:"
echo " pk Run binaries on the proxy kernel, which enables virtual memory"
echo " and a few syscalls. If this option is not set, binaries will be"
echo " run in baremetal mode."
echo
echo " debug Use the debug version of the VCS simulator, which will output"
echo " a waveform to \`$WAVEFORM\`."
echo
echo " BINARY The RISCV binary that you want to run. This can either be the"
echo ' name of a program in `software/gemmini-rocc-tests`, or it can'
echo " be the full path to a binary you compiled."
echo
echo "Examples:"
echo " $0 template"
echo " $0 --debug template"
echo " $0 --pk mvin_mvout"
echo " $0 path/to/binary-baremetal"
echo
echo 'Note: Run this command after running `scripts/build-vcs.sh` or'
echo ' `scripts/build-vcs.sh --debug`.'
exit
}

if [ $# -le 0 ]; then
help
fi

pk=0
debug=0
show_help=0
binary=""

while [ $# -gt 0 ] ; do
case $1 in
--pk) pk=1 ;;
--debug) debug=1 ;;
-h | --help) show_help=1 ;;
*) binary=$1
esac

shift
done

if [ $show_help -eq 1 ]; then
help
fi

if [ $pk -eq 1 ]; then
default_suffix="-pk"
PK="pk -p"
else
default_suffix="-baremetal"
PK=""
fi

if [ $debug -eq 1 ]; then
DEBUG="-debug +permissive +ntb_random_seed_automatic +fsdbfile=${ROOT}${WAVEFORM} +permissive-off"
else
DEBUG=""
fi

path=""
suffix=""

for dir in bareMetalC mlps imagenet transformers ; do
if [ -f "software/gemmini-rocc-tests/build/${dir}/${binary}$default_suffix" ]; then
path="${ROOT}/software/gemmini-rocc-tests/build/${dir}/"
suffix=$default_suffix
fi
done

full_binary_path="${path}${binary}${suffix}"

if [ ! -f "${full_binary_path}" ]; then
echo "Binary not found: $full_binary_path"
exit 1
fi

cd ../../sims/vcs/
#./simv-chipyard-CustomGemminiSoCConfig${DEBUG} $PK $full_binary_path
./simv-chipyard.harness-TestFP32GemminiRocketConfig${DEBUG} $PK $full_binary_path | tee "${ROOT}/scripts/profile_result/${binary}.log"

0 comments on commit 8659877

Please sign in to comment.