Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add inference api:exp_disable_tensorrt_dynamic_shape_ops #62352

Merged
merged 10 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
xiu
  • Loading branch information
lizexu123 committed Mar 4, 2024
commit e1f7f0009011b5719eda4e7dd4bc471f7a2d0a7c
1 change: 1 addition & 0 deletions paddle/fluid/inference/analysis/argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ struct Argument {
TRTExcludeVarNames,
std::vector<std::string>);
DECL_ARGUMENT_FIELD(trt_forbid_dynamic_op, TRTForbidDynamicOp, bool);

DECL_ARGUMENT_FIELD(tensorrt_disabled_ops,
TensorRtDisabledOPs,
std::vector<std::string>);
Expand Down
1 change: 1 addition & 0 deletions paddle/fluid/inference/analysis/ir_pass_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ void IRPassManager::CreatePasses(Argument *argument,
new std::vector<std::string>(argument->trt_exclude_var_names()));
pass->Set("forbid_dynamic_op",
new bool(argument->trt_forbid_dynamic_op()));

pass->Set("program",
new framework::ProgramDesc *(&argument->main_program()));
pass->Set("predictor_id", new int(argument->predictor_id()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ void analysis::TensorRtSubgraphPass::ApplyImpl(
trt_disabled_ops.end(),
node->Op()->Type()) != trt_disabled_ops.end()) {
VLOG(3) << node->Op()->Type().c_str()

<< " is diabled by config in TensorRT";
return false;
}
Expand Down
1 change: 1 addition & 0 deletions paddle/fluid/inference/api/analysis_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,7 @@ void AnalysisPredictor::PrepareArgument() {
argument_->SetTensorRtDisabledOPs(config_.trt_disabled_ops_);
argument_->SetTRTExcludeVarNames(config_.trt_exclude_var_names_);
argument_->SetTRTForbidDynamicOp(config_.trt_forbid_dynamic_op_);

argument_->SetTensorRtUseDLA(config_.trt_use_dla_);
argument_->SetTensorRtDLACore(config_.trt_dla_core_);
argument_->SetTensorRtUseStaticEngine(config_.trt_use_static_engine_);
Expand Down
1 change: 1 addition & 0 deletions paddle/fluid/inference/api/paddle_analysis_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ struct PD_INFER_DECL AnalysisConfig {
bool trt_with_interleaved_{false};
bool trt_mark_output_{false};
bool trt_forbid_dynamic_op_{false};

std::vector<std::string> trt_output_tensor_names_{};
std::vector<std::string> trt_exclude_var_names_{};
std::string tensorrt_transformer_posid_{""};
Expand Down
9 changes: 4 additions & 5 deletions paddle/fluid/inference/tensorrt/op_teller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct SimpleOpTypeSetTeller : public Teller {
}

if (forbid_dynamic_op_enter_into_trt) {
LOG(INFO) << "forbid_dynamic_op_enter_into_trt is open";
VLOG(3) << "forbid_dynamic_op_enter_into_trt is open";
auto* block = desc.Block();
auto inputs = desc.Inputs();
for (auto iter : inputs) {
Expand Down Expand Up @@ -3248,7 +3248,7 @@ struct GenericPluginTeller : public Teller {
}

if (forbid_dynamic_op_enter_into_trt) {
LOG(INFO) << "forbid_dynamic_op_enter_into_trt is open";
VLOG(3) << "forbid_dynamic_op_enter_into_trt is open";
auto* block = desc.Block();
auto inputs = desc.Inputs();
for (auto iter : inputs) {
Expand Down Expand Up @@ -3364,9 +3364,8 @@ struct CustomPluginTeller : public Teller {
return false;
}


if (forbid_dynamic_op_enter_into_trt) {
LOG(INFO) << "forbid_dynamic_op_enter_into_trt is open";
VLOG(3) << "forbid_dynamic_op_enter_into_trt is open";
auto* block = desc.Block();
auto inputs = desc.Inputs();
for (auto iter : inputs) {
Expand Down Expand Up @@ -3437,7 +3436,7 @@ struct CustomGenericPluginTeller : public Teller {
}

if (forbid_dynamic_op_enter_into_trt) {
LOG(INFO) << "forbid_dynamic_op_enter_into_trt is open";
VLOG(3) << "forbid_dynamic_op_enter_into_trt is open";
auto* block = desc.Block();
auto inputs = desc.Inputs();
for (auto iter : inputs) {
Expand Down
1 change: 1 addition & 0 deletions paddle/fluid/pybind/inference_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ void BindAnalysisConfig(py::module *m) {
.def("enable_tuned_tensorrt_dynamic_shape",
&AnalysisConfig::EnableTunedTensorRtDynamicShape,
py::arg("shape_range_info_path") = "",

py::arg("allow_build_at_runtime") = true)
.def("tuned_tensorrt_dynamic_shape",
&AnalysisConfig::tuned_tensorrt_dynamic_shape)
Expand Down