Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
finn-base v0.0.2 (#34)
Browse files Browse the repository at this point in the history
* Modified set_nodeattr to allow using it on repeated fields (#18)

* [base]: changed how the floats, ints, strings, tensors, graphs and sparse_tensors field of AttributeProto is set.

* [Core] restrict attributes to tested types

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Support for non-square input images and kernels for im2col node (#20)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [Im2Col] style fixes and comments

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Update AUTHORS.rst

* Support for non-square input images and kernels in LowerConvsToMatMul transformation (#16)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col] function compute_conv_output_dim can now be called in case non-equal and equal padding is assumed.
[test_im2col] changed function call to compute_conv_output_dim.
[test_conv_lowering] changed function call to compute_conv_output_dim.
[lower_convs_to_matmul] removed old assertion.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [test_conv_lowering]: minor fix for test case depthwise and regular convolutions

* Support for non-square input images and kernels for im2col node (#20)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [Im2Col] style fixes and comments

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Update AUTHORS.rst

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Added support for dilation value = 2 for 1D and 2D images/kernels (#17)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col] added support for dilations = 2 for 2D and 1D images. Dilation value must be equal along each axis.
[test_im2col] added several test cases in case dilations = 2 (a.o. cases where image and kernel are 2D and 1D, with and without padding, and with stride = 2).
[lower_convs_to_matmul] added support for dilation value. Dilation value must be equal along each axis.
[test_conv_lowering] added test case for dilations = 2 for 2D and 1D images and kernels, with and without padding, and with stride = 2.

* [lower_convs_to_matmul] removed old assertion
[test_conv_lowering] added more dilation values to test cases. Dilation values of {1, 2, 3, 4} are tested.

* [im2col] function compute_conv_output_dim can now be called in case non-equal and equal padding is assumed.
[test_im2col] changed function call to compute_conv_output_dim
[test_conv_lowering] changed function call to compute_conv_output_dim

* [im2col] function compute_conv_output_dim can now be called in case non-equal and equal padding is assumed.
[test_im2col] changed function call to compute_conv_output_dim.
[test_conv_lowering] changed function call to compute_conv_output_dim.
[lower_convs_to_matmul] removed old assertion.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [test_conv_lowering]: minor fix for test case depthwise and regular convolutions

* [im2col]: minor style adjustment.
[test_conv_lowering]: merged test functions into one test function.

* Support for non-square input images and kernels for im2col node (#20)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [Im2Col] style fixes and comments

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Update AUTHORS.rst

* Support for non-square input images and kernels in LowerConvsToMatMul transformation (#16)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col] function compute_conv_output_dim can now be called in case non-equal and equal padding is assumed.
[test_im2col] changed function call to compute_conv_output_dim.
[test_conv_lowering] changed function call to compute_conv_output_dim.
[lower_convs_to_matmul] removed old assertion.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [test_conv_lowering]: minor fix for test case depthwise and regular convolutions

* Support for non-square input images and kernels for im2col node (#20)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [Im2Col] style fixes and comments

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Update AUTHORS.rst

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* Update quantavgpool2d.py (#22)

Add  "Copyright (c) 2021 Xilinx, Inc" heather

* [batchnorm_to_affine]: epsilon value is now read out from the attributes. (#21)

[test_batchnorm_to_affine]: added a test case for various epsilon values.

* Added 3D to 4D (tensor) transformation (#19)

* [im2col.py]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [im2col]: support for non-square input images and kernels, [test_im2col]: added/modified several test cases for (non-)square images and kernels

* [test_general_transformation]: changed kernel_size attribute to list instead of integer as required by im2col node

* [base]: changed how the "ints" field of AttributeProto set.
[test_general_transformation]: changed the type of the kernel_size attribute to list of integers

* removed unused import

* [base]: added support for writing repeated fields in AttributeProto

* minor style changes

* [im2col, test_im2col]: added support for non-equal padding

* [lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding.
[test_conv_lowering]: added/modified test cases for non-equal padding, depthwise convolution and 'standard' convolution.

* [test_conv_lowering]: included 1D depthwise and regular convolutions in tests

* Revert "[test_conv_lowering]: included 1D depthwise and regular convolutions in tests"

This reverts commit 3ff449c

* Revert "[lower_convs_to_matmul]: added support for non-square input images and kernels and non-equal padding."

This reverts commit 15e34ed.

* Revert "[im2col, test_im2col]: added support for non-equal padding"

This reverts commit c524020.

* [im2col] added support for dilations = 2 for 2D and 1D images. Dilation value must be equal along each axis.
[test_im2col] added several test cases in case dilations = 2 (a.o. cases where image and kernel are 2D and 1D, with and without padding, and with stride = 2).
[lower_convs_to_matmul] added support for dilation value. Dilation value must be equal along each axis.
[test_conv_lowering] added test case for dilations = 2 for 2D and 1D images and kernels, with and without padding, and with stride = 2.

* [lower_convs_to_matmul] removed old assertion
[test_conv_lowering] added more dilation values to test cases. Dilation values of {1, 2, 3, 4} are tested.

* [im2col] function compute_conv_output_dim can now be called in case non-equal and equal padding is assumed.
[test_im2col] changed function call to compute_conv_output_dim
[test_conv_lowering] changed function call to compute_conv_output_dim

* [im2col] function compute_conv_output_dim can now be called in case non-equal and equal padding is assumed.
[test_im2col] changed function call to compute_conv_output_dim.
[test_conv_lowering] changed function call to compute_conv_output_dim.
[lower_convs_to_matmul] removed old assertion.

* [im2col]: minor fix with assumption on kernel dimension
[lower_convs_to_matmul]: minor fix with assumption on kernel dimension

* [change_3d_tensors_to_4d]: added new transformation that transforms 3D tensors to 4D and changes the nodes accordingly
[test_4d_conversion]: test function for 3D to 4D tensor transformation

* [change_3d_tensors_to_4d]: added new transformation that changes 3D tensors to 4D.
[test_4d_conversion]: added a test case for the 3D to 4D transformation.

* [change_3d_tensors_to_4d]: added 3D to 4D transformation (for QuartzNet).
[test_4d_conversion]: added test case for 3D to 4D transform.

* [change_3d_tensors_to_4d]: changed how an invalid graph is handled.
[test_4d_conversion]: changed the test case for an invalid graph.

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: changed how a square kernel is instantiated.
[lower_convs_to_matmul]: changed how the kernel size attribute is read (based on how a square kernel is instantiated).

* [im2col]: minor change in style.

* [im2col]: minor style change and changed the way how a square kernel is instantiated.

* [test_conv_lowering]: merged tests for depthwise and standard convolutions.

* [test_conv_lowering]: minor fix for test case depthwise and regular convolutions

* [im2col]: minor style adjustment.
[test_conv_lowering]: merged test functions into one test function.

* [change_3d_tensors_to_4d]: style fixes and comments.
[test_4d_converions]: rearranged code.

* [Transform] check invalid node list length

* [change_3d_tensors_to_4d]: rearranged the code to make it more readable.

Co-authored-by: Yaman Umuroglu <yamanu@xilinx.com>

* [Docs] update tutorials

* [Util] experimental: fast_mode data packing for binary (#24)

* Generic partitioning feature (#23)

* Add basic partitioning functionality

* Mount build dir within docker container

* Support for non-linear models and multi in/out partitions

* Remove dataflowpartition custom op from finn-base

* Fix temporary build dir for CI

* Fix docstring

* [create_generic_partitions]: minor modification, removed redundant output value_info entries. (#26)

* [extend_partition]: added a new transformation ExtendPartition. (#27)

[test_extend_partition]: added a test case for the new transformation.

* Added support for non-equal strides along different axes (#25)

* [im2col]: added support for non-equal strides along different axes and cleaned up the code.
[lower_convs_to_matmul]: added support for non-equal strides along different axes and cleaned up the code.
[test_conv_lowering]: added test case for non-equal strides along different axes.

* [im2col]: minor fix.
[test_im2col]: added test case for non-equal strides along different axes.

* Changes for supporting vitis_hls (#28)

* [Refactor] split up RTL/HLS-related utils

* [Util] rename to CallHLS and allow specifying vivado_hls/vitis_hls

* [Util] more flexible stream naming in rtlsim_multi_io

* Changes for supporting non-equal dilation (#29)

* added support for non-equal dilation value along (H, W) dimension

* added test cases for non-equal dilation configurations

* appending dilation value along dummy dimension correctly (i.e. with a '1')

* changed tensor sparsity annotation for consistency

* Support infer_datatype for flatten layer (#30)

* Support infer_datatype for flatten layer

* [InferDT] add more identity op types for datatype inference

* [Lint] fix linting issues

Co-authored-by: Yaman Umuroglu <maltanar@gmail.com>

* Update AUTHORS.rst

* Create python-publish.yml

* Add ZCU111 board to part map (#32)

* Update AUTHORS.rst

Co-authored-by: Mirza Mrahorovic <34712307+mmrahorovic@users.noreply.github.com>
Co-authored-by: jalezeta <51440887+jalezeta@users.noreply.github.com>
Co-authored-by: Felix Jentzsch <45395194+fpjentzsch@users.noreply.github.com>
  • Loading branch information
4 people authored Jun 4, 2021
1 parent 4bd7a98 commit 0b5d967
Show file tree
Hide file tree
Showing 33 changed files with 3,506 additions and 409 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ jobs:
run: |
docker run --rm \
-v $(pwd):/workspace/finn-base \
-e FINN_BUILD_DIR=/tmp/finn-base-gha \
finn-base-gha run_tests.sh
- name: Build Docs
run: |
docker run --rm \
-v $(pwd):/workspace/finn-base \
-e FINN_BUILD_DIR=/tmp/finn-base-gha \
finn-base-gha build_docs.sh
36 changes: 36 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
7 changes: 5 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
Contributors
============

* Yaman Umuroglu <yamanu@xilinx.com> (maintainer)
* Sambhav Jain <sambhavj@xilinx.com> (maintainer)
* Yaman Umuroglu (@maltanar) (maintainer)
* Sambhav Jain (@sjain-stanford)
* Jakoba Petri-Koenig (@auphelia)
* Lucian Petrica (@quetric)
* Tobias Alonso (@Tobi-Alonso)
* Hendrik Borras (@HenniOVP)
* Mirza Mrahorovic (@mmrahorovic)
* Felix Paul Jentzsch (@felixpj)
* Jon Ander Lezeta (@jalezeta)
8 changes: 6 additions & 2 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ The notebooks in this folder are more developer oriented. They should help you t

* 0_custom_analysis_pass

* This notebook explains what an analysis pass is and how to write one for FINN.
* Explains what an analysis pass is and how to write one for FINN.

* 1_custom_transformation_pass

* This notebook explains what a transformation pass is and how to write one for FINN.
* Explains what a transformation pass is and how to write one for FINN.

* 2_custom_op

* Explains the basics of FINN custom ops and how to define a new one.
9 changes: 9 additions & 0 deletions run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ SCRIPT=$(readlink -f "$0")
# Absolute path of dir this script is in.
SCRIPTPATH=$(dirname "${SCRIPT}")

# Take build dir from environment variable, otherwise use this default
: ${FINN_HOST_BUILD_DIR="/tmp/finn-base_dev"}
# Ensure build dir exists locally
mkdir -p $FINN_HOST_BUILD_DIR

DOCKER_INTERACTIVE=""

if [ "$1" = "tests" ]; then
Expand All @@ -70,6 +75,8 @@ else
exit -1
fi

gecho "Mounting $FINN_HOST_BUILD_DIR into $FINN_HOST_BUILD_DIR"

# Build the finn-base docker image
docker build -f docker/Dockerfile -t ${DOCKER_TAG} \
--build-arg GROUP=${DOCKER_GROUP} \
Expand All @@ -81,4 +88,6 @@ docker build -f docker/Dockerfile -t ${DOCKER_TAG} \
# Launch container with current directory mounted
docker run -t --rm ${DOCKER_INTERACTIVE} \
-v ${SCRIPTPATH}:/workspace/finn-base \
-v $FINN_HOST_BUILD_DIR:$FINN_HOST_BUILD_DIR \
-e FINN_BUILD_DIR=$FINN_HOST_BUILD_DIR \
${DOCKER_TAG} ${DOCKER_CMD}
22 changes: 21 additions & 1 deletion src/finn/core/onnx_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,27 @@ def execute_node(node, context, graph, return_full_exec_context=False):
Input/output provided via context."""

if node.op_type == "StreamingDataflowPartition":
if node.op_type == "GenericPartition":
partition_node = getCustomOp(node)
model = ModelWrapper(partition_node.get_nodeattr("model"))
inp_ctx = dict(filter(lambda x: x[0] in node.input, context.items()))
# inputs may have been renamed in partition
for i, old_iname in enumerate(node.input):
new_iname = model.graph.input[i].name
if old_iname != new_iname:
inp_ctx[new_iname] = inp_ctx[old_iname]
del inp_ctx[old_iname]
ret = execute_onnx(model, inp_ctx, return_full_exec_context)
# outputs may have been renamed in partition
for i, node_oname in enumerate(node.output):
model_oname = model.graph.output[i].name
context[node_oname] = ret[model_oname]
# prefix and insert exec context entries
if return_full_exec_context:
for tname in ret.keys():
if tname not in [x.name for x in model.graph.output]:
context[node.name + "_" + tname] = ret[tname]
elif node.op_type == "StreamingDataflowPartition":
sdp_node = getCustomOp(node)
model = ModelWrapper(sdp_node.get_nodeattr("model"))
inp_ctx = dict(filter(lambda x: x[0] in node.input, context.items()))
Expand Down
5 changes: 3 additions & 2 deletions src/finn/core/rtlsim_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@

from finn.custom_op.registry import getCustomOp
from finn.util.data_packing import npy_to_rtlsim_input, rtlsim_output_to_npy
from finn.util.fpgadataflow import (
from finn.util.pyverilator import (
pyverilate_get_liveness_threshold_cycles,
pyverilate_stitched_ip,
reset_rtlsim,
toggle_clk,
)
from finn.util.pyverilator import reset_rtlsim, toggle_clk

try:
from pyverilator import PyVerilator
Expand Down
13 changes: 12 additions & 1 deletion src/finn/custom_op/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,18 @@ def set_nodeattr(self, name, value):
if dtype == "s":
# encode string attributes
value = value.encode("utf-8")
attr.__setattr__(dtype, value)
attr.__setattr__(dtype, value)
elif dtype == "floats": # list of floats
attr.floats[:] = value
elif dtype == "ints": # list of integers
attr.ints[:] = value
elif dtype in ["strings", "tensors", "graphs", "sparse_tensors"]:
# untested / unsupported attribute types
# add testcases & appropriate getters before enabling
raise Exception("Attribute type %s not yet supported" % dtype)
else:
# attempt to set attr.dtype = value directly
attr.__setattr__(dtype, value)
else:
# not set, create and insert AttributeProto
attr_proto = helper.make_attribute(name, value)
Expand Down
4 changes: 2 additions & 2 deletions src/finn/custom_op/general/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from finn.custom_op.general.debugmarker import DebugMarker
from finn.custom_op.general.genericpartition import GenericPartition
from finn.custom_op.general.im2col import Im2Col
from finn.custom_op.general.maxpoolnhwc import MaxPoolNHWC
from finn.custom_op.general.multithreshold import MultiThreshold
from finn.custom_op.general.quantavgpool2d import QuantAvgPool2d
from finn.custom_op.general.streamingdataflowpartition import StreamingDataflowPartition
from finn.custom_op.general.xnorpopcount import XnorPopcountMatMul

custom_op = dict()

custom_op["DebugMarker"] = DebugMarker
custom_op["QuantAvgPool2d"] = QuantAvgPool2d
custom_op["MaxPoolNHWC"] = MaxPoolNHWC
custom_op["StreamingDataflowPartition"] = StreamingDataflowPartition
custom_op["GenericPartition"] = GenericPartition
custom_op["MultiThreshold"] = MultiThreshold
custom_op["XnorPopcountMatMul"] = XnorPopcountMatMul
custom_op["Im2Col"] = Im2Col
26 changes: 5 additions & 21 deletions ..._op/general/streamingdataflowpartition.py → ...inn/custom_op/general/genericpartition.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,14 @@
from finn.custom_op.base import CustomOp


class StreamingDataflowPartition(CustomOp):
"""Class that corresponds to the meta/container node StreamingDataflowPartition
which is a placeholder for a group of fpgadataflow nodes that have been separated
out into a FINN-ONNX model of its own. Note that is does not produce any HLS or
bitfile by itself."""
class GenericPartition(CustomOp):
"""Class that corresponds to the meta/container node GenericPartition
which is a placeholder for a group of nodes that have been separated
out into a FINN-ONNX model of its own."""

def get_nodeattr_types(self):
return {
"model": ("s", True, ""),
"res_estimate": ("s", False, ""),
"res_hls": ("s", False, ""),
"res_synth": ("s", False, ""),
"slr": ("i", False, -1),
"partition_id": ("i", False, 0),
"device_id": ("i", False, 0),
"mem_port": ("s", False, ""),
}

def make_shape_compatible_op(self, model):
Expand All @@ -54,8 +46,6 @@ def infer_node_datatype(self, model):
pass

def execute_node(self, context, graph):
# TODO add RPC execution with synthesized bitfile?
# whole-design rtlsim with PyVerilator may also be an alternative
pass

def verify_node(self):
Expand All @@ -79,14 +69,8 @@ def verify_node(self):
except Exception:
info_messages.append(
"""The necessary attributes do not exist.
StreamingDataflowPartition needs the following attribute(s):
GenericPartition needs the following attribute(s):
model"""
)

# verify the number of inputs
if len(self.onnx_node.input) >= 1:
info_messages.append("The number of inputs is correct")
else:
info_messages.append("StreamingDataflowPartition needs 1 data input")

return info_messages
Loading

0 comments on commit 0b5d967

Please # to comment.