fastmachinelearning / hls4ml

Machine learning on FPGAs using HLS
https://fastmachinelearning.org/hls4ml
Apache License 2.0
1.24k stars 402 forks source link

CNNs with binary quantizer fail #740

Closed sandeep1404 closed 1 year ago

sandeep1404 commented 1 year ago

Hi, I am using hls4ml version 0.6.0 when I used to compile the hls_model using hls_model.compile() it throws me the below error

Writing HLS project
Done
firmware/myproject.cpp: In function ‘void myproject(input_t*, result_t*, short unsigned int&, short unsigned int&)’:
firmware/myproject.cpp:101:17: error: ‘layer15_t’ was not declared in this scope; did you mean ‘layer17_t’?
  101 |     nnet::dense<layer15_t, layer17_t, config17>(layer15_out, layer17_out, w17, b17); // qdense_1
      |                 ^~~~~~~~~
      |                 layer17_t
firmware/myproject.cpp:101:49: error: ‘layer15_out’ was not declared in this scope; did you mean ‘layer17_out’?
  101 |     nnet::dense<layer15_t, layer17_t, config17>(layer15_out, layer17_out, w17, b17); // qdense_1
      |                                                 ^~~~~~~~~~~
      |                                                 layer17_out
g++: error: myproject.o: No such file or directory
---------------------------------------------------------------------------

`OSError                                   Traceback (most recent call last)
Cell In[31], line 1
----> 1 hls_model1.compile()

File ~/.local/lib/python3.8/site-packages/hls4ml/model/hls_model.py:546, in HLSModel.compile(self)
    544         dlclose_func.restype = ctypes.c_int
    545         dlclose_func(self._top_function_lib._handle)
--> 546     self._top_function_lib = ctypes.cdll.LoadLibrary(lib_name)
    547 finally:
    548     os.chdir(curr_dir)

File /usr/lib/python3.8/ctypes/__init__.py:451, in LibraryLoader.LoadLibrary(self, name)
    450 def LoadLibrary(self, name):
--> 451     return self._dlltype(name)

File /usr/lib/python3.8/ctypes/__init__.py:373, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    370 self._FuncPtr = _FuncPtr
    372 if handle is None:
--> 373     self._handle = _dlopen(self._name, mode)
    374 else:
    375     self._handle = handle

OSError: firmware/myproject-0FfB97A6.so: cannot open shared object file: No such file or directory`

I have no idea how to resolve this can anyone help me in resolving this issue`

333 #276 #264 I have checked the earlier issues who faced this problem but not able to resolve the issue from the discussion

vloncar commented 1 year ago

I told you to open the issue so that you can follow the template that asks you to provide reproducible steps. What you provided is not enough to reproduce this issue and help you. Please provide a minimal working example to reproduce the issue.

sandeep1404 commented 1 year ago

Hi, sorry from my side for not providing the complete information, I am using hls4ml version ==0.6.0 and vivado 2019.2. I am trying to synthesize and port the binary neural network on pynq-z2 board which is written in qkeras on mnist dataset. My model architecture is given below :

Model: "model"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 input_3 (InputLayer)        [(None, 28, 28, 1)]       0         

 conv1 (QConv2D)             (None, 26, 26, 16)        160       

 batch_normalization_4 (Batc  (None, 26, 26, 16)       64        
 hNormalization)                                                 

 act1 (QActivation)          (None, 26, 26, 16)        0         

 max_pooling2d_2 (MaxPooling  (None, 13, 13, 16)       0         
 2D)                                                             

 dropout_1 (Dropout)         (None, 13, 13, 16)        0         

 conv2 (QConv2D)             (None, 11, 11, 12)        1740      

 batch_normalization_5 (Batc  (None, 11, 11, 12)       48        
 hNormalization)                                                 

 act2 (QActivation)          (None, 11, 11, 12)        0         

 max_pooling2d_3 (MaxPooling  (None, 5, 5, 12)         0         
 2D)                                                             

 conv3 (QConv2D)             (None, 3, 3, 10)          1090      

 batch_normalization_6 (Batc  (None, 3, 3, 10)         40        
 hNormalization)                                                 

 act3 (QActivation)          (None, 3, 3, 10)          0         

 flatten (Flatten)           (None, 90)                0         

 qdense_1 (QDense)           (None, 10)                910       

 act4 (Activation)           (None, 10)                0         

=================================================================
Total params: 4,052
Trainable params: 3,976
Non-trainable params: 76
_________________________________________________________________

I am achieving 85% accuracy on qkeras model but when i tried to compile the hls model to see hls accuracy I am facing error during hls_model.compile() Here is my configuration setup:

Configuration
Model
  Precision:         ap_fixed<16,6>
  ReuseFactor:       1
  Strategy:          Resource
LayerName
  input_3
    Precision
      result:        ap_fixed<16,6>
  conv1
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     144
    Strategy:        Resource
  batch_normalization_4
    Precision
      scale:         ap_fixed<16,6>
      bias:          ap_fixed<16,6>
    ReuseFactor:     1
  act1
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  max_pooling2d_2
    Precision:       ap_fixed<16,6>
  conv2
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     1728
    Strategy:        Resource
  batch_normalization_5
    Precision
      scale:         ap_fixed<16,6>
      bias:          ap_fixed<16,6>
    ReuseFactor:     1
  act2
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  max_pooling2d_3
    Precision:       ap_fixed<16,6>
  conv3
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     1080
    Strategy:        Resource
  batch_normalization_6
    Precision
      scale:         ap_fixed<16,6>
      bias:          ap_fixed<16,6>
    ReuseFactor:     1
  act3
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  qdense_1
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     900
    Strategy:        Resource
  act4
    Precision:       ap_fixed<16,6>
    ReuseFactor:     1
    table_size:      1024
    exp_table_t:     ap_fixed<18,8,AP_RND,AP_SAT>
    inv_table_t:     ap_fixed<18,8,AP_RND,AP_SAT>
IOTtype:             io_stream
-----------------------------------
import hls4ml
hls_config = hls4ml.utils.config_from_keras_model(model, granularity='name')
hls_config['Model']['Strategy'] = 'Resource'
hls_config['IOTtype']= 'io_stream'

hls_config['LayerName']['qdense_1']['Strategy'] = 'Resource'
hls_config['LayerName']['qdense_1']['ReuseFactor'] = 900

hls_config['LayerName']['conv1']['Strategy'] = 'Resource'
hls_config['LayerName']['conv1']['ReuseFactor'] = 144

hls_config['LayerName']['conv2']['Strategy'] = 'Resource'
hls_config['LayerName']['conv2']['ReuseFactor'] = 1728

hls_config['LayerName']['conv3']['Strategy'] = 'Resource'
hls_config['LayerName']['conv3']['ReuseFactor'] = 1080
hls_model = hls4ml.converters.convert_from_keras_model(model,
                                                       hls_config=hls_config,
                                                       output_dir='model_pynq/hls4ml_prj_pynq',
                                                       backend='VivadoAccelerator',
                                                       board='pynq-z2')

I am getting the following error when compiling the model:

WARNING: You set a XilinxPart that does not correspond to the Board you specified. The correct XilinxPart is now set.
Writing HLS project
Done
firmware/myproject.cpp: In function ‘void myproject(input_t*, result_t*, short unsigned int&, short unsigned int&)’:
firmware/myproject.cpp:101:17: error: ‘layer15_t’ was not declared in this scope; did you mean ‘layer17_t’?
  101 |     nnet::dense<layer15_t, layer17_t, config17>(layer15_out, layer17_out, w17, b17); // qdense_1
      |                 ^~~~~~~~~
      |                 layer17_t
firmware/myproject.cpp:101:49: error: ‘layer15_out’ was not declared in this scope; did you mean ‘layer17_out’?
  101 |     nnet::dense<layer15_t, layer17_t, config17>(layer15_out, layer17_out, w17, b17); // qdense_1
      |                                                 ^~~~~~~~~~~
      |                                                 layer17_out
g++: error: myproject.o: No such file or directory
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[26], line 1
----> 1 hls_model.compile()

File ~/.local/lib/python3.8/site-packages/hls4ml/model/hls_model.py:546, in HLSModel.compile(self)
    544         dlclose_func.restype = ctypes.c_int
    545         dlclose_func(self._top_function_lib._handle)
--> 546     self._top_function_lib = ctypes.cdll.LoadLibrary(lib_name)
    547 finally:
    548     os.chdir(curr_dir)

File /usr/lib/python3.8/ctypes/__init__.py:451, in LibraryLoader.LoadLibrary(self, name)
    450 def LoadLibrary(self, name):
--> 451     return self._dlltype(name)

File /usr/lib/python3.8/ctypes/__init__.py:373, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    370 self._FuncPtr = _FuncPtr
    372 if handle is None:
--> 373     self._handle = _dlopen(self._name, mode)
    374 else:
    375     self._handle = handle

OSError: firmware/myproject-C4170850.so: cannot open shared object file: No such file or directory

I have no idea how to resolve this can anyone help me in resolving this issue`

