op.cmake 9.7 KB
Newer Older
H
hanbuhe 已提交
1
set(FOUND_MATCH OFF)
2 3 4 5 6 7
set(CON -1)

message(STATUS "nets :${NET}")

list(FIND NET "googlenet" CON)
if (CON GREATER -1)
H
hanbuhe 已提交
8
  message("googlenet enabled")
D
dolphin8 已提交
9 10 11 12 13 14 15 16 17
  set(CONCAT_OP ON)
  set(CONV_OP ON)
  set(LRN_OP ON)
  set(MUL_OP ON)
  set(ELEMENTWISEADD_OP ON)
  set(FUSION_FC_OP ON)
  set(POOL_OP ON)
  set(RELU_OP ON)
  set(FUSION_CONVADD_OP ON)
Z
zhangyang 已提交
18
  set(FUSION_CONVADDRELU_OP ON)
H
hanbuhe 已提交
19 20 21 22

  set(FOUND_MATCH ON)
endif()

23 24
list(FIND NET "mobilenet" CON)
if (CON GREATER -1)
H
hanbuhe 已提交
25
  message("mobilenet enabled")
D
dolphin8 已提交
26 27 28 29
  set(CONV_OP ON)
  set(ELEMENTWISEADD_OP ON)
  set(RELU_OP ON)
  set(SOFTMAX_OP ON)
30
  set(MUL_OP ON)
D
dolphin8 已提交
31 32 33 34
  set(DEPTHWISECONV_OP ON)
  set(BATCHNORM_OP ON)
  set(POOL_OP ON)
  set(RESHAPE_OP ON)
W
wangliu 已提交
35
  set(FUSION_CONVADDBNRELU_OP ON)
36
  set(FUSION_CONVADDRELU_OP ON)
W
wangliu 已提交
37
  set(FUSION_CONVADD_OP ON)
H
hanbuhe 已提交
38 39 40 41 42

  set(FOUND_MATCH ON)
endif()


43 44
list(FIND NET "mobilenetssd" CON)
if (CON GREATER -1)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
  message("mobilenetssd enabled")
  set(FUSION_CONVBNRELU_OP ON)
  set(FUSION_CONVBNRELU_OP ON)
  set(FUSION_DWCONVBNRELU_OP ON)
  set(FUSION_CONVADD_OP ON)
  set(MULTICLASSNMS_OP ON)
  set(SOFTMAX_OP ON)
  set(TRANSPOSE_OP ON)
    #feed
  set(PRIORBOX_OP ON)
  set(CONCAT_OP ON)
  set(BOXCODER_OP ON)
  set(RESHAPE_OP ON)
#fetch
  #total

  set(FOUND_MATCH ON)

endif()


66 67
list(FIND NET "yolo" CON)
if (CON GREATER -1)
H
hanbuhe 已提交
68
  message("yolo enabled")
D
dolphin8 已提交
69 70 71 72
  set(BATCHNORM_OP ON)
  set(CONV_OP ON)
  set(RELU_OP ON)
  set(ELEMENTWISEADD_OP ON)
H
hanbuhe 已提交
73 74 75 76

  set(FOUND_MATCH ON)
endif()

77 78
list(FIND NET "squeezenet" CON)
if (CON GREATER -1)
H
hanbuhe 已提交
79
  message("squeezenet enabled")
D
dolphin8 已提交
80 81 82 83 84 85 86
  set(CONCAT_OP ON)
  set(CONV_OP ON)
  set(RELU_OP ON)
  set(ELEMENTWISEADD_OP ON)
  set(POOL_OP ON)
  set(RESHAPE_OP ON)
  set(SOFTMAX_OP ON)
H
hanbuhe 已提交
87 88 89 90 91

  set(FOUND_MATCH ON)
endif()


92 93
list(FIND NET "resnet" CON)
if (CON GREATER -1)
H
hanbuhe 已提交
94 95
  message("resnet enabled")
  set(CONCAT_OP ON)
D
dolphin8 已提交
96
  set(CONV_OP ON)
H
hanbuhe 已提交
97
  set(RELU_OP ON)
D
dolphin8 已提交
98 99
  set(ELEMENTWISEADD_OP ON)
  set(POOL_OP ON)
qnqinan's avatar
qnqinan 已提交
100
  set(BATCHNORM_OP ON)
101
  set(FUSION_CONVBNADDRELU_OP ON)
qnqinan's avatar
qnqinan 已提交
102
  set(MUL_OP ON)
H
hanbuhe 已提交
103 104 105 106 107
  set(RESHAPE_OP ON)
  set(SOFTMAX_OP ON)
  set(FOUND_MATCH ON)
