Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:27

0001 #ifndef PARAMETERS_H_
0002 #define PARAMETERS_H_
0003 
0004 #include "ap_fixed.h"
0005 #include "ap_int.h"
0006 
0007 #include <complex>
0008 
0009 // Tau NN components
0010 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/nnet_utils/nnet_activation.h"
0011 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/nnet_utils/nnet_dense.h"
0012 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/defines.h"
0013 
0014 // Load the NN weights
0015 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w2.h"
0016 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b2.h"
0017 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w5.h"
0018 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b5.h"
0019 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w8.h"
0020 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b8.h"
0021 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w11.h"
0022 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b11.h"
0023 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w14.h"
0024 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b14.h"
0025 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w17.h"
0026 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b17.h"
0027 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w20.h"
0028 #include "L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b20.h"
0029 
0030 // hls-fpga-machine-learning insert layer-config
0031 // Dense_1
0032 struct config2 : nnet::dense_config {
0033   static const unsigned n_in = 80;
0034   static const unsigned n_out = 25;
0035   static const unsigned io_type = nnet::io_parallel;
0036   static const unsigned strategy = nnet::latency;
0037   static const unsigned reuse_factor = 1;
0038   static const unsigned n_zeros = 1205;
0039   static const unsigned n_nonzeros = 795;
0040   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0041   static const bool store_weights_in_bram = false;
0042   typedef model_default_t accum_t;
0043   typedef bias2_t bias_t;
0044   typedef weight2_t weight_t;
0045   typedef layer2_index index_t;
0046   template <class x_T, class y_T>
0047   using product = nnet::product::mult<x_T, y_T>;
0048 };
0049 
0050 // relu_1
0051 struct relu_config4 : nnet::activ_config {
0052   static const unsigned n_in = 25;
0053   static const unsigned table_size = 1024;
0054   static const unsigned io_type = nnet::io_parallel;
0055   static const unsigned reuse_factor = 1;
0056   typedef relu_1_table_t table_t;
0057 };
0058 
0059 // Dense_2
0060 struct config5 : nnet::dense_config {
0061   static const unsigned n_in = 25;
0062   static const unsigned n_out = 25;
0063   static const unsigned io_type = nnet::io_parallel;
0064   static const unsigned strategy = nnet::latency;
0065   static const unsigned reuse_factor = 1;
0066   static const unsigned n_zeros = 375;
0067   static const unsigned n_nonzeros = 250;
0068   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0069   static const bool store_weights_in_bram = false;
0070   typedef model_default_t accum_t;
0071   typedef bias5_t bias_t;
0072   typedef weight5_t weight_t;
0073   typedef layer5_index index_t;
0074   template <class x_T, class y_T>
0075   using product = nnet::product::mult<x_T, y_T>;
0076 };
0077 
0078 // relu_2
0079 struct relu_config7 : nnet::activ_config {
0080   static const unsigned n_in = 25;
0081   static const unsigned table_size = 1024;
0082   static const unsigned io_type = nnet::io_parallel;
0083   static const unsigned reuse_factor = 1;
0084   typedef relu_2_table_t table_t;
0085 };
0086 
0087 // Dense_3
0088 struct config8 : nnet::dense_config {
0089   static const unsigned n_in = 25;
0090   static const unsigned n_out = 15;
0091   static const unsigned io_type = nnet::io_parallel;
0092   static const unsigned strategy = nnet::latency;
0093   static const unsigned reuse_factor = 1;
0094   static const unsigned n_zeros = 225;
0095   static const unsigned n_nonzeros = 150;
0096   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0097   static const bool store_weights_in_bram = false;
0098   typedef model_default_t accum_t;
0099   typedef bias8_t bias_t;
0100   typedef weight8_t weight_t;
0101   typedef layer8_index index_t;
0102   template <class x_T, class y_T>
0103   using product = nnet::product::mult<x_T, y_T>;
0104 };
0105 
0106 // relu_3
0107 struct relu_config10 : nnet::activ_config {
0108   static const unsigned n_in = 15;
0109   static const unsigned table_size = 1024;
0110   static const unsigned io_type = nnet::io_parallel;
0111   static const unsigned reuse_factor = 1;
0112   typedef relu_3_table_t table_t;
0113 };
0114 
0115 // Dense_4
0116 struct config11 : nnet::dense_config {
0117   static const unsigned n_in = 15;
0118   static const unsigned n_out = 15;
0119   static const unsigned io_type = nnet::io_parallel;
0120   static const unsigned strategy = nnet::latency;
0121   static const unsigned reuse_factor = 1;
0122   static const unsigned n_zeros = 135;
0123   static const unsigned n_nonzeros = 90;
0124   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0125   static const bool store_weights_in_bram = false;
0126   typedef model_default_t accum_t;
0127   typedef bias11_t bias_t;
0128   typedef weight11_t weight_t;
0129   typedef layer11_index index_t;
0130   template <class x_T, class y_T>
0131   using product = nnet::product::mult<x_T, y_T>;
0132 };
0133 
0134 // relu_4
0135 struct relu_config13 : nnet::activ_config {
0136   static const unsigned n_in = 15;
0137   static const unsigned table_size = 1024;
0138   static const unsigned io_type = nnet::io_parallel;
0139   static const unsigned reuse_factor = 1;
0140   typedef relu_4_table_t table_t;
0141 };
0142 
0143 // Dense_5
0144 struct config14 : nnet::dense_config {
0145   static const unsigned n_in = 15;
0146   static const unsigned n_out = 10;
0147   static const unsigned io_type = nnet::io_parallel;
0148   static const unsigned strategy = nnet::latency;
0149   static const unsigned reuse_factor = 1;
0150   static const unsigned n_zeros = 90;
0151   static const unsigned n_nonzeros = 60;
0152   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0153   static const bool store_weights_in_bram = false;
0154   typedef model_default_t accum_t;
0155   typedef bias14_t bias_t;
0156   typedef weight14_t weight_t;
0157   typedef layer14_index index_t;
0158   template <class x_T, class y_T>
0159   using product = nnet::product::mult<x_T, y_T>;
0160 };
0161 
0162 // relu_5
0163 struct relu_config16 : nnet::activ_config {
0164   static const unsigned n_in = 10;
0165   static const unsigned table_size = 1024;
0166   static const unsigned io_type = nnet::io_parallel;
0167   static const unsigned reuse_factor = 1;
0168   typedef relu_5_table_t table_t;
0169 };
0170 
0171 // Dense_6
0172 struct config17 : nnet::dense_config {
0173   static const unsigned n_in = 10;
0174   static const unsigned n_out = 1;
0175   static const unsigned io_type = nnet::io_parallel;
0176   static const unsigned strategy = nnet::latency;
0177   static const unsigned reuse_factor = 1;
0178   static const unsigned n_zeros = 6;
0179   static const unsigned n_nonzeros = 4;
0180   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0181   static const bool store_weights_in_bram = false;
0182   typedef model_default_t accum_t;
0183   typedef bias17_t bias_t;
0184   typedef weight17_t weight_t;
0185   typedef layer17_index index_t;
0186   template <class x_T, class y_T>
0187   using product = nnet::product::mult<x_T, y_T>;
0188 };
0189 
0190 // jetID_output
0191 struct sigmoid_config19 : nnet::activ_config {
0192   static const unsigned n_in = 1;
0193   static const unsigned table_size = 1024;
0194   static const unsigned io_type = nnet::io_parallel;
0195   static const unsigned reuse_factor = 1;
0196   typedef jetID_output_table_t table_t;
0197 };
0198 
0199 // pT_output
0200 struct config20 : nnet::dense_config {
0201   static const unsigned n_in = 10;
0202   static const unsigned n_out = 1;
0203   static const unsigned io_type = nnet::io_parallel;
0204   static const unsigned strategy = nnet::latency;
0205   static const unsigned reuse_factor = 1;
0206   static const unsigned n_zeros = 6;
0207   static const unsigned n_nonzeros = 4;
0208   static const unsigned multiplier_limit = DIV_ROUNDUP(n_in * n_out, reuse_factor) - n_zeros / reuse_factor;
0209   static const bool store_weights_in_bram = false;
0210   typedef model_default_t accum_t;
0211   typedef bias20_t bias_t;
0212   typedef weight20_t weight_t;
0213   typedef layer20_index index_t;
0214   template <class x_T, class y_T>
0215   using product = nnet::product::mult<x_T, y_T>;
0216 };
0217 
0218 #endif