@@ -70,15 +70,12 @@ bool IsDynamicShapeOp(const framework::OpDesc& desc) {
7070// Just tell by the op_types.
7171struct SimpleOpTypeSetTeller : public Teller {
7272 SimpleOpTypeSetTeller () { // NOLINT
73- #if IS_TRT_VERSION_GE(7130)
7473 // use TensorRT plugin
7574 teller_set.insert (" group_norm" );
7675 teller_set.insert (" multiclass_nms3" );
7776 teller_set.insert (" multiclass_nms" );
7877 int8_teller_set.insert (" multiclass_nms3" );
7978 int8_teller_set.insert (" multiclass_nms" );
80- #endif
81- #if IS_TRT_VERSION_GE(7000)
8279 teller_set.insert (" tile" );
8380 int8_teller_set.insert (" tile" );
8481 teller_set.insert (" flatten_contiguous_range" );
@@ -87,17 +84,14 @@ struct SimpleOpTypeSetTeller : public Teller {
8784 int8_teller_set.insert (" rnn" );
8885 teller_set.insert (" fill_constant_batch_size_like" );
8986 int8_teller_set.insert (" fill_constant_batch_size_like" );
90- #endif
9187 teller_set.insert (" reshape" );
9288 teller_set.insert (" reshape2" );
9389 int8_teller_set.insert (" reshape" );
9490 int8_teller_set.insert (" reshape2" );
95- #if IS_TRT_VERSION_GE(8000)
9691 teller_set.insert (" sparse_fc" );
9792 int8_teller_set.insert (" sparse_fc" );
9893 teller_set.insert (" sparse_multihead_matmul" );
9994 int8_teller_set.insert (" sparse_multihead_matmul" );
100- #endif
10195#if IS_TRT_VERSION_GE(8522)
10296 teller_set.insert (" flash_multihead_matmul" );
10397 int8_teller_set.insert (" flash_multihead_matmul" );
@@ -193,12 +187,6 @@ struct SimpleOpTypeSetTeller : public Teller {
193187 " the pass." ;
194188 return false ;
195189 }
196- #if !IS_TRT_VERSION_GE(7000)
197- if (op_type == " erf" ) {
198- VLOG (3 ) << op_type << " op does not support tensorrt." ;
199- return false ;
200- }
201- #endif
202190 auto x_var_name = desc.Input (" X" )[0 ];
203191 auto * x_var_desc = block->FindVarRecursive (x_var_name);
204192 auto x_dtype = x_var_desc->GetDataType ();
@@ -345,26 +333,6 @@ struct SimpleOpTypeSetTeller : public Teller {
345333 return false ;
346334 }
347335
348- // strides > 1 and 'SAME' is only supported by trt7.0 above
349- #if !IS_TRT_VERSION_GE(7000)
350- if (op_type == " conv2d" || op_type == " fused_conv2d_add_act" ||
351- op_type == " depthwise_conv2d" ) {
352- if (desc.HasAttr (" padding_algorithm" ) && with_dynamic_shape) {
353- auto padding_algorithm =
354- PADDLE_GET_CONST (std::string, desc.GetAttr (" padding_algorithm" ));
355- if (padding_algorithm == " SAME" && desc.HasAttr (" strides" )) {
356- const std::vector<int > strides =
357- PADDLE_GET_CONST (std::vector<int >, desc.GetAttr (" strides" ));
358- // there is no issue if strides.size() less than 2
359- if (strides.size () > 1 ) {
360- for (size_t i = 0 ; i < strides.size (); i++) {
361- if (strides[i] > 1 ) return false ;
362- }
363- }
364- }
365- }
366- }
367- #endif
368336 auto * block = desc.Block ();
369337 if (block) {
370338 auto * filter_var_desc =
@@ -569,10 +537,6 @@ struct SimpleOpTypeSetTeller : public Teller {
569537 if (!desc.HasAttr (" axis" )) {
570538 return false ;
571539 } else {
572- #if IS_TRT_VERSION_GE(7130)
573- #else
574- if (with_dynamic_shape) return false ;
575- #endif
576540 int axis = PADDLE_GET_CONST (int , desc.GetAttr (" axis" ));
577541 if (axis != 1 ) return false ;
578542 }
@@ -635,14 +599,6 @@ struct SimpleOpTypeSetTeller : public Teller {
635599 " the pass." ;
636600 return false ;
637601 }
638- #if !IS_TRT_VERSION_GE(7000)
639- auto * x_var_desc = block->FindVarRecursive (desc.Input (" X" )[0 ]);
640- const auto x_shape = x_var_desc->GetShape ();
641- if (x_shape.size () == 1 ) {
642- VLOG (3 ) << " Gather does not support 1-dimensional input in tensorrt" ;
643- return false ;
644- }
645- #endif
646602 }
647603 }
648604
@@ -1315,21 +1271,12 @@ struct SimpleOpTypeSetTeller : public Teller {
13151271 }
13161272
13171273 if (op_type == " roll" ) {
1318- #if !IS_TRT_VERSION_GE(7000)
1319- VLOG (3 ) << " roll converter does not support trt versions below 7.0" ;
1320- return false ;
1321- #endif
13221274 if (!with_dynamic_shape) {
13231275 return false ;
13241276 }
13251277 }
13261278
13271279 if (op_type == " strided_slice" ) {
1328- #if !IS_TRT_VERSION_GE(7000)
1329- VLOG (3 )
1330- << " strided_slice converter does not support trt versions below 7.0" ;
1331- return false ;
1332- #endif
13331280 if (!desc.HasAttr (" axes" ) || !desc.HasAttr (" starts" ) ||
13341281 !desc.HasAttr (" ends" ) || !desc.HasAttr (" strides" )) {
13351282 VLOG (3 )
@@ -2398,7 +2345,6 @@ struct SimpleOpTypeSetTeller : public Teller {
23982345 return false ;
23992346 }
24002347 } else {
2401- #if IS_TRT_VERSION_GE(7000)
24022348 if (dtype != framework::proto::VarType::INT32 &&
24032349 dtype != framework::proto::VarType::INT64 &&
24042350 dtype != framework::proto::VarType::FP32 &&
@@ -2408,18 +2354,8 @@ struct SimpleOpTypeSetTeller : public Teller {
24082354 " float64" ;
24092355 return false ;
24102356 }
2411- #else
2412- if (dtype != framework::proto::VarType::FP32 &&
2413- dtype != framework::proto::VarType::FP64) {
2414- VLOG (3 ) << " reduce op input data type must be float32 or float64 "
2415- " using TensorRT "
2416- " < 7.0" ;
2417- return false ;
2418- }
2419- #endif
24202357 }
24212358 }
2422- #if IS_TRT_VERSION_GE(7000)
24232359 if (op_type == " tile" ) {
24242360 // Paddle-TRT does not support the input tensors.
24252361 auto tile_inputs = desc.Inputs ();
@@ -2442,7 +2378,6 @@ struct SimpleOpTypeSetTeller : public Teller {
24422378 }
24432379 }
24442380 }
2445- #endif
24462381
24472382 // conv3d_transpose
24482383 if (op_type == " conv3d_transpose" ) {
@@ -2473,13 +2408,6 @@ struct SimpleOpTypeSetTeller : public Teller {
24732408 }
24742409 }
24752410
2476- #if !IS_TRT_VERSION_GE(7000)
2477- // looks like some issues with trt6.0
2478- if (with_dynamic_shape) {
2479- return false ;
2480- }
2481- #endif
2482-
24832411 std::vector<int > paddings =
24842412 PADDLE_GET_CONST (std::vector<int >, desc.GetAttr (" paddings" ));
24852413
@@ -2522,10 +2450,6 @@ struct SimpleOpTypeSetTeller : public Teller {
25222450 }
25232451
25242452 if (op_type == " cast" ) {
2525- // trt 6015 result in Windows ppyolo_mbv3 TRT fp32 diff
2526- #if !IS_TRT_VERSION_GE(7000)
2527- return false ;
2528- #endif
25292453 if (!(desc.HasAttr (" in_dtype" ) && desc.HasAttr (" out_dtype" ))) {
25302454 VLOG (3 ) << " the " << op_type
25312455 << " does not have attr (in_dtype or "
@@ -2821,10 +2745,6 @@ struct SimpleOpTypeSetTeller : public Teller {
28212745 }
28222746
28232747 if (op_type == " cumsum" ) {
2824- #if !IS_TRT_VERSION_GE(7220)
2825- VLOG (3 ) << " cumsum is not supported when TensorRT < 7.2.2" ;
2826- return false ;
2827- #endif
28282748 if (!with_dynamic_shape) {
28292749 VLOG (3 ) << " the cumsum does not support "
28302750 " static shape yet" ;
@@ -3037,10 +2957,6 @@ struct SimpleOpTypeSetTeller : public Teller {
30372957 " static shape yet" ;
30382958 return false ;
30392959 }
3040- #if !IS_TRT_VERSION_GE(7220)
3041- VLOG (3 ) << " flip is not supported when TensorRT below 7.2.2" ;
3042- return false ;
3043- #endif
30442960 }
30452961
30462962 if (use_no_calib_int8) {
0 commit comments