Skip to content

Commit

Permalink
Merge pull request #413 from Xilinx/dev
Browse files Browse the repository at this point in the history
FINN v0.7
  • Loading branch information
maltanar authored Nov 5, 2021
2 parents bdfbd4b + d8e0f68 commit d1cc9cf
Show file tree
Hide file tree
Showing 205 changed files with 8,062 additions and 4,574 deletions.
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Bug report
about: Something isn't working as expected
title: ''
labels: bug
assignees: ''

---


## Prerequisites
Please make sure to check off these prerequisites before submitting a bug report.
- [ ] Test that the bug appears on the current version of the dev-branch. Make sure to include the commit hash of the commit you checked out.
- [ ] Check that the issue hasn't already been reported, by checking the currently open issues.
- [ ] If there are steps to reproduce the problem, make sure to write them down below.
- [ ] If relevant, please include the ONNX files, which were created directly before and/or after the bug.

## Quick summary
Please give a brief and concise description of the bug.

## Details
Please add to the following sections to describe the bug as accurately as possible.

### Steps to Reproduce
Add what needs to be done to reproduce the bug. Add code examples where useful
and make sure to include the resulting ONNX files, and the commit hash you are working on.

1. Clone the FINN repository
2. Checkout the dev branch, with commit hash: [...]
3. Start the docker container with the command: [...]
4. Run transformation [...] on ONNX file [...] or run the dataflow builder with the following settings: [...]
5. [Further steps ...]

### Expected behavior
Please add a brief description of what you expected to happen.

### Actual behavior
Describe what actually happens instead.

## Optional

### Possible fix
If you already know where the issue stems from, or you have a hint please let us know.

### Additional context
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Getting started with FINN
url: https://finn.readthedocs.io/en/latest/getting_started.html
about: Documentation about how to get up and running with FINN.
- name: Ask for help and get in touch with the community
url: https://gitter.im/xilinx-finn/community
about: Check out our gitter channel, if you have a question about FINN or a general problem that is likely not a bug.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature request
about: Suggest an idea for FINN
title: ''
labels: enhancement
assignees: ''

---

## Prerequisites
Please make sure to check that the idea is not already being worked on
by looking at the currently open issues and the [project Kanbans](https://github.com/Xilinx/finn/projects).

Even if an idea is already being worked on you can still create a feature request,
if you would like to open a discussion about the feature or want to contribute to it.

## Details
Please add to the following sections to describe the feature as accurately as possible.

### New behavior
Please add a brief and concise description of what you would like to happen in FINN in the future.

### Motivation
Please tell us why this feature is important to the FINN community.

### Parts of FINN affected
Please describe which parts of FINN would be affected by this feature.
33 changes: 33 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: DockerImage

on:
push:
branches:
- 'dev'

jobs:
docker:
runs-on: ubuntu-18.04
steps:
-
name: checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
file: docker/Dockerfile.finn
context: .
push: true
tags: maltanar/finn:dev_latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
22 changes: 22 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pre-commit

on:
pull_request:
branches: [ main, dev ]
push:
branches: [ main, dev ]

jobs:
lint:
name: Lint PR or Push to DEV
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Run Lint
uses: pre-commit/action@v2.0.0
32 changes: 31 additions & 1 deletion .github/workflows/quicktest-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,37 @@ jobs:
- name: checkout
uses: actions/checkout@v2

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
uses: docker/build-push-action@v2
with:
file: docker/Dockerfile.finn
context: .
push: false
load: true
tags: finn_gha
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
-
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: DockerRunQuicktest
run: |
docker build -t finn_gha -f docker/Dockerfile.finn_ci --build-arg BUILD_PATH=/tmp/finn_gha .
docker run --init --hostname finn_gha -v $(pwd):/workspace/finn -e FINN_BUILD_DIR=/tmp/finn_gha -e FINN_INST_NAME=finn_gha finn_gha quicktest.sh
11 changes: 11 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[settings]
line_length=88
indent=' '
skip=.tox,.venv,build,dist
known_standard_library=setuptools,pkg_resources
known_test=pytest
known_first_party=finn
sections=FUTURE,STDLIB,TEST,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section=THIRDPARTY
multi_line_output=3
profile=black
32 changes: 24 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,44 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

exclude: '^docs/conf.py'

default_language_version:
python: python3

repos:
# black
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude: '\.dat$'
- id: check-added-large-files
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
exclude: '^src/finn/builder/build_dataflow.py$'
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ['--fix=no']

- repo: git://github.com/PyCQA/isort
rev: 5.5.3
hooks:
- id: isort

- repo: git://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
args: ['--max-line-length=88'] # default of Black
# black-compatible flake-8 config
args: ['--max-line-length=88', # black default
'--extend-ignore=E203'] # E203 is not PEP8 compliant
43 changes: 43 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) 2021, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of FINN nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# 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.
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