endif()

qnqinan's avatar
qnqinan 已提交
108
list(FIND NET "FPGA_NET_V1" CON)
109
if (CON GREATER -1)
qnqinan's avatar
qnqinan 已提交
110
  message("FPGA_NET_V1 enabled")
Z
zhangyang 已提交
111
  set(FUSION_CONVADDRELU_OP ON)
Z
zhangyang 已提交
112
  set(FUSION_ELEMENTWISEADDRELU_OP ON)
Z
zhangyang 已提交
113
  set(FUSION_FC_OP ON)
Z
zhangyang 已提交
114
  set(POOL_OP ON)
H
hanbuhe 已提交
115
  set(SOFTMAX_OP ON)
Z
zhangyang 已提交
116 117
  set(FUSION_CONVBNRELU_OP ON)
  set(FUSION_CONVBN_OP ON)
Z
zhangyang 已提交
118 119 120 121 122 123 124
  set(TANH_OP ON)
  set(ELEMENTWISEADD_OP ON)
  set(TRANSPOSE2_OP ON)
  set(FUSION_CONVADD_OP ON)
  set(SPLIT_OP ON)
  set(FUSION_DECONVADD_OP ON)
  set(FUSION_DECONVADDRELU_OP ON)
xiebaiyuan's avatar
xiebaiyuan 已提交
125
  set(FOUND_MATCH ON)
H
hanbuhe 已提交
126 127
endif()

qnqinan's avatar
qnqinan 已提交
128 129 130
list(FIND NET "FPGA_NET_V2" CON)
if (CON GREATER -1)
  message("FPGA_NET_V2 enabled")
qnqinan's avatar
qnqinan 已提交
131
  set(FUSION_CONVADDRELU_OP ON)
qnqinan's avatar
qnqinan 已提交
132 133 134 135 136 137
  set(FUSION_ELEMENTWISEADDRELU_OP ON)
  set(FUSION_FC_OP ON)
  set(POOL_OP ON)
  set(SOFTMAX_OP ON)
  set(FUSION_CONVBNRELU_OP ON)
  set(FUSION_CONVBN_OP ON)
Z
zhangyang 已提交
138 139
  set(TANH_OP ON)
  set(ELEMENTWISEADD_OP ON)
qnqinan's avatar
qnqinan 已提交
140 141 142 143 144
  set(TRANSPOSE2_OP ON)
  set(FUSION_CONVADD_OP ON)
  set(SPLIT_OP ON)
  set(FUSION_DECONVADD_OP ON)
  set(FUSION_DECONVADDRELU_OP ON)
qnqinan's avatar
qnqinan 已提交
145 146 147
  set(FOUND_MATCH ON)
endif()

148 149
list(FIND NET "nlp" CON)
if (CON GREATER -1)
150 151 152 153 154 155 156 157 158 159 160 161
  message("nlp enabled")
  set(FUSION_FC_OP ON)
  set(LOOKUP_OP ON)
  set(GRU_OP ON)
  set(CRF_OP ON)
  set(CONCAT_OP ON)
  set(ELEMENTWISEADD_OP ON)


  set(FOUND_MATCH ON)
endif()

162 163
list(FIND NET "mobilenetfssd" CON)
if (CON GREATER -1)
xiebaiyuan's avatar
xiebaiyuan 已提交
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
  message("mobilenetfssd enabled")
  set(FUSION_CONVADDRELU_OP ON)
  set(FUSION_CONVADDBNRELU_OP ON)
  set(FUSION_CONVADD_OP ON)
  set(SOFTMAX_OP ON)
  set(RESHAPE_OP ON)
  set(BILINEAR_INTERP_OP ON)
  set(TRANSPOSE_OP ON)
  set(CONCAT_OP ON)
  set(PRIORBOX_OP ON)
  set(BATCHNORM_OP ON)
  set(BOXCODER_OP ON)
  set(MULTICLASSNMS_OP ON)
  set(FLATTEN_OP ON)
  set(SPLIT_OP ON)
  set(SHAPE_OP ON)

  set(FOUND_MATCH ON)
endif()

184 185
list(FIND NET "genet" CON)
if (CON GREATER -1)
xiebaiyuan's avatar
xiebaiyuan 已提交
186 187 188 189 190 191 192 193 194 195 196 197 198
  message("genet enabled")
  set(FUSION_CONVADDPRELU_OP ON)
  set(FUSION_CONVADDADDPRELU_OP ON)
  set(FUSION_CONVADD_OP ON)
  set(CONV_TRANSPOSE_OP ON)
  set(FUSION_CONVADDRELU_OP ON)
  set(ELEMENTWISEADD_OP ON)
  set(PRELU_OP ON)
  set(POOL_OP ON)
  set(CONCAT_OP ON)

  set(FOUND_MATCH ON)