333 #276 #264

I have checked the earlier issues who faced this problem but not able to resolve the issue from the discussion can anyone please help me in resolving this issue.


Also I have developed one more model which is getting compiled but the hls4ml accuracy is significantly dropped when compared to keras accuracy. Keras Accuracy: 72.22% hls4ml Accuracy: 14.45%

The model is shown below:

Model: "model_2"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 input_3 (InputLayer)        [(None, 28, 28, 1)]       0         

 conv2d_1 (QConv2D)          (None, 26, 26, 4)         40        

 q_batch_normalization_10 (Q  (None, 26, 26, 4)        16        
 BatchNormalization)                                             

 act1 (QActivation)          (None, 26, 26, 4)         0         

 conv2d_2 (QConv2D)          (None, 24, 24, 8)         296       

 q_batch_normalization_11 (Q  (None, 24, 24, 8)        32        
 BatchNormalization)                                             

 act2 (QActivation)          (None, 24, 24, 8)         0         

 max_pooling2d_4 (MaxPooling  (None, 12, 12, 8)        0         
 2D)                                                             

 conv2d_3 (QConv2D)          (None, 10, 10, 8)         584       

 q_batch_normalization_12 (Q  (None, 10, 10, 8)        32        
 BatchNormalization)                                             

 act3 (QActivation)          (None, 10, 10, 8)         0         

 max_pooling2d_5 (MaxPooling  (None, 5, 5, 8)          0         
 2D)                                                             

 flatten_2 (Flatten)         (None, 200)               0         

 q_dense_6 (QDense)          (None, 10)                2010      

 q_batch_normalization_13 (Q  (None, 10)               40        
 BatchNormalization)                                             

 act4 (QActivation)          (None, 10)                0         

 q_dense_7 (QDense)          (None, 10)                110       

=================================================================
Total params: 3,160
Trainable params: 3,100
Non-trainable params: 60
________________________________________________________________
hls configuration is given below
import hls4ml
hls_config = hls4ml.utils.config_from_keras_model(model, granularity='name')
hls_config['Model']['Strategy'] = 'Resource'
hls_config['IOTtype']= 'io_stream'

hls_config['LayerName']['conv2d_1']['ReuseFactor'] = 36
hls_config['LayerName']['conv2d_2']['ReuseFactor'] = 288
hls_config['LayerName']['conv2d_3']['ReuseFactor'] = 576

hls_config['LayerName']['q_dense_6']['ReuseFactor'] = 2000
hls_config['LayerName']['q_dense_7']['ReuseFactor'] = 100
Configuration
Model
  Precision:         ap_fixed<16,6>
  ReuseFactor:       1
  Strategy:          Resource
LayerName
  input_3
    Precision
      result:        ap_fixed<16,6>
  conv2d_1
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     36
  q_batch_normalization_10
    Precision
      beta:          ap_int<5>
      gamma:         ap_int<6>
      mean:          ap_int<5>
      variance:      ap_int<6>
    ReuseFactor:     1
  act1
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  conv2d_2
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     288
  q_batch_normalization_11
    Precision
      beta:          ap_int<5>
      gamma:         ap_int<6>
      mean:          ap_int<5>
      variance:      ap_int<6>
    ReuseFactor:     1
  act2
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  max_pooling2d_4
    Precision:       ap_fixed<16,6>
  conv2d_3
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     576
  q_batch_normalization_12
    Precision
      beta:          ap_int<5>
      gamma:         ap_int<6>
      mean:          ap_int<5>
      variance:      ap_int<6>
    ReuseFactor:     1
  act3
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  max_pooling2d_5
    Precision:       ap_fixed<16,6>
  q_dense_6
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     2000
  q_batch_normalization_13
    Precision
      beta:          ap_int<5>
      gamma:         ap_int<6>
      mean:          ap_int<5>
      variance:      ap_int<6>
    ReuseFactor:     1
  act4
    Precision
      result:        ap_int<2>
    ReuseFactor:     1
  q_dense_7
    Precision
      weight:        ap_int<2>
      bias:          ap_int<2>
    ReuseFactor:     100
IOTtype:             io_stream
-----------------------------------

when I convert the model from keras to hls it generates the following warnings for Unsupported quantizer: quantized_po2 Unsupported quantizer: quantized_relu_po2 I am new to hls and I am unaware of why that warnings are generated .

hls_model = hls4ml.converters.convert_from_keras_model(model,
                                                       hls_config=hls_config,
                                                       output_dir='model_pynq/hls4ml_prj_pynq_trail3',
                                                       backend='VivadoAccelerator',
                                                       board='pynq-z2')
Interpreting Model
Topology:
Layer name: input_3, layer type: InputLayer, input shapes: [[None, 28, 28, 1]], output shape: [None, 28, 28, 1]
Layer name: conv2d_1, layer type: QConv2D, input shapes: [[None, 28, 28, 1]], output shape: [None, 26, 26, 4]
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Layer name: q_batch_normalization_10, layer type: QBatchNormalization, input shapes: [[None, 26, 26, 4]], output shape: [None, 26, 26, 4]
Layer name: act1, layer type: Activation, input shapes: [[None, 26, 26, 4]], output shape: [None, 26, 26, 4]
Layer name: conv2d_2, layer type: QConv2D, input shapes: [[None, 26, 26, 4]], output shape: [None, 24, 24, 8]
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Layer name: q_batch_normalization_11, layer type: QBatchNormalization, input shapes: [[None, 24, 24, 8]], output shape: [None, 24, 24, 8]
Layer name: act2, layer type: Activation, input shapes: [[None, 24, 24, 8]], output shape: [None, 24, 24, 8]
Layer name: max_pooling2d_4, layer type: MaxPooling2D, input shapes: [[None, 24, 24, 8]], output shape: [None, 12, 12, 8]
Layer name: conv2d_3, layer type: QConv2D, input shapes: [[None, 12, 12, 8]], output shape: [None, 10, 10, 8]
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Layer name: q_batch_normalization_12, layer type: QBatchNormalization, input shapes: [[None, 10, 10, 8]], output shape: [None, 10, 10, 8]
Layer name: act3, layer type: Activation, input shapes: [[None, 10, 10, 8]], output shape: [None, 10, 10, 8]
Layer name: max_pooling2d_5, layer type: MaxPooling2D, input shapes: [[None, 10, 10, 8]], output shape: [None, 5, 5, 8]
Layer name: flatten_2, layer type: Reshape, input shapes: [[None, 5, 5, 8]], output shape: [None, 200]
Layer name: q_dense_6, layer type: QDense, input shapes: [[None, 200]], output shape: [None, 10]
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Unsupported quantizer: quantized_po2
Unsupported quantizer: quantized_relu_po2
Layer name: q_batch_normalization_13, layer type: QBatchNormalization, input shapes: [[None, 10]], output shape: [None, 10]
Layer name: act4, layer type: Activation, input shapes: [[None, 10]], output shape: [None, 10]
Layer name: q_dense_7, layer type: QDense, input shapes: [[None, 10]], output shape: [None, 10]
Creating HLS model

when I try to build the model using hls_model.build(csim=False,export=True,synth=True, vsynth=True) it gives the following error as mentioned below:

****** Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC v2019.1 (64-bit)
  **** SW Build 2552052 on Fri May 24 14:47:09 MDT 2019
  **** IP Build 2548770 on Fri May 24 18:01:18 MDT 2019
    ** Copyright 1986-2019 Xilinx, Inc. All Rights Reserved.

