File tree Expand file tree Collapse file tree 4 files changed +28
-5
lines changed
Expand file tree Collapse file tree 4 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
5050 set (LITE_INSTALL_DIR ${THIRD_PARTY_PATH} /install /lite)
5151
5252 if (NOT LITE_GIT_TAG)
53- set (LITE_GIT_TAG 1c4698c6efd9a5f57a4f8369bd5b6374166f5ba4 )
53+ set (LITE_GIT_TAG 4ab64daecc11fbf74fffdc6a4733f388472e7d5d )
5454 endif ()
5555
5656 if (NOT CUDA_ARCH_NAME)
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ ELSE ()
3535ENDIF ()
3636
3737SET (XPU_BASE_URL_WITHOUT_DATE "https://baidu-kunlun-product.cdn.bcebos.com/KL-SDK/klsdk-dev" )
38- SET (XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE} /20210909 " )
38+ SET (XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE} /20210921 " )
3939SET (XPU_XRE_URL "${XPU_BASE_URL} /${XPU_XRE_DIR_NAME} .tar.gz" CACHE STRING "" FORCE)
4040SET (XPU_XDNN_URL "${XPU_BASE_URL} /${XPU_XDNN_DIR_NAME} .tar.gz" CACHE STRING "" FORCE)
4141SET (XPU_XCCL_URL "${XPU_BASE_URL_WITHOUT_DATE} /20210623/${XPU_XCCL_DIR_NAME} .tar.gz" CACHE STRING "" FORCE)
Original file line number Diff line number Diff line change @@ -686,9 +686,24 @@ void AnalysisPredictor::OptimizeInferenceProgram() {
686686// Note, please do NOT use any member variables, because member variables may
687687// have been destructed in multiple threads.
688688#if PADDLE_WITH_TENSORRT
689- paddle::inference::Singleton<
690- inference::tensorrt::TRTEngineManager>::Global ()
691- .DeleteAll ();
689+ auto &block = prog->Block (0 );
690+ for (auto &op_desc : block.AllOps ()) {
691+ if (op_desc->Type () == " tensorrt_engine" ) {
692+ std::string engine_key =
693+ BOOST_GET_CONST (std::string, op_desc->GetAttr (" engine_key" ));
694+ int engine_predictor_id =
695+ BOOST_GET_CONST (int , op_desc->GetAttr (" predictor_id" ));
696+ std::string engine_name =
697+ engine_key + std::to_string (engine_predictor_id);
698+ if (paddle::inference::Singleton<
699+ inference::tensorrt::TRTEngineManager>::Global ()
700+ .Has (engine_name)) {
701+ paddle::inference::Singleton<
702+ inference::tensorrt::TRTEngineManager>::Global ()
703+ .DeleteKey (engine_name);
704+ }
705+ }
706+ }
692707#endif
693708 delete prog;
694709 });
Original file line number Diff line number Diff line change @@ -631,6 +631,14 @@ class TRTEngineManager {
631631 }
632632 }
633633
634+ void DeleteKey (const std::string& key) {
635+ auto iter = engines_.find (key);
636+ if (iter != engines_.end ()) {
637+ iter->second .reset (nullptr );
638+ engines_.erase (iter);
639+ }
640+ }
641+
634642 private:
635643 std::unordered_map<std::string, std::unique_ptr<TensorRTEngine>> engines_;
636644};
You can’t perform that action at this time.
0 commit comments