endif()
H
hanbuhe 已提交
199

200

H
hanbuhe 已提交
201 202
if(NOT FOUND_MATCH)
  message("--default--")
D
dolphin8 已提交
203
  set(BATCHNORM_OP ON)
L
liuruilong 已提交
204
  set(CONV_TRANSPOSE_OP ON)
D
dolphin8 已提交
205 206 207 208 209
  set(BOXCODER_OP ON)
  set(CONCAT_OP ON)
  set(CONV_OP ON)
  set(DEPTHWISECONV_OP ON)
  set(ELEMENTWISEADD_OP ON)
210 211
  set(ELEMENTWISESUB_OP ON)
  set(IM2SEQUENCE_OP ON)
L
lijiancheng0614 已提交
212
  set(FILL_CONSTANT_OP ON)
D
dolphin8 已提交
213
  set(FUSION_CONVADD_OP ON)
214
  set(FUSION_CONVADDPRELU_OP ON)
Z
zhangyang 已提交
215
  set(FUSION_CONVADDRELU_OP ON)
D
dolphin8 已提交
216 217 218 219
  set(FUSION_FC_OP ON)
  set(LRN_OP ON)
  set(MUL_OP ON)
  set(MULTICLASSNMS_OP ON)
L
lijiancheng0614 已提交
220
  set(POLYGONBOXTRANSFORM_OP ON)
D
dolphin8 已提交
221 222 223 224
  set(POOL_OP ON)
  set(PRIORBOX_OP ON)
  set(RELU_OP ON)
  set(RESHAPE_OP ON)
L
lijiancheng0614 已提交
225
  set(RESHAPE2_OP ON)
D
dolphin8 已提交
226 227 228
  set(SIGMOID_OP ON)
  set(SOFTMAX_OP ON)
  set(TRANSPOSE_OP ON)
L
lijiancheng0614 已提交
229
  set(TRANSPOSE2_OP ON)
E
eclipsess 已提交
230
  set(FUSION_CONVADDBNRELU_OP ON)
231
  set(FUSION_CONVADDADDPRELU_OP ON)
E
eclipsess 已提交
232
  set(FUSION_DWCONVBNRELU_OP ON)
233
  set(FUSION_CONVBNRELU_OP ON)
234
  set(FUSION_CONVBNADDRELU_OP ON)
T
Tian 已提交
235 236 237 238
  set(PRELU_OP ON)
  set(RESIZE_OP ON)
  set(SCALE_OP ON)
  set(SLICE_OP ON)
Y
Yao,kun 已提交
239 240
  set(DROPOUT_OP ON)
  set(IM2SEQUENCE_OP ON)
xiebaiyuan's avatar
xiebaiyuan 已提交
241 242 243
  set(LOOKUP_OP ON)
  set(GRU_OP ON)
  set(CRF_OP ON)
244 245 246 247
  set(BILINEAR_INTERP_OP ON)
  set(SPLIT_OP ON)
  set(FLATTEN_OP ON)
  set(SHAPE_OP ON)
E
debug  
eclipsess 已提交
248 249
  set(ELEMENTWISEMUL_OP ON)
  set(SUM_OP ON)
250 251
  set(QUANT_OP ON)
  set(DEQUANT_OP ON)
252 253 254
  set(FUSION_DEQUANT_ADD_BN_OP ON)
  set(FUSION_DEQUANT_BN_RELU_OP ON)
  set(FUSION_DEQUANT_ADD_BN_RELU_OP ON)
H
hanbuhe 已提交
255 256
endif()

D
dolphin8 已提交
257 258 259 260 261 262
  # option(BATCHNORM_OP "" ON)
  # option(BOXCODER_OP "" ON)
  # option(CONCAT_OP "" ON)
  # option(CONV_OP "" ON)
  # option(DEPTHWISECONV_OP "" ON)
  # option(ELEMENTWISEADD_OP "" ON)
L
lijiancheng0614 已提交
263
  # option(FILL_CONSTANT_OP "" ON)
D
dolphin8 已提交
264
  # option(FUSION_CONVADD_OP "" ON)
Z
zhangyang 已提交
265
  # option(FUSION_CONVADDRELU_OP "" ON)
D
dolphin8 已提交
266 267 268 269
  # option(FUSION_FC_OP "" ON)
  # option(LRN_OP "" ON)
  # option(MUL_OP "" ON)
  # option(MULTICLASSNMS_OP "" ON)
