提交 e3a7f8f2 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!1698 bugfix:get nullptr from graph manager

Merge pull request !1698 from zyli2020/r0.3
...@@ -65,6 +65,7 @@ void MemSwapManager::Init(const mindspore::session::KernelGraph *kernel_graph) { ...@@ -65,6 +65,7 @@ void MemSwapManager::Init(const mindspore::session::KernelGraph *kernel_graph) {
void MemSwapManager::SaveUserKernelTopoOrder(const mindspore::session::KernelGraph *kernel_graph) { void MemSwapManager::SaveUserKernelTopoOrder(const mindspore::session::KernelGraph *kernel_graph) {
MS_EXCEPTION_IF_NULL(kernel_graph); MS_EXCEPTION_IF_NULL(kernel_graph);
FuncGraphManagerPtr manager = kernel_graph->manager(); FuncGraphManagerPtr manager = kernel_graph->manager();
MS_EXCEPTION_IF_NULL(manager);
NodeUsersMap user_map = manager->node_users(); NodeUsersMap user_map = manager->node_users();
for (const auto &kernel : execution_order_) { for (const auto &kernel : execution_order_) {
auto iter = user_map.find(kernel); auto iter = user_map.find(kernel);
......
...@@ -590,6 +590,7 @@ KernelGraphPtr SessionBasic::ConstructKernelGraph(const AnfNodePtrList &lst, con ...@@ -590,6 +590,7 @@ KernelGraphPtr SessionBasic::ConstructKernelGraph(const AnfNodePtrList &lst, con
graph->set_output(ConstructOutput(outputs, graph)); graph->set_output(ConstructOutput(outputs, graph));
MS_EXCEPTION_IF_NULL(context_); MS_EXCEPTION_IF_NULL(context_);
FuncGraphManagerPtr manager = MakeManager({graph}); FuncGraphManagerPtr manager = MakeManager({graph});
context_->AddManager(manager);
if (manager) { if (manager) {
manager->AddFuncGraph(graph); manager->AddFuncGraph(graph);
graph->set_manager(manager); graph->set_manager(manager);
......
...@@ -37,8 +37,10 @@ class Context : public pipeline::ResourceBase { ...@@ -37,8 +37,10 @@ class Context : public pipeline::ResourceBase {
uint32_t device_id() const { return device_id_; } uint32_t device_id() const { return device_id_; }
static std::shared_ptr<Context> GetInstance(); static std::shared_ptr<Context> GetInstance();
void AddManager(const FuncGraphManagerPtr &m) { manager_list_.push_back(m); }
private: private:
std::vector<FuncGraphManagerPtr> manager_list_;
std::string target_; std::string target_;
uint32_t device_id_; uint32_t device_id_;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册