Skip to content

Commit 68b1a6d

Browse files
authored
Merge pull request Xilinx#928 from Xilinx/refactor/rtl_integration
Refactoring of RTL/HLS component integration
2 parents 0ecbe6a + b9d4e62 commit 68b1a6d

File tree

225 files changed

+18996
-11058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+18996
-11058
lines changed

AUTHORS.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ Contributors
2828
* Matthias Gehre (@mgehre-amd)
2929
* Hugo Le Blevec (@hleblevec)
3030
* Patrick Geel (@patrickgeel)
31+
* John Monks (@jmonks-amd)
32+
* Tim Paine (@timkpaine)
33+
* Linus Jungemann (@LinusJungemann)
34+
* Shashwat Khandelwal (@shashwat1198)
35+
* Ian Colbert (@i-colbert)
36+
* Rachit Garg (@rstar900)

CHANGELOG.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,60 @@ Please follow the steps below and be sure that your contribution complies with o
2929
1. The <a href="https://github.com/Xilinx/finn" target="_blank">main branch</a> should always be treated as stable and clean. Only hot fixes are allowed to be pull-requested. The hot fix is supposed to be very important such that without this fix, a lot of things will break.
3030
2. For new features, smaller bug fixes, doc updates, and many other fixes, users should pull request against the <a href="https://github.com/Xilinx/finn/tree/dev" target="_blank">development branch</a>.
3131

32-
3. We will review your contribution and, if any additional fixes or modifications are
32+
3. Sign Your Work
33+
34+
Please use the *Signed-off-by* line at the end of your patch which indicates that you accept the Developer Certificate of Origin (DCO) defined by https://developercertificate.org/ reproduced below::
35+
36+
```
37+
Developer Certificate of Origin
38+
Version 1.1
39+
40+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
41+
1 Letterman Drive
42+
Suite D4700
43+
San Francisco, CA, 94129
44+
45+
Everyone is permitted to copy and distribute verbatim copies of this
46+
license document, but changing it is not allowed.
47+
48+
49+
Developer's Certificate of Origin 1.1
50+
51+
By making a contribution to this project, I certify that:
52+
53+
(a) The contribution was created in whole or in part by me and I
54+
have the right to submit it under the open source license
55+
indicated in the file; or
56+
57+
(b) The contribution is based upon previous work that, to the best
58+
of my knowledge, is covered under an appropriate open source
59+
license and I have the right under that license to submit that
60+
work with modifications, whether created in whole or in part
61+
by me, under the same open source license (unless I am
62+
permitted to submit under a different license), as indicated
63+
in the file; or
64+
65+
(c) The contribution was provided directly to me by some other
66+
person who certified (a), (b) or (c) and I have not modified
67+
it.
68+
69+
(d) I understand and agree that this project and the contribution
70+
are public and that a record of the contribution (including all
71+
personal information I submit with it, including my sign-off) is
72+
maintained indefinitely and may be redistributed consistent with
73+
this project or the open source license(s) involved.
74+
```
75+
76+
You can enable Signed-off-by automatically by adding the `-s` flag to the `git commit` command.
77+
78+
Here is an example Signed-off-by line which indicates that the contributor accepts DCO:
79+
80+
```
81+
This is my commit message
82+
83+
Signed-off-by: Jane Doe <[email protected]>
84+
```
85+
86+
4. We will review your contribution and, if any additional fixes or modifications are
3387
necessary, may provide feedback to guide you. When accepted, your pull request will
3488
be merged to the repository. If you have more questions please contact us.

LICENSE.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright (c) 2020, Xilinx
1+
Copyright (C) 2020-2022, Xilinx, Inc.
2+
Copyright (C) 2022-2024, Advanced Micro Devices, Inc.
23
All rights reserved.
34

45
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33

44

