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

fix trt engine memory sharing (#49584)

上级 0400eaed
......@@ -434,6 +434,7 @@ AnalysisConfig::AnalysisConfig(const AnalysisConfig &other) {
CP_MEMBER(shape_range_info_path_);
CP_MEMBER(trt_use_inspector_);
CP_MEMBER(trt_engine_memory_sharing_);
CP_MEMBER(trt_engine_memory_sharing_identifier_);
// Dlnne related
CP_MEMBER(use_dlnne_);
CP_MEMBER(dlnne_min_subgraph_size_);
......
......@@ -103,16 +103,17 @@ class AnalysisPredictor : public PaddlePredictor {
if (config_.shape_range_info_collected()) {
config_.SwitchIrOptim(false);
}
auto trt_identifier = config_.trt_engine_memory_sharing_identifier_;
int trt_identifier = config_.trt_engine_memory_sharing_identifier_;
if (trt_identifier > 0) {
// NOTE(liuyuanle): For convenience, we set the id of the predictor to
// negative sharing_identifier directly. In the future, this may affect
// the meaning of negative predictor id.
predictor_id_ = -trt_identifier;
LOG_FIRST_N(WARNING, 1)
LOG(WARNING)
<< "Since the engine context memory of multiple predictors "
"is enabled in Paddle-TRT, we set the id of current predictor to "
"negative sharing_identifier you specified.";
"is enabled in Paddle-TRT, we set the id of these predictors to "
"negative sharing_identifier you specified : "
<< predictor_id_;
} else {
predictor_id_ = inference::GetUniqueId();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册