Skip to content

Commit

Permalink
release the cloned model if passthrough mode for AUTO
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwang201911 committed Nov 29, 2024
1 parent 38551d5 commit 821d23f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/plugins/auto/src/auto_schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ void AutoSchedule::init() {
auto load_device_task = [&](AutoCompileContext* context_ptr, const std::shared_ptr<ov::Model>& model) {
try_to_compile_model(*context_ptr, model);
if (context_ptr->m_is_load_success) {
// release cloned model here
const_cast<std::shared_ptr<ov::Model>&>(model).reset();
if (context_ptr->m_worker_name.empty()) {
context_ptr->m_worker_name = context_ptr->m_device_info.device_name;
}
Expand Down
9 changes: 8 additions & 1 deletion src/plugins/auto/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,14 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model_impl(const std::string
if (is_cumulative) {
impl = std::make_shared<AutoCumuCompiledModel>(cloned_model, shared_from_this(), device_context, auto_s_context, scheduler);
} else {
impl = std::make_shared<AutoCompiledModel>(cloned_model, shared_from_this(), device_context, auto_s_context, scheduler);
auto model = auto_s_context->m_model;
if (std::static_pointer_cast<AutoSchedule>(scheduler)->m_compile_context[ACTUALDEVICE].m_is_already) {
// release cloned model here if actual device finish compiling model.
model.reset();
auto_s_context->m_model.reset();
}
impl =
std::make_shared<AutoCompiledModel>(model, shared_from_this(), device_context, auto_s_context, scheduler);
}
return impl;
}
Expand Down

0 comments on commit 821d23f

Please sign in to comment.