5-
<img align="left" src="https://raw.githubusercontent.com/Xilinx/finn/github-pages/docs/img/finn-stack.png" alt="drawing" style="margin-right: 20px" width="250"/>
5+
<img align="left" src="https://raw.githubusercontent.com/Xilinx/finn/github-pages/docs/img/finn-stack.PNG" alt="drawing" style="margin-right: 20px" width="250"/>
66

77
[![GitHub Discussions](https://img.shields.io/badge/discussions-join-green)](https://github.com/Xilinx/finn/discussions)
88
[![ReadTheDocs](https://readthedocs.org/projects/finn/badge/?version=latest&style=plastic)](http://finn.readthedocs.io/)
99

10-
FINN is an experimental framework from Xilinx Research Labs to explore deep neural network
11-
inference on FPGAs.
10+
FINN is an experimental framework from Integrated Communications and AI Lab of AMD Research & Advanced Development to explore deep neural network inference on FPGAs.
1211
It specifically targets <a href="https://github.com/maltanar/qnn-inference-examples" target="_blank">quantized neural
1312
networks</a>, with emphasis on
1413
generating dataflow-style architectures customized for each network.
@@ -28,7 +27,7 @@ Please see the [Getting Started](https://finn.readthedocs.io/en/latest/getting_s
2827

2928
## Documentation
3029

31-
You can view the documentation on [readthedocs](https://finn.readthedocs.io) or build them locally using `python setup.py doc` from inside the Docker container. Additionally, there is a series of [Jupyter notebook tutorials](https://github.com/Xilinx/finn/tree/main/notebooks), which we recommend running from inside Docker for a better experience.
30+
You can view the documentation on [readthedocs](https://finn.readthedocs.io). Additionally, there is a series of [Jupyter notebook tutorials](https://github.com/Xilinx/finn/tree/main/notebooks), which we recommend running from inside Docker for a better experience.
3231

3332
## Community
3433

docker/Dockerfile.finn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright (c) 2021, Xilinx
1+
# Copyright (C) 2021-2022, Xilinx, Inc.
2+
# Copyright (C) 2022-2024, Advanced Micro Devices, Inc.
23
# All rights reserved.
34
#
45
# Redistribution and use in source and binary forms, with or without
@@ -27,7 +28,7 @@
2728
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829

2930
FROM ubuntu:jammy-20230126
30-
LABEL maintainer="Yaman Umuroglu <yamanu@xilinx.com>"
31+
LABEL maintainer="Jakoba Petri-Koenig <[email protected]>, Yaman Umuroglu <yaman.umuroglu@amd.com>"
3132

3233
ARG XRT_DEB_VERSION="xrt_202220.2.14.354_22.04-amd64-xrt"
3334

docs/finn/brevitas_export.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Brevitas Export
88
:scale: 70%
99
:align: center
1010

11-
FINN expects an ONNX model as input. This can be a model trained with `Brevitas <https://github.com/Xilinx/brevitas>`_. Brevitas is a PyTorch library for quantization-aware training and the FINN Docker image comes with several `example Brevitas networks <https://github.com/Xilinx/brevitas/tree/master/src/brevitas_examples/bnn_pynq>`_. Brevitas provides an export of a quantized network in ONNX representation in several flavors.
12-
Two of the Brevitas-exported ONNX variants can be ingested by FINN:
13-
14-
* FINN-ONNX: Quantized weights exported as tensors with additional attributes to mark low-precision datatypes. Quantized activations exported as MultiThreshold nodes.
15-
* QONNX: All quantization is represented using Quant, BinaryQuant or Trunc nodes. QONNX must be converted into FINN-ONNX by :py:mod:`finn.transformation.qonnx.convert_qonnx_to_finn`
11+
FINN expects an ONNX model as input. This can be a model trained with `Brevitas <https://github.com/Xilinx/brevitas>`_. Brevitas is a PyTorch library for quantization-aware training and the FINN Docker image comes with several `example Brevitas networks <https://github.com/Xilinx/brevitas/tree/master/src/brevitas_examples/bnn_pynq>`_.
12+
Brevitas provides an export of a quantized network in QONNX representation, which is the format that can be ingested by FINN.
13+
In a QONNX graph, all quantization is represented using Quant, BinaryQuant or Trunc nodes.
14+
QONNX must be converted into FINN-ONNX by :py:mod:`finn.transformation.qonnx.convert_qonnx_to_finn`. FINN-ONNX is the intermediate representation (IR) FINN uses internally.
15+
In this IR, quantized weights are indicated through tensors with additional attributes to mark low-precision datatypes and quantized activations are expressed as MultiThreshold nodes.
1616

1717
To work with either type of ONNX model, it is loaded into a :ref:`modelwrapper` provided by FINN.
1818

docs/finn/command_line.rst

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ two command line entry points for productivity and ease-of-use:
2020
Jupyter notebook as a starting point, visualizing the model at intermediate
2121
steps and adding calls to new transformations as needed.
2222
Once you have a working flow, you can implement a command line entry for this
23-
by using the "advanced mode" described here.
23+
by using the "advanced mode".
2424

2525

2626
Simple dataflow build mode
2727
--------------------------
2828

2929
This mode is intended for simpler networks whose topologies resemble the
3030
FINN end-to-end examples.
31-
It runs a fixed build flow spanning tidy-up, streamlining, HLS conversion
31+
It runs a fixed build flow spanning tidy-up, streamlining, HW conversion
3232
and hardware synthesis.
3333
It can be configured to produce different outputs, including stitched IP for
3434
integration in Vivado IPI as well as bitfiles.
@@ -43,7 +43,9 @@ To use it, first create a folder with the necessary configuration and model file
4343
3. Create a JSON file with the build configuration. It must be named ``dataflow_build_dir/dataflow_build_config.json``.
4444
Read more about the build configuration options on :py:mod:`finn.builder.build_dataflow_config.DataflowBuildConfig`.
4545
You can find an example .json file under ``src/finn/qnn-data/build_dataflow/dataflow_build_config.json``
46-
4. (Optional) create a JSON file with the folding configuration. It must be named ``dataflow_build_dir/folding_config.json``.
46+
4. (Optional) create a JSON file with the specialize layers configuration. It must be named ``dataflow_build_dir/specialize_layers_config.json``
47+
You can find an example .json file under ``src/finn/qnn-data/build_dataflow/specialize_layers_config.json``.
48+
5. (Optional) create a JSON file with the folding configuration. It must be named ``dataflow_build_dir/folding_config.json``.
4749
You can find an example .json file under ``src/finn/qnn-data/build_dataflow/folding_config.json``.
4850
Instead of specifying the folding configuration, you can use the `target_fps` option in the build configuration
4951
to control the degree of parallelization for your network.
@@ -59,25 +61,28 @@ as it goes through numerous steps:
5961

6062
.. code-block:: none
6163
62-
Building dataflow accelerator from /home/maltanar/sandbox/build_dataflow/model.onnx
64+
Building dataflow accelerator from build_dataflow/model.onnx
6365
Outputs will be generated at output_tfc_w1a1_Pynq-Z1
6466
Build log is at output_tfc_w1a1_Pynq-Z1/build_dataflow.log
65-
Running step: step_tidy_up [1/16]
66-
Running step: step_streamline [2/16]
67-
Running step: step_convert_to_hls [3/16]
68-
Running step: step_create_dataflow_partition [4/16]
69-
Running step: step_target_fps_parallelization [5/16]
70-
Running step: step_apply_folding_config [6/16]
71-
Running step: step_generate_estimate_reports [7/16]
72-
Running step: step_hls_codegen [8/16]
73-
Running step: step_hls_ipgen [9/16]
74-
Running step: step_set_fifo_depths [10/16]
75-
Running step: step_create_stitched_ip [11/16]
76-
Running step: step_measure_rtlsim_performance [12/16]
77-
Running step: step_make_pynq_driver [13/16]
78-
Running step: step_out_of_context_synthesis [14/16]
79-
Running step: step_synthesize_bitfile [15/16]
80-
Running step: step_deployment_package [16/16]
67+
Running step: step_qonnx_to_finn [1/19]
68+
Running step: step_tidy_up [2/19]
69+
Running step: step_streamline [3/19]
70+
Running step: step_convert_to_hw [4/19]
71+
Running step: step_create_dataflow_partition [5/19]
72+
Running step: step_specialize_layers [6/19]
73+
Running step: step_target_fps_parallelization [7/19]
74+
Running step: step_apply_folding_config [8/19]
75+
Running step: step_minimize_bit_width [9/19]
76+
Running step: step_generate_estimate_reports [10/19]
77+
Running step: step_hw_codegen [11/19]
78+
Running step: step_hw_ipgen [12/19]
79+
Running step: step_set_fifo_depths [13/19]
80+
Running step: step_create_stitched_ip [14/19]
81+
Running step: step_measure_rtlsim_performance [15/19]
82+
Running step: step_out_of_context_synthesis [16/19]
83+
Running step: step_synthesize_bitfile [17/19]
84+
Running step: step_make_pynq_driver [18/19]
85+
Running step: step_deployment_package [19/19]
8186
8287
8388
You can read a brief description of what each step does on
@@ -99,6 +104,7 @@ The following outputs will be generated regardless of which particular outputs a
99104
* ``build_dataflow.log`` is the build logfile that will contain any warnings/errors
100105
* ``time_per_step.json`` will report the time (in seconds) each build step took
101106
* ``final_hw_config.json`` will contain the final (after parallelization, FIFO sizing etc) hardware configuration for the build
107+
* ``template_specialize_layers_config.json`` is an example json file that can be used to set the specialize layers config
102108
* ``intermediate_models/`` will contain the ONNX file(s) produced after each build step
103109

104110

@@ -206,3 +212,5 @@ You can launch the desired custom build flow using:
206212
This will mount the specified folder into the FINN Docker container and launch
207213
the build flow. If ``<name-of-build-flow>`` is not specified it will default to ``build``
208214
and thus execute ``build.py``. If it is specified, it will be ``<name-of-build-flow>.py``.
215+
216+
If you would like to learn more about advance builder settings, please have a look at `our tutorial about this topic <https://github.com/Xilinx/finn/blob/main/notebooks/advanced/4_advanced_builder_settings.ipynb>`_.

docs/finn/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = "FINN"
22-
copyright = "2020, Xilinx"
22+
copyright = "2020-2022, Xilinx, 2022-2024, AMD"
2323
author = "Y. Umuroglu and J. Petri-Koenig"
2424

2525

docs/finn/developers.rst

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Power users may also find this information useful.
1010
Prerequisites
1111
================
1212

13-
Before starting to do development on FINN it's a good idea to start
13+
Before starting to do development on FINN it is a good idea to start
1414
with understanding the basics as a user. Going through all of the
1515
:ref:`tutorials` is strongly recommended if you haven't already done so.
1616
Additionally, please review the documentation available on :ref:`internals`.
@@ -61,7 +61,7 @@ further detailed below:
6161
Docker images
6262
===============
6363

64-
If you want to add new dependencies (packages, repos) to FINN it's
64+
If you want to add new dependencies (packages, repos) to FINN it is
6565
important to understand how we handle this in Docker.
6666

6767
The finn.dev image is built and launched as follows:
@@ -70,7 +70,7 @@ The finn.dev image is built and launched as follows:
7070

7171
2. run-docker.sh launches the build of the Docker image with `docker build` (unless ``FINN_DOCKER_PREBUILT=1``). Docker image is built from docker/Dockerfile.finn using the following steps:
7272

73-
* Base: PyTorch dev image
73+
* Base: Ubuntu 22.04 LTS image
7474
* Set up apt dependencies: apt-get install a few packages for verilator and
7575
* Set up pip dependencies: Python packages FINN depends on are listed in requirements.txt, which is copied into the container and pip-installed. Some additional packages (such as Jupyter and Netron) are also installed.
7676
* Install XRT deps, if needed: For Vitis builds we need to install the extra dependencies for XRT. This is only triggered if the image is built with the INSTALL_XRT_DEPS=1 argument.
@@ -84,9 +84,9 @@ The finn.dev image is built and launched as follows:
8484

8585
4. Entrypoint script (docker/finn_entrypoint.sh) upon launching container performs the following:
8686

87-
* Source Vivado settings64.sh from specified path to make vivado and vivado_hls available.
88-
* Download PYNQ board files into the finn root directory, unless they already exist.
89-
* Source Vitits settings64.sh if Vitis is mounted.
87+
* Source Vivado settings64.sh from specified path to make vivado and vitis_hls available.
88+
* Download board files into the finn root directory, unless they already exist or ``FINN_SKIP_BOARD_FILES=1``.
89+
* Source Vitis settings64.sh if Vitis is mounted.
9090

9191
5. Depending on the arguments to run-docker.sh a different application is launched. run-docker.sh notebook launches a Jupyter server for the tutorials, whereas run-docker.sh build_custom and run-docker.sh build_dataflow trigger a dataflow build (see documentation). Running without arguments yields an interactive shell. See run-docker.sh for other options.
9292

@@ -106,7 +106,7 @@ Linting
106106
We use a pre-commit hook to auto-format Python code and check for issues.
107107
See https://pre-commit.com/ for installation. Once you have pre-commit, you can install
108108
the hooks into your local clone of the FINN repo.
109-
It's recommended to do this **on the host** and not inside the Docker container:
109+
It is recommended to do this **on the host** and not inside the Docker container:
110110

111111
::
112112

@@ -119,7 +119,7 @@ you may have to fix it manually, then run `git commit` once again.
119119
The checks are configured in .pre-commit-config.yaml under the repo root.
120120

121121
Testing
122-
=======
122+
========
123123

124124
Tests are vital to keep FINN running. All the FINN tests can be found at https://github.com/Xilinx/finn/tree/main/tests.
125125
These tests can be roughly grouped into three categories:
@@ -132,7 +132,7 @@ These tests can be roughly grouped into three categories:
132132

133133
Additionally, qonnx, brevitas and finn-hlslib also include their own test suites.
134134
The full FINN compiler test suite
135-
(which will take several hours to run and require a PYNQ board) can be executed
135+
(which will take several hours to run) can be executed
136136
by:
137137

138138
::
@@ -146,7 +146,7 @@ requiring Vivado or as slow-running tests:
146146

147147
bash ./run-docker.sh quicktest
148148

149-
When developing a new feature it's useful to be able to run just a single test,
149+
When developing a new feature it is useful to be able to run just a single test,
150150
or a group of tests that e.g. share the same prefix.
151151
You can do this inside the Docker container
152152
from the FINN root directory as follows:
@@ -178,16 +178,9 @@ FINN provides two types of documentation:
178178
* manually written documentation, like this page
179179
* autogenerated API docs from Sphinx
180180

181-
Everything is built using Sphinx, which is installed into the finn.dev
182-
Docker image. You can build the documentation locally by running the following
183-
inside the container:
184-
185-
::
186-
187-
python setup.py docs
181+
Everything is built using Sphinx.
188182

189-
You can view the generated documentation on build/html/index.html.
190-
The documentation is also built online by readthedocs:
183+
The documentation is built online by readthedocs:
191184

192185
* finn.readthedocs.io contains the docs from the master branch
193186
* finn-dev.readthedocs.io contains the docs from the dev branch

0 commit comments

Comments
 (0)