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

[Paddle-TRT] remove engine info from RumImpl process #50181

Merged
merged 4 commits into from
Feb 8, 2023
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
12 changes: 7 additions & 5 deletions paddle/fluid/inference/tensorrt/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ void TensorRTEngine::FreezeNetwork() {
.updateContextMemorySize(infer_engine_->getDeviceMemorySize(),
predictor_id_per_thread);
}

GetEngineInfo();
if (use_inspector_) {
GetEngineInfo();
}
}

nvinfer1::ITensor *TensorRTEngine::DeclareInput(const std::string &name,
Expand Down Expand Up @@ -552,8 +553,9 @@ void TensorRTEngine::Deserialize(const std::string &engine_serialized_data) {
.updateContextMemorySize(infer_engine_->getDeviceMemorySize(),
predictor_id_per_thread);
}

GetEngineInfo();
if (use_inspector_) {
GetEngineInfo();
}
}

void TensorRTEngine::SetRuntimeBatch(size_t batch_size) {
Expand Down Expand Up @@ -828,7 +830,7 @@ void TensorRTEngine::GetEngineInfo() {
auto *infer_context = context();
infer_inspector->setExecutionContext(infer_context);
LOG(INFO) << infer_inspector->getEngineInformation(
nvinfer1::LayerInformationFormat::kONELINE);
nvinfer1::LayerInformationFormat::kJSON);
Copy link
Contributor

@zhangjun zhangjun Feb 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么改成json,输出是什么形式?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前输出是一条line,不易于观看,json更易于看

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前输出是一条line,不易于观看,json更易于看

两者对比应该在PR说明里面给出来

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,已补充

LOG(INFO) << "====== engine info end ======";
#else
LOG(INFO) << "Inspector needs TensorRT version 8.2 and after.";
Expand Down
5 changes: 0 additions & 5 deletions paddle/fluid/operators/tensorrt/tensorrt_engine_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class TensorRTEngineOp : public framework::OperatorBase {
bool enable_int8_;
bool enable_fp16_;
bool use_calib_mode_;
bool use_inspector_;
std::string calibration_data_;
std::string engine_key_;
std::string calibration_engine_key_;
Expand Down Expand Up @@ -219,7 +218,6 @@ class TensorRTEngineOp : public framework::OperatorBase {
shape_range_info_path_ = Attr<std::string>("shape_range_info_path");
allow_build_at_runtime_ = Attr<bool>("allow_build_at_runtime");
use_static_engine_ = Attr<bool>("use_static_engine");
use_inspector_ = HasAttr("use_inspector") && Attr<bool>("use_inspector");
if (use_static_engine_) {
model_opt_cache_dir_ = Attr<std::string>("model_opt_cache_dir");
}
Expand Down Expand Up @@ -331,9 +329,6 @@ class TensorRTEngineOp : public framework::OperatorBase {
return;
}
auto *trt_engine = GetEngine(scope, dev_place);
if (use_inspector_) {
trt_engine->GetEngineInfo();
}
if (trt_engine->with_dynamic_shape()) {
// get runtime input shapes.
std::map<std::string, std::vector<int32_t>> runtime_input_shape;
Expand Down