|
|
|
@@ -269,24 +269,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, std::v |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeModelPtr &ge_model_ptr, |
|
|
|
uint64_t session_id) { |
|
|
|
ModelPtr model_ptr = MakeShared<ge::Model>(); |
|
|
|
if (model_ptr == nullptr) { |
|
|
|
return MEMALLOC_FAILED; |
|
|
|
} |
|
|
|
|
|
|
|
Graph2SubGraphInfoList subgraph_map; |
|
|
|
ge::ModelBuilder builder(session_id, comp_graph, subgraph_map, stream_max_parallel_num_, hcom_parallel_, build_mode_); |
|
|
|
GE_CHK_STATUS_RET(builder.PreBuildModel(), "Failed to pre build model."); |
|
|
|
|
|
|
|
GELOGI("Begin to build unknown shape graph[%s].", comp_graph->GetName().c_str()); |
|
|
|
GE_TIMESTAMP_START(CalcOpParam); |
|
|
|
GE_CHK_STATUS_RET(CalcOpParam(comp_graph), "Graph[%s] builder CalcOpParam() return fail.", |
|
|
|
comp_graph->GetName().c_str()); |
|
|
|
GE_TIMESTAMP_END(CalcOpParam, "GraphBuilder::CalcOpParam"); |
|
|
|
GE_DUMP(comp_graph, "AfterCalcOpParam"); |
|
|
|
|
|
|
|
Status GraphBuilder::SetConstantInputOffset(ComputeGraphPtr &comp_graph) { |
|
|
|
for (auto &node : comp_graph->GetDirectNode()) { |
|
|
|
GE_CHECK_NOTNULL(node); |
|
|
|
auto op_desc = node->GetOpDesc(); |
|
|
|
@@ -320,6 +303,7 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo |
|
|
|
GE_CHECK_NOTNULL(weight); |
|
|
|
int64_t input_offset = 0; |
|
|
|
(void) TensorUtils::GetDataOffset(weight->MutableTensorDesc(), input_offset); |
|
|
|
// valid_input_index must smaller than num_inputs |
|
|
|
input_offsets[valid_input_index] = input_offset; |
|
|
|
GELOGD("[%s] input[%u] is const, offset = %ld", node->GetName().c_str(), valid_input_index, input_offset); |
|
|
|
} |
|
|
|
@@ -328,6 +312,27 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo |
|
|
|
std::vector<int64_t> output_offsets(op_desc->GetOutputsSize(), 0); |
|
|
|
op_desc->SetOutputOffset(output_offsets); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeModelPtr &ge_model_ptr, |
|
|
|
uint64_t session_id) { |
|
|
|
ModelPtr model_ptr = MakeShared<ge::Model>(); |
|
|
|
if (model_ptr == nullptr) { |
|
|
|
return MEMALLOC_FAILED; |
|
|
|
} |
|
|
|
|
|
|
|
Graph2SubGraphInfoList subgraph_map; |
|
|
|
ge::ModelBuilder builder(session_id, comp_graph, subgraph_map, stream_max_parallel_num_, hcom_parallel_, build_mode_); |
|
|
|
GE_CHK_STATUS_RET(builder.PreBuildModel(), "Failed to pre build model."); |
|
|
|
|
|
|
|
GELOGI("Begin to build unknown shape graph[%s].", comp_graph->GetName().c_str()); |
|
|
|
GE_TIMESTAMP_START(CalcOpParam); |
|
|
|
GE_CHK_STATUS_RET(CalcOpParam(comp_graph), "Graph[%s] builder CalcOpParam() return fail.", |
|
|
|
comp_graph->GetName().c_str()); |
|
|
|
GE_TIMESTAMP_END(CalcOpParam, "GraphBuilder::CalcOpParam"); |
|
|
|
GE_DUMP(comp_graph, "AfterCalcOpParam"); |
|
|
|
|
|
|
|
GE_CHK_STATUS_RET(SetConstantInputOffset(comp_graph), "Failed to set constant input offset."); |
|
|
|
GE_CHK_STATUS_RET(builder.MergeWeights(), "Failed to merge weights."); |
|
|
|
|
|
|
|
GE_TIMESTAMP_START(BuildModelForGetDynShapeTask); |
|
|
|
|