asyn dynamic shape format control flow error formattags/v1.1.0
| @@ -146,8 +146,7 @@ GraphId AscendSession::CompileGraphImpl(NotNull<FuncGraphPtr> func_graph) { | |||||
| std::vector<KernelGraphPtr> all_graphs; | std::vector<KernelGraphPtr> all_graphs; | ||||
| auto root_graph = ConstructKernelGraph(func_graph, &all_graphs); | auto root_graph = ConstructKernelGraph(func_graph, &all_graphs); | ||||
| // Update Graph Dynamic Shape Attr | // Update Graph Dynamic Shape Attr | ||||
| UpdateGraphDynamicShapeAttr(NOT_NULL(root_graph)); | |||||
| root_graph->UpdateGraphDynamicAttr(); | |||||
| UpdateAllGraphDynamicShapeAttr(all_graphs); | |||||
| BackendOptimization(all_graphs); | BackendOptimization(all_graphs); | ||||
| // empty graph dont entry to backend | // empty graph dont entry to backend | ||||
| if (root_graph->execution_order().empty()) { | if (root_graph->execution_order().empty()) { | ||||
| @@ -1527,6 +1527,17 @@ bool IsNodeInputDynamicShape(const CNodePtr &anf_node_ptr) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| void SessionBasic::UpdateAllGraphDynamicShapeAttr(const std::vector<KernelGraphPtr> &all_graphs) { | |||||
| bool is_dynamic = false; | |||||
| for (const auto &graph : all_graphs) { | |||||
| UpdateGraphDynamicShapeAttr(NOT_NULL(graph)); | |||||
| is_dynamic = graph->is_dynamic_shape() || is_dynamic; | |||||
| } | |||||
| if (is_dynamic && all_graphs.size() > 1) { | |||||
| MS_LOG(EXCEPTION) << "Dynamic shape is not supported with control flow."; | |||||
| } | |||||
| } | |||||
| void SessionBasic::UpdateGraphDynamicShapeAttr(const NotNull<KernelGraphPtr> &root_graph) { | void SessionBasic::UpdateGraphDynamicShapeAttr(const NotNull<KernelGraphPtr> &root_graph) { | ||||
| for (const auto &cnode : root_graph->execution_order()) { | for (const auto &cnode : root_graph->execution_order()) { | ||||
| auto output_dynamic = IsNodeOutputDynamicShape(NOT_NULL(cnode)); | auto output_dynamic = IsNodeOutputDynamicShape(NOT_NULL(cnode)); | ||||
| @@ -180,6 +180,7 @@ class SessionBasic : public std::enable_shared_from_this<SessionBasic> { | |||||
| void InitInternalOutputParameter(const AnfNodePtr &out_node, const AnfNodePtr ¶meter); | void InitInternalOutputParameter(const AnfNodePtr &out_node, const AnfNodePtr ¶meter); | ||||
| AnfNodePtr FindPullNode(const AnfNodePtr &push_node, const std::vector<AnfNodePtr> &node_list); | AnfNodePtr FindPullNode(const AnfNodePtr &push_node, const std::vector<AnfNodePtr> &node_list); | ||||
| void UpdateGraphDynamicShapeAttr(const NotNull<KernelGraphPtr> &root_graph); | void UpdateGraphDynamicShapeAttr(const NotNull<KernelGraphPtr> &root_graph); | ||||
| void UpdateAllGraphDynamicShapeAttr(const std::vector<KernelGraphPtr> &all_graphs); | |||||
| std::unordered_map<GraphId, std::shared_ptr<KernelGraph>> graphs_; | std::unordered_map<GraphId, std::shared_ptr<KernelGraph>> graphs_; | ||||
| std::unordered_map<GraphInfo, std::shared_ptr<KernelGraph>> run_op_graphs_; | std::unordered_map<GraphInfo, std::shared_ptr<KernelGraph>> run_op_graphs_; | ||||