Skip to content

Commit

Permalink
Merge pull request Xilinx#348 from Xilinx/dev
Browse files Browse the repository at this point in the history
FINN v0.6
  • Loading branch information
maltanar authored Jun 15, 2021
2 parents af783db + c8be504 commit 5a7cc37
Show file tree
Hide file tree
Showing 124 changed files with 6,786 additions and 1,600 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/quicktest-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

test:
name: Run quicktest on PR branch
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04

steps:
- name: checkout
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ __pycache__/*
*.ipynb_checkpoints*

# Project files
.vscode
.ropeproject
.project
.pydevproject
Expand Down
7 changes: 6 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
Contributors
============

* Yaman Umuroglu (@maltanar)
* Yaman Umuroglu (@maltanar) (maintainer)
* Jakoba Petri-Koenig (@auphelia)
* Andrea Rigoni (@AndreaRigoni)
* Hendrik Borras (@HenniOVP)
* Lucian Petrica (@quetric)
* Tobias Alonso (@Tobi-Alonso)
* Felix Paul Jentzsch (@felixpj)
* Mirza Mrahorovic (@mmrahorovic)
* Suranga Mahesh (@surangamh)
* Peter Lehnhardt (@pete-lennart)
* Neil Kim Nielsen (@neilkimn)
40 changes: 32 additions & 8 deletions docker/Dockerfile.finn_ci
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,50 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

FROM pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-devel
MAINTAINER Yaman Umuroglu <[email protected]>
LABEL maintainer="Yaman Umuroglu <[email protected]>"

WORKDIR /workspace

# some Vitis deps require a timezone to be specified, which hangs in Docker
# use workaround from https://grigorkh.medium.com/fix-tzdata-hangs-docker-image-build-cdb52cc3360d
ENV TZ="Europe/Dublin"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y build-essential libglib2.0-0 libsm6 libxext6 libxrender-dev
RUN apt-get install -y verilator zsh nano
RUN apt-get install -y sshpass wget unzip
RUN apt-get install -y build-essential
RUN apt-get install -y libglib2.0-0
RUN apt-get install -y libsm6
RUN apt-get install -y libxext6
RUN apt-get install -y libxrender-dev
RUN apt-get install -y verilator
RUN apt-get install -y nano
RUN apt-get install -y zsh
RUN apt-get install -y rsync
RUN apt-get install -y git
RUN apt-get install -y sshpass
RUN apt-get install -y wget
RUN apt-get install -y unzip
RUN apt-get install -y zip
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config

# XRT deps
RUN wget https://raw.githubusercontent.com/Xilinx/XRT/master/src/runtime_src/tools/scripts/xrtdeps.sh
RUN apt-get update
RUN bash xrtdeps.sh -docker
RUN rm xrtdeps.sh
# install vitis deps if required
ARG INSTALL_XRT_DEPS="0"
ARG XRT_DEB_VERSION="xrt_202010.2.7.766_18.04-amd64-xrt"
RUN if [ "$INSTALL_XRT_DEPS" = "1" ] ; then \
echo "Installing XRT: $XRT_DEB_VERSION"; \
wget https://www.xilinx.com/bin/public/openDownload?filename=$XRT_DEB_VERSION.deb -O /tmp/$XRT_DEB_VERSION.deb; \
apt install -y /tmp/$XRT_DEB_VERSION.deb; \
else \
echo "Skipping installation of XRT dependencies"; \
fi

# cloning dependency repos
# finn-base
RUN git clone https://github.com/Xilinx/finn-base.git /workspace/finn-base
# finn-experimental
RUN git clone https://github.com/Xilinx/finn-experimental.git /workspace/finn-experimental
# Brevitas
RUN git clone https://github.com/Xilinx/brevitas.git /workspace/brevitas
# CNPY
Expand Down
47 changes: 35 additions & 12 deletions docker/Dockerfile.finn_dev
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

FROM pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-devel
MAINTAINER Yaman Umuroglu <[email protected]>
FROM pytorch/pytorch:1.7.1-cuda11.0-cudnn8-runtime
LABEL maintainer="Yaman Umuroglu <[email protected]>"
ARG GID
ARG GNAME
ARG UNAME
Expand All @@ -36,11 +36,28 @@ ARG PASSWD

WORKDIR /workspace

# some Vitis deps require a timezone to be specified, which hangs in Docker
# use workaround from https://grigorkh.medium.com/fix-tzdata-hangs-docker-image-build-cdb52cc3360d
ENV TZ="Europe/Dublin"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y build-essential libglib2.0-0 libsm6 libxext6 libxrender-dev
RUN apt-get install -y verilator nano zsh rsync
RUN apt-get -y install sshpass wget unzip
RUN apt-get install -y build-essential
RUN apt-get install -y libglib2.0-0
RUN apt-get install -y libsm6
RUN apt-get install -y libxext6
RUN apt-get install -y libxrender-dev
RUN apt-get install -y verilator
RUN apt-get install -y nano
RUN apt-get install -y zsh
RUN apt-get install -y rsync
RUN apt-get install -y git
RUN apt-get install -y sshpass
RUN apt-get install -y wget
RUN apt-get install -y unzip
RUN apt-get install -y zip
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config

COPY requirements.txt .
Expand All @@ -54,22 +71,29 @@ RUN pip install sphinx==3.1.2
RUN pip install sphinx_rtd_theme==0.5.0
RUN pip install pytest-xdist==2.0.0
RUN pip install pytest-parallel==0.1.0
RUN pip install netron
RUN pip install netron>=4.7.9
RUN pip install pandas==1.1.5
RUN pip install scikit-learn==0.24.1
RUN pip install tqdm==4.31.1
RUN pip install -e git+https://github.com/fbcotter/[email protected]#egg=dataset_loading


# switch user
RUN groupadd -g $GID $GNAME
RUN useradd -M -u $UID $UNAME -g $GNAME
RUN usermod -aG sudo $UNAME
RUN echo "$UNAME:$PASSWD" | chpasswd
RUN echo "root:$PASSWD" | chpasswd
RUN chown -R $UNAME:$GNAME /workspace
RUN ln -s /workspace /home/$UNAME
RUN chown -R $UNAME:$GNAME /home/$UNAME
USER $UNAME


# cloning dependency repos (as user)
# finn-base
RUN git clone https://github.com/Xilinx/finn-base.git /workspace/finn-base
# finn-experimental
RUN git clone https://github.com/Xilinx/finn-experimental.git /workspace/finn-experimental
# Brevitas
RUN git clone https://github.com/Xilinx/brevitas.git /workspace/brevitas
# CNPY
Expand Down Expand Up @@ -98,12 +122,11 @@ RUN chmod 755 /usr/local/bin/finn_entrypoint.sh
RUN chmod 755 /usr/local/bin/quicktest.sh
# install vitis deps if required
ARG INSTALL_XRT_DEPS
ARG XRT_DEB_VERSION
RUN if [ "$INSTALL_XRT_DEPS" = "1" ] ; then \
echo "Installing XRT dependencies"; \
wget https://raw.githubusercontent.com/Xilinx/XRT/master/src/runtime_src/tools/scripts/xrtdeps.sh; \
apt-get update; \
bash xrtdeps.sh -docker; \
rm xrtdeps.sh; \
echo "Installing XRT: $XRT_DEB_VERSION"; \
wget https://www.xilinx.com/bin/public/openDownload?filename=$XRT_DEB_VERSION.deb -O /tmp/$XRT_DEB_VERSION.deb; \
apt install -y /tmp/$XRT_DEB_VERSION.deb; \
else \
echo "Skipping installation of XRT dependencies"; \
fi
Expand Down
26 changes: 21 additions & 5 deletions docker/finn_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,39 @@ export SHELL=/bin/bash
export FINN_ROOT=/workspace/finn

GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

gecho () {
echo -e "${GREEN}$1${NC}"
}

recho () {
echo -e "${RED}ERROR: $1${NC}"
}

# checkout the correct dependency repo commits
# the repos themselves are cloned in the Dockerfile
FINN_BASE_COMMIT=1363981654009067790d5f2d0c3dd303b5fa05cb
BREVITAS_COMMIT=aff49758ec445d77c75721c7de3091a2a1797ca8
FINN_BASE_COMMIT=ac0b86a63eb937b869bfa453a996a8a8b8506546
FINN_EXP_COMMIT=f82c0d9868bb88ea045dfadb28508d327d287221
BREVITAS_COMMIT=d7ded80fa9557da2998ea310669edee7fb2d9526
CNPY_COMMIT=4e8810b1a8637695171ed346ce68f6984e585ef4
HLSLIB_COMMIT=cfafe11a93b79ab1af7529d68f08886913a6466e
HLSLIB_COMMIT=4d74baefa79df48b5a0348d63f39a26df075de51
PYVERILATOR_COMMIT=e2ff74030de3992dcac54bf1b6aad2915946e8cb
OMX_COMMIT=1bae737669901e762f581af73348332b5c4b2ada
AVNET_BDF_COMMIT=2d49cfc25766f07792c0b314489f21fe916b639b

gecho "Setting up known-good commit versions for FINN dependencies"
# finn-base
gecho "finn-base @ $FINN_BASE_COMMIT"
git -C /workspace/finn-base pull --quiet
git -C /workspace/finn-base checkout $FINN_BASE_COMMIT --quiet
pip install --user -e /workspace/finn-base
# finn-experimental
gecho "finn-experimental @ $FINN_EXP_COMMIT"
git -C /workspace/finn-experimental pull --quiet
git -C /workspace/finn-experimental checkout $FINN_EXP_COMMIT --quiet
pip install --user -e /workspace/finn-experimental
# Brevitas
gecho "brevitas @ $BREVITAS_COMMIT"
git -C /workspace/brevitas pull --quiet
Expand Down Expand Up @@ -74,22 +86,26 @@ if [ ! -d "/workspace/finn/board_files" ]; then
rm pynq-z2.zip
cd $OLD_PWD
fi
if [ ! -d "/workspace/finn/board_files/ultra96v1" ]; then
gecho "Downloading Avnet BDF files into board_files"
if [ ! -d "/workspace/finn/board_files/ultra96v2" ]; then
gecho "Downloading Avnet BDF files from known-good commit into board_files"
OLD_PWD=$(pwd)
cd /workspace/finn
git clone https://github.com/Avnet/bdf.git
git -C /workspace/finn/bdf checkout $AVNET_BDF_COMMIT --quiet
mv /workspace/finn/bdf/* /workspace/finn/board_files/
rm -rf /workspace/finn/bdf
cd $OLD_PWD
fi
if [ ! -z "$VITIS_PATH" ];then
# source Vitis env.vars
export XILINX_VITIS=$VITIS_PATH
export XILINX_XRT=/opt/xilinx/xrt
source $VITIS_PATH/settings64.sh
if [ ! -z "$XILINX_XRT" ];then
# source XRT
source $XILINX_XRT/setup.sh
else
recho "XRT not found on $XILINX_XRT, did the installation fail?"
fi
fi
exec "$@"
4 changes: 2 additions & 2 deletions docker/quicktest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
cd $FINN_ROOT
# check if command line argument is empty or not present
if [ -z $1 ]; then
echo "Running quicktest: not (vivado or slow) with pytest-xdist"
python setup.py test --addopts "-m 'not (vivado or slow or vitis)' --dist=loadfile -n $PYTEST_PARALLEL"
echo "Running quicktest: not (vivado or slow or board) with pytest-xdist"
python setup.py test --addopts "-m 'not (vivado or slow or vitis or board)' --dist=loadfile -n $PYTEST_PARALLEL"
elif [ $1 = "main" ]; then
echo "Running main test suite: not (rtlsim or end2end) with pytest-xdist"
python setup.py test --addopts "-k 'not (rtlsim or end2end)' --dist=loadfile -n $PYTEST_PARALLEL"
Expand Down
31 changes: 16 additions & 15 deletions docs/finn/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,22 @@ as it go through numerous steps:
Building dataflow accelerator from /home/maltanar/sandbox/build_dataflow/model.onnx
Outputs will be generated at output_tfc_w1a1_Pynq-Z1
Build log is at output_tfc_w1a1_Pynq-Z1/build_dataflow.log
Running step: step_tidy_up [1/15]
Running step: step_streamline [2/15]
Running step: step_convert_to_hls [3/15]
Running step: step_create_dataflow_partition [4/15]
Running step: step_target_fps_parallelization [5/15]
Running step: step_apply_folding_config [6/15]
Running step: step_generate_estimate_reports [7/15]
Running step: step_hls_ipgen [8/15]
Running step: step_set_fifo_depths [9/15]
Running step: step_create_stitched_ip [10/15]
Running step: step_measure_rtlsim_performance [11/15]
Running step: step_make_pynq_driver [12/15]
Running step: step_out_of_context_synthesis [13/15]
Running step: step_synthesize_bitfile [14/15]
Running step: step_deployment_package [15/15]
Running step: step_tidy_up [1/16]
Running step: step_streamline [2/16]
Running step: step_convert_to_hls [3/16]
Running step: step_create_dataflow_partition [4/16]
Running step: step_target_fps_parallelization [5/16]
Running step: step_apply_folding_config [6/16]
Running step: step_generate_estimate_reports [7/16]
Running step: step_hls_codegen [8/16]
Running step: step_hls_ipgen [9/16]
Running step: step_set_fifo_depths [10/16]
Running step: step_create_stitched_ip [11/16]
Running step: step_measure_rtlsim_performance [12/16]
Running step: step_make_pynq_driver [13/16]
Running step: step_out_of_context_synthesis [14/16]
Running step: step_synthesize_bitfile [15/16]
Running step: step_deployment_package [16/16]
You can read a brief description of what each step does on
Expand Down
Loading

0 comments on commit 5a7cc37

Please sign in to comment.