source /home/sandeep/vivado/Vivado/2019.1/scripts/vivado_hls/hls.tcl -notrace
INFO: [HLS 200-10] Running '/home/sandeep/vivado/Vivado/2019.1/bin/unwrapped/lnx64.o/vivado_hls'
INFO: [HLS 200-10] For user 'sandeep' on host 'sandeep-VirtualBox' (Linux_x86_64 version 5.15.0-67-generic) on Mon Mar 29 14:31:31 IST 2021
INFO: [HLS 200-10] On os Ubuntu 20.04.5 LTS
INFO: [HLS 200-10] In directory '/home/sandeep/Desktop/hls4ml/hls4ml-tutorial/model_pynq/hls4ml_prj_pynq_trail3'
Sourcing Tcl script 'build_prj.tcl'
INFO: [HLS 200-10] Creating and opening project '/home/sandeep/Desktop/hls4ml/hls4ml-tutorial/model_pynq/hls4ml_prj_pynq_trail3/myproject_prj'.
INFO: [HLS 200-10] Adding design file 'firmware/myproject_axi.cpp' to the project
INFO: [HLS 200-10] Adding design file 'firmware/myproject.cpp' to the project
INFO: [HLS 200-10] Adding test bench file 'myproject_test.cpp' to the project
INFO: [HLS 200-10] Adding test bench file 'firmware/weights' to the project
INFO: [HLS 200-10] Adding test bench file 'tb_data' to the project
INFO: [HLS 200-10] Creating and opening solution '/home/sandeep/Desktop/hls4ml/hls4ml-tutorial/model_pynq/hls4ml_prj_pynq_trail3/myproject_prj/solution1'.
INFO: [XFORM 203-101] Allowed max sub elements number after partition is 4096.
INFO: [XFORM 203-1161] The maximum of name length is set into 60.
INFO: [HLS 200-10] Setting target device to 'xc7z020-clg400-1'
INFO: [SYN 201-201] Setting up clock 'default' with a period of 5ns.
***** C/RTL SYNTHESIS *****
INFO: [SCHED 204-61] Option 'relax_ii_for_timing' is enabled, will increase II to preserve clock frequency constraints.
INFO: [HLS 200-10] Analyzing design file 'firmware/myproject.cpp' ... 
WARNING: [HLS 200-40] In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:214:69: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                if ((oh*CONFIG_T::stride_height+fh) < CONFIG_T::pad_top
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d.h:83:9: note: in instantiation of function template specialization 'nnet::conv_2d_latency_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config2>' requested here
        conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
        ^
firmware/myproject.cpp:72:2: note: in instantiation of function template specialization 'nnet::conv_2d_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config2>' requested here
 nnet::conv_2d_cl<input_t, layer2_t, config2>(input_3, layer2_out, w2, b2);
 ^
In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:216:67: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                || (ow*CONFIG_T::stride_width+fw) < CONFIG_T::pad_left
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:30:69: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                if ((oh*CONFIG_T::stride_height+fh) < CONFIG_T::pad_top
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:191:31: note: in instantiation of function template specialization 'nnet::compute_multiplier_limit_conv2d<config2>' requested here
 const int multiplier_limit = compute_multiplier_limit_conv2d<CONFIG_T>(weights);
                              ^
firmware/nnet_utils/nnet_conv2d.h:83:9: note: in instantiation of function template specialization 'nnet::conv_2d_latency_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config2>' requested here
        conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
        ^
firmware/myproject.cpp:72:2: note: in instantiation of function template specialization 'nnet::conv_2d_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config2>' requested here
 nnet::conv_2d_cl<input_t, layer2_t, config2>(input_3, layer2_out, w2, b2);
 ^
In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:32:67: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                || (ow*CONFIG_T::stride_width+fw) < CONFIG_T::pad_left
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:214:69: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                if ((oh*CONFIG_T::stride_height+fh) < CONFIG_T::pad_top
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d.h:83:9: note: in instantiation of function template specialization 'nnet::conv_2d_latency_cl<ap_uint<1>, ap_fixed<16, 6, 5, 3, 0>, config6>' requested here
        conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
        ^
firmware/myproject.cpp:80:2: note: in instantiation of function template specialization 'nnet::conv_2d_cl<ap_uint<1>, ap_fixed<16, 6, 5, 3, 0>, config6>' requested here
 nnet::conv_2d_cl<layer28_t, layer6_t, config6>(layer28_out, layer6_out, w6, b6);
 ^
In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:216:67: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                || (ow*CONFIG_T::stride_width+fw) < CONFIG_T::pad_left
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:30:69: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                if ((oh*CONFIG_T::stride_height+fh) < CONFIG_T::pad_top
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:191:31: note: in instantiation of function template specialization 'nnet::compute_multiplier_limit_conv2d<config6>' requested here
 const int multiplier_limit = compute_multiplier_limit_conv2d<CONFIG_T>(weights);
                              ^
firmware/nnet_utils/nnet_conv2d.h:83:9: note: in instantiation of function template specialization 'nnet::conv_2d_latency_cl<ap_uint<1>, ap_fixed<16, 6, 5, 3, 0>, config6>' requested here
        conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
        ^
firmware/myproject.cpp:80:2: note: in instantiation of function template specialization 'nnet::conv_2d_cl<ap_uint<1>, ap_fixed<16, 6, 5, 3, 0>, config6>' requested here
 nnet::conv_2d_cl<layer28_t, layer6_t, config6>(layer28_out, layer6_out, w6, b6);
 ^
In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:32:67: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                || (ow*CONFIG_T::stride_width+fw) < CONFIG_T::pad_left
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:214:69: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                if ((oh*CONFIG_T::stride_height+fh) < CONFIG_T::pad_top
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d.h:83:9: note: in instantiation of function template specialization 'nnet::conv_2d_latency_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config11>' requested here
        conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
        ^
firmware/myproject.cpp:92:2: note: in instantiation of function template specialization 'nnet::conv_2d_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config11>' requested here
 nnet::conv_2d_cl<layer10_t, layer11_t, config11>(layer10_out, layer11_out, w11, b11);
 ^
In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:216:67: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                || (ow*CONFIG_T::stride_width+fw) < CONFIG_T::pad_left
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:30:69: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                if ((oh*CONFIG_T::stride_height+fh) < CONFIG_T::pad_top
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_conv2d_latency.h:191:31: note: in instantiation of function template specialization 'nnet::compute_multiplier_limit_conv2d<config11>' requested here
 const int multiplier_limit = compute_multiplier_limit_conv2d<CONFIG_T>(weights);
                              ^
firmware/nnet_utils/nnet_conv2d.h:83:9: note: in instantiation of function template specialization 'nnet::conv_2d_latency_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config11>' requested here
        conv_2d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
        ^
firmware/myproject.cpp:92:2: note: in instantiation of function template specialization 'nnet::conv_2d_cl<ap_fixed<16, 6, 5, 3, 0>, ap_fixed<16, 6, 5, 3, 0>, config11>' requested here
 nnet::conv_2d_cl<layer10_t, layer11_t, config11>(layer10_out, layer11_out, w11, b11);
 ^
In file included from firmware/myproject.cpp:1:
In file included from firmware/myproject.cpp:22:
In file included from firmware/parameters.h:13:
In file included from firmware/nnet_utils/nnet_conv2d.h:24:
firmware/nnet_utils/nnet_conv2d_latency.h:32:67: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                                || (ow*CONFIG_T::stride_width+fw) < CONFIG_T::pad_left
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
12 warnings generated.
WARNING: [HLS 214-114] Since the only kind of statements allowed in a dataflow region are variable declarations and function calls, the compiler may not be able to correctly handle the region: firmware/nnet_utils/nnet_dense_latency.h:64:9
WARNING: [HLS 214-104] Only for-loops and functions support the dataflow: firmware/nnet_utils/nnet_dense_latency.h:76:9
WARNING: [HLS 214-104] Only for-loops and functions support the dataflow: firmware/nnet_utils/nnet_batchnorm.h:79:9
WARNING: [HLS 214-114] Since the only kind of statements allowed in a dataflow region are variable declarations and function calls, the compiler may not be able to correctly handle the region: firmware/myproject.cpp:37:2
WARNING: [HLS 200-471] Dataflow form checks found 4 issue(s) in file firmware/myproject.cpp
INFO: [HLS 200-10] Analyzing design file 'firmware/myproject_axi.cpp' ... 
INFO: [HLS 200-111] Finished Linking Time (s): cpu = 00:00:23 ; elapsed = 00:00:25 . Memory (MB): peak = 809.871 ; gain = 128.000 ; free physical = 40277 ; free virtual = 47575
INFO: [HLS 200-111] Finished Checking Pragmas Time (s): cpu = 00:00:23 ; elapsed = 00:00:25 . Memory (MB): peak = 809.871 ; gain = 128.000 ; free physical = 40277 ; free virtual = 47575
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-489] Unrolling loop 'MultLoop' (firmware/nnet_utils/nnet_dense_resource.h:158) in function 'void nnet::dense_resource_rf_gt_nin_rem0<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>(FORWARD_REFERENCE*, FORWARD_REFERENCE*, FORWARD_REFERENCE::weight_t*, FORWARD_REFERENCE::bias_t*)' completely with a factor of 1.
INFO: [HLS 200-489] Unrolling loop 'MultLoop' (firmware/nnet_utils/nnet_dense_resource.h:158) in function 'void nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>(FORWARD_REFERENCE*, FORWARD_REFERENCE*, FORWARD_REFERENCE::weight_t*, FORWARD_REFERENCE::bias_t*)' completely with a factor of 1.
INFO: [HLS 200-489] Unrolling loop 'MultLoop' (firmware/nnet_utils/nnet_dense_resource.h:158) in function 'void nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>(FORWARD_REFERENCE*, FORWARD_REFERENCE*, FORWARD_REFERENCE::weight_t*, FORWARD_REFERENCE::bias_t*)' completely with a factor of 1.
INFO: [HLS 200-489] Unrolling loop 'MultLoop' (firmware/nnet_utils/nnet_dense_resource.h:158) in function 'void nnet::dense_resource_rf_gt_nin_rem0<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>(FORWARD_REFERENCE*, FORWARD_REFERENCE*, FORWARD_REFERENCE::weight_t*, FORWARD_REFERENCE::bias_t*)' completely with a factor of 1.
INFO: [HLS 200-489] Unrolling loop 'MultLoop' (firmware/nnet_utils/nnet_dense_resource.h:158) in function 'void nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>(FORWARD_REFERENCE*, FORWARD_REFERENCE*, FORWARD_REFERENCE::weight_t*, FORWARD_REFERENCE::bias_t*)' completely with a factor of 1.
INFO: [XFORM 203-603] Inlining function 'nnet::product::weight_binary<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::product' into 'nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' (firmware/nnet_utils/nnet_dense_resource.h:160).
INFO: [XFORM 203-603] Inlining function 'nnet::product::weight_binary<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::product' into 'nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' (firmware/nnet_utils/nnet_dense_resource.h:160).
INFO: [XFORM 203-603] Inlining function 'nnet::product::weight_binary<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::product' into 'nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' (firmware/nnet_utils/nnet_dense_resource.h:160).
INFO: [XFORM 203-603] Inlining function 'nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' into 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' (firmware/nnet_utils/nnet_dense_resource.h:276).
INFO: [XFORM 203-603] Inlining function 'nnet::dense<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' into 'nnet::conv_2d_resource_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' (firmware/nnet_utils/nnet_conv2d_resource.h:206).
INFO: [XFORM 203-603] Inlining function 'nnet::product::both_binary<ap_uint<1>, ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::product' into 'nnet::dense_resource_rf_gt_nin_rem0<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' (firmware/nnet_utils/nnet_dense_resource.h:160).
INFO: [XFORM 203-603] Inlining function 'nnet::product::both_binary<ap_uint<1>, ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::product' into 'nnet::dense_resource_rf_gt_nin_rem0<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' (firmware/nnet_utils/nnet_dense_resource.h:160).
INFO: [XFORM 203-603] Inlining function 'nnet::dense_resource_rf_gt_nin_rem0<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' into 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' (firmware/nnet_utils/nnet_dense_resource.h:276).
INFO: [XFORM 203-603] Inlining function 'nnet::dense<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' into 'nnet::conv_2d_resource_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6>' (firmware/nnet_utils/nnet_conv2d_resource.h:206).
INFO: [XFORM 203-603] Inlining function 'nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' into 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' (firmware/nnet_utils/nnet_dense_resource.h:276).
INFO: [XFORM 203-603] Inlining function 'nnet::dense<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' into 'nnet::conv_2d_resource_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' (firmware/nnet_utils/nnet_conv2d_resource.h:206).
INFO: [XFORM 203-603] Inlining function 'nnet::dense_resource_rf_gt_nin_rem0<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' into 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' (firmware/nnet_utils/nnet_dense_resource.h:276).
INFO: [XFORM 203-603] Inlining function 'nnet::dense<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' into 'myproject' (firmware/myproject.cpp:104).
INFO: [XFORM 203-603] Inlining function 'nnet::dense_resource_rf_gt_nin_rem0<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' into 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' (firmware/nnet_utils/nnet_dense_resource.h:276).
INFO: [XFORM 203-603] Inlining function 'nnet::dense<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' into 'myproject' (firmware/myproject.cpp:112).
INFO: [XFORM 203-603] Inlining function 'nnet::product::weight_exponential<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, exponent_type27, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::product' into 'nnet::normalize<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config27>' (firmware/nnet_utils/nnet_batchnorm.h:90).
INFO: [XFORM 203-603] Inlining function 'nnet::softmax<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' into 'myproject' (firmware/myproject.cpp:118).
INFO: [HLS 200-111] Finished Standard Transforms Time (s): cpu = 00:00:31 ; elapsed = 00:00:33 . Memory (MB): peak = 879.434 ; gain = 197.562 ; free physical = 40133 ; free virtual = 47446
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [XFORM 203-602] Inlining function 'nnet::cast<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' into 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' (firmware/nnet_utils/nnet_dense_resource.h:178->firmware/nnet_utils/nnet_dense_resource.h:276) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::cast<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' into 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' (firmware/nnet_utils/nnet_dense_resource.h:178->firmware/nnet_utils/nnet_dense_resource.h:276) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::max<ap_uint<1>, 4>' into 'nnet::pool_op<ap_uint<1>, 4, (nnet::Pool_Op)0>' (firmware/nnet_utils/nnet_pooling.h:61) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::pool_op_limit<config10>' into 'nnet::pooling2d_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config10>' (firmware/nnet_utils/nnet_pooling.h:199) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::pad_val<ap_uint<1>, (nnet::Pool_Op)0>' into 'nnet::pooling2d_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config10>' (firmware/nnet_utils/nnet_pooling.h:223) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::pool_op<ap_uint<1>, 4, (nnet::Pool_Op)0>' into 'nnet::pooling2d_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config10>' (firmware/nnet_utils/nnet_pooling.h:234) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::cast<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' into 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' (firmware/nnet_utils/nnet_dense_resource.h:178->firmware/nnet_utils/nnet_dense_resource.h:276) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::pool_op_limit<config15>' into 'nnet::pooling2d_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config15>' (firmware/nnet_utils/nnet_pooling.h:199) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::pad_val<ap_uint<1>, (nnet::Pool_Op)0>' into 'nnet::pooling2d_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config15>' (firmware/nnet_utils/nnet_pooling.h:223) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::pool_op<ap_uint<1>, 4, (nnet::Pool_Op)0>' into 'nnet::pooling2d_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config15>' (firmware/nnet_utils/nnet_pooling.h:234) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::cast<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' into 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' (firmware/nnet_utils/nnet_dense_resource.h:178->firmware/nnet_utils/nnet_dense_resource.h:276) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::cast<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' into 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' (firmware/nnet_utils/nnet_dense_resource.h:178->firmware/nnet_utils/nnet_dense_resource.h:276) automatically.
INFO: [XFORM 203-602] Inlining function 'fp_struct<double>::mantissa' into 'generic_cast_IEEE754<int, (ap_q_mode)6, double>' (/wrk/2019.1/continuous/2019_05_24_2552052/src/products/hls/hls_lib/hlsmath/include/FloatingPoint/hls_case_IEEE754.h:15) automatically.
INFO: [XFORM 203-602] Inlining function 'fp_struct<double>::expv' into 'generic_cast_IEEE754<int, (ap_q_mode)6, double>' (/wrk/2019.1/continuous/2019_05_24_2552052/src/products/hls/hls_lib/hlsmath/include/FloatingPoint/hls_case_IEEE754.h:18) automatically.
INFO: [XFORM 203-602] Inlining function 'fp_struct<double>::__signbit' into 'generic_cast_IEEE754<int, (ap_q_mode)6, double>' (/wrk/2019.1/continuous/2019_05_24_2552052/src/products/hls/hls_lib/hlsmath/include/FloatingPoint/hls_case_IEEE754.h:59) automatically.
INFO: [XFORM 203-602] Inlining function 'generic_cast_IEEE754<int, (ap_q_mode)6, double>' into 'generic_cast_IEEE754<int, double>' (/wrk/2019.1/continuous/2019_05_24_2552052/src/products/hls/hls_lib/hlsmath/include/FloatingPoint/hls_case_IEEE754.h:117) automatically.
INFO: [XFORM 203-602] Inlining function 'generic_cast_IEEE754<int, double>' into '__hls_fptosi_double_i32' (/wrk/2019.1/continuous/2019_05_24_2552052/src/products/hls/hls_lib/hlsmath/src/lib_floatconversion.cpp:55) automatically.
INFO: [XFORM 203-602] Inlining function '__hls_fptosi_double_i32' into 'nnet::normalize<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config27>' (firmware/nnet_utils/nnet_batchnorm.h:73) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::product::Product<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, exponent_type27, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0> >::limit' into 'nnet::normalize<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config27>' (firmware/nnet_utils/nnet_batchnorm.h:74) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> >::operator()' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 2, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:53) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 2, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 4, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:55) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> >::operator()' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 4, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:55) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> >::operator()' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 8, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:55) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 8, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 10, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:55) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 2, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 10, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:55) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> >::operator()' into 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 10, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' (firmware/nnet_utils/nnet_common.h:55) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::softmax_idx_from_real_val<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' into 'nnet::softmax_latency<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' (firmware/nnet_utils/nnet_activation.h:250) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::reduce<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, 10, nnet::Op_add<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0> > >' into 'nnet::softmax_latency<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' (firmware/nnet_utils/nnet_activation.h:257) automatically.
INFO: [XFORM 203-602] Inlining function 'nnet::softmax_idx_from_real_val<ap_fixed<18, 8, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' into 'nnet::softmax_latency<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' (firmware/nnet_utils/nnet_activation.h:259) automatically.
WARNING: [SYNCHK 200-23] firmware/myproject_axi.cpp:29: variable-indexed range selection may cause suboptimal QoR.
INFO: [SYNCHK 200-10] 0 error(s), 1 warning(s).
INFO: [HLS 200-111] Finished Checking Synthesizability Time (s): cpu = 00:01:00 ; elapsed = 00:01:01 . Memory (MB): peak = 879.434 ; gain = 197.562 ; free physical = 40120 ; free virtual = 47435
WARNING: [XFORM 203-1103] Ignored data pack directive on non-struct variable 'out.data' (firmware/myproject_axi.cpp:5).
WARNING: [XFORM 203-1103] Ignored data pack directive on non-struct variable 'in.data' (firmware/myproject_axi.cpp:4).
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::softmax_latency<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' (firmware/nnet_utils/nnet_activation.h:224:45).
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::normalize<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config27>' (firmware/nnet_utils/nnet_batchnorm.h:61:55).
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config31>' (firmware/nnet_utils/nnet_batchnorm.h:116:39).
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config30>' (firmware/nnet_utils/nnet_batchnorm.h:116:39).
INFO: [XFORM 203-502] Unrolling all sub-loops inside loop 'WidthLoop' (firmware/nnet_utils/nnet_conv2d_resource.h:203) in function 'nnet::conv_2d_resource_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' for pipelining.
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' (firmware/nnet_utils/nnet_dense_resource.h:45:37).
WARNING: [XFORM 203-505] Ignored pipeline directive for loop 'ReuseLoop' (firmware/nnet_utils/nnet_dense_resource.h:151) because its parent loop or function is pipelined.
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' (firmware/nnet_utils/nnet_conv2d_resource.h:157:25).
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config29>' (firmware/nnet_utils/nnet_batchnorm.h:116:39).
INFO: [XFORM 203-502] Unrolling all sub-loops inside loop 'WidthLoop' (firmware/nnet_utils/nnet_conv2d_resource.h:203) in function 'nnet::conv_2d_resource_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6>' for pipelining.
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' (firmware/nnet_utils/nnet_dense_resource.h:35:48).
WARNING: [XFORM 203-505] Ignored pipeline directive for loop 'ReuseLoop' (firmware/nnet_utils/nnet_dense_resource.h:151) because its parent loop or function is pipelined.
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::im2col_2d_cl<ap_uint<1>, config6>' (firmware/nnet_utils/nnet_conv2d_resource.h:151).
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config28>' (firmware/nnet_utils/nnet_batchnorm.h:116:39).
INFO: [XFORM 203-502] Unrolling all sub-loops inside loop 'WidthLoop' (firmware/nnet_utils/nnet_conv2d_resource.h:203) in function 'nnet::conv_2d_resource_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' for pipelining.
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' (firmware/nnet_utils/nnet_dense_resource.h:45:37).
WARNING: [XFORM 203-505] Ignored pipeline directive for loop 'ReuseLoop' (firmware/nnet_utils/nnet_dense_resource.h:151) because its parent loop or function is pipelined.
INFO: [XFORM 203-502] Unrolling all loops for pipelining in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' (firmware/nnet_utils/nnet_conv2d_resource.h:157:25).
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_activation.h:248) in function 'nnet::softmax_latency<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'Loop-2' (firmware/nnet_utils/nnet_activation.h:260) in function 'nnet::softmax_latency<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, softmax_config22>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'Result' (firmware/nnet_utils/nnet_batchnorm.h:83) in function 'nnet::normalize<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config27>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'InitAccum' (firmware/nnet_utils/nnet_dense_resource.h:130) in function 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'Result' (firmware/nnet_utils/nnet_dense_resource.h:176) in function 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config21>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_batchnorm.h:123) in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config31>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'InitAccum' (firmware/nnet_utils/nnet_dense_resource.h:130) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'Result' (firmware/nnet_utils/nnet_dense_resource.h:176) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config17>' completely with a factor of 10.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_batchnorm.h:123) in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config30>' completely with a factor of 800.
INFO: [HLS 200-489] Unrolling loop 'FiltLoop' (firmware/nnet_utils/nnet_conv2d_resource.h:208) in function 'nnet::conv_2d_resource_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'InitAccum' (firmware/nnet_utils/nnet_dense_resource.h:130) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'ReuseLoop' (firmware/nnet_utils/nnet_dense_resource.h:151) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' completely with a factor of 576.
INFO: [HLS 200-489] Unrolling loop 'Result' (firmware/nnet_utils/nnet_dense_resource.h:176) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11_mult>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_conv2d_resource.h:157) in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' completely with a factor of 3.
INFO: [HLS 200-489] Unrolling loop 'Loop-1.1' (firmware/nnet_utils/nnet_conv2d_resource.h:160) in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' completely with a factor of 3.
INFO: [HLS 200-489] Unrolling loop 'Loop-1.1.1' (firmware/nnet_utils/nnet_conv2d_resource.h:161) in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config11>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_batchnorm.h:123) in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config29>' completely with a factor of 4608.
INFO: [HLS 200-489] Unrolling loop 'FiltLoop' (firmware/nnet_utils/nnet_conv2d_resource.h:208) in function 'nnet::conv_2d_resource_cl<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'InitAccum' (firmware/nnet_utils/nnet_dense_resource.h:130) in function 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'ReuseLoop' (firmware/nnet_utils/nnet_dense_resource.h:151) in function 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' completely with a factor of 288.
INFO: [HLS 200-489] Unrolling loop 'Result' (firmware/nnet_utils/nnet_dense_resource.h:176) in function 'nnet::dense_resource<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6_mult>' completely with a factor of 8.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_conv2d_resource.h:157) in function 'nnet::im2col_2d_cl<ap_uint<1>, config6>' completely with a factor of 3.
INFO: [HLS 200-489] Unrolling loop 'Loop-1.1' (firmware/nnet_utils/nnet_conv2d_resource.h:160) in function 'nnet::im2col_2d_cl<ap_uint<1>, config6>' completely with a factor of 3.
INFO: [HLS 200-489] Unrolling loop 'Loop-1.1.1' (firmware/nnet_utils/nnet_conv2d_resource.h:161) in function 'nnet::im2col_2d_cl<ap_uint<1>, config6>' completely with a factor of 4.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_batchnorm.h:123) in function 'nnet::normalize_binary_tanh<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config28>' completely with a factor of 2704.
INFO: [HLS 200-489] Unrolling loop 'FiltLoop' (firmware/nnet_utils/nnet_conv2d_resource.h:208) in function 'nnet::conv_2d_resource_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' completely with a factor of 4.
INFO: [HLS 200-489] Unrolling loop 'InitAccum' (firmware/nnet_utils/nnet_dense_resource.h:130) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' completely with a factor of 4.
INFO: [HLS 200-489] Unrolling loop 'ReuseLoop' (firmware/nnet_utils/nnet_dense_resource.h:151) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' completely with a factor of 36.
INFO: [HLS 200-489] Unrolling loop 'Result' (firmware/nnet_utils/nnet_dense_resource.h:176) in function 'nnet::dense_resource<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2_mult>' completely with a factor of 4.
INFO: [HLS 200-489] Unrolling loop 'Loop-1' (firmware/nnet_utils/nnet_conv2d_resource.h:157) in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' completely with a factor of 3.
INFO: [HLS 200-489] Unrolling loop 'Loop-1.1' (firmware/nnet_utils/nnet_conv2d_resource.h:160) in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' completely with a factor of 3.
INFO: [HLS 200-489] Unrolling loop 'Loop-1.1.1' (firmware/nnet_utils/nnet_conv2d_resource.h:161) in function 'nnet::im2col_2d_cl<ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config2>' completely with a factor of 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w21.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w17.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w11.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w6.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w2.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w21.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w17.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w11.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w6.V' : incorrect reshape factor 1.
WARNING: [XFORM 203-135] Cannot reshape array 'w2.V' : incorrect reshape factor 1.
INFO: [XFORM 203-131] Reshaping array 'in_local.V' (firmware/myproject_axi.cpp:16) in dimension 1 completely.
INFO: [XFORM 203-101] Partitioning array 'out_local'  in dimension 1 completely.
INFO: [XFORM 203-101] Partitioning array 'layer2_out.V' (firmware/myproject.cpp:70) in dimension 1 completely.
INFO: [XFORM 203-101] Partitioning array 'layer28_out.V' (firmware/myproject.cpp:74) in dimension 1 completely.
ERROR: [XFORM 203-103] Array 'layer6_out.V' (firmware/myproject.cpp:78): partitioned elements number (4608) has exeeded the threshold (4096), which may cause long run-time.
ERROR: [HLS 200-70] Pre-synthesis failed.
command 'ap_source' returned error code
    while executing
