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

optimize Paddle-TRT performance (#46684)

上级 a0e03418
......@@ -1244,6 +1244,16 @@ void AnalysisPredictor::PrepareArgument() {
// NOTE All the members in AnalysisConfig should be copied to Argument.
void AnalysisPredictor::OptimizeInferenceProgram() {
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_);
PADDLE_ENFORCE_EQ(
......
......@@ -646,9 +646,8 @@ void TensorRTEngine::GetEngineInfo() {
LOG(INFO) << "====== engine info ======";
std::unique_ptr<nvinfer1::IEngineInspector> infer_inspector(
infer_engine_->createEngineInspector());
auto infer_context = infer_ptr<nvinfer1::IExecutionContext>(
infer_engine_->createExecutionContextWithoutDeviceMemory());
infer_inspector->setExecutionContext(infer_context.get());
auto infer_context = context();
infer_inspector->setExecutionContext(infer_context);
LOG(INFO) << infer_inspector->getEngineInformation(
nvinfer1::LayerInformationFormat::kONELINE);
LOG(INFO) << "====== engine info end ======";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册