未验证 提交 377cbcea 编写于 作者: Z Zhang Jun 提交者: GitHub

handle trt engine deserialization failure and rebuild (#50775)

上级 6c181d1d
......@@ -580,11 +580,20 @@ void TensorRtSubgraphPass::CreateTensorRTOp(
Get<std::string>("model_opt_cache_dir"), engine_key);
// we can load the engine info serialized before from the disk.
if (!trt_engine_serialized_data.empty()) {
trt_engine->Deserialize(trt_engine_serialized_data);
LOG(INFO) << "Load TRT Optimized Info from "
<< GetTrtEngineSerializedPath(
Get<std::string>("model_opt_cache_dir"), engine_key);
return;
try {
trt_engine->Deserialize(trt_engine_serialized_data);
LOG(INFO) << "Load TRT Optimized Info from "
<< GetTrtEngineSerializedPath(
Get<std::string>("model_opt_cache_dir"), engine_key);
return;
} catch (const std::exception &exp) {
LOG(WARNING)
<< "Fail to load TRT Optimized Info from "
<< GetTrtEngineSerializedPath(
Get<std::string>("model_opt_cache_dir"), engine_key)
<< ". Engine deserialization failed: Serialized Engine Version "
"does not match Current Version, TRT engine will be rebuilded";
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册