CMakeLists.txt 14.0 KB
Newer Older
1 2 3 4
file(
  GLOB TEST_INFERENCE_IR_PASSES
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_*.py")
5 6
string(REPLACE ".py" "" TEST_INFERENCE_IR_PASSES "${TEST_INFERENCE_IR_PASSES}")

7 8 9 10
file(
  GLOB TEST_TRT_IR_PASSES
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_trt_*.py")
11
string(REPLACE ".py" "" TEST_TRT_IR_PASSES "${TEST_TRT_IR_PASSES}")
W
Wilber 已提交
12

13 14 15 16
file(
  GLOB TEST_TRT_CONVERTER
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_trt_convert_*.py")
W
Wilber 已提交
17 18
string(REPLACE ".py" "" TEST_TRT_CONVERTER "${TEST_TRT_CONVERTER}")

19 20 21 22 23 24 25
if(NOT WITH_DISTRIBUTE)
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES "test_delete_c_identity_op_pass")
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES "test_trt_convert_c_allreduce")
  list(REMOVE_ITEM TEST_TRT_IR_PASSES "test_trt_convert_c_allreduce")
  list(REMOVE_ITEM TEST_TRT_CONVERTER "test_trt_convert_c_allreduce")
endif()

26 27 28
if(WIN32)
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES
       "test_trt_convert_fused_token_prune")
W
wenbin 已提交
29 30 31 32
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES
       "test_preln_groupnorm_act_fuse_pass")
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES
       "test_element_groupnorm_act_fuse_pass")
W
wenbin 已提交
33
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES "test_groupnorm_act_pass_fuse_pass")
34 35 36
  list(REMOVE_ITEM TEST_TRT_IR_PASSES "test_trt_convert_trans_layernorm")
  list(REMOVE_ITEM TEST_TRT_CONVERTER "test_trt_convert_trans_layernorm")
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES "test_trt_convert_trans_layernorm")
37 38
  list(REMOVE_ITEM TEST_TRT_IR_PASSES "test_trt_convert_fused_token_prune")
  list(REMOVE_ITEM TEST_TRT_CONVERTER "test_trt_convert_fused_token_prune")
39 40 41 42 43 44
  list(REMOVE_ITEM TEST_TRT_IR_PASSES
       "test_trt_convert_elementwiseadd_transpose")
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES
       "test_trt_convert_elementwiseadd_transpose")
  list(REMOVE_ITEM TEST_TRT_CONVERTER
       "test_trt_convert_elementwiseadd_transpose")
W
wenbin 已提交
45 46
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES
       "test_split_layernorm_to_math_ops_pass")
47 48
endif()

B
baoachun 已提交
49
# Only for cpu(mkl + openblas)
B
baoachun 已提交
50
set(TEST_INFERENCE_CPU_UT "test_mul_lstm_fuse_pass" "test_mul_gru_fuse_pass")
B
baoachun 已提交
51 52 53 54 55

foreach(CPU_UT ${TEST_INFERENCE_CPU_UT})
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES ${CPU_UT})
endforeach()

56 57 58 59 60
foreach(TEST_INFERENCE_IR_PASS ${TEST_TRT_IR_PASSES})
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES ${TEST_INFERENCE_IR_PASS})
endforeach()

if(WITH_GPU AND TENSORRT_FOUND)
W
Wangzheee 已提交
61
  list(REMOVE_ITEM TEST_TRT_IR_PASSES test_trt_multiclass_nms_op)
W
Wilber 已提交
62 63 64 65 66

  foreach(TRT_CONVERT ${TEST_TRT_CONVERTER})
    list(REMOVE_ITEM TEST_TRT_IR_PASSES ${TRT_CONVERT})
  endforeach()

67
  foreach(target ${TEST_TRT_IR_PASSES})
S
Shang Zhizhou 已提交
68
    if(${target} STREQUAL "test_trt_slice_dynamic_plugin")
69 70
      if("${TENSORRT_MAJOR_VERSION}.${TENSORRT_MINOR_VERSION}" VERSION_GREATER
         "7.1")
S
Shang Zhizhou 已提交
71 72
        py_test_modules(${target} MODULES ${target})
        set_tests_properties(${target} PROPERTIES TIMEOUT 60)
Y
YUNSHEN XIE 已提交
73
        set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
S
Shang Zhizhou 已提交
74 75 76
      endif()
    else()
      py_test_modules(${target} MODULES ${target})
Y
YUNSHEN XIE 已提交
77
      set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
S
Shang Zhizhou 已提交
78
    endif()
79
  endforeach()
W
Wilber 已提交
80 81 82

  foreach(target ${TEST_TRT_CONVERTER})
    py_test_modules(${target} MODULES ${target})
83
    set_tests_properties(${target} PROPERTIES TIMEOUT 300)
