Skip to content

Commit

Permalink
Common FPGA passes, for both Quartus and Vivado
Browse files Browse the repository at this point in the history
  • Loading branch information
bo3z authored and vloncar committed Apr 29, 2022
1 parent 5495f3e commit c96a7bc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 158 deletions.
5 changes: 5 additions & 0 deletions hls4ml/backends/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def _init_file_optimizers(self):
opt_path = os.path.dirname(inspect.getfile(self.__class__)) + '/passes'
module_path = self.__module__[:self.__module__.rfind('.')] + '.passes'
file_optimizers = extract_optimizers_from_path(opt_path, module_path, self)
for base in self.__class__.__bases__:
opt_path = os.path.dirname(inspect.getfile(base)) + '/passes'
module_path = base.__module__[:base.__module__.rfind('.')] + '.passes'
base_optimizers = extract_optimizers_from_path(opt_path, module_path, self)
file_optimizers.update(base_optimizers)
return file_optimizers

def _get_layer_initializers(self):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

batchnorm_quantized_tanh_function_template = 'nnet::normalize_{quantize}_tanh<{input_t}, {config}>({input}, {output}, {threshold});'

bn_include_list = ['nnet_utils/nnet_batchnorm.h']
bn_include_list = ['nnet_utils/nnet_batchnorm.h', 'nnet_utils/nnet_batchnorm_stream.h']

class BatchNormalizationQuantizedTanhConfigTemplate(LayerConfigTemplate):
def __init__(self):
Expand Down
157 changes: 0 additions & 157 deletions hls4ml/backends/vivado/passes/bn_quant.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// rfnoc-hls-neuralnet: Vivado HLS code for neural-net building blocks
//
// Copyright (C) 2017 EJ Kreinar
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

/*
* PLACEHOLDER - The common pass bn_quant.py includes both parallel and streaming BN; streaming is currently not supported in Quartus
*/

#ifndef NNET_BATCHNORM_STREAM_H_
#define NNET_BATCHNORM_STREAM_H_

#include "nnet_common.h"
#include "nnet_helpers.h"
#include "nnet_mult.h"

namespace nnet {}

#endif

0 comments on commit c96a7bc

Please sign in to comment.