Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions paddle/fluid/inference/tensorrt/convert/range_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 0 additions & 19 deletions paddle/fluid/inference/tensorrt/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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(
Expand All @@ -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_,
Expand Down
4 changes: 0 additions & 4 deletions paddle/fluid/inference/tensorrt/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
26 changes: 1 addition & 25 deletions paddle/fluid/inference/tensorrt/op_teller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> attrs{"data_layout",
"interp_method",
"align_corners",
Expand Down Expand Up @@ -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<std::string> attrs{"data_layout",
"interp_method",
"align_corners",
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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") {
Expand Down
Loading