Y
YUNSHEN XIE 已提交
84
    set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
W
Wilber 已提交
85
  endforeach()
86 87
endif()

88 89 90 91
file(
  GLOB TEST_MKLDNN_IR_PASSES
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_mkldnn_*.py")
92 93 94 95 96
string(REPLACE ".py" "" TEST_MKLDNN_IR_PASSES "${TEST_MKLDNN_IR_PASSES}")
foreach(TEST_INFERENCE_IR_PASS ${TEST_MKLDNN_IR_PASSES})
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES ${TEST_INFERENCE_IR_PASS})
endforeach()

97 98 99 100 101 102 103 104 105
file(
  GLOB TEST_ONEDNN_IR_PASSES
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_onednn_*.py")
string(REPLACE ".py" "" TEST_ONEDNN_IR_PASSES "${TEST_ONEDNN_IR_PASSES}")
foreach(TEST_INFERENCE_IR_PASS ${TEST_ONEDNN_IR_PASSES})
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES ${TEST_INFERENCE_IR_PASS})
endforeach()

106 107 108
if(WITH_MKLDNN)
  foreach(target ${TEST_MKLDNN_IR_PASSES})
    py_test_modules(${target} MODULES ${target})
Y
YUNSHEN XIE 已提交
109
    set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
110
  endforeach()
111 112 113 114 115

  foreach(target ${TEST_ONEDNN_IR_PASSES})
    py_test_modules(${target} MODULES ${target})
    set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
  endforeach()
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
endif()

file(
  GLOB TEST_XPU_IR_PASSES
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_xpu_*.py")
string(REPLACE ".py" "" TEST_XPU_IR_PASSES "${TEST_XPU_IR_PASSES}")
foreach(TEST_XPU_IR_PASS ${TEST_XPU_IR_PASSES})
  list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES ${TEST_XPU_IR_PASS})
endforeach()

if(WITH_XPU)
  foreach(target ${TEST_XPU_IR_PASSES})
    py_test_modules(${target} MODULES ${target})
    set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
131 132 133
  endforeach()
endif()