"source build_prj.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel \#0 [list source $arg] "

INFO: [Common 17-206] Exiting vivado_hls at Mon Mar 29 14:33:49 2021...
Synthesis report not found

Each layer has number of parameter's less than 4096, IOType:io_stream, and I have used model strategy as resource and set every layer to maximum reuse factor but still I am getting the issue during partitioned elements. Any help in these issues can be really helpful, I am not sure why the above mentioned 1st model is not even compiled, and why the modified 2nd model gets compiled but giving error during synthesis and exporting IP. Any valid explanation in comparison between the two models is really appreciated. Thanks in Advance.

sandeep1404 commented 1 year ago

can anyone please look into the issue since I got struck why I cannot able to compile and build my model even my model is very small in terms of parameters also is there any support for zcu104 board since I see there are no board files in supported board files.json. Please kindly help me in this regard,since I am new to hls4ml.

vloncar commented 1 year ago

Can you provide a function that creates that model? I can't retype all that.

Also, can you try if the issue still exists on the main branch?

sandeep1404 commented 1 year ago

Thanks for the reply, please find the functions that create the model below

Model_1:

x_in = Input(shape=(28, 28, 1))

x = QConv2D(16, (3, 3), kernel_quantizer="binary", bias_quantizer="binary", use_bias=True, name='conv1')(x_in)
x = BatchNormalization()(x)
x = QActivation("binary", name='act1')(x)
x = MaxPooling2D(pool_size=(2, 2))(x)
x = Dropout(0.2)(x)

