CMakeLists.txt 21.7 KB
Newer Older
1 2 3
add_subdirectory(fuse_optimizer_ops_pass)
add_subdirectory(memory_optimize_pass)
add_subdirectory(multi_devices_graph_pass)
4 5 6 7
if(NOT APPLE
   AND NOT WIN32
   AND (WITH_GPU OR WITH_ROCM))
  add_subdirectory(fusion_group)
8
endif()
Y
Yan Chunwei 已提交
9

10
unset(INFER_IR_PASSES CACHE) # clear the global variable
11 12 13 14 15 16 17 18 19 20 21
cc_library(
  node
  SRCS node.cc
  DEPS proto_desc)
cc_library(
  graph
  SRCS graph.cc
  DEPS node pretty_log)
cc_library(
  graph_helper
  SRCS graph_helper.cc
22
  DEPS graph program_utils scale_loss_grad_op_handle
23
       grad_merge_all_reduce_op_handle collective_helper)
24 25 26 27 28 29 30 31 32 33 34
cc_library(
  pass
  SRCS pass.cc
  DEPS graph node graph_helper)
cc_library(
  graph_traits
  SRCS graph_traits.cc
  DEPS graph)
cc_library(
  cost_model
  SRCS cost_model.cc
35
  DEPS executor graph profiler proto_desc phi)
H
Huihuang Zheng 已提交
36

37 38 39
set(GRAPH_PATTERN_DETECTOR_DEPS graph graph_helper graph_traits)
if(WITH_TESTING)
  set(GRAPH_PATTERN_DETECTOR_DEPS ${GRAPH_PATTERN_DETECTOR_DEPS} gtest)
40
endif()
41 42 43 44
cc_library(
  graph_pattern_detector
  SRCS graph_pattern_detector.cc
  DEPS ${GRAPH_PATTERN_DETECTOR_DEPS})
H
Huihuang Zheng 已提交
45

46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
cc_library(
  op_compat_sensible_pass
  SRCS op_compat_sensible_pass.cc
  DEPS graph_pattern_detector op_def_api pass)
cc_library(
  subgraph_detector
  SRCS subgraph_detector.cc
  DEPS graph_pattern_detector executor)
cc_library(
  fuse_pass_base
  SRCS fuse_pass_base.cc
  DEPS op_compat_sensible_pass)
cc_library(
  placement_pass_base
  SRCS placement_pass_base.cc
  DEPS pass)
L
luotao1 已提交
62

63 64 65 66
cc_library(
  coalesce_grad_tensor_pass
  SRCS coalesce_grad_tensor_pass.cc
  DEPS graph graph_helper)
67