L
lijiancheng0614 已提交
270
  # option(POLYGONBOXTRANSFORM_OP "" ON)
D
dolphin8 已提交
271 272 273 274
  # option(POOL_OP "" ON)
  # option(PRIORBOX_OP "" ON)
  # option(RELU_OP "" ON)
  # option(RESHAPE_OP "" ON)
L
lijiancheng0614 已提交
275
  # option(RESHAPE2_OP "" ON)
D
dolphin8 已提交
276 277 278
  # option(SIGMOID_OP "" ON)
  # option(SOFTMAX_OP "" ON)
  # option(TRANSPOSE_OP "" ON)
L
lijiancheng0614 已提交
279
  # option(TRANSPOSE2_OP "" ON)
H
hanbuhe 已提交
280
# endif ()
D
dolphin8 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299

if (BATCHNORM_OP)
  add_definitions(-DBATCHNORM_OP)
endif()
if (BOXCODER_OP)
  add_definitions(-DBOXCODER_OP)
endif()
if (CONCAT_OP)
  add_definitions(-DCONCAT_OP)
endif()
if (CONV_OP)
  add_definitions(-DCONV_OP)
endif()
if (DEPTHWISECONV_OP)
  add_definitions(-DDEPTHWISECONV_OP)
endif()
if (ELEMENTWISEADD_OP)
  add_definitions(-DELEMENTWISEADD_OP)
endif()
300 301 302
if (ELEMENTWISESUB_OP)
  add_definitions(-DELEMENTWISESUB_OP)
endif()
L
lijiancheng0614 已提交
303 304 305
if (FILL_CONSTANT_OP)
  add_definitions(-DFILL_CONSTANT_OP)
endif()
D
dolphin8 已提交
306 307 308
if (FUSION_CONVADD_OP)
  add_definitions(-DFUSION_CONVADD_OP)
endif()
Z
zhangyang 已提交
309 310
if (FUSION_CONVADDRELU_OP)
  add_definitions(-DFUSION_CONVADDRELU_OP)
D
dolphin8 已提交
311
endif()
312 313 314 315 316 317
if (FUSION_CONVADDPRELU_OP)
  add_definitions(-DFUSION_CONVADDPRELU_OP)
endif()
if (FUSION_CONVADDADDPRELU_OP)
  add_definitions(-DFUSION_CONVADDADDPRELU_OP)
endif()
D
dolphin8 已提交
318 319 320 321 322 323 324 325 326 327 328 329
if (FUSION_FC_OP)
  add_definitions(-DFUSION_FC_OP)
endif()
if (LRN_OP)
  add_definitions(-DLRN_OP)
endif()
if (MUL_OP)
  add_definitions(-DMUL_OP)
endif()
if (MULTICLASSNMS_OP)
  add_definitions(-DMULTICLASSNMS_OP)
endif()
L
lijiancheng0614 已提交
330 331 332
if (POLYGONBOXTRANSFORM_OP)
  add_definitions(-DPOLYGONBOXTRANSFORM_OP)
endif()
D
dolphin8 已提交
333 334 335 336 337 338 339 340 341 342 343 344
if (POOL_OP)
  add_definitions(-DPOOL_OP)
endif()
if (PRIORBOX_OP)
  add_definitions(-DPRIORBOX_OP)
endif()
if (RELU_OP)
  add_definitions(-DRELU_OP)
endif()
if (RESHAPE_OP)
  add_definitions(-DRESHAPE_OP)
endif()
L
lijiancheng0614 已提交
345 346 347
if (RESHAPE2_OP)
  add_definitions(-DRESHAPE2_OP)
endif()
D
dolphin8 已提交
348 349 350 351 352 353 354 355 356
if (SIGMOID_OP)
  add_definitions(-DSIGMOID_OP)
endif()
if (SOFTMAX_OP)
  add_definitions(-DSOFTMAX_OP)
endif()
if (TRANSPOSE_OP)
  add_definitions(-DTRANSPOSE_OP)
endif()
L
lijiancheng0614 已提交
357 358 359
if (TRANSPOSE2_OP)
  add_definitions(-DTRANSPOSE2_OP)
endif()
E
eclipsess 已提交
360 361 362
if (FUSION_CONVADDBNRELU_OP)
  add_definitions(-DFUSION_CONVADDBNRELU_OP)
endif()
E
eclipsess 已提交
363 364 365
if (FUSION_DWCONVBNRELU_OP)
  add_definitions(-DFUSION_DWCONVBNRELU_OP)
endif()
366 367 368 369 370

if (FUSION_CONVBNRELU_OP)
  add_definitions(-DFUSION_CONVBNRELU_OP)