x = QConv2D(12, (3, 3), kernel_quantizer="binary", bias_quantizer="binary", use_bias=True, name='conv2')(x)
x = BatchNormalization()(x)
x = QActivation("binary", name='act2')(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

x = QConv2D(10, (3, 3), kernel_quantizer="binary", bias_quantizer="binary", use_bias=True, name='conv3')(x)
x = BatchNormalization()(x)
x = QActivation("binary", name='act3')(x)

x = Flatten()(x)
x= QDense(10, kernel_quantizer='binary', bias_quantizer='binary',name='qdense_1')(x)
x_out = Activation('softmax',name='act4')(x)

model1 = Model(inputs=x_in, outputs=x_out)

opt = Adam(learning_rate=0.001)

model1.compile(optimizer=opt, loss='categorical_crossentropy', metrics=['accuracy'])
model1.summary()

The summary for the above model_1 is given below

Model: "model"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 input_1 (InputLayer)        [(None, 28, 28, 1)]       0         

 conv1 (QConv2D)             (None, 26, 26, 16)        160       

 batch_normalization (BatchN  (None, 26, 26, 16)       64        
 ormalization)                                                   

 act1 (QActivation)          (None, 26, 26, 16)        0         

 max_pooling2d (MaxPooling2D  (None, 13, 13, 16)       0         
 )                                                               

 dropout (Dropout)           (None, 13, 13, 16)        0         

 conv2 (QConv2D)             (None, 11, 11, 12)        1740      

 batch_normalization_1 (Batc  (None, 11, 11, 12)       48        
 hNormalization)                                                 

 act2 (QActivation)          (None, 11, 11, 12)        0         

 max_pooling2d_1 (MaxPooling  (None, 5, 5, 12)         0         
 2D)                                                             

 conv3 (QConv2D)             (None, 3, 3, 10)          1090      

 batch_normalization_2 (Batc  (None, 3, 3, 10)         40        
 hNormalization)                                                 

 act3 (QActivation)          (None, 3, 3, 10)          0         

 flatten (Flatten)           (None, 90)                0         

 qdense_1 (QDense)           (None, 10)                910       

 act4 (Activation)           (None, 10)                0         

=================================================================
Total params: 4,052
Trainable params: 3,976
Non-trainable params: 76
____________________________________

The model_2 function was given below

x_in = Input(shape=(28, 28, 1))

x = QConv2D(4, (3, 3),kernel_quantizer="binary", bias_quantizer="binary",name="conv2d_1", kernel_regularizer=regularizers.l2(0.0001))(x_in)
x = QBatchNormalization()(x)
x = QActivation('binary', name='act1')(x)

x = QConv2D(8, (3, 3),kernel_quantizer="binary", bias_quantizer="binary",name="conv2d_2", kernel_regularizer=regularizers.l2(0.0001))(x)
x = QBatchNormalization()(x)
x = QActivation('binary', name='act2')(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

x = QConv2D(8, (3, 3),kernel_quantizer="binary", bias_quantizer="binary",name="conv2d_3", kernel_regularizer=regularizers.l2(0.0001))(x)
x = QBatchNormalization()(x)
x = QActivation('binary', name='act3')(x)
x = MaxPooling2D(pool_size=(2, 2))(x)

x=Flatten()(x)

x=QDense(10, kernel_quantizer='binary', bias_quantizer='binary')(x)
x=QBatchNormalization()(x)
x=QActivation('binary_tanh', name='act4')(x)

x=QDense(10, kernel_quantizer='binary', bias_quantizer='binary',activation='softmax')(x)

model2 = Model(inputs=x_in, outputs=x)

model2.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])

