diff --git a/paddle/fluid/inference/tensorrt/convert/range_op.cc b/paddle/fluid/inference/tensorrt/convert/range_op.cc index 4e6847f6c4a656..9b777c9a98cdf6 100644 --- a/paddle/fluid/inference/tensorrt/convert/range_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/range_op.cc @@ -45,11 +45,7 @@ class RangeOpConverter : public OpConverter { } auto number_tensor = Max(Sub(zero_tensor, quotient_tensor), zero_tensor); auto* start1 = engine_->GetITensor(op_desc.Input("Start")[0]); -#if IS_TRT_VERSION_LT(8000) - nvinfer1::Dims start_dims{0, {1}, { nvinfer1::DimensionType::kSPATIAL }}; -#else nvinfer1::Dims start_dims{0, {1}}; -#endif start1 = Reshape(start1, start_dims); layer = TRT_ENGINE_ADD_LAYER( engine_, Fill, nvinfer1::Dims{}, nvinfer1::FillOperation::kLINSPACE); diff --git a/paddle/fluid/inference/tensorrt/convert/test_custom_op_plugin.h b/paddle/fluid/inference/tensorrt/convert/test_custom_op_plugin.h index adb41528bae004..d7e43798a92190 100644 --- a/paddle/fluid/inference/tensorrt/convert/test_custom_op_plugin.h +++ b/paddle/fluid/inference/tensorrt/convert/test_custom_op_plugin.h @@ -83,15 +83,9 @@ class custom_op_plugin : public nvinfer1::IPluginV2 { return 0; } -#if IS_TRT_VERSION_LT(8000) - int enqueue(int batch_size, - const void* const* inputs, - void** outputs, -#else int enqueue(int batch_size, const void* const* inputs, void* const* outputs, -#endif void* workspace, cudaStream_t stream) noexcept override { return 0; diff --git a/paddle/fluid/inference/tensorrt/engine.cc b/paddle/fluid/inference/tensorrt/engine.cc index 725bd4d4cb2fb5..e7a085c523a064 100644 --- a/paddle/fluid/inference/tensorrt/engine.cc +++ b/paddle/fluid/inference/tensorrt/engine.cc @@ -326,20 +326,6 @@ void TensorRTEngine::FreezeNetwork() { LOG(INFO) << "Run Paddle-TRT Dynamic Shape mode."; for (int i = 0; i < max_profile_num_; i++) { for (auto &input : min_input_shape()) { -#if IS_TRT_VERSION_LT(7100) - // trt6/trt7011 will check all_of input > 0 - if (!(std::all_of(input.second.begin(), - input.second.end(), - [](int x) { return x > 0; }) && - std::all_of(max_input_shape()[input.first].begin(), - max_input_shape()[input.first].end(), - [](int x) { return x > 0; }) && - std::all_of(optim_input_shape()[input.first].begin(), - optim_input_shape()[input.first].end(), - [](int x) { return x > 0; }))) { - continue; - } -#endif VLOG(4) << "TRT dynamic_shape set " << input.first << " min: " << Vec2Str(input.second) << ", max: " << Vec2Str(max_input_shape()[input.first]) @@ -419,10 +405,6 @@ void TensorRTEngine::FreezeNetwork() { } #endif -#if IS_TRT_VERSION_LT(8000) - infer_engine_.reset(infer_builder_->buildEngineWithConfig( - *network(), *infer_builder_config_)); -#else ihost_memory_.reset(infer_builder_->buildSerializedNetwork( *network(), *infer_builder_config_)); PADDLE_ENFORCE_NOT_NULL( @@ -439,7 +421,6 @@ void TensorRTEngine::FreezeNetwork() { infer_engine_.reset(infer_runtime_->deserializeCudaEngine( ihost_memory_->data(), ihost_memory_->size())); -#endif PADDLE_ENFORCE_NOT_NULL( infer_engine_, diff --git a/paddle/fluid/inference/tensorrt/engine.h b/paddle/fluid/inference/tensorrt/engine.h index 02486c57cb2403..0d07c33a2f6d17 100644 --- a/paddle/fluid/inference/tensorrt/engine.h +++ b/paddle/fluid/inference/tensorrt/engine.h @@ -256,14 +256,10 @@ class TensorRTEngine { infer_engine_, common::errors::InvalidArgument( "The TensorRT engine must be built first before serialization")); -#if IS_TRT_VERSION_LT(8000) - ihost_memory_.reset(infer_engine_->serialize()); -#else PADDLE_ENFORCE_NOT_NULL( ihost_memory_, common::errors::InvalidArgument( "TensorRT >= 8.0 requires that buildSerializedNetwork is called")); -#endif return ihost_memory_.get(); } diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 83891ff0354699..0be02840e80935 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -887,10 +887,6 @@ struct SimpleOpTypeSetTeller : public Teller { } if (op_type == "bilinear_interp_v2") { - // trt 7011 result in test_solov2_trt_fp32.py TRT fp32 diff -#if IS_TRT_VERSION_LT(7100) - return false; -#endif std::vector attrs{"data_layout", "interp_method", "align_corners", @@ -1010,9 +1006,6 @@ struct SimpleOpTypeSetTeller : public Teller { } } if (op_type == "linear_interp_v2") { -#if IS_TRT_VERSION_LT(7100) - return false; -#endif std::vector attrs{"data_layout", "interp_method", "align_corners", @@ -1670,13 +1663,6 @@ struct SimpleOpTypeSetTeller : public Teller { << desc.Output("Out").size(); return false; } - -#if IS_TRT_VERSION_LT(7000) - if (desc.HasAttr("approximate")) { - VLOG(3) << "approximate gelu op needs TensorRT 7.0 and after"; - if (PADDLE_GET_CONST(bool, desc.GetAttr("approximate"))) return false; - } -#endif } if (op_type == "layer_norm") { @@ -2154,8 +2140,7 @@ struct SimpleOpTypeSetTeller : public Teller { return false; } } else { -#if (IS_TRT_VERSION_GE(8000) && IS_TRT_VERSION_LT(8100)) || \ - (IS_TRT_VERSION_LT(7200)) +#if (IS_TRT_VERSION_GE(8000) && IS_TRT_VERSION_LT(8100)) VLOG(3) << "There are some bugs with trt 8.0"; return false; #endif @@ -2691,15 +2676,6 @@ struct SimpleOpTypeSetTeller : public Teller { "the pass."; return false; } - -#if IS_TRT_VERSION_LT(8000) - auto x_var_name = desc.Input("X")[0]; - auto* x_var_desc = block->FindVarRecursive(x_var_name); - const auto x_shape = x_var_desc->GetShape(); - if (x_shape.size() == 0) { - return false; // not supported 0 dim. - } -#endif } if (op_type == "grid_sampler") {