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

Integration of new deconvolution implementation based on the REVD2 algorithm (Ongoing) #1263

Draft
wants to merge 13 commits into
base: feature/deconv
Choose a base branch
from
Draft
Changes from 1 commit
Commits
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
Changing the computation of the timout value to be based on parameters
hleblevec committed Jan 16, 2025
commit c157dc0c694a80ef968843fc2381e014f59eaa53
20 changes: 17 additions & 3 deletions src/finn/custom_op/fpgadataflow/hls/deconvolution_hls.py
Original file line number Diff line number Diff line change
@@ -198,13 +198,27 @@ def strm_decl(self):
def docompute(self):
odtype = self.get_output_datatype()
pe = self.get_nodeattr("PE")
# ishape = self.get_normal_input_shape()
oshape = self.get_normal_output_shape()
simd = self.get_nodeattr("SIMD")
i_ch = self.get_nodeattr("IFMChannels")
k_h, k_w = self.get_nodeattr("KernelDim")
s_h, s_w = self.get_nodeattr("Stride")
i_h, i_w = self.get_nodeattr("IFMDim")
p_h, p_w = self.get_nodeattr("Padding")
if p_w >= k_w - s_w:
padup = 0
else:
padup = (k_w - p_w - 1) / s_w
crop = s_w * padup - ((k_w - s_w) - p_w)
sf = i_ch / simd
w_eff = padup + i_w + padup
wo_eff = (w_eff - 1) * s_w + k_w
self.code_gen_dict["$DOCOMPUTE$"] = [
"hls::stream<hls::vector<{},{}>> strm;".format(odtype.get_hls_datatype_str(), pe)
]
self.code_gen_dict["$DOCOMPUTE$"].append("unsigned timeout = 0;")
self.code_gen_dict["$DOCOMPUTE$"].append("while(timeout < %s) {" % (2 * np.prod(oshape)))
self.code_gen_dict["$DOCOMPUTE$"].append(
"while(timeout < %s) {" % (wo_eff * (crop + 1) * ((k_w / s_w) ** 2) * sf + 50)
)
self.code_gen_dict["$DOCOMPUTE$"].append(
"""deconv<Kernel, Stride, Padding, IFMH, IFMW, OCH, ICH, PE1, SIMD1>
(weights, in0_{}, out_{});""".format(