Skip to content
Snippets Groups Projects
Commit c2435a76 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[PYNQ] enable Vivado IP caching for synthesis speedup

parent 1bb13ab8
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,9 @@ DOCKER_PASSWD="finn"
# containers from the same user
DOCKER_RND=$(shuf -i0-32768 -n1)
DOCKER_TAG="finn_${DOCKER_UNAME}"
DOCKER_INST_NAME="finn_${DOCKER_UNAME}_${DOCKER_RND}"
# uncomment to run multiple instances with different names
# DOCKER_INST_NAME="finn_${DOCKER_UNAME}_${DOCKER_RND}"
DOCKER_INST_NAME="finn_${DOCKER_UNAME}"
: ${JUPYTER_PORT=8888}
: ${NETRON_PORT=8081}
......@@ -38,6 +40,7 @@ PYVERILATOR_LOCAL=$SCRIPTPATH/pyverilator
PYNQSHELL_LOCAL=$SCRIPTPATH/PYNQ-HelloWorld
BUILD_LOCAL=/tmp/$DOCKER_INST_NAME
VIVADO_HLS_LOCAL=$VIVADO_PATH
: ${VIVADO_IP_CACHE=$BUILD_LOCAL/vivado_ip_cache}
# clone dependency repos
git clone --branch feature/finn_onnx_export $BREVITAS_REPO $BREVITAS_LOCAL || git -C "$BREVITAS_LOCAL" pull
......@@ -49,6 +52,7 @@ git clone $PYNQSHELL_REPO $PYNQSHELL_LOCAL || git -C "$PYNQSHELL_LOCAL" pull
# ensure build dir exists locally
mkdir -p $BUILD_LOCAL
mkdir -p $VIVADO_IP_CACHE
echo "Instance is named as $DOCKER_INST_NAME"
echo "Mounting $SCRIPTPATH into /workspace/finn"
......@@ -62,6 +66,7 @@ echo "Mounting $BUILD_LOCAL into $BUILD_LOCAL"
echo "Mounting $VIVADO_PATH into $VIVADO_PATH"
echo "Port-forwarding for Jupyter $JUPYTER_PORT:$JUPYTER_PORT"
echo "Port-forwarding for Netron $NETRON_PORT:$NETRON_PORT"
echo "Vivado IP cache dir is at $VIVADO_IP_CACHE"
if [ "$1" = "test" ]; then
echo "Running test suite"
......@@ -101,6 +106,7 @@ docker run -t --rm --name $DOCKER_INST_NAME -it \
-e VIVADO_PATH=$VIVADO_PATH \
-e FINN_INST_NAME=$DOCKER_INST_NAME \
-e FINN_ROOT="/workspace/finn" \
-e VIVADO_IP_CACHE="$VIVADO_IP_CACHE" \
-p $JUPYTER_PORT:$JUPYTER_PORT \
-p $NETRON_PORT:$NETRON_PORT \
$DOCKER_TAG bash -c "$DOCKER_CMD"
......@@ -69,6 +69,7 @@ class MakePYNQProject(Transformation):
out_if_name = "out_r_0"
clk_name = "ap_clk_0"
nrst_name = "ap_rst_n_0"
vivado_ip_cache = os.getenv("VIVADO_IP_CACHE", default="")
# create a temporary folder for the project
vivado_pynq_proj_dir = make_build_dir(prefix="vivado_pynq_proj_")
......@@ -85,6 +86,7 @@ class MakePYNQProject(Transformation):
out_if_name,
clk_name,
nrst_name,
vivado_ip_cache,
)
with open(vivado_pynq_proj_dir + "/ip_config.tcl", "w") as f:
......
......@@ -9,6 +9,7 @@ variable config_ip_axis_name_out
variable config_ip_use_axilite
variable config_ip_project_dir
variable config_output_products_dir
variable config_remote_cache
# for arguments involving paths below: use absolute paths or relative to the
# platform/overlay/bitstream folder
......@@ -36,6 +37,8 @@ set config_ip_clk_name %s
set config_ip_nrst_name %s
# whether the IP needs an AXI Lite interface for control
set config_ip_use_axilite 0
# Vivado OOC IP cache
set config_remote_cache "%s"
"""
call_pynqshell_makefile_template = """
......
......@@ -54,7 +54,7 @@ def create_one_fc_model():
MW=m,
MH=m,
SIMD=m,
PE=m,
PE=m // 2,
inputDataType=idt.name,
weightDataType=wdt.name,
outputDataType=odt.name,
......@@ -69,7 +69,7 @@ def create_one_fc_model():
["outp_tlast"],
domain="finn",
backend="fpgadataflow",
NumIters=1,
NumIters=2,
ElemWidth=odt.bitwidth(),
StreamWidth=odt.bitwidth() * m,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment