Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/custom/transformer' into feature…
Browse files Browse the repository at this point in the history
…/mvau_dyn
  • Loading branch information
aziz bahri committed Dec 13, 2024
2 parents bcb80a9 + 1b03f6b commit 01c4628
Show file tree
Hide file tree
Showing 88 changed files with 5,555 additions and 1,189 deletions.
12 changes: 9 additions & 3 deletions docker/Dockerfile.finn
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ RUN apt-get update && \
python-is-python3 \
python3-pip \
python3-setuptools-scm \
python3-venv
python3-venv \
pybind11-dev \
libfmt-dev \
libboost-dev \
libjansson-dev \
libgetdata-dev \
libtinfo5
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
RUN locale-gen "en_US.UTF-8"

# install Verilator from source to get the right version
RUN apt-get install -y git perl make autoconf g++ flex bison ccache libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g zlib1g-dev
RUN apt-get install -y git perl make autoconf g++-10 flex bison ccache libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g zlib1g-dev
RUN git clone https://github.com/verilator/verilator
RUN cd verilator && \
git checkout v4.224 && \
Expand All @@ -95,7 +101,7 @@ RUN pip install -r /tmp/requirements.txt
RUN rm /tmp/requirements.txt

# install PyTorch
RUN pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
RUN pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --extra-index-url https://download.pytorch.org/whl/cu121

# extra Python package dependencies (for testing and interaction)
RUN pip install pygments==2.14.0
Expand Down
35 changes: 28 additions & 7 deletions docker/finn_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ recho () {
mv ${FINN_ROOT}/deps/qonnx/pyproject.toml ${FINN_ROOT}/deps/qonnx/pyproject.tmp
pip install --user -e ${FINN_ROOT}/deps/qonnx
mv ${FINN_ROOT}/deps/qonnx/pyproject.tmp ${FINN_ROOT}/deps/qonnx/pyproject.toml
# finn-experimental
pip install --user -e ${FINN_ROOT}/deps/finn-experimental
# brevitas
pip install --user -e ${FINN_ROOT}/deps/brevitas
# pyverilator
pip install --user -e ${FINN_ROOT}/deps/pyverilator

cat <(tail -n +3 python_repos.txt) | while IFS=',' read -a arr ; do
# extract line to $arr as array separated by ','
pip install --user -e ${FINN_ROOT}/deps/"${arr[0]}"
done



if [ -f "${FINN_ROOT}/setup.py" ];then
# run pip install for finn
Expand All @@ -87,7 +88,7 @@ if [ -f "$VITIS_PATH/settings64.sh" ];then
gecho "Found XRT at $XILINX_XRT"
else
recho "XRT not found on $XILINX_XRT, did you skip the download or did the installation fail?"
exit -1
#exit -1
fi
else
yecho "Unable to find $VITIS_PATH/settings64.sh"
Expand All @@ -105,6 +106,22 @@ else
fi
fi

if [ -z "${XILINX_VIVADO}" ]; then
yecho "pyxsi will be unavailable since Vivado was not found"
else
if [ -f "${FINN_ROOT}/deps/pyxsi/pyxsi.so" ]; then
gecho "Found pyxsi at ${FINN_ROOT}/deps/pyxsi/pyxsi.so"
else
OLDPWD=$(pwd)
cd ${FINN_ROOT}/deps/pyxsi
touch .dockerenv
make
cd $OLDPWD
fi
export PYTHONPATH=$PYTHONPATH:${FINN_ROOT}/deps/pyxsi:${FINN_ROOT}/deps/pyxsi/py
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/x86_64-linux-gnu/:${XILINX_VIVADO}/lib/lnx64.o
fi

if [ -f "$HLS_PATH/settings64.sh" ];then
# source Vitis HLS env.vars
source $HLS_PATH/settings64.sh
Expand All @@ -129,6 +146,7 @@ if [ -d "$FINN_ROOT/.Xilinx" ]; then
mkdir "$HOME/.Xilinx/Vivado/"
cp "$FINN_ROOT/.Xilinx/Vivado/Vivado_init.tcl" "$HOME/.Xilinx/Vivado/"
gecho "Found Vivado_init.tcl and copied to $HOME/.Xilinx/Vivado/Vivado_init.tcl"

else
yecho "Unable to find $FINN_ROOT/.Xilinx/Vivado/Vivado_init.tcl"
fi
Expand All @@ -137,6 +155,9 @@ else
echo "See https://docs.xilinx.com/r/en-US/ug835-vivado-tcl-commands/Tcl-Initialization-Scripts"
fi

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VITIS_PATH/lnx64/tools/fpo_v7_1"

export PATH=$PATH:$HOME/.local/bin

# execute the provided command(s) as root
exec "$@"
32 changes: 13 additions & 19 deletions fetch-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,33 @@
# 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.

QONNX_COMMIT="2281a777d84aa5cbd7469085c2e534fb4a03ccf9"
FINN_EXP_COMMIT="0724be21111a21f0d81a072fccc1c446e053f851"
BREVITAS_COMMIT="d4834bd2a0fad3c1fbc0ff7e1346d5dcb3797ea4"
PYVERILATOR_COMMIT="ce0a08c20cb8c1d1e84181d6f392390f846adbd1"
CNPY_COMMIT="4e8810b1a8637695171ed346ce68f6984e585ef4"
HLSLIB_COMMIT="16e5847a5e3ef76cffe84c8fad2f010d593457d3"
CNPY_COMMIT="8c82362372ce600bbd1cf11d64661ab69d38d7de"
HLSLIB_COMMIT="7783acaac835e702da25aa6b7103254b3cbcdf83"
OMX_COMMIT="0b59762f9e4c4f7e5aa535ee9bc29f292434ca7a"
AVNET_BDF_COMMIT="2d49cfc25766f07792c0b314489f21fe916b639b"
XIL_BDF_COMMIT="8cf4bb674a919ac34e3d99d8d71a9e60af93d14e"
RFSOC4x2_BDF_COMMIT="13fb6f6c02c7dfd7e4b336b18b959ad5115db696"
KV260_BDF_COMMIT="98e0d3efc901f0b974006bc4370c2a7ad8856c79"
EXP_BOARD_FILES_MD5="226ca927a16ea4ce579f1332675e9e9a"
PYXSI_COMMIT="28051f8dad7644614fc50dc755d1def9e45fc97b"

QONNX_URL="https://github.com/fastmachinelearning/qonnx.git"
FINN_EXP_URL="https://github.com/Xilinx/finn-experimental.git"
BREVITAS_URL="https://github.com/Xilinx/brevitas.git"
PYVERILATOR_URL="https://github.com/maltanar/pyverilator.git"
CNPY_URL="https://github.com/rogersce/cnpy.git"
CNPY_URL="https://github.com/maltanar/cnpy.git"
HLSLIB_URL="https://github.com/Xilinx/finn-hlslib.git"
OMX_URL="https://github.com/maltanar/oh-my-xilinx.git"
AVNET_BDF_URL="https://github.com/Avnet/bdf.git"
XIL_BDF_URL="https://github.com/Xilinx/XilinxBoardStore.git"
RFSOC4x2_BDF_URL="https://github.com/RealDigitalOrg/RFSoC4x2-BSP.git"
KV260_BDF_URL="https://github.com/Xilinx/XilinxBoardStore.git"
PYXSI_URL="https://github.com/maltanar/pyxsi.git"

QONNX_DIR="qonnx"
FINN_EXP_DIR="finn-experimental"
BREVITAS_DIR="brevitas"
PYVERILATOR_DIR="pyverilator"
CNPY_DIR="cnpy"
HLSLIB_DIR="finn-hlslib"
OMX_DIR="oh-my-xilinx"
AVNET_BDF_DIR="avnet-bdf"
XIL_BDF_DIR="xil-bdf"
RFSOC4x2_BDF_DIR="rfsoc4x2-bdf"
KV260_SOM_BDF_DIR="kv260-som-bdf"
PYXSI_DIR="pyxsi"

# absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
Expand Down Expand Up @@ -115,17 +106,20 @@ fetch_board_files() {
cd $OLD_PWD
}

fetch_repo $QONNX_URL $QONNX_COMMIT $QONNX_DIR
fetch_repo $FINN_EXP_URL $FINN_EXP_COMMIT $FINN_EXP_DIR
fetch_repo $BREVITAS_URL $BREVITAS_COMMIT $BREVITAS_DIR
fetch_repo $PYVERILATOR_URL $PYVERILATOR_COMMIT $PYVERILATOR_DIR

cat <(tail -n +2 python_repos.txt) | while IFS=',' read -a arr ; do
# extract line to $arr as array separated by ','
fetch_repo "${arr[1]}" "${arr[2]}" "${arr[0]}"
done

fetch_repo $CNPY_URL $CNPY_COMMIT $CNPY_DIR
fetch_repo $HLSLIB_URL $HLSLIB_COMMIT $HLSLIB_DIR
fetch_repo $OMX_URL $OMX_COMMIT $OMX_DIR
fetch_repo $AVNET_BDF_URL $AVNET_BDF_COMMIT $AVNET_BDF_DIR
fetch_repo $XIL_BDF_URL $XIL_BDF_COMMIT $XIL_BDF_DIR
fetch_repo $RFSOC4x2_BDF_URL $RFSOC4x2_BDF_COMMIT $RFSOC4x2_BDF_DIR
fetch_repo $KV260_BDF_URL $KV260_BDF_COMMIT $KV260_SOM_BDF_DIR
fetch_repo $PYXSI_URL $PYXSI_COMMIT $PYXSI_DIR

# Can skip downloading of board files entirely if desired
if [ "$FINN_SKIP_BOARD_FILES" = "1" ]; then
Expand Down
Loading

0 comments on commit 01c4628

Please sign in to comment.