|
|
|
@ -353,10 +353,10 @@ Status GraphManager::AddGraph(const GraphId &graph_id, const Graph &graph,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphNodePtr graph_node = MakeShared<ge::GraphNode>(graph_id);
|
|
|
|
|
GE_IF_BOOL_EXEC(graph_node == nullptr, GELOGE(FAILED, "GraphNode make shared failed");
|
|
|
|
|
GE_IF_BOOL_EXEC(graph_node == nullptr, GELOGE(FAILED, "GraphNode make shared failed.");
|
|
|
|
|
return FAILED);
|
|
|
|
|
std::shared_ptr<Graph> graph_ptr = MakeShared<ge::Graph>(graph);
|
|
|
|
|
GE_IF_BOOL_EXEC(graph_ptr == nullptr, GELOGE(FAILED, "GraphPtr make shared failed");
|
|
|
|
|
GE_IF_BOOL_EXEC(graph_ptr == nullptr, GELOGE(FAILED, "GraphPtr make shared failed.");
|
|
|
|
|
return FAILED);
|
|
|
|
|
|
|
|
|
|
graph_node->SetGraph(graph_ptr);
|
|
|
|
@ -737,7 +737,7 @@ Status GraphManager::PreRunAfterOptimizeSubGraph(const GraphNodePtr &graph_node,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Status GraphManager::SetRtContext(rtContext_t rt_context, rtCtxMode_t mode, uint64_t session_id, uint32_t graph_id) {
|
|
|
|
|
GELOGD("set rt_context, session id: %lu, graph id: %u, mode %d, device id:%u.",
|
|
|
|
|
GELOGD("set rt_context: session id: %lu, graph id: %u, mode %d, device id:%u.",
|
|
|
|
|
session_id, graph_id, static_cast<int>(mode), ge::GetContext().DeviceId());
|
|
|
|
|
|
|
|
|
|
rtError_t rt_ret = rtCtxCreate(&rt_context, mode, ge::GetContext().DeviceId());
|
|
|
|
@ -779,7 +779,7 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector<Ge
|
|
|
|
|
GE_CHK_STATUS_RET(analyzer_instance->BuildJsonObject(session_id, compute_graph->GetGraphID()),
|
|
|
|
|
"BuildJsonObject Failed")
|
|
|
|
|
|
|
|
|
|
GEEVENT("PreRun start, graph node size %zu, session id %lu, graph id %u, graph name %s.",
|
|
|
|
|
GEEVENT("PreRun start: graph node size %zu, session id %lu, graph id %u, graph name %s.",
|
|
|
|
|
compute_graph->GetDirectNodesSize(), session_id, compute_graph->GetGraphID(),
|
|
|
|
|
compute_graph->GetName().c_str());
|
|
|
|
|
GE_DUMP(compute_graph, "PreRunBegin");
|
|
|
|
@ -800,7 +800,7 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector<Ge
|
|
|
|
|
if (run_optimize_original_graph) {
|
|
|
|
|
Status ret = PreRunOptimizeOriginalGraph(graph_node, inputs, compute_graph, session_id);
|
|
|
|
|
if (ret != SUCCESS) {
|
|
|
|
|
GELOGE(ret, "Run PreRunOptimizeOriginalGraph failed for graph:%s", compute_graph->GetName().c_str());
|
|
|
|
|
GELOGE(ret, "Run PreRunOptimizeOriginalGraph failed for graph:%s.", compute_graph->GetName().c_str());
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -872,7 +872,7 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std:
|
|
|
|
|
// release rts generate context
|
|
|
|
|
RtContextUtil::GetInstance().DestroyRtContexts(session_id, graph_node->GetGraphId());
|
|
|
|
|
if (ret != SUCCESS) {
|
|
|
|
|
GELOGE(ret, "PreRun Failed. graph_id:%u", graph_node->GetGraphId());
|
|
|
|
|
GELOGE(ret, "PreRun Failed. graph_id:%u.", graph_node->GetGraphId());
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1212,7 +1212,7 @@ Status GraphManager::BuildGraphForUnregisteredOp(const GraphId &graph_id, const
|
|
|
|
|
|
|
|
|
|
Status GraphManager::BuildGraph(const GraphId &graph_id, const std::vector<GeTensor> &inputs,
|
|
|
|
|
GeRootModelPtr &ge_root_model, uint64_t session_id, bool async) {
|
|
|
|
|
GELOGD("[BuildGraph] start to build graph, graph_id:%u.", graph_id);
|
|
|
|
|
GELOGD("[BuildGraph] start to build graph, graph_id:%u", graph_id);
|
|
|
|
|
if (inputs.empty()) {
|
|
|
|
|
GELOGW("[BuildGraph] BuildGraph warning: empty GeTensor inputs");
|
|
|
|
|
}
|
|
|
|
@ -1244,7 +1244,7 @@ Status GraphManager::BuildGraph(const GraphId &graph_id, const std::vector<GeTen
|
|
|
|
|
ret = StartForRunGraph(graph_node, inputs, ge_root_model, session_id);
|
|
|
|
|
graph_node->SetRunFlag(false);
|
|
|
|
|
if (ret != SUCCESS) {
|
|
|
|
|
GELOGE(GE_GRAPH_PRERUN_FAILED, "[BuildGraph] StartForRunGraph failed! graph_id:%u", graph_id);
|
|
|
|
|
GELOGE(GE_GRAPH_PRERUN_FAILED, "[BuildGraph] StartForRunGraph failed! graph_id:%u.", graph_id);
|
|
|
|
|
return GE_GRAPH_PRERUN_FAILED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1498,7 +1498,7 @@ Status GraphManager::ParseOptions(const std::map<std::string, std::string> &opti
|
|
|
|
|
ParseOption(options, INPUT_SHAPE, options_.input_shape);
|
|
|
|
|
ParseOption(options, kDynamicDims, options_.dynamic_dims);
|
|
|
|
|
ParseOption(options, DYNAMIC_NODE_TYPE, options_.dynamic_node_type);
|
|
|
|
|
GELOGD("Dynamic dims params: input shape is %s, dynamic dims is %s, dynamic node type is %d.",
|
|
|
|
|
GELOGD("Dynamic dims params: input shape is %s, dynamic dims is %s, dynamic node type is %d",
|
|
|
|
|
options_.input_shape.c_str(), options_.dynamic_dims.c_str(), options_.dynamic_node_type);
|
|
|
|
|
|
|
|
|
|
// Set Build model and step
|
|
|
|
@ -1511,7 +1511,7 @@ Status GraphManager::ParseOptions(const std::map<std::string, std::string> &opti
|
|
|
|
|
Status GraphManager::ParseTrainGraphFlag(bool &options, bool &option) {
|
|
|
|
|
std::shared_ptr<GELib> ge_instance_ptr = ge::GELib::GetInstance();
|
|
|
|
|
if (ge_instance_ptr == nullptr) {
|
|
|
|
|
GELOGW("[Initialize] set train_graph_flag_ to 0 when GE is not initialized or finalized.");
|
|
|
|
|
GELOGW("[Initialize] set train_graph_flag to 0 when GE is not initialized or finalized.");
|
|
|
|
|
option = false;
|
|
|
|
|
} else if (!ge_instance_ptr->isTrainMode()) {
|
|
|
|
|
option = false;
|
|
|
|
@ -1528,7 +1528,8 @@ Status GraphManager::ParseTrainGraphFlag(bool &options, bool &option) {
|
|
|
|
|
|
|
|
|
|
bool GraphManager::IsPerfLevelInvalid(int32_t perf_level) {
|
|
|
|
|
return ((perf_level != static_cast<int32_t>(GEN_TASK_WITHOUT_L2FUSION)) &&
|
|
|
|
|
(perf_level != static_cast<int32_t>(GEN_TASK_WITHOUT_FUSION)) && (perf_level != -1));
|
|
|
|
|
(perf_level != static_cast<int32_t>(GEN_TASK_WITHOUT_FUSION)) &&
|
|
|
|
|
(perf_level != -1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GraphManager::ParseOption(const std::map<std::string, std::string> &options, const std::string &key,
|
|
|
|
|