134 135 136 137 138 139 140 141 142 143 144 145 146
# below are cutlass unitests
file(
  GLOB TEST_CUTLASS
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_cutlass_*.py")
string(REPLACE ".py" "" TEST_CUTLASS "${TEST_CUTLASS}")
list(REMOVE_ITEM TEST_INFERENCE_IR_PASSES ${TEST_CUTLASS})
if(WITH_CUTLASS)
  foreach(target ${TEST_CUTLASS})
    py_test_modules(${target} MODULES ${target})
  endforeach()
endif()

147 148 149
if(WITH_MKLDNN
   AND TENSORRT_FOUND
   AND WITH_GPU)
150 151
  foreach(target ${TEST_INFERENCE_IR_PASSES})
    py_test_modules(${target} MODULES ${target})
Y
YUNSHEN XIE 已提交
152
    set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
153 154 155
  endforeach()
endif()

156 157 158
if(NOT WITH_MKLDNN
   AND NOT TENSORRT_FOUND
   AND NOT WITH_GPU)
B
baoachun 已提交
159 160
  foreach(target ${TEST_INFERENCE_CPU_UT})
    py_test_modules(${target} MODULES ${target})
Y
YUNSHEN XIE 已提交
161
    set_tests_properties(${target} PROPERTIES LABELS "RUN_TYPE=INFER")
B
baoachun 已提交
162 163
  endforeach()

164 165
  set_tests_properties(test_mul_lstm_fuse_pass PROPERTIES TIMEOUT 300)
  set_tests_properties(test_mul_gru_fuse_pass PROPERTIES TIMEOUT 300)
B
baoachun 已提交
166 167
endif()

Y
YUNSHEN XIE 已提交
168
if(WITH_GPU AND TENSORRT_FOUND)
169
  set_tests_properties(test_trt_subgraph_pass PROPERTIES TIMEOUT 120)
170 171
  # longer timeout for trt_activation_pass for longer trt optimization time in trt 8
  set_tests_properties(test_trt_activation_pass PROPERTIES TIMEOUT 250)
172 173 174 175
  set_tests_properties(test_trt_conv_pass PROPERTIES TIMEOUT 120)
  #set_tests_properties(test_trt_multiclass_nms_op PROPERTIES TIMEOUT 200)
  set_tests_properties(test_trt_dynamic_shape PROPERTIES TIMEOUT 120)
  set_tests_properties(test_trt_inspector PROPERTIES TIMEOUT 60)
176
  set_tests_properties(test_trt_inference_predictor PROPERTIES TIMEOUT 60)
177
  set_tests_properties(test_trt_inference_fp16_io PROPERTIES TIMEOUT 300)
W
wenbin 已提交
178

179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
  if(WITH_NV_JETSON)
    set_tests_properties(
      test_trt_pool_op
      PROPERTIES ENVIRONMENT FLAGS_fraction_of_gpu_memory_to_use=0.1 TIMEOUT
                 450)
    set_tests_properties(
      test_trt_pool3d_op
      PROPERTIES ENVIRONMENT FLAGS_fraction_of_gpu_memory_to_use=0.1 TIMEOUT
                 450)
  else()
    set_tests_properties(
      test_trt_pool_op
      PROPERTIES ENVIRONMENT FLAGS_fraction_of_gpu_memory_to_use=0.1 TIMEOUT
                 300)
    set_tests_properties(
      test_trt_pool3d_op
      PROPERTIES ENVIRONMENT FLAGS_fraction_of_gpu_memory_to_use=0.1 TIMEOUT 45)
  endif()
  set_tests_properties(test_trt_tile_op PROPERTIES TIMEOUT 60)
  set_tests_properties(test_trt_fc_fuse_quant_dequant_pass PROPERTIES TIMEOUT
                                                                      100)
200 201
  set_tests_properties(test_trt_conv_quant_dequant_pass PROPERTIES TIMEOUT 180)
  set_tests_properties(test_trt_matmul_quant_dequant PROPERTIES TIMEOUT 450)
202 203 204
  set_tests_properties(test_trt_conv3d_op PROPERTIES TIMEOUT 60)
  set_tests_properties(test_trt_conv3d_transpose_op PROPERTIES TIMEOUT 60)
  set_tests_properties(test_trt_nearest_interp_v2_op PROPERTIES TIMEOUT 30)
205
  set_tests_properties(test_trt_multiclass_nms3_op PROPERTIES TIMEOUT 60)
206 207 208 209

  if(WITH_MKLDNN
     AND TENSORRT_FOUND
     AND WITH_GPU)
W
wenbin 已提交
210 211 212
    set_tests_properties(test_merge_layernorm_fuse_pass PROPERTIES TIMEOUT 180)
    set_tests_properties(test_skip_merge_layernorm_fuse_pass PROPERTIES TIMEOUT
                                                                        180)
213 214
    set_tests_properties(test_emb_eltwise_layernorm_fuse_pass PROPERTIES TIMEOUT
                                                                         120)
W
Wang Bojun 已提交
215

216
    set_tests_properties(test_fc_fuse_pass PROPERTIES TIMEOUT 240)
W
Wang Bojun 已提交
217
    set_tests_properties(test_reverse_roll_fuse_pass PROPERTIES TIMEOUT 120)
218
    set_tests_properties(test_inplace_op_pass PROPERTIES TIMEOUT 120)
219
    set_tests_properties(test_transfer_layout_elim_pass PROPERTIES TIMEOUT 300)
W
Wang Bojun 已提交
220

221
    set_tests_properties(test_simplify_with_basic_ops_pass_autoscan
222
                         PROPERTIES TIMEOUT 240)
223 224
    set_tests_properties(test_adaptive_pool2d_convert_global_pass_autoscan
                         PROPERTIES TIMEOUT 100)
225
    set_tests_properties(test_conv_act_onednn_fuse_pass PROPERTIES TIMEOUT 120)
226 227 228 229
    set_tests_properties(test_conv_elementwise_add2_act_fuse_pass
                         PROPERTIES TIMEOUT 120)
    set_tests_properties(test_conv_elementwise_add_act_fuse_pass
                         PROPERTIES TIMEOUT 120)
230 231 232
    set_tests_properties(test_onednn_conv_bias_fuse_pass PROPERTIES TIMEOUT 300)
    set_tests_properties(test_onednn_conv_concat_activation_fuse_pass
                         PROPERTIES TIMEOUT 300)
233 234 235
    set_tests_properties(test_onednn_multi_gru_fuse_pass PROPERTIES TIMEOUT 120)
    set_tests_properties(test_onednn_multi_gru_seq_fuse_pass PROPERTIES TIMEOUT
                                                                        120)
236 237 238
    set_tests_properties(test_flatten2_matmul_fuse_pass PROPERTIES TIMEOUT 240)
    set_tests_properties(test_squeeze2_matmul_fuse_pass PROPERTIES TIMEOUT 240)
    set_tests_properties(test_reshape2_matmul_fuse_pass PROPERTIES TIMEOUT 240)
W
wenbin 已提交
239 240
    set_tests_properties(test_preln_layernorm_x_fuse_pass PROPERTIES TIMEOUT
                                                                     240)
241 242 243 244 245 246 247 248 249 250 251
    set_tests_properties(test_shuffle_channel_detect_pass PROPERTIES TIMEOUT
                                                                     120)
    if(WIN32)
      set_tests_properties(test_matmul_scale_fuse_pass PROPERTIES TIMEOUT 300)
      set_tests_properties(test_matmul_v2_scale_fuse_pass PROPERTIES TIMEOUT
                                                                     300)
      set_tests_properties(test_map_matmul_v2_to_matmul_pass PROPERTIES TIMEOUT
                                                                        360)
      set_tests_properties(test_map_matmul_v2_to_mul_pass PROPERTIES TIMEOUT
                                                                     360)
      set_tests_properties(test_map_matmul_to_mul_pass PROPERTIES TIMEOUT 360)
252 253
      set_tests_properties(test_layernorm_shift_partition_pass
                           PROPERTIES TIMEOUT 360)
254 255 256 257 258 259 260 261
    else()
      set_tests_properties(test_matmul_scale_fuse_pass PROPERTIES TIMEOUT 60)
      set_tests_properties(test_matmul_v2_scale_fuse_pass PROPERTIES TIMEOUT 60)
      set_tests_properties(test_map_matmul_v2_to_matmul_pass PROPERTIES TIMEOUT
                                                                        120)
      set_tests_properties(test_map_matmul_v2_to_mul_pass PROPERTIES TIMEOUT
                                                                     120)
      set_tests_properties(test_map_matmul_to_mul_pass PROPERTIES TIMEOUT 120)
W
wenbin 已提交
262 263 264 265
      set_tests_properties(test_element_groupnorm_act_fuse_pass
                           PROPERTIES TIMEOUT 120)
      set_tests_properties(test_preln_groupnorm_act_fuse_pass PROPERTIES TIMEOUT
                                                                         120)
W
wenbin 已提交
266 267
      set_tests_properties(test_groupnorm_act_pass_fuse_pass PROPERTIES TIMEOUT
                                                                        120)
W
wenbin 已提交
268 269
      set_tests_properties(test_split_layernorm_to_math_ops_pass
                           PROPERTIES TIMEOUT 240)
270
    endif()
271
  endif()
W
Wilber 已提交
272

273
  if(WITH_MKLDNN)
274
    set_tests_properties(test_onednn_conv_bn_fuse_pass PROPERTIES TIMEOUT 120)
275
    set_tests_properties(test_onednn_conv_elementwise_add_fuse_pass
276 277
                         PROPERTIES TIMEOUT 120)
    set_tests_properties(test_mkldnn_depthwise_conv_pass PROPERTIES TIMEOUT 120)
278
    set_tests_properties(test_onednn_reshape_transpose_matmul_fuse_pass
279 280 281 282
                         PROPERTIES TIMEOUT 100)
    set_tests_properties(test_mkldnn_mish_op PROPERTIES TIMEOUT 300)
    set_tests_properties(test_mkldnn_conv3d_op PROPERTIES TIMEOUT 300)
    set_tests_properties(test_mkldnn_prelu_op PROPERTIES TIMEOUT 300)
283
    set_tests_properties(test_conv_act_onednn_fuse_pass PROPERTIES TIMEOUT 120)
284 285
    set_tests_properties(test_conv_transpose_eltwiseadd_bn_fuse_pass
                         PROPERTIES TIMEOUT 250)
286
    set_tests_properties(test_onednn_matmul_transpose_reshape_fuse_pass
287 288 289 290 291 292 293
                         PROPERTIES TIMEOUT 100)
    set_tests_properties(test_conv_transpose_bn_fuse_pass PROPERTIES TIMEOUT
                                                                     300)
    set_tests_properties(test_mkldnn_conv_hard_sigmoid_fuse_pass
                         PROPERTIES TIMEOUT 300)
    set_tests_properties(test_mkldnn_conv_hard_swish_fuse_pass
                         PROPERTIES TIMEOUT 300)
294
    set_tests_properties(test_onednn_batch_norm_act_fuse_pass PROPERTIES TIMEOUT
295 296 297 298 299 300 301 302
                                                                         100)
    set_tests_properties(test_mkldnn_matmul_v2_transpose_reshape_fuse_pass
                         PROPERTIES TIMEOUT 100)
    set_tests_properties(test_mkldnn_conv_transpose_bias_fuse_pass
                         PROPERTIES TIMEOUT 100)
    set_tests_properties(test_conv_eltwiseadd_bn_fuse_pass PROPERTIES TIMEOUT
                                                                      300)
    set_tests_properties(test_mkldnn_conv_mish_fuse_pass PROPERTIES TIMEOUT 300)
303 304
    set_tests_properties(test_onednn_fc_activation_fuse_pass PROPERTIES TIMEOUT
                                                                        300)
305
    set_tests_properties(test_onednn_fc_elementwise_add_fuse_pass
306 307 308 309
                         PROPERTIES TIMEOUT 120)
    set_tests_properties(test_mkldnn_conv_affine_channel_fuse_pass
                         PROPERTIES TIMEOUT 60)
  endif()
Y
YUNSHEN XIE 已提交
310
endif()