Skip to content

Commit

Permalink
Merge pull request #1010 from calad0i/im2col_default
Browse files Browse the repository at this point in the history
Make im2col default option for quartus
  • Loading branch information
jmitrevs committed Jun 28, 2024
2 parents 9e9944f + d72900b commit 02688f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions hls4ml/backends/quartus/quartus_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def init_conv1d(self, layer):
# - combination - at compile-time, the decision between Winograd and im2col is made
# - im2col - specifically use im2col
# - Winograd - use Winograd, if possible
layer.set_attr('implementation', layer.model.config.get_layer_config_value(layer, 'Implementation', 'combination'))
layer.set_attr('implementation', layer.model.config.get_layer_config_value(layer, 'Implementation', 'im2col'))

layer.set_attr(
'n_partitions', 1
Expand Down Expand Up @@ -305,7 +305,7 @@ def init_conv2d(self, layer):
# - combination - at compile-time, the decision between Winograd and im2col is made
# - im2col - specifically use im2col
# - Winograd - use Winograd, if possible
layer.set_attr('implementation', layer.model.config.get_layer_config_value(layer, 'Implementation', 'combination'))
layer.set_attr('implementation', layer.model.config.get_layer_config_value(layer, 'Implementation', 'im2col'))

layer.set_attr(
'n_partitions', 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "nnet_common.h"
#include "nnet_dense.h"
#include <cstdint>

namespace nnet {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "nnet_common.h"
#include "nnet_dense.h"
#include "nnet_helpers.h"
#include <cstdint>

namespace nnet {

Expand Down
6 changes: 0 additions & 6 deletions test/pytest/test_auto_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ def test_auto_precision_conv(keras_model_conv1d, keras_model_conv2d, data_2d, da
},
}

# Winograd is not bit-accurate, so avoid it.
if backend == 'Quartus' and io_type == 'io_parallel':
config['LayerName']['first_layer']['Implementation'] = 'im2col'
config['LayerName']['middle_layer']['Implementation'] = 'im2col'
config['LayerName']['last_layer']['Implementation'] = 'im2col'

odir = str(test_root_path / f'hls4mlprj_auto_{model_type}_{backend}_{io_type}')
hls_model = hls4ml.converters.convert_from_keras_model(
model, hls_config=config, io_type=io_type, output_dir=odir, backend=backend
Expand Down

0 comments on commit 02688f1

Please sign in to comment.