model2.summary()
Model: "model_1"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 input_2 (InputLayer)        [(None, 28, 28, 1)]       0         

 conv2d_1 (QConv2D)          (None, 26, 26, 4)         40        

 q_batch_normalization (QBat  (None, 26, 26, 4)        16        
 chNormalization)                                                

 act1 (QActivation)          (None, 26, 26, 4)         0         

 conv2d_2 (QConv2D)          (None, 24, 24, 8)         296       

 q_batch_normalization_1 (QB  (None, 24, 24, 8)        32        
 atchNormalization)                                              

 act2 (QActivation)          (None, 24, 24, 8)         0         

 max_pooling2d_2 (MaxPooling  (None, 12, 12, 8)        0         
 2D)                                                             

 conv2d_3 (QConv2D)          (None, 10, 10, 8)         584       

 q_batch_normalization_2 (QB  (None, 10, 10, 8)        32        
 atchNormalization)                                              

 act3 (QActivation)          (None, 10, 10, 8)         0         

 max_pooling2d_3 (MaxPooling  (None, 5, 5, 8)          0         
 2D)                                                             

 flatten_1 (Flatten)         (None, 200)               0         

 q_dense (QDense)            (None, 10)                2010      

 q_batch_normalization_3 (QB  (None, 10)               40        
 atchNormalization)                                              

 act4 (QActivation)          (None, 10)                0         

 q_dense_1 (QDense)          (None, 10)                110       