sphinx:
configuration: docs/finn/conf.py

python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs
9 changes: 9 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ Contributors
* Suranga Mahesh (@surangamh)
* Peter Lehnhardt (@pete-lennart)
* Neil Kim Nielsen (@neilkimn)
* Jon Ander Lezeta (@jalezeta)
* John Terry (@jterry-x)
* Alina Vasilciuc (@alinavalinav)
* Alessandro Pappalardo (@volcacius)
* Giuseppe Franco (@Giuseppe5)
* Syed Asad Alam (@asadalam)
* Javier Duarte (@jmduarte)
* Uma Maheshwari (@umav1511)
* José Rosa (@pinxau1000)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Please see the [Getting Started](https://finn.readthedocs.io/en/latest/getting_s

## What's New in FINN?

* **2021-11-05:** v0.7 is released, introducing QONNX support, three new example networks and many other improvements. Read more on the [v0.7 release blog post](https://xilinx.github.io/finn//2021/11/05/finn-v07-is-released.html).
* **2021-06-15:** v0.6 is released, with ResNet-50 on U250 and ZCU104 MobileNet-v1 in finn-examples showcasing new features plus a lot more. Read more on the [v0.6 release blog post](https://xilinx.github.io/finn//2021/06/15/finn-v06-is-released.html).
* **2020-12-17:** v0.5b (beta) is released, with a new [examples repo](https://github.com/Xilinx/finn-examples) including MobileNet-v1. Read more on the <a href="https://xilinx.github.io/finn/2020/12/17/finn-v05b-beta-is-released.html">release blog post</a>.
* **2020-09-21:** v0.4b (beta) is released. Read more on the <a href="https://xilinx.github.io/finn/2020/09/21/finn-v04b-beta-is-released.html">release blog post</a>.

## Documentation

Expand Down
60 changes: 60 additions & 0 deletions custom_hls/lookup.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/******************************************************************************
* Copyright (c) 2021, Xilinx
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of FINN nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* 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.
*******************************************************************************/

#include <ap_int.h>
#include <hls_stream.h>

#ifndef LOOKUP_HPP
#define LOOKUP_HPP

template <
unsigned NumEmbeddings,
unsigned EmbeddingDim,
unsigned NumInputs,
typename InputType,
typename EmbeddingType,
typename InputPackedType = ap_uint<InputType::width>,
typename OutputPackedType = ap_uint<EmbeddingDim*EmbeddingType::width>>
void StreamingLookup(
hls::stream<InputPackedType> &in,
hls::stream<OutputPackedType> &out,
OutputPackedType const embeddings[NumEmbeddings]
) {
for(unsigned i = 0; i < NumInputs; i++) {
#pragma HLS PIPELINE II=1
InputPackedType inPackedElem = in.read();
InputType inElem = *(reinterpret_cast<InputType*>(&inPackedElem));
OutputPackedType outElem = embeddings[inElem];
out.write(outElem);
}
}

#endif
Loading

0 comments on commit d1cc9cf

Please sign in to comment.