未验证 提交 146d70ca 编写于 作者: Y Yuanle Liu 提交者: GitHub

optimize Paddle-TRT performance (#46682)

* optimize Paddle-TRT performance
上级 04abcab8
...@@ -1246,6 +1246,16 @@ void AnalysisPredictor::PrepareArgument() { ...@@ -1246,6 +1246,16 @@ void AnalysisPredictor::PrepareArgument() {
// NOTE All the members in AnalysisConfig should be copied to Argument. // NOTE All the members in AnalysisConfig should be copied to Argument.
void AnalysisPredictor::OptimizeInferenceProgram() { void AnalysisPredictor::OptimizeInferenceProgram() {
PrepareArgument(); PrepareArgument();
#ifdef PADDLE_WITH_TENSORRT
if (config_.tensorrt_engine_enabled()) {
inference::tensorrt::TensorRTEngine::predictor_id_per_thread =
predictor_id_;
VLOG(3) << "thread_local var predictor_id in TensorRTEngine is set to: "
<< inference::tensorrt::TensorRTEngine::predictor_id_per_thread;
}
#endif
Analyzer().Run(&argument_); Analyzer().Run(&argument_);
PADDLE_ENFORCE_EQ( PADDLE_ENFORCE_EQ(
......
...@@ -745,9 +745,8 @@ void TensorRTEngine::GetEngineInfo() { ...@@ -745,9 +745,8 @@ void TensorRTEngine::GetEngineInfo() {
LOG(INFO) << "====== engine info ======"; LOG(INFO) << "====== engine info ======";
std::unique_ptr<nvinfer1::IEngineInspector> infer_inspector( std::unique_ptr<nvinfer1::IEngineInspector> infer_inspector(
infer_engine_->createEngineInspector()); infer_engine_->createEngineInspector());
auto infer_context = infer_ptr<nvinfer1::IExecutionContext>( auto *infer_context = context();
infer_engine_->createExecutionContextWithoutDeviceMemory()); infer_inspector->setExecutionContext(infer_context);
infer_inspector->setExecutionContext(infer_context.get());
LOG(INFO) << infer_inspector->getEngineInformation( LOG(INFO) << infer_inspector->getEngineInformation(
nvinfer1::LayerInformationFormat::kONELINE); nvinfer1::LayerInformationFormat::kONELINE);
LOG(INFO) << "====== engine info end ======"; LOG(INFO) << "====== engine info end ======";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册