=================================================================
Total params: 3,160
Trainable params: 3,100
Non-trainable params: 60
_________________________________________________________________

I tried it with main branch still the issue exists I can able to compile but cannot able to synthesize model_2 because of the above mentioned errors, I have tried with main branch also but still the issue exists. Also I want to port my models on ZCU-104, but if I set my config part and board corresponding to ZCU-104, while synthesizing the model is resetting the board part number and board to pynq board, how to get support for ZCU-104 since there are no board files for zcu104 in supported_bordfiles.json Please look into my issues and any valuable comments is really appreciated. Thanks in advance.

jmduarte commented 1 year ago

@sandeep1404 I created a gist for model1 and model2 here: https://gist.github.com/jmduarte/b4de1d6c5a4084ad3c1605ebd6f2f6e2

For model1, I can reproduce your error for in hls4ml==0.6.0 (i.e. pip install hls4ml==0.6.0), but if I install the current main branch (i.e. pip install pip install git+https://github.com/fastmachinelearning/hls4ml@13148eb2d73b64facedfdaf145b46fa37e8ab9d6), I can compile and run inference for model1.

For model2, I do indeed see an issue synthesizing the model even on the current main branch.

sandeep1404 commented 1 year ago

@jmduarte Thanks for the reply, I am having still the same issues while compiling the model as mentioned below can you please address the issues

1. What is the reason for the compilation error which I got for model 1 and model 2, still I am facing the error as mentioned above even with the main branch, I am not sure how u can able to compile model 1 while I am still getting the same issue as mentioned below for both model 1 and model 2 .I just changed activation to binary_tanh rest of the model remains same.

firmware/myproject.cpp: In function ‘void myproject(hls::stream<nnet::array<ap_fixed<16, 6>, 1> >&, hls::stream<nnet::array<ap_fixed<16, 6>, 10> >&)’:
firmware/myproject.cpp:64:81: error: no matching function for call to ‘normalize_binary_tanh<layer2_t, config20>(hls::stream<nnet::array<ap_fixed<16, 6>, 16> >&, hls::stream<nnet::array<ap_uint<1>, 16> >&, threshold20_t [16])’
   64 |     nnet::normalize_binary_tanh<layer2_t, config20>(layer2_out, layer20_out, t20); // bnbt_batch_normalization
      |                                                                                 ^
In file included from firmware/parameters.h:12,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm.h:80:6: note: candidate: ‘void nnet::normalize_binary_tanh(data_T*, ap_uint<1>*, data_T*) [with data_T = nnet::array<ap_fixed<16, 6>, 16>; CONFIG_T = config20]’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm.h:80:35: note:   no known conversion for argument 1 from ‘hls::stream<nnet::array<ap_fixed<16, 6>, 16> >’ to ‘nnet::array<ap_fixed<16, 6>, 16>*’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from firmware/parameters.h:13,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm_stream.h:54:6: note: candidate: ‘void nnet::normalize_binary_tanh(hls::stream<srcType>&, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in> >&, typename data_T::value_type*) [with data_T = nnet::array<ap_fixed<16, 6>, 16>; CONFIG_T = config20; typename data_T::value_type = ap_fixed<16, 6>]’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm_stream.h:54:109: note:   no known conversion for argument 2 from ‘hls::stream<nnet::array<ap_uint<1>, 16> >’ to ‘hls::stream<nnet::array<ap_uint<1>, 10816> >&’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[16], line 2
      1 # hls_model_q = hls4ml.converters.keras_to_hls(cfg_q)
----> 2 hls_model.compile()

File ~/.local/lib/python3.8/site-packages/hls4ml/model/graph.py:664, in ModelGraph.compile(self)
    662     dlclose_func.restype = ctypes.c_int
    663     dlclose_func(self._top_function_lib._handle)
--> 664 self._top_function_lib = ctypes.cdll.LoadLibrary(lib_name)

File /usr/lib/python3.8/ctypes/__init__.py:451, in LibraryLoader.LoadLibrary(self, name)
    450 def LoadLibrary(self, name):
--> 451     return self._dlltype(name)

File /usr/lib/python3.8/ctypes/__init__.py:373, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    370 self._FuncPtr = _FuncPtr
    372 if handle is None:
--> 373     self._handle = _dlopen(self._name, mode)
    374 else:
    375     self._handle = handle

OSError: model_pynq_main_1/hls4ml_prj_pynq_bnn_git_model1/firmware/myproject-F1A0F009.so: cannot open shared object file: No such file or directory

Also I have few quires, how to synthesize my model1 on zcu104, since all my models are not able to synthesize on pynq-z2 due to limited resources we also have zcu104 with us which we want to use for inference, when I set zcu104 as the part number in the config file it gives the following warning.

WARNING: You set a Part that does not correspond to the Board you specified. The correct Part is now set.

Also I am getting error for the below command

hls4ml.model.optimizer.OutputRoundingSaturationMode.layers = ['Activation']
AttributeError: module 'hls4ml.model.optimizer' has no attribute 'OutputRoundingSaturationMode'

with the earlier version of hls4ml==0.6.0 I am not getting that AttributeError, but when I install the main branch version as specified above I am getting the AttributeError, I am facing this issue, what's the problem with the main branch can you kindly look into the problem.

Why I am getting this OSError, for both the models for main branch also . I cannot able to understand how to rectify the issues and what's the problem is, please help me in this regard. Thanks in advance.

sandeep1404 commented 1 year ago

Please kindly help I am completely struck at the issue of OS error cannot open shared object file:No such file or directory and cannot able to compile all my models even. If there is any implementation of binary neural network on qkeras can you please share it i will have a look at the example and can possibly understand if there is any mistake from my side.

jmduarte commented 1 year ago

Hi @sandeep1404, I'd like to help you, but I'm quite slammed at the moment and I think you're relating multiple issues, some of which can reproduce, and some of which I cannot so I think they are an issue with your setup.

(1) In the gist I shared, I am able to compile and run inference for model1. Do you confirm you can do that? There may be an accuracy issue, but that is often related to needing to tune precisions / activations used and requires further investigation and profiling (which are provided tools in the utils).

(2) In the gist I shared, I confirm that there is an issue compiling model2. One error is:

firmware/nnet_utils/nnet_mult.h:99:53: error: ‘n_in’ is not a member of ‘config6’
                                ap_int<nnet::ceillog2(CONFIG_T::n_in) + 2>>::type

and another is

firmware/nnet_utils/nnet_conv2d_latency.h:76:57: error: no matching function for call to ‘cast<ap_uint<1>, ap_fixed<16, 6, (ap_q_mode)5, (ap_o_mode)3, 0>, config6>(config6::accum_t&)’
                 *(res++) = cast<data_T, res_T, CONFIG_T>(acc[i_res]);

We need more time to investigate this. I have a feeling it has to do with the choice of the quantizer.

(3) zcu104 is not an FPGA part number, but instead a type of board. The FPGA part number corresponding to that board is something like this xczu7ev-ffvc1156-2-e (https://www.xilinx.com/products/boards-and-kits/zcu104.html#documentation). Note: you may need to install board files from that Xilinx webpage if you don't have them already.

Also, we do not currently support the zcu104 with the Pynq-based VivadoAccelerator backend (you're welcome to add this as a PR! It should be very similar to zcu102: https://github.com/fastmachinelearning/hls4ml/tree/main/hls4ml/templates/vivado_accelerator/zcu102). Nonetheless, you can still synthesize a model for that FPGA by using the Vivado backend.

(4) The corresponding API for this command has changed from:

hls4ml.model.optimizer.OutputRoundingSaturationMode.layers = ['Activation']

to:

hls_config["Flows"] = ['output_rounding_saturation_mode']
hls4ml.model.optimizer.get_optimizer('output_rounding_saturation_mode').configure(layers=['Activation'])

Note, you should also specify how you want to round these layers. See the docstring here (to be updated and added to docs): https://github.com/fastmachinelearning/hls4ml/blob/86f583df2c04bbabfb35aee7e0d38bb35473d7d8/hls4ml/model/optimizer/passes/qkeras.py#L28-L38

@vloncar feel free to add anything

jmitrevs commented 1 year ago

By the way, recently the activation rounding default changed to AP_RND_CONV and overflow to AP_SAT, since those were what we generally used, though they can be changed.

I will try to run the gist.

sandeep1404 commented 1 year ago

Hi @jmduarte Still I am facing the same compilation issue for model1 as in gist cannot able to compile both the models, is it the problem with binary quantizers, since I can able to compile and build the basic tensorflow models which are not quantised. The error for model1 is given below:

WARNING: You set a Part that does not correspond to the Board you specified. The correct Part is now set.
Writing HLS project
Done
firmware/myproject.cpp: In function ‘void myproject(hls::stream<nnet::array<ap_fixed<16, 6>, 1> >&, hls::stream<nnet::array<ap_fixed<16, 6>, 10> >&)’:
firmware/myproject.cpp:66:81: error: no matching function for call to ‘normalize_binary_tanh<layer2_t, config24>(hls::stream<nnet::array<ap_fixed<16, 6>, 16> >&, hls::stream<nnet::array<ap_uint<1>, 16> >&, threshold24_t [16])’
   66 |     nnet::normalize_binary_tanh<layer2_t, config24>(layer2_out, layer24_out, t24); // bnbt_conv1_alpha
      |                                                                                 ^
In file included from firmware/parameters.h:12,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm.h:80:6: note: candidate: ‘void nnet::normalize_binary_tanh(data_T*, ap_uint<1>*, data_T*) [with data_T = nnet::array<ap_fixed<16, 6>, 16>; CONFIG_T = config24]’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm.h:80:35: note:   no known conversion for argument 1 from ‘hls::stream<nnet::array<ap_fixed<16, 6>, 16> >’ to ‘nnet::array<ap_fixed<16, 6>, 16>*’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from firmware/parameters.h:13,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm_stream.h:54:6: note: candidate: ‘void nnet::normalize_binary_tanh(hls::stream<srcType>&, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in> >&, typename data_T::value_type*) [with data_T = nnet::array<ap_fixed<16, 6>, 16>; CONFIG_T = config24; typename data_T::value_type = ap_fixed<16, 6>]’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm_stream.h:54:109: note:   no known conversion for argument 2 from ‘hls::stream<nnet::array<ap_uint<1>, 16> >’ to ‘hls::stream<nnet::array<ap_uint<1>, 10816> >&’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
firmware/myproject.cpp:78:81: error: no matching function for call to ‘normalize_binary_tanh<layer7_t, config25>(hls::stream<nnet::array<ap_fixed<16, 6>, 12> >&, hls::stream<nnet::array<ap_uint<1>, 12> >&, threshold25_t [12])’
   78 |     nnet::normalize_binary_tanh<layer7_t, config25>(layer7_out, layer25_out, t25); // bnbt_conv2_alpha
      |                                                                                 ^
In file included from firmware/parameters.h:12,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm.h:80:6: note: candidate: ‘void nnet::normalize_binary_tanh(data_T*, ap_uint<1>*, data_T*) [with data_T = nnet::array<ap_fixed<16, 6>, 12>; CONFIG_T = config25]’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm.h:80:35: note:   no known conversion for argument 1 from ‘hls::stream<nnet::array<ap_fixed<16, 6>, 12> >’ to ‘nnet::array<ap_fixed<16, 6>, 12>*’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from firmware/parameters.h:13,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm_stream.h:54:6: note: candidate: ‘void nnet::normalize_binary_tanh(hls::stream<srcType>&, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in> >&, typename data_T::value_type*) [with data_T = nnet::array<ap_fixed<16, 6>, 12>; CONFIG_T = config25; typename data_T::value_type = ap_fixed<16, 6>]’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm_stream.h:54:109: note:   no known conversion for argument 2 from ‘hls::stream<nnet::array<ap_uint<1>, 12> >’ to ‘hls::stream<nnet::array<ap_uint<1>, 1452> >&’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
firmware/myproject.cpp:90:83: error: no matching function for call to ‘normalize_binary_tanh<layer12_t, config26>(hls::stream<nnet::array<ap_fixed<16, 6>, 10> >&, hls::stream<nnet::array<ap_uint<1>, 10> >&, threshold26_t [10])’
   90 |     nnet::normalize_binary_tanh<layer12_t, config26>(layer12_out, layer26_out, t26); // bnbt_conv3_alpha
      |                                                                                   ^
In file included from firmware/parameters.h:12,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm.h:80:6: note: candidate: ‘void nnet::normalize_binary_tanh(data_T*, ap_uint<1>*, data_T*) [with data_T = nnet::array<ap_fixed<16, 6>, 10>; CONFIG_T = config26]’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm.h:80:35: note:   no known conversion for argument 1 from ‘hls::stream<nnet::array<ap_fixed<16, 6>, 10> >’ to ‘nnet::array<ap_fixed<16, 6>, 10>*’
   80 | void normalize_binary_tanh(data_T data[CONFIG_T::n_in], ap_uint<1> res[CONFIG_T::n_in], data_T threshold[CONFIG_T::n_in]) {
      |                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from firmware/parameters.h:13,
                 from firmware/myproject.cpp:22:
firmware/nnet_utils/nnet_batchnorm_stream.h:54:6: note: candidate: ‘void nnet::normalize_binary_tanh(hls::stream<srcType>&, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in> >&, typename data_T::value_type*) [with data_T = nnet::array<ap_fixed<16, 6>, 10>; CONFIG_T = config26; typename data_T::value_type = ap_fixed<16, 6>]’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |      ^~~~~~~~~~~~~~~~~~~~~
firmware/nnet_utils/nnet_batchnorm_stream.h:54:109: note:   no known conversion for argument 2 from ‘hls::stream<nnet::array<ap_uint<1>, 10> >’ to ‘hls::stream<nnet::array<ap_uint<1>, 90> >&’
   54 | void normalize_binary_tanh(hls::stream<data_T> &data, hls::stream<nnet::array<ap_uint<1>, CONFIG_T::n_in>> &res,
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
g++: error: myproject.o: No such file or directory
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[3], line 2
      1 if __name__ == "__main__":
----> 2     test_model1()
      3 #     test_model2()

Cell In[2], line 79, in test_model1()
     69 hls_config["LayerName"]["conv3"]["ReuseFactor"] = 1080
     70 hls_model = hls4ml.converters.convert_from_keras_model(
     71     model1,
     72     hls_config=hls_config,
   (...)
     76     board="pynq-z2",
     77 )
---> 79 hls_model.compile()
     80 y_hls = hls_model.predict(np.zeros((1, 28, 28, 1)))
     82 print(y_hls)

File ~/.local/lib/python3.8/site-packages/hls4ml/model/graph.py:664, in ModelGraph.compile(self)
    662     dlclose_func.restype = ctypes.c_int
    663     dlclose_func(self._top_function_lib._handle)
--> 664 self._top_function_lib = ctypes.cdll.LoadLibrary(lib_name)

File /usr/lib/python3.8/ctypes/__init__.py:451, in LibraryLoader.LoadLibrary(self, name)
    450 def LoadLibrary(self, name):
--> 451     return self._dlltype(name)

File /usr/lib/python3.8/ctypes/__init__.py:373, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    370 self._FuncPtr = _FuncPtr
    372 if handle is None:
--> 373     self._handle = _dlopen(self._name, mode)
    374 else:
    375     self._handle = handle

OSError: model_pynq_main_git12/hls4ml_prj_pynq/firmware/myproject-f7D1C8DE.so: cannot open shared object file: No such file or directory

I am using the main branch even though I cannot able to compile the models, I am not sure if there is a problem with the setup?

jmduarte commented 1 year ago

Hi @sandeep1404, I think we should set up a time to chat.

I am able to compile model1 with the main branch. I will note that it's best to start from a fresh environment and remove previous projects to avoid conflicts.

sandeep1404 commented 1 year ago

Thanks @jmduarte for your time, I will try to setup a new environment and try again, but I don't understand why few models can able to compile well and why some of the models cannot compile, if there is any problem with in the setup, any model which I build shouldn't compile but few of the models are compiling well, so there might be the problem with the model not with the setup I feel, but I may be wrong in my sense, but I am trying to resolve the issues from my side, please let me know if anyone in the team can support and resolve the issues. I am happy to respond to you at any time whenever you are available so you can setup the chat at any time when you are free and available. Thanks for the help.

jmitrevs commented 1 year ago

Note that binary networks haven't been tested too carefully and there are still issues. Let us know if you run into more problems.