Y
Yan Chunwei 已提交
68 69
pass_library(graph_to_program_pass base)
pass_library(graph_viz_pass base)
70
pass_library(lock_free_optimize_pass base DEPS string_helper)
Y
Yan Chunwei 已提交
71 72
pass_library(fc_fuse_pass inference)
pass_library(attention_lstm_fuse_pass inference)
F
feng_shuai 已提交
73
pass_library(vit_attention_fuse_pass inference)
Y
Yan Chunwei 已提交
74
pass_library(fc_lstm_fuse_pass inference)
75
pass_library(embedding_fc_lstm_fuse_pass inference)
76
pass_library(fc_gru_fuse_pass inference)
Y
Yan Chunwei 已提交
77
pass_library(seq_concat_fc_fuse_pass inference)
78
pass_library(multi_batch_merge_pass base)
G
gem5 已提交
79
pass_library(map_op_to_another_pass inference)
S
Sylwester Fraczek 已提交
80
pass_library(conv_bn_fuse_pass inference)
T
tensor-tang 已提交
81
pass_library(seqconv_eltadd_relu_fuse_pass inference)
T
tensor-tang 已提交
82
pass_library(seqpool_concat_fuse_pass inference)
83
pass_library(seqpool_cvm_concat_fuse_pass inference)
T
tensor-tang 已提交
84
pass_library(repeated_fc_relu_fuse_pass inference)
85
pass_library(squared_mat_sub_fuse_pass inference)
86
pass_library(is_test_pass base)
87 88
pass_library(conv_elementwise_add_act_fuse_pass inference)
pass_library(conv_elementwise_add2_act_fuse_pass inference)
N
nhzlx 已提交
89
pass_library(conv_elementwise_add_fuse_pass inference)
90
pass_library(transpose_flatten_concat_fuse_pass inference)
91
pass_library(inplace_op_var_pass inference)
92
pass_library(identity_op_clean_pass base)
Q
qingqing01 已提交
93
pass_library(sync_batch_norm_pass base)
L
luotao1 已提交
94
pass_library(runtime_context_cache_pass base)
N
nhzlx 已提交
95
pass_library(quant_conv2d_dequant_fuse_pass inference)
96
pass_library(shuffle_channel_detect_pass inference)
97
pass_library(delete_quant_dequant_op_pass inference)
98
pass_library(delete_quant_dequant_filter_op_pass inference)
99
pass_library(trt_delete_weight_dequant_linear_op_pass inference)
Z
zhupengyang 已提交
100
pass_library(delete_op_device_pass inference)
101 102
pass_library(delete_weight_dequant_linear_op_pass inference)
pass_library(delete_quant_dequant_linear_op_pass inference)
Z
zhupengyang 已提交
103
pass_library(delete_assign_op_pass inference)
D
denglin-github 已提交
104
pass_library(delete_dropout_op_pass inference)
105
pass_library(delete_concat_op_pass inference)
106
pass_library(preln_residual_bias_fuse_pass inference)
107
pass_library(constant_folding_pass inference)
108
pass_library(auto_mixed_precision_pass inference)
109
pass_library(conv2d_fusion_layout_transfer_pass inference)
110
pass_library(transfer_layout_elim_pass inference)
W
wz1qqx 已提交
111
pass_library(relu6_fuse_pass inference)
112
pass_library(silu_fuse_pass inference)
113
pass_library(simplify_with_basic_ops_pass base)
114
pass_library(fc_elementwise_layernorm_fuse_pass base)
115
pass_library(skip_layernorm_fuse_pass base)
116
pass_library(multihead_matmul_fuse_pass inference)
117
pass_library(multihead_matmul_roformer_fuse_pass inference)
118 119
pass_library(fused_multi_transformer_encoder_pass inference)
pass_library(fused_multi_transformer_decoder_pass inference)
120
pass_library(fuse_multi_transformer_layer_pass inference)
121
pass_library(adaptive_pool2d_convert_global_pass inference)
122
pass_library(yolo_box_fuse_pass inference)
123
pass_library(layer_norm_fuse_pass inference)
124
pass_library(add_support_int8_pass inference)
H
heliqi 已提交
125
pass_library(matmul_scale_fuse_pass inference)
126
pass_library(gpu_cpu_map_matmul_to_mul_pass inference)
127 128
pass_library(dense_fc_to_sparse_pass inference)
pass_library(dense_multihead_matmul_to_sparse_pass inference)
Y
Yuanle Liu 已提交
129
pass_library(delete_cast_op_pass inference)
130
pass_library(delete_elementwise_mul_op_pass inference)
131
pass_library(delete_repeated_ops_pass inference)
132
pass_library(fused_continuous_same_ops_pass inference)
133
pass_library(sigmoid_elementmul_fuse_pass inference)
134 135
pass_library(generate_pass DEPS pass_desc_proto)
target_link_libraries(generate_pass pass_desc_proto)
136 137

if(WITH_TENSORRT)
138
  pass_library(trt_map_ops_to_matrix_multiply_pass inference)
139
  pass_library(trt_multihead_matmul_fuse_pass inference)
140 141
  pass_library(trt_flash_multihead_matmul_fuse_pass inference)
  pass_library(trt_cross_multihead_matmul_fuse_pass inference)
142
  pass_library(trt_qk_multihead_matmul_fuse_pass inference)
143
  pass_library(trt_skip_layernorm_fuse_pass inference)