endif()

371 372 373 374
if (FUSION_CONVBNADDRELU_OP)
  add_definitions(-DFUSION_CONVBNADDRELU_OP)
endif()

T
Tian 已提交
375 376 377 378 379 380 381 382 383 384 385
if (PRELU_OP)
  add_definitions(-DPRELU_OP)
endif()
if (RESIZE_OP)
  add_definitions(-DRESIZE_OP)
endif()
if (SCALE_OP)
  add_definitions(-DSCALE_OP)
endif()
if (SLICE_OP)
  add_definitions(-DSLICE_OP)
L
liuruilong 已提交
386
endif()
Y
Yao,kun 已提交
387 388 389
if (DROPOUT_OP)
  add_definitions(-DDROPOUT_OP)
endif()
Y
bugfix  
Yao,kun 已提交
390 391
if (IM2SEQUENCE_OP)
  add_definitions(-DIM2SEQUENCE_OP)
T
Tian 已提交
392
endif()
Z
zhangyang 已提交
393

Z
zhangyang 已提交
394 395
if (FUSION_CONVADDBN_OP)
  add_definitions(-DFUSION_CONVADDBN_OP)
Z
zhangyang 已提交
396
endif()
Z
zhangyang 已提交
397 398
if (FUSION_FCRELU_OP)
  add_definitions(-DFUSION_FCRELU_OP)
Z
zhangyang 已提交
399 400 401 402 403 404 405
endif()
if (FUSION_POOLBN_OP)
  add_definitions(-DFUSION_POOLBN_OP)
endif()
if (FUSION_ELEMENTWISEADDRELU_OP)
  add_definitions(-DFUSION_ELEMENTWISEADDRELU_OP)
endif()
Z
zhangyang 已提交
406 407
if (FUSION_CONVBN_OP)
  add_definitions(-DFUSION_CONVBN_OP)
Z
zhangyang 已提交
408 409
endif()

L
liuruilong 已提交
410
if (CONV_TRANSPOSE_OP)
H
hjchen2 已提交
411
  add_definitions(-DCONV_TRANSPOSE_OP)
L
liuruilong 已提交
412
endif()
xiebaiyuan's avatar
xiebaiyuan 已提交
413 414 415 416 417 418 419 420 421 422 423 424

if (LOOKUP_OP)
  add_definitions(-DLOOKUP_OP)
endif()

if (GRU_OP)
  add_definitions(-DGRU_OP)
endif()

if (CRF_OP)
  add_definitions(-DCRF_OP)
endif()
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440


if (FLATTEN_OP)
  add_definitions(-DFLATTEN_OP)
endif()

if (SPLIT_OP)
  add_definitions(-DSPLIT_OP)
endif()

if (BILINEAR_INTERP_OP)
  add_definitions(-DBILINEAR_INTERP_OP)
endif()

if (SHAPE_OP)
  add_definitions(-DSHAPE_OP)
H
hjchen2 已提交
441
endif()
E
debug  
eclipsess 已提交
442 443 444 445 446 447 448 449

if (ELEMENTWISEMUL_OP)
  add_definitions(-DELEMENTWISEMUL_OP)
endif()
if (SUM_OP)
  add_definitions(-DSUM_OP)
endif()

450 451 452 453 454 455
if (QUANT_OP)
  add_definitions(-DQUANT_OP)
endif()
if (DEQUANT_OP)
  add_definitions(-DDEQUANT_OP)
endif()
456 457 458 459 460 461 462
if (FUSION_DEQUANT_ADD_BN_OP)
  add_definitions(-DFUSION_DEQUANT_ADD_BN_OP)
endif()
if (FUSION_DEQUANT_BN_RELU_OP)
  add_definitions(-DFUSION_DEQUANT_BN_RELU_OP)
endif()
if (FUSION_DEQUANT_ADD_BN_RELU_OP)
H
hjchen2 已提交
463 464
  add_definitions(-DFUSION_DEQUANT_ADD_BN_RELU_OP)
endif()
465

466

Z
zhangyang 已提交
467 468 469 470 471
if (TANH_OP)
  add_definitions(-DTANH_OP)
endif()
if (FUSION_DECONVRELU_OP)
  add_definitions(-DFUSION_DECONVRELU_OP)
qnqinan's avatar
qnqinan 已提交
472 473 474 475 476 477
endif()
if (FUSION_DECONVADD_OP)
  add_definitions(-DFUSION_DECONVADD_OP)
endif()
if (FUSION_DECONVADDRELU_OP)
  add_definitions(-DFUSION_DECONVADDRELU_OP)
H
hjchen2 已提交
478
endif()
479