Skip to content

Commit 4497631

Browse files
committed
add an assert checking that multiplier limit is 1
1 parent dad40aa commit 4497631

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

hls4ml/templates/vivado/nnet_utils/nnet_sepconv1d_latency.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ void depthwise_conv_1d_latency_cl(data_T data[CONFIG_T::in_width * CONFIG_T::n_c
3232
// Limit multipliers to control parallelization
3333
#pragma HLS ALLOCATION operation instances=mul limit=CONFIG_T::mult_config::multiplier_limit
3434

35+
assert((CONFIG_T::n_filt == CONFIG_T::n_chan) && "only a depth multiplier of 1 is currently supported");
36+
3537
PartitionLoop:
3638
for (int i_part = 0; i_part < CONFIG_T::n_partitions; i_part++) {
3739
#pragma HLS PIPELINE II=CONFIG_T::reuse_factor rewind

hls4ml/templates/vivado/nnet_utils/nnet_sepconv1d_stream.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ template <class data_T, class res_T, typename CONFIG_T>
6161
void depthwise_conv_1d_cl(hls::stream<data_T> &data, hls::stream<res_T> &res,
6262
typename CONFIG_T::weight_t weights[CONFIG_T::filt_width * CONFIG_T::n_chan],
6363
typename CONFIG_T::bias_t biases[CONFIG_T::n_chan]) {
64+
65+
assert((CONFIG_T::n_filt == CONFIG_T::n_chan) && "only a depth multiplier of 1 is currently supported");
66+
6467
#pragma HLS inline recursive
6568
switch (CONFIG_T::implementation) {
6669
case conv_implementation::linebuffer:

hls4ml/templates/vivado/nnet_utils/nnet_sepconv2d_latency.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ void depthwise_conv_2d_latency_cl(
3333
// Limit multipliers to control parallelization
3434
#pragma HLS ALLOCATION operation instances=mul limit=CONFIG_T::mult_config::multiplier_limit
3535

36+
assert((CONFIG_T::n_filt == CONFIG_T::n_chan) && "only a depth multiplier of 1 is currently supported");
37+
3638
PartitionLoop:
3739
for (int i_part = 0; i_part < CONFIG_T::n_partitions; i_part++) {
3840
#pragma HLS PIPELINE II=CONFIG_T::reuse_factor rewind

hls4ml/templates/vivado/nnet_utils/nnet_sepconv2d_stream.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ void depthwise_conv_2d_cl(
8181
hls::stream<data_T> &data, hls::stream<res_T> &res,
8282
typename CONFIG_T::weight_t weights[CONFIG_T::filt_height * CONFIG_T::filt_width * CONFIG_T::n_chan],
8383
typename CONFIG_T::bias_t biases[CONFIG_T::n_chan]) {
84+
85+
assert((CONFIG_T::n_filt == CONFIG_T::n_chan) && "only a depth multiplier of 1 is currently supported");
86+
8487
#pragma HLS inline recursive
8588
switch (CONFIG_T::implementation) {
8689
case conv_implementation::linebuffer:

0 commit comments

Comments
 (0)