Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce support for generic elementwise binary operations #1040

Draft
wants to merge 24 commits into
base: dev
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9bb8313
Introduce support for generic elementwise binary operations
iksnagreb Apr 12, 2024
f61a538
[Streamline] Fix FoldQuantWeights input order and shape annotations
iksnagreb Nov 13, 2023
8691d3f
Make quantized activation handlers data layout aware
iksnagreb Nov 20, 2023
24acc18
[Streamline] Fix AbsorbAddIntoMultiThreshold assumed input order
iksnagreb Nov 13, 2023
e632328
Fix clipping range issue in RoundAndClipThresholds transformation
iksnagreb Mar 13, 2024
8dd85f4
Rework RoundAndClipThresholds to avoid range and type promotion issues
iksnagreb Apr 6, 2024
8b7c2eb
[Thresholding] Make sure the output of python simulation is float32
iksnagreb Apr 17, 2024
f01d02f
[Tests] Rework test-cases for reworked RoundAndClipThresholds
iksnagreb Apr 6, 2024
023d950
[Streamline] Check validity of broadcasting Add into MultiThreshold
iksnagreb Apr 17, 2024
945db12
[Streamline] Fix backwards-propagating shapes in MoveAddPastMul
iksnagreb Apr 17, 2024
3f13673
[Elementwise] Add InferElementwiseBinaryOperation transformation
iksnagreb Apr 18, 2024
6a6616a
[Tests] Add simple integration test for ElementwiseBinaryOperation
iksnagreb Apr 18, 2024
fd1aedd
[Elementwise] Some cleanup / simplification of generated code
iksnagreb Apr 19, 2024
f010d18
[Streamline] Fix shape propagation of MoveLinearPastEltwiseAdd
iksnagreb Apr 19, 2024
7aaf739
[Tests] Add missing streamlining for testing ElementwiseBinaryOperation
iksnagreb Apr 19, 2024
5268ffe
[Elementwise] Implement bit-width minimization for all specializations
iksnagreb Apr 19, 2024
4769d8e
[Elementwise] Add support for floating-point operations
iksnagreb Apr 19, 2024
87fc002
[Elementwise] Implement get_exp_cycles for ElementwiseBinaryOperation
iksnagreb May 3, 2024
efb1cc9
[Elementwise] Add support for ElementwiseBinaryOperation to SetFolding
iksnagreb May 3, 2024
f34dcfc
[Elementwise] Remove FIFO depths attribute overloads
iksnagreb May 10, 2024
e361cb9
[Elementwise] Add ARRAY_PARTITION and BIND_STORAGE directives
iksnagreb May 17, 2024
653673b
[Streamline] Prevent FactorOutMulSignMagnitude from handling join-nodes
iksnagreb Aug 8, 2024
de97911
[Streamline] Delete initializer datatype annotation after MoveAddPastMul
iksnagreb Aug 8, 2024
dd68078
[Elementwise] Reintroduce FIFO depths attribute overloads
iksnagreb Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Elementwise] Some cleanup / simplification of generated code
iksnagreb committed Apr 19, 2024
commit fd1aedd9525ada11c0c76ff6f930608de8692033
2 changes: 1 addition & 1 deletion custom_hls/flatten.hpp
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@

// Flattens an array of N elements of Type into a single bitvector
template<long unsigned N, class Type>
ap_uint<N * Type::width> flatten(const Type *buffer) {
ap_uint<N * Type::width> flatten(const Type buffer[N]) {
// Inline this small piece of bit merging logic
#pragma HLS INLINE
// Fill a flat word of N times the bit-width of the element type
12 changes: 3 additions & 9 deletions src/finn/custom_op/fpgadataflow/hls/elementwise_binary_hls.py
Original file line number Diff line number Diff line change
@@ -204,15 +204,9 @@ def defines(self, var):
# thus adding this to the global includes is not possible.
'#include "params.hpp"',
# Input and output HLS stream datatypes
"using LhsStream = hls::stream<"
f" ap_uint<{self.get_instream_width(ind=0)}>"
">;",
"using RhsStream = hls::stream<"
f" ap_uint<{self.get_instream_width(ind=1)}>"
">;",
"using OutStream = hls::stream<"
f" ap_uint<{self.get_outstream_width(ind=0)}>"
">;",
"using LhsStream = hls::stream<LhsPacked>;",
"using RhsStream = hls::stream<RhsPacked>;",
"using OutStream = hls::stream<OutPacked>;",
]

# Generates C++ code for reading data from .npy (numpy format) for testing