-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] Modifications to TDCC and scripts for first pass profiling (
#2040) * add new option * Barebones hack version created... Now I want to write to a file * Fixing clippy errors * Small scripts for first pass VCD parsing * very hacky way to only get group names * Bare bones python script to output group to number of cycles * Fix clippy errors * Output JSON to file * remove unused import * Remove hack for obtaining group to states * Small wrapper script to run TDCC, simulation, and output cycle counts * Fix clippy errors * Small changes to scripts * Get Enables to directly produce FSMInfo * First pass code for collecting FSMInfos across multiple TDCC groups * Fix clippy errors * remove debugging prints * Clean things up before making PR * Clean up more comments * Allow passing Calyx arguments from command line * Update fud2 tests to have empty args variable * Replace script to get no-opt vcd with fud2 command * README for scripts in tools/vcd-parsing * Documentation comments for new structs * Use Id instead of String for JSON structs
- Loading branch information
1 parent
0916c48
commit b789140
Showing
17 changed files
with
197 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Profiling Scripts | ||
|
||
This directory contains scripts for a first pass at profiling cycle counts in Calyx programs. It contains: | ||
|
||
- `get-profile-counts-info.sh`: A wrapper script that produces a cycle counts estimate given a Calyx program | ||
- `parse-vcd.py`: A helper script that reads in a VCD file and a JSON FSM file to generate cycle count estimates | ||
|
||
### Usage | ||
|
||
- To run the profiling pipeline, you can run `get-profile-counts-info.sh` providing the Calyx file and the Memory data. ex) From the Calyx root directory | ||
``` | ||
bash tools/vcd-parsing/get-profile-counts-info.sh examples/tutorial/language-tutorial-compute.futil examples/tutorial/data.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Wrapper script for running TDCC, running simulation, and obtaining cycle counts information | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "USAGE: bash $0 INPUT_FILE SIM_DATA_JSON" | ||
exit | ||
fi | ||
|
||
SCRIPT_DIR=$( cd $( dirname $0 ) && pwd ) | ||
SCRIPT_NAME=$( echo "$0" | rev | cut -d/ -f1 | rev ) | ||
CALYX_DIR=$( dirname $( dirname ${SCRIPT_DIR} ) ) | ||
TMP_DIR=${SCRIPT_DIR}/tmp | ||
TMP_VERILOG=${TMP_DIR}/no-opt-verilog.sv | ||
FSM_JSON=${TMP_DIR}/fsm.json | ||
VCD_FILE=${TMP_DIR}/trace-info.vcd | ||
LOGS_DIR=${SCRIPT_DIR}/logs | ||
mkdir -p ${TMP_DIR} ${LOGS_DIR} | ||
|
||
rm -f ${TMP_VERILOG} ${FSM_JSON} | ||
|
||
INPUT_FILE=$1 | ||
SIM_DATA_JSON=$2 | ||
|
||
# Run TDCC to get the FSM info | ||
echo "[${SCRIPT_NAME}] Obtaining FSM info from TDCC" | ||
( | ||
cd ${CALYX_DIR} | ||
set -o xtrace | ||
cargo run -- ${INPUT_FILE} -p no-opt -x tdcc:dump-fsm-json="${FSM_JSON}" | ||
set +o xtrace | ||
) &> ${LOGS_DIR}/gol-tdcc | ||
|
||
# Run simuation to get VCD | ||
echo "[${SCRIPT_NAME}] Obtaining VCD file via simulation" | ||
( | ||
set -o xtrace | ||
fud2 ${INPUT_FILE} -o ${VCD_FILE} -s calyx.args='-p no-opt' -s sim.data=${SIM_DATA_JSON} | ||
set +o xtrace | ||
) &> ${LOGS_DIR}/gol-vcd | ||
|
||
# Run script to get cycle level counts | ||
echo "[${SCRIPT_NAME}] Using FSM info and VCD file to obtain cycle level counts" | ||
( | ||
python3 ${SCRIPT_DIR}/parse-vcd.py ${VCD_FILE} ${FSM_JSON} | ||
) # &> ${LOGS_DIR}/gol-process |
Oops, something went wrong.