W
Wang Bojun 已提交
144
  pass_library(merge_layernorm_fuse_pass inference)
145 146 147 148
  pass_library(preln_skip_layernorm_fuse_pass inference)
  pass_library(set_transformer_input_convert_pass inference)
  pass_library(remove_padding_recover_padding_pass inference)
  pass_library(delete_remove_padding_recover_padding_pass inference)
W
wenbin 已提交
149
  pass_library(layernorm_shift_partition_fuse_pass inference)
W
Wang Bojun 已提交
150
  pass_library(reverse_roll_fuse_pass inference)
151
  pass_library(elementwiseadd_transpose_pass inference)
W
wenbin 已提交
152
  pass_library(preln_layernorm_x_fuse_pass inference)
Y
Yuanle Liu 已提交
153
  pass_library(trt_support_nhwc_pass inference)
W
wenbin 已提交
154 155
  pass_library(elementwise_groupnorm_act_pass inference)
  pass_library(preln_elementwise_groupnorm_act_pass inference)
W
wenbin 已提交
156
  pass_library(groupnorm_act_pass inference)
157
  pass_library(trans_layernorm_fuse_pass inference)
158 159
  pass_library(trt_embedding_eltwise_layernorm_fuse_pass inference)
  pass_library(preln_embedding_eltwise_layernorm_fuse_pass inference)
W
wenbin 已提交
160
  pass_library(split_layernorm_to_math_ops_pass inference)
161 162
endif()

163
if(WITH_GPU OR WITH_ROCM)
164 165
  pass_library(cudnn_placement_pass base DEPS placement_pass_base)
  pass_library(embedding_eltwise_layernorm_fuse_pass inference)
166
endif()
167

W
Wojciech Uss 已提交
168
if(WITH_MKLDNN)
169 170 171 172 173 174 175
  pass_library(mkldnn_placement_pass base DEPS placement_pass_base DIR mkldnn)
  pass_library(depthwise_conv_mkldnn_pass base DIR mkldnn)
  pass_library(conv_affine_channel_mkldnn_fuse_pass inference DIR mkldnn)
  pass_library(conv_bias_mkldnn_fuse_pass inference DIR mkldnn)
  pass_library(conv_activation_mkldnn_fuse_pass inference DIR mkldnn)
  pass_library(conv_elementwise_add_mkldnn_fuse_pass inference DIR mkldnn)
  pass_library(int8_scale_calculation_mkldnn_pass inference DIR mkldnn)
176
  pass_library(params_quantization_mkldnn_pass inference DIR mkldnn)
177 178 179 180 181
  pass_library(scale_matmul_fuse_pass inference DIR mkldnn)
  pass_library(cpu_bfloat16_placement_pass inference DIR mkldnn)
  pass_library(cpu_bfloat16_pass inference DIR mkldnn)
  pass_library(fc_mkldnn_pass inference DIR mkldnn)
  pass_library(interpolate_mkldnn_pass inference DIR mkldnn)
S
Sławomir Siwek 已提交
182
  pass_library(softplus_activation_onednn_fuse_pass inference DIR mkldnn)
183 184
  pass_library(shuffle_channel_mkldnn_detect_pass inference DIR mkldnn)
  pass_library(fc_act_mkldnn_fuse_pass inference DIR mkldnn)
185
  pass_library(elementwise_act_onednn_fuse_pass inference DIR mkldnn)
186
  pass_library(matmul_elementwise_add_mkldnn_fuse_pass inference DIR mkldnn)
187
  pass_library(matmul_activation_mkldnn_fuse_pass inference DIR mkldnn)
188
  pass_library(operator_scale_onednn_fuse_pass inference DIR mkldnn)
189
  pass_library(quant_transpose2_dequant_onednn_fuse_pass inference DIR mkldnn)
190
  pass_library(squeeze2_transpose2_onednn_fuse_pass inference DIR mkldnn)
191 192
  pass_library(operator_unsqueeze2_onednn_fuse_pass inference DIR mkldnn)
  pass_library(operator_reshape2_onednn_fuse_pass inference DIR mkldnn)
