CMakeLists.txt 13.8 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
  # longer timeout for trt_activation_pass for longer trt optimization time in trt 8
171 172 173 174
  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)
175
  set_tests_properties(test_trt_inference_predictor PROPERTIES TIMEOUT 60)
176
  set_tests_properties(test_trt_inference_fp16_io PROPERTIES TIMEOUT 300)
177 178 179
  if(WITH_MKLDNN)
    set_tests_properties(test_save_optimized_model_pass PROPERTIES TIMEOUT 300)
  endif()
W
wenbin 已提交
180

181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
  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)
202 203
  set_tests_properties(test_trt_conv_quant_dequant_pass PROPERTIES TIMEOUT 180)
  set_tests_properties(test_trt_matmul_quant_dequant PROPERTIES TIMEOUT 450)
204 205 206
  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)
207
  set_tests_properties(test_trt_multiclass_nms3_op PROPERTIES TIMEOUT 60)
208 209 210 211

  if(WITH_MKLDNN
     AND TENSORRT_FOUND
     AND WITH_GPU)
W
wenbin 已提交
212 213 214
    set_tests_properties(test_merge_layernorm_fuse_pass PROPERTIES TIMEOUT 180)
    set_tests_properties(test_skip_merge_layernorm_fuse_pass PROPERTIES TIMEOUT
                                                                        180)
215 216
    set_tests_properties(test_trt_emb_eltwise_layernorm_fuse_pass
                         PROPERTIES TIMEOUT 180)
W
Wang Bojun 已提交
217

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

223
    set_tests_properties(test_simplify_with_basic_ops_pass_autoscan
224
                         PROPERTIES TIMEOUT 480)
225 226
    set_tests_properties(test_adaptive_pool2d_convert_global_pass_autoscan
                         PROPERTIES TIMEOUT 100)
227
    set_tests_properties(test_conv_act_onednn_fuse_pass PROPERTIES TIMEOUT 120)
228 229 230 231
    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)
232 233 234
    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)
235 236 237
    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)
238 239 240
    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 已提交
241 242
    set_tests_properties(test_preln_layernorm_x_fuse_pass PROPERTIES TIMEOUT
                                                                     240)
243 244 245 246 247 248 249 250 251 252 253
    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)
254 255
      set_tests_properties(test_layernorm_shift_partition_pass
                           PROPERTIES TIMEOUT 360)
256 257 258 259 260 261 262 263
    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 已提交
264 265 266 267
      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 已提交
268 269
      set_tests_properties(test_groupnorm_act_pass_fuse_pass PROPERTIES TIMEOUT
                                                                        120)
W
wenbin 已提交
270 271
      set_tests_properties(test_split_layernorm_to_math_ops_pass
                           PROPERTIES TIMEOUT 240)
272
    endif()
273
  endif()
W
Wilber 已提交
274

275
  if(WITH_MKLDNN)
276
    set_tests_properties(test_onednn_conv_bn_fuse_pass PROPERTIES TIMEOUT 120)
277
    set_tests_properties(test_onednn_conv_elementwise_add_fuse_pass
278 279
                         PROPERTIES TIMEOUT 120)
    set_tests_properties(test_mkldnn_depthwise_conv_pass PROPERTIES TIMEOUT 120)
280
    set_tests_properties(test_onednn_reshape_transpose_matmul_fuse_pass
281 282 283 284
                         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)
285
    set_tests_properties(test_conv_act_onednn_fuse_pass PROPERTIES TIMEOUT 120)
286 287
    set_tests_properties(test_conv_transpose_eltwiseadd_bn_fuse_pass
                         PROPERTIES TIMEOUT 250)
288
    set_tests_properties(test_onednn_matmul_transpose_reshape_fuse_pass
289 290 291 292 293 294 295
                         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)
296
    set_tests_properties(test_onednn_batch_norm_act_fuse_pass PROPERTIES TIMEOUT
297 298 299 300 301 302 303 304
                                                                         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)
305 306
    set_tests_properties(test_onednn_fc_activation_fuse_pass PROPERTIES TIMEOUT
                                                                        300)
307 308 309
    set_tests_properties(test_mkldnn_conv_affine_channel_fuse_pass
                         PROPERTIES TIMEOUT 60)
  endif()
Y
YUNSHEN XIE 已提交
310
endif()