diff --git a/src/finn/custom_op/fpgadataflow/convolutioninputgenerator1d.py b/src/finn/custom_op/fpgadataflow/convolutioninputgenerator1d.py index 8d401c40dc3efbfef5c387bdfc2f777a2cfb553b..8b4d3e425b449079615b769564b82a7571c152db 100644 --- a/src/finn/custom_op/fpgadataflow/convolutioninputgenerator1d.py +++ b/src/finn/custom_op/fpgadataflow/convolutioninputgenerator1d.py @@ -272,10 +272,12 @@ class ConvolutionInputGenerator1D(HLSCustomOp): cycles_read_block = ifm_dim_w * ifm_ch / simd cycles_write_block = ofm_dim_w * k_w * ifm_ch / simd exp_cycles = cycles_read_block + cycles_write_block - else: + elif self.get_nodeattr("depthwise") == 1: cycles_read_block = ifm_ch / simd * (k_w - 1) - (k_w - 1) cycles_write_block = ofm_dim_w * k_w * ifm_ch / simd exp_cycles = cycles_read_block + cycles_write_block + else: + exp_cycles = 1 + ofm_dim_w * k_w * ifm_ch / simd return int(exp_cycles) @@ -599,7 +601,7 @@ class ConvolutionInputGenerator1D(HLSCustomOp): self.code_gen_dict["$DOCOMPUTE$"] = [ """{}<ConvKernelDim1_x, IFMChannels1, Input_precision1, IFMDim1_x, OFMDim1_x, - SIMD1> (in0, out, numReps, {});""".format( + Stride1_x, SIMD1> (in0, out, numReps, {});""".format( hls_call, hls_ram_style ) ] diff --git a/src/finn/transformation/fpgadataflow/convert_to_hls_layers.py b/src/finn/transformation/fpgadataflow/convert_to_hls_layers.py index f7cb0a16b9d3893066eaeaae416ea0259ab6a915..2cf0394275b1936aa64313c7990b9ae52e7247c6 100644 --- a/src/finn/transformation/fpgadataflow/convert_to_hls_layers.py +++ b/src/finn/transformation/fpgadataflow/convert_to_hls_layers.py @@ -213,6 +213,11 @@ class InferConvInpGen(Transformation): 1D depthwise separable convolutions""" % n.name ) + if stride_h > 1 or stride_w > 1: + assert ( + stride_h < k_h and stride_w < k_w and depthwise == 0 + ), """%s: Stride value must be smaller than kernel dimension, not supported + for depthwise convolutions """ ConvInpGen_node = helper.make_node( "ConvolutionInputGenerator1D", [ConvInpGen_input],