193 194 195 196
  pass_library(cpu_quantize_placement_pass base DIR mkldnn)
  pass_library(cpu_quantize_pass inference DIR mkldnn)
  pass_library(cpu_quantize_squash_pass inference DIR mkldnn)
  pass_library(reshape_transpose_matmul_mkldnn_fuse_pass inference DIR mkldnn)
197
  pass_library(matmul_transpose_reshape_mkldnn_fuse_pass inference DIR mkldnn)
198 199 200 201 202
  pass_library(batch_norm_act_fuse_pass inference DIR mkldnn)
  pass_library(multi_gru_fuse_pass inference DIR mkldnn)
  pass_library(multi_gru_seq_fuse_pass inference DIR mkldnn)
  pass_library(quant_dequant_mkldnn_pass inference DIR mkldnn)
  pass_library(compute_propagate_scales_mkldnn_pass inference DIR mkldnn)
203 204 205 206 207 208 209
  pass_library(self_attention_fuse_pass inference DIR mkldnn)
  if(WITH_AVX
     AND AVX512F_FOUND
     AND AVX512F_FLAG)
    set_target_properties(self_attention_fuse_pass
                          PROPERTIES COMPILE_FLAGS "-mfma ${AVX512F_FLAG}")
  endif()
W
Wojciech Uss 已提交
210
endif()
211

A
Allen Guo 已提交
212
if(WITH_IPU)
213 214 215 216 217 218 219 220 221 222 223 224
  pass_library(forward_graph_extract_pass base DIR ipu)
  pass_library(optimizer_extract_pass base DIR ipu)
  pass_library(optimizer_state_align_pass base DIR ipu)
  pass_library(ipu_graph_builder_pass base DIR ipu)
  pass_library(ipu_runtime_replacer_pass base DIR ipu)
  pass_library(inference_process_pass base DIR ipu)
  pass_library(inference_postprocess_pass base DIR ipu)
  pass_library(popart_canonicalization_pass base DIR ipu)
  pass_library(ipu_inplace_pass base DIR ipu)
  pass_library(infer_shape_pass base DIR ipu)
  pass_library(delete_scale_op_pass base DIR ipu)
  pass_library(avg_shard_pass base DIR ipu)
225
  pass_library(inference_dtype_transfer_pass base DIR ipu)
A
Allen Guo 已提交
226 227
endif()

228 229
if(WITH_XPU)
  cc_library(
230
    xpu_quant_utils
231
    SRCS xpu/quant_utils.cc
232
    DEPS pass phi)
233 234 235
  cc_library(
    xpu_pass_utils
    SRCS xpu/pass_utils.cc
236
    DEPS pass xpu_quant_utils)
237
  set(XPU_PASS_DEPS xpu_quant_utils xpu_pass_utils)
