@@ -267,6 +267,8 @@ def read_npy_data(self):
267
267
wdt = self .get_input_datatype (1 )
268
268
elem_bits = wdt .bitwidth ()
269
269
packed_bits = self .get_instream_width (1 )
270
+ if self .get_nodeattr ("dynamic_input" ):
271
+ packed_bits = packed_bits * self .get_nodeattr ("SIMD" )
270
272
packed_hls_type = "ap_uint<%d>" % packed_bits
271
273
elem_hls_type = wdt .get_hls_datatype_str ()
272
274
npy_type = "float"
@@ -294,8 +296,11 @@ def strm_decl(self):
294
296
)
295
297
296
298
if mem_mode == "internal_decoupled" or mem_mode == "external" :
299
+ iwidth = self .get_instream_width (1 )
300
+ if self .get_nodeattr ("dynamic_input" ):
301
+ iwidth = iwidth * self .get_nodeattr ("SIMD" )
297
302
self .code_gen_dict ["$STREAMDECLARATIONS$" ].append (
298
- 'hls::stream<ap_uint<{}>> in1_V ("in1_V");' .format (self . get_instream_width ( 1 ) )
303
+ 'hls::stream<ap_uint<{}>> in1_V ("in1_V");' .format (iwidth )
299
304
)
300
305
301
306
def docompute (self ):
@@ -391,6 +396,9 @@ def blackboxfunction(self):
391
396
)
392
397
]
393
398
elif mem_mode == "internal_decoupled" or mem_mode == "external" :
399
+ wwidth = self .get_instream_width (1 )
400
+ if self .get_nodeattr ("dynamic_input" ):
401
+ wwidth = wwidth * self .get_nodeattr ("SIMD" )
394
402
self .code_gen_dict ["$BLACKBOXFUNCTION$" ] = [
395
403
"""void {}(
396
404
hls::stream<ap_uint<{}>> &in0_V,
@@ -399,7 +407,7 @@ def blackboxfunction(self):
399
407
)""" .format (
400
408
self .onnx_node .name ,
401
409
self .get_instream_width (0 ),
402
- self . get_instream_width ( 1 ) ,
410
+ wwidth ,
403
411
self .get_outstream_width (),
404
412
)
405
413
]
@@ -464,9 +472,11 @@ def get_ap_int_max_w(self):
464
472
max_of_io = super ().get_ap_int_max_w ()
465
473
# internal_decoupled mode weight stream
466
474
weightstream = self .get_instream_width (1 )
475
+ simd = self .get_nodeattr ("SIMD" )
476
+ if self .get_nodeattr ("dynamic_input" ):
477
+ weightstream = weightstream * simd
467
478
# single PE weight entry
468
479
weight_bits = self .get_input_datatype (1 ).bitwidth ()
469
- simd = self .get_nodeattr ("SIMD" )
470
480
single_pe_w = simd * weight_bits
471
481
return max ([weightstream , max_of_io , single_pe_w ])
472
482
@@ -543,6 +553,8 @@ def execute_node(self, context, graph):
543
553
544
554
if dynamic_input or mem_mode in ["external" , "internal_decoupled" ]:
545
555
wnbits = self .get_instream_width (1 )
556
+ if self .get_nodeattr ("dynamic_input" ):
557
+ wnbits = wnbits * self .get_nodeattr ("SIMD" )
546
558
export_wdt = self .get_input_datatype (1 )
547
559
548
560
# we have converted bipolar weights to binary for export,
0 commit comments