Skip to content

Commit 93acaa6

Browse files
committed
pre-commit
1 parent dd021ec commit 93acaa6

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

hls4ml/backends/vivado/passes/convolution_templates.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ def format(self, node):
9595
else:
9696
params['fill_fn'] = 'FillConv1DBuffer'
9797

98-
is_pointwise_parallel_latency = node.get_attr('filt_width') == 1 and node.get_attr('strategy').lower() == 'latency' and node.model.config.get_config_value('IOType') == 'io_parallel'
98+
is_pointwise_parallel_latency = (
99+
node.get_attr('filt_width') == 1
100+
and node.get_attr('strategy').lower() == 'latency'
101+
and node.model.config.get_config_value('IOType') == 'io_parallel'
102+
)
99103
if is_pointwise_parallel_latency:
100104
params['conv_fn'] = f'pointwise_conv_{node.index}'
101105
else:
@@ -108,7 +112,9 @@ def format(self, node):
108112

109113
mult_params = self._default_config_params(node)
110114
if is_pointwise_parallel_latency:
111-
mult_params['n_in'] = int(node.get_attr('in_width') * node.get_attr('n_chan') * node.get_attr('filt_width') / mult_params['reuse'])
115+
mult_params['n_in'] = int(
116+
node.get_attr('in_width') * node.get_attr('n_chan') * node.get_attr('filt_width') / mult_params['reuse']
117+
)
112118
mult_params['n_out'] = int(node.get_attr('in_width') * node.get_attr('n_filt') / mult_params['reuse'])
113119
else:
114120
mult_params['n_in'] = node.get_attr('n_chan') * node.get_attr('filt_width')

hls4ml/backends/vivado/passes/pointwise_codegen.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ class GeneratePointwiseConv1D(OptimizerPass):
6666
'''Generates code for pointwise 1D convolution'''
6767

6868
def match(self, node):
69-
return isinstance(node, Conv1D) and node.model.config.get_config_value('IOType') == 'io_parallel' and node.get_attr('filt_width') == 1
69+
return (
70+
isinstance(node, Conv1D)
71+
and node.model.config.get_config_value('IOType') == 'io_parallel'
72+
and node.get_attr('filt_width') == 1
73+
)
7074

7175
def transform(self, model, node):
7276
self._generate_pointwise_conv1d(node)

hls4ml/templates/vitis/nnet_utils/nnet_conv1d_latency.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void pointwise_conv_1d_latency_cl(data_T data[CONFIG_T::in_width * CONFIG_T::n_c
157157
// Cast to "res_t" type
158158
for (int ii = 0; ii < CONFIG_T::out_width / CONFIG_T::reuse_factor; ii++) {
159159
for (int ff = 0; ff < CONFIG_T::n_filt; ff++) {
160-
#pragma HLS UNROLL
160+
#pragma HLS UNROLL
161161
res[ii * CONFIG_T::n_filt + ff] = cast<data_T, res_T, typename CONFIG_T::mult_config>(acc[ii][ff]);
162162
}
163163
}

hls4ml/templates/vivado/nnet_utils/nnet_conv1d_latency.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void pointwise_conv_1d_latency_cl(data_T data[CONFIG_T::in_width * CONFIG_T::n_c
156156
// Cast to "res_t" type
157157
for (int ii = 0; ii < CONFIG_T::out_width / CONFIG_T::reuse_factor; ii++) {
158158
for (int ff = 0; ff < CONFIG_T::n_filt; ff++) {
159-
#pragma HLS UNROLL
159+
#pragma HLS UNROLL
160160
res[ii * CONFIG_T::n_filt + ff] = cast<data_T, res_T, typename CONFIG_T::mult_config>(acc[ii][ff]);
161161
}
162162
}

hls4ml/templates/vivado/nnet_utils/nnet_function_stubs.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ template <class data_T, class res_T, typename CONFIG_T> class DenseKernel {
3939

4040
template <class data_T, class res_T, typename CONFIG_T> class Conv1DKernel {
4141
public:
42-
static void conv(data_T data[CONFIG_T::in_width * CONFIG_T::n_chan],
43-
res_T res[CONFIG_T::out_width * CONFIG_T::n_filt],
42+
static void conv(data_T data[CONFIG_T::in_width * CONFIG_T::n_chan], res_T res[CONFIG_T::out_width * CONFIG_T::n_filt],
4443
typename CONFIG_T::weight_t weights[CONFIG_T::n_chan * CONFIG_T::n_filt],
4544
typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
4645
// To be implemented in subclasses

0 commit comments

Comments
 (0)