238 239
  pass_library(cast_mixed_precision_op_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
240
  pass_library(yolo_box_xpu_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
241
  pass_library(conv2d_xpu_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
W
wz1qqx 已提交
242 243
  pass_library(redundant_onnx_ops_elimination_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
244 245
  pass_library(redundant_squeeze_unsqueeze_elimination_pass inference DIR xpu
               DEPS ${XPU_PASS_DEPS})
246 247
  pass_library(conv2d_transpose_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
Z
zhupengyang 已提交
248 249
  pass_library(embedding_with_eltwise_add_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
250
  pass_library(fc_xpu_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
251 252
  pass_library(reshape_unstack_concat_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
253 254
  pass_library(multi_encoder_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
255 256
  pass_library(multi_encoder_xpu_adaptive_seqlen_fuse_pass inference DIR xpu
               DEPS ${XPU_PASS_DEPS})
Z
zhupengyang 已提交
257 258 259 260 261
  pass_library(multi_encoder_xpu_slice_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
  pass_library(generate_sequence_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
  pass_library(link_xpu_op_max_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
262
  pass_library(one_beam_size_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
263 264
  pass_library(delete_isolated_node_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
265
  pass_library(fused_multi_transformer_xpu_pass inference DIR xpu DEPS
266
               ${XPU_PASS_DEPS})
Z
zhupengyang 已提交
267
  pass_library(stack_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
268 269
  pass_library(fused_multi_transformer_cachekv_layout_trans_pass inference DIR
               xpu DEPS ${XPU_PASS_DEPS})
W
wz1qqx 已提交
270 271
  pass_library(add_activation_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
W
wz1qqx 已提交
272 273
  pass_library(add_layernorm_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
274
  pass_library(xpu_delete_cast_op_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
275 276
  pass_library(fold_interp_outsize_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
277 278
  pass_library(fold_two_squeeze2_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
W
wz1qqx 已提交
279
  pass_library(reduce_ops_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
280 281 282
  pass_library(matmul_weight_trans_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
  pass_library(reshape2_matmul_xpu_fuse_pass inference DIR xpu DEPS
               ${XPU_PASS_DEPS})
283
  pass_library(fast_where_xpu_fuse_pass inference DIR xpu DEPS ${XPU_PASS_DEPS})
284 285
endif()

286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
cc_library(
  fuse_bn_act_pass
  SRCS fuse_bn_act_pass.cc
  DEPS pass graph_pattern_detector)
cc_library(
  fuse_bn_add_act_pass
  SRCS fuse_bn_add_act_pass.cc
  DEPS pass graph_pattern_detector)
cc_library(
  fuse_elewise_add_act_pass
  SRCS fuse_elewise_add_act_pass.cc
  DEPS pass graph_pattern_detector)
cc_library(
  fuse_gemm_epilogue_pass
  SRCS fuse_gemm_epilogue_pass.cc
  DEPS pass graph_pattern_detector)
302 303 304 305
cc_library(
  fused_attention_pass
  SRCS fused_attention_pass.cc
  DEPS pass graph_pattern_detector)
306 307 308 309
cc_library(
  fuse_relu_depthwise_conv_pass
  SRCS fuse_relu_depthwise_conv_pass.cc
  DEPS pass graph_pattern_detector)
Y
yuehuayingxueluo 已提交
310 311 312 313
cc_library(
  fuse_adamw_op_pass
  SRCS fuse_adamw_op_pass.cc
  DEPS pass graph_pattern_detector)
314 315 316 317
cc_library(
  fused_feedforward_pass
  SRCS fused_feedforward_pass.cc
  DEPS pass graph_pattern_detector)
318 319

set(GLOB_PASS_LIB
320
    ${INFER_IR_PASSES}
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
    CACHE INTERNAL "Global PASS library")

cc_library(
  pass_builder
  SRCS pass_builder.cc
  DEPS pass)
cc_library(
  pass_test_util
  SRCS pass_test_util.cc
  DEPS graph pass)

cc_test(
  node_test
  SRCS node_test.cc
  DEPS node)
cc_test(
  pass_test
  SRCS pass_test.cc
  DEPS graph pass graph_helper)
cc_test(
  graph_test
  SRCS graph_test.cc
  DEPS graph graph_helper op_registry)
cc_test(
  graph_helper_test
  SRCS graph_helper_test.cc
  DEPS graph graph_helper op_registry)
cc_test(
  graph_to_program_pass_test
  SRCS graph_to_program_pass_test.cc
  DEPS graph_to_program_pass)
cc_test(
  cost_model_test
  SRCS cost_model_test.cc
  DEPS cost_model op_registry)
cc_test(
  test_graph_pattern_detector
  SRCS graph_pattern_detector_tester.cc
  DEPS graph_pattern_detector)
cc_test(
  test_op_compat_sensible_pass
  SRCS op_compat_sensible_pass_tester.cc
  DEPS op_compat_sensible_pass)
cc_test(
  test_fc_fuse_pass_cc
  SRCS fc_fuse_pass_tester.cc
  DEPS fc_fuse_pass framework_proto)
cc_test(
  test_fc_lstm_fuse_pass_cc
  SRCS fc_lstm_fuse_pass_tester.cc
  DEPS fc_lstm_fuse_pass framework_proto)
cc_test(
  test_fc_gru_fuse_pass_cc
  SRCS fc_gru_fuse_pass_tester.cc
  DEPS fc_gru_fuse_pass framework_proto)
cc_test(
  test_seqpool_concat_fuse_pass
  SRCS seqpool_concat_fuse_pass_tester.cc
  DEPS seqpool_concat_fuse_pass framework_proto)
cc_test(
  test_seqpool_cvm_concat_fuse_pass
  SRCS seqpool_cvm_concat_fuse_pass_tester.cc
  DEPS seqpool_cvm_concat_fuse_pass framework_proto)
cc_test(
  test_repeated_fc_relu_fuse_pass_cc
  SRCS repeated_fc_relu_fuse_pass_tester.cc
  DEPS repeated_fc_relu_fuse_pass framework_proto)
cc_test(
  test_is_test_pass
  SRCS is_test_pass_tester.cc
  DEPS is_test_pass)
cc_test(
  test_simplify_with_basic_ops_pass
  SRCS simplify_with_basic_ops_pass_tester.cc
  DEPS simplify_with_basic_ops_pass)
cc_test(
  test_fc_elementwise_layernorm_fuse_pass_cc
  SRCS fc_elementwise_layernorm_fuse_pass_tester.cc
  DEPS fc_elementwise_layernorm_fuse_pass)
cc_test(
  test_skip_layernorm_fuse_pass
  SRCS skip_layernorm_fuse_pass_tester.cc
  DEPS skip_layernorm_fuse_pass)
cc_test(
  test_multihead_matmul_fuse_pass
  SRCS multihead_matmul_fuse_pass_tester.cc
  DEPS multihead_matmul_fuse_pass)
408 409 410 411 412 413 414 415
cc_test(
  test_fused_multi_transformer_encoder_pass
  SRCS fused_multi_transformer_encoder_pass_tester.cc
  DEPS fused_multi_transformer_encoder_pass)
cc_test(
  test_fused_multi_transformer_decoder_pass
  SRCS fused_multi_transformer_decoder_pass_tester.cc
  DEPS fused_multi_transformer_decoder_pass)
416 417 418 419
cc_test(
  test_fuse_multi_transformer_layer_pass
  SRCS fuse_multi_transformer_layer_pass_tester.cc
  DEPS fuse_multi_transformer_layer_pass)
420 421 422 423 424 425 426 427 428 429 430 431
cc_test(
  test_conv_bn_fuse_pass_cc
  SRCS conv_bn_fuse_pass_tester.cc
  DEPS conv_bn_fuse_pass)
cc_test(
  test_adaptive_pool2d_convert_global_pass
  SRCS adaptive_pool2d_convert_global_pass_tester.cc
  DEPS adaptive_pool2d_convert_global_pass)
cc_test(
  test_generate_pass_cc
  SRCS generate_pass_tester.cc
  DEPS generate_pass pass_desc_proto)
Z
zhupengyang 已提交
432 433 434 435
cc_test(
  test_delete_op_device_pass
  SRCS delete_op_device_pass_test.cc
  DEPS delete_op_device_pass)
Z
zhupengyang 已提交
436 437 438 439
cc_test(
  test_delete_assign_op_pass_cc
  SRCS delete_assign_op_pass_test.cc
  DEPS delete_assign_op_pass)
440 441 442 443
cc_test(
  test_identity_op_clean_pass_cc
  SRCS identity_op_clean_pass_test.cc
  DEPS identity_op_clean_pass)
444 445 446 447
cc_test(
  test_delete_dropout_pass_cc
  SRCS delete_dropout_op_pass_test.cc
  DEPS delete_dropout_op_pass)
448 449 450 451
cc_test(
  test_delete_dequant_weight_linear_op_pass
  SRCS delete_weight_dequant_linear_op_pass_tester.cc
  DEPS delete_weight_dequant_linear_op_pass)
Y
Yuanle Liu 已提交
452 453 454 455
cc_test(
  test_delete_cast_op_pass
  SRCS delete_cast_op_pass_test.cc
  DEPS delete_cast_op_pass)
W
wz1qqx 已提交
456 457 458 459
cc_test(
  test_relu6_fuse_pass
  SRCS relu6_fuse_pass_test.cc
  DEPS relu6_fuse_pass)
Y
Yuanle Liu 已提交
460

461
if(WITH_GPU OR WITH_ROCM)
462 463 464 465 466 467 468 469
  cc_test(
    test_embedding_eltwise_layernorm_fuse_pass
    SRCS embedding_eltwise_layernorm_fuse_pass_tester.cc
    DEPS embedding_eltwise_layernorm_fuse_pass)
  cc_test(
    test_cudnn_placement_pass
    SRCS cudnn_placement_pass_tester.cc
    DEPS cudnn_placement_pass)
470
endif()
Q
qingqing01 已提交
471
if(NOT WIN32)
472 473 474 475
  cc_test(
    test_sync_batch_norm_pass
    SRCS sync_batch_norm_pass_tester.cc
    DEPS sync_batch_norm_pass)
476 477 478 479 480 481 482 483
  cc_test(
    test_dense_fc_to_sparse_pass_cc
    SRCS dense_fc_to_sparse_pass_tester.cc
    DEPS fc_fuse_pass dense_fc_to_sparse_pass framework_proto)
  cc_test(
    test_dense_multihead_matmul_to_sparse_pass
    SRCS dense_multihead_matmul_to_sparse_pass_tester.cc
    DEPS multihead_matmul_fuse_pass dense_multihead_matmul_to_sparse_pass)
Q
qingqing01 已提交
484
endif()
485 486 487 488 489
if(WITH_MKLDNN)
  cc_test(
    test_depthwise_conv_mkldnn_pass
    SRCS mkldnn/depthwise_conv_mkldnn_pass_tester.cc
    DEPS depthwise_conv_mkldnn_pass)
490 491 492 493 494 495 496 497
  cc_test_old(
    test_int8_scale_calculation_mkldnn_pass SRCS
    mkldnn/int8_scale_calculation_mkldnn_pass_tester.cc DEPS
    int8_scale_calculation_mkldnn_pass pass_test_util)
  cc_test_old(
    test_params_quantization_mkldnn_pass SRCS
    mkldnn/params_quantization_mkldnn_pass_tester.cc DEPS
    params_quantization_mkldnn_pass)
498 499 500 501
  set(TEST_CONV_BN_PASS_DEPS
      conv_bn_fuse_pass
      graph_to_program_pass
      batch_norm_op
502
      generated_op
503
      generated_static_op
504 505 506 507 508
      activation_op
      elementwise_add_op
      concat_and_split
      naive_executor
      device_context
509
      phi)
510
  if(WITH_GPU OR WITH_ROCM)
511
    set(TEST_CONV_BN_PASS_DEPS ${TEST_CONV_BN_PASS_DEPS} depthwise_conv)
512 513 514 515 516 517 518 519 520
  endif()
  cc_test(
    test_mkldnn_placement_pass
    SRCS mkldnn/mkldnn_placement_pass_tester.cc
    DEPS mkldnn_placement_pass)
  cc_test(
    test_compute_propagate_scales_mkldnn_pass
    SRCS mkldnn/compute_propagate_scales_mkldnn_pass_tester.cc
    DEPS compute_propagate_scales_mkldnn_pass naive_executor)
521 522 523 524 525 526 527

  if(WITH_ONNXRUNTIME AND WIN32)
    # Copy onnxruntime for some c++ test in Windows, since the test will
    # be build only in CI, so suppose the generator in Windows is Ninja.
    copy_onnx(test_compute_propagate_scales_mkldnn_pass)
  endif()

528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551
  cc_test(
    test_cpu_quantize_placement_pass
    SRCS mkldnn/cpu_quantize_placement_pass_tester.cc
    DEPS cpu_quantize_placement_pass)
  cc_test(
    test_cpu_quantize_pass
    SRCS mkldnn/cpu_quantize_pass_tester.cc
    DEPS cpu_quantize_pass naive_executor)
  cc_test(
    test_cpu_quantize_squash_pass
    SRCS mkldnn/cpu_quantize_squash_pass_tester.cc
    DEPS cpu_quantize_squash_pass naive_executor)
  cc_test(
    test_shuffle_channel_mkldnn_detect_pass
    SRCS mkldnn/shuffle_channel_mkldnn_detect_pass_tester.cc
    DEPS shuffle_channel_mkldnn_detect_pass)
  cc_test(
    test_cpu_bfloat16_placement_pass
    SRCS mkldnn/cpu_bfloat16_placement_pass_tester.cc
    DEPS cpu_bfloat16_placement_pass)
  cc_test(
    test_cpu_bfloat16_pass
    SRCS mkldnn/cpu_bfloat16_pass_tester.cc
    DEPS cpu_bfloat16_pass)
552
endif()
553 554

if(WITH_XPU)
555 556 557 558
  cc_test(
    test_cast_mixed_precision_op_fuse_pass
    SRCS xpu/cast_mixed_precision_op_fuse_pass_test.cc
    DEPS cast_mixed_precision_op_fuse_pass)
559 560 561 562
  cc_test(
    test_delete_isolated_node_pass
    SRCS xpu/delete_isolated_node_pass_test.cc
    DEPS delete_isolated_node_pass)
563
  cc_test(
564 565 566
    test_fused_multi_transformer_xpu_pass
    SRCS xpu/fused_multi_transformer_xpu_pass_tester.cc
    DEPS fused_multi_transformer_xpu_pass)
567 568 569 570
  cc_test(
    test_one_beam_size_fuse_pass
    SRCS xpu/one_beam_size_fuse_pass_test.cc
    DEPS one_beam_size_fuse_pass)
Z
zhupengyang 已提交
571 572 573 574
  cc_test(
    test_stack_fuse_pass
    SRCS xpu/stack_fuse_pass_test.cc
    DEPS stack_fuse_pass)
575 576 577 578
  cc_test(
    test_fused_multi_transformer_cachekv_layout_trans_pass
    SRCS xpu/fused_multi_transformer_cachekv_layout_trans_pass_test.cc
    DEPS fused_multi_transformer_cachekv_layout_trans_pass)
579 580 581 582
  cc_test(
    test_multi_encoder_xpu_adaptive_seqlen_fuse_pass
    SRCS xpu/multi_encoder_xpu_adaptive_seqlen_fuse_pass_test.cc
    DEPS multi_encoder_xpu_adaptive_seqlen_fuse_pass)
583 584 585 586
  cc_test(
    test_xpu_delete_cast_op_pass
    SRCS xpu/xpu_delete_cast_op_pass_test.cc
    DEPS xpu_delete_cast_op_pass)
587 588 589 590
  cc_test(
    test_fold_interp_outsize_fuse_pass
    SRCS xpu/fold_interp_outsize_fuse_pass_test.cc
    DEPS fold_interp_outsize_fuse_pass)
591 592 593 594 595 596 597 598 599 600 601 602
  cc_test(
    test_fold_two_squeeze2_fuse_pass
    SRCS xpu/fold_two_squeeze2_fuse_pass_test.cc
    DEPS fold_two_squeeze2_fuse_pass)
  cc_test(
    test_matmul_weight_trans_pass
    SRCS xpu/matmul_weight_trans_pass_test.cc
    DEPS matmul_weight_trans_pass)
  cc_test(
    test_reshape2_matmul_xpu_fuse_pass
    SRCS xpu/reshape2_matmul_xpu_fuse_pass_test.cc
    DEPS reshape2_matmul_xpu_fuse_pass)
603 604 605 606
  cc_test(
    test_fast_where_xpu_fuse_pass
    SRCS xpu/fast_where_xpu_fuse_pass_test.cc
    DEPS fast_where_xpu_fuse_pass)
607
endif()