Browse Source

fix cpp lint and errocode

tags/v1.2.0
weiyang 3 years ago
parent
commit
11161e313e
30 changed files with 100 additions and 59 deletions
  1. +2
    -1
      ge/common/debug/memory_dumper.cc
  2. +2
    -1
      ge/common/helper/model_helper.cc
  3. +2
    -1
      ge/common/helper/om_file_helper.cc
  4. +2
    -1
      ge/executor/ge_executor.cc
  5. +2
    -1
      ge/graph/build/graph_builder.cc
  6. +1
    -1
      ge/graph/build/memory/binary_block_mem_assigner.cc
  7. +3
    -2
      ge/graph/build/memory/block_mem_assigner.cc
  8. +4
    -2
      ge/graph/build/memory/graph_mem_assigner.cc
  9. +2
    -1
      ge/graph/build/stream_allocator.cc
  10. +2
    -1
      ge/graph/load/graph_loader.cc
  11. +12
    -10
      ge/graph/load/new_model_manager/davinci_model.cc
  12. +2
    -1
      ge/graph/load/new_model_manager/model_manager.cc
  13. +2
    -1
      ge/graph/load/new_model_manager/task_info/hccl_task_info.cc
  14. +2
    -2
      ge/graph/load/new_model_manager/task_info/kernel_task_info.cc
  15. +7
    -2
      ge/graph/manager/graph_manager.cc
  16. +2
    -1
      ge/graph/manager/util/hcom_util.cc
  17. +4
    -4
      ge/graph/passes/subgraph_pass.cc
  18. +2
    -1
      ge/graph/preprocess/graph_preprocess.cc
  19. +6
    -2
      ge/host_kernels/ssd_prior_box_kernel.cc
  20. +4
    -2
      ge/hybrid/executor/hybrid_model_async_executor.cc
  21. +2
    -1
      ge/hybrid/executor/worker/shape_inference_engine.cc
  22. +12
    -6
      ge/hybrid/model/hybrid_model.cc
  23. +2
    -1
      ge/hybrid/model/hybrid_model.h
  24. +2
    -2
      ge/ir_build/ge_ir_build.cc
  25. +4
    -4
      ge/opskernel_manager/ops_kernel_manager.cc
  26. +2
    -1
      ge/session/omg.cc
  27. +6
    -3
      ge/single_op/single_op.cc
  28. +2
    -1
      ge/single_op/single_op_model.cc
  29. +2
    -1
      ge/single_op/task/tbe_task_builder.cc
  30. +1
    -1
      inc/framework/common/taskdown_common.h

+ 2
- 1
ge/common/debug/memory_dumper.cc View File

@@ -139,7 +139,8 @@ int MemoryDumper::OpenFile(const char *filename) {
GE_IF_BOOL_EXEC(
-1 != path_split_pos, string prefix_path = std::string(filename).substr(0, path_split_pos);
string last_path = std::string(filename).substr(path_split_pos, strlen(filename) - 1);
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(prefix_path.length() >= MMPA_MAX_PATH, return kInvalidFd, "Prefix path is too long!");
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(prefix_path.length() >= MMPA_MAX_PATH,
return kInvalidFd, "Prefix path is too long!");
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmRealPath(prefix_path.c_str(), tmp_path, MMPA_MAX_PATH) != EN_OK, return kInvalidFd,
"Dir %s does not exit.", prefix_path.c_str());
real_path = std::string(tmp_path) + last_path;)


+ 2
- 1
ge/common/helper/model_helper.cc View File

@@ -189,7 +189,8 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr<OmFileSaveHelper> &om_file_s
err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(),
platform_version.size() + 1);
if (err != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "ModelHelper SaveModel failed while allocating memory for platform_version.");
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"ModelHelper SaveModel failed while allocating memory for platform_version.");
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
string version = reinterpret_cast<char *>(model_header.platform_version);


+ 2
- 1
ge/common/helper/om_file_helper.cc View File

@@ -180,7 +180,8 @@ Status OmFileLoadHelper::LoadModelPartitionTable(uint8_t *model_data, const uint
context_.partition_datas_.push_back(partition);

if (partition.size > model_data_size || mem_offset > model_data_size - partition.size) {
GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "The partition size %zu is greater than the model data size %u.",
GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID,
"The partition size %zu is greater than the model data size %u.",
partition.size + mem_offset, model_data_size);
return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID;
}


+ 2
- 1
ge/executor/ge_executor.cc View File

@@ -639,7 +639,8 @@ Status GeExecutor::UnloadModel(uint32_t model_id) {
return ACL_ERROR_GE_INTERNAL_ERROR;
}

std::shared_ptr<hybrid::HybridDavinciModel> hybrid_davinci_model = ModelManager::GetInstance()->GetHybridModel(model_id);
std::shared_ptr<hybrid::HybridDavinciModel> hybrid_davinci_model =
ModelManager::GetInstance()->GetHybridModel(model_id);
if (hybrid_davinci_model != nullptr) {
uint64_t session_id = hybrid_davinci_model->GetSessionId();
VarManagerPool::Instance().RemoveVarManager(session_id);


+ 2
- 1
ge/graph/build/graph_builder.cc View File

@@ -349,7 +349,8 @@ static Status GenerateTaskForConstant(const std::shared_ptr<ComputeGraph> &graph
GELOGD("Insert MemcpyAsync node between %s and %s.", in_node->GetName().c_str(), node->GetName().c_str());
std::string name = node->GetName() + "_input_" + std::to_string(in_data_anchor->GetIdx()) + "_Memcpy";
if (InsertMemcpyNode(graph, peer_out_anchor, {in_data_anchor}, name) != SUCCESS) {
GELOGE(FAILED, "Insert memcpy between %s and %s failed.", in_node->GetName().c_str(), node->GetName().c_str());
GELOGE(FAILED, "Insert memcpy between %s and %s failed.",
in_node->GetName().c_str(), node->GetName().c_str());
return FAILED;
}
}


+ 1
- 1
ge/graph/build/memory/binary_block_mem_assigner.cc View File

@@ -21,7 +21,7 @@
namespace {
const uint32_t kRangeCeilInterval = 2;
const uint32_t kLogBase = 2;
const int64_t kLargeBlockSize = 8 * 1024 * 1024;
const int64_t kLargeBlockSize = 8 * 1024 * 1024; // 8M
const int64_t kLargeBlockRangeSize = 2;
} // namespace



+ 3
- 2
ge/graph/build/memory/block_mem_assigner.cc View File

@@ -1416,7 +1416,8 @@ Status BlockMemAssigner::AssignOutputMemoryWithReuse(const NodePtr &node, vector
bool no_need_assign_memory = ((size == 0) || CheckIsZeroMemNodeType(node->GetType()));
if (!no_need_assign_memory) {
out_node_set_continuous_input =
IsOutNodeSetContinuousInput(node, i, peer_name, peer_input_index, no_need_assign_memory, reset_zero_copy_flag);
IsOutNodeSetContinuousInput(node, i, peer_name, peer_input_index,
no_need_assign_memory, reset_zero_copy_flag);
GE_IF_BOOL_EXEC(!no_need_assign_memory,
no_need_assign_memory = IsAtomicOutputMemory(node, i, is_atomic, out_node_set_continuous_input););
}
@@ -1499,7 +1500,7 @@ void BlockMemAssigner::AssignMemoryWithReuse(vector<int64_t> &ranges) {
bool workspace_skip_flag = false;
if (has_tvm_workspace_mem_type_attr && tvm_workspace_memory_type[i] == RT_MEMORY_L1) {
GELOGI(
"fusion: node[%s]workspace index[%zu] is not hbm type, add to zero_memory_list, workspace memory type [%ld]",
"fusion:node[%s]workspace index[%zu] is not hbm type, add to zero_memory_list, workspace memory type [%ld]",
node_op_desc->GetName().c_str(), i, tvm_workspace_memory_type[i]);
workspace_skip_flag = true;
}


+ 4
- 2
ge/graph/build/memory/graph_mem_assigner.cc View File

@@ -419,7 +419,8 @@ Status GraphMemoryAssigner::AssignContinuousInputMemory(const ge::NodePtr &node,
GE_IF_BOOL_EXEC(is_peer_output_continuous && (peer_output_size != 1),
std::string error = "Current op" + FmtToStr(node->GetOpDesc()->GetName()) +
" requires continuous input, while the previous op" + FmtToStr(peer_op_desc->GetName()) +
" requires continuous output. There may be conflict between the two. This node is not supported now.";
" requires continuous output. There may be conflict between the two." +
"This node is not supported now.";
GE_ERRORLOG_AND_ERRORMSG(FAILED, error.c_str());
return PARAM_INVALID;);

@@ -429,7 +430,8 @@ Status GraphMemoryAssigner::AssignContinuousInputMemory(const ge::NodePtr &node,
GE_IF_BOOL_EXEC(is_peer_reference,
std::string error = "Current op" + FmtToStr(node->GetOpDesc()->GetName()) +
" requires continuous input, while the previous op" + FmtToStr(peer_op_desc->GetName()) +
" requires continuous output. There may be conflict between the two. This node is not supported now.";
" requires continuous output. There may be conflict between the two." +
"This node is not supported now.";
GE_ERRORLOG_AND_ERRORMSG(FAILED, error.c_str());
return PARAM_INVALID;);



+ 2
- 1
ge/graph/build/stream_allocator.cc View File

@@ -49,7 +49,8 @@ inline bool HasContinuousStreamLabel(const ge::OpDescPtr &op_desc, std::string &
}

bool IsHcclOp(const string &op_type) {
const set<string> hccl_op_types({ge::HCOMBROADCAST, ge::HCOMALLGATHER, ge::HCOMALLREDUCE, ge::HCOMREDUCESCATTER, ge::HCOMREDUCE});
const set<string> hccl_op_types({ge::HCOMBROADCAST, ge::HCOMALLGATHER,
ge::HCOMALLREDUCE, ge::HCOMREDUCESCATTER, ge::HCOMREDUCE});
return hccl_op_types.find(op_type) != hccl_op_types.end();
}
} // namespace


+ 2
- 1
ge/graph/load/graph_loader.cc View File

@@ -283,7 +283,8 @@ Status GraphLoader::ExecuteModel(uint32_t model_id, rtStream_t stream, bool asyn
std::vector<GeTensorDesc> &output_desc) {
auto model_manager = ModelManager::GetInstance();
GE_CHECK_NOTNULL(model_manager);
Status ret = model_manager->ExecuteModel(model_id, stream, async_mode, input_data, input_desc, output_data, output_desc);
Status ret = model_manager->ExecuteModel(model_id, stream, async_mode,
input_data, input_desc, output_data, output_desc);
if (ret != SUCCESS) {
GELOGE(ret, "Execute model failed, model_id:%u.", model_id);
return ret;


+ 12
- 10
ge/graph/load/new_model_manager/davinci_model.cc View File

@@ -83,7 +83,7 @@ const uint32_t kAddrLen = sizeof(void *);
const int kDecimal = 10;
const int kBytes = 8;
const uint32_t kDataMemAlignSizeCompare = 64;
const uint32_t kDumpL1FusionOpMByteSize = 2 * 1024 * 1024;
const uint32_t kDumpL1FusionOpMByteSize = 2 * 1024 * 1024; // 2M
const uint32_t kDumpFlagOfL1Fusion = 0;
const char *const kDefaultBatchLable = "Batch_default";
const char *const kGetDynamicDimsName = "ascend_mbatch_get_dynamic_dims_node";
@@ -330,8 +330,8 @@ Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) {
GELOGE(GE_EXEC_ALLOC_FEATURE_MAP_MEM_FAILED, "Alloc feature map memory failed. size: %zu", data_size);
return GE_EXEC_ALLOC_FEATURE_MAP_MEM_FAILED;
}
GEEVENT("[IMAS]InitFeatureMapAndP2PMem graph_%u MallocMemory type[F] memaddr[%p] mem_size[%zu]", runtime_param_.graph_id,
mem_base_, data_size);
GEEVENT("[IMAS]InitFeatureMapAndP2PMem graph_%u MallocMemory type[F] memaddr[%p] mem_size[%zu]",
runtime_param_.graph_id, mem_base_, data_size);

if (!is_inner_weight_base_) {
weights_mem_base_ = mem_base_;
@@ -1543,7 +1543,8 @@ Status DavinciModel::LoadWithQueue() {
}

if (output_queue_ids_.size() != new_output_data_info_.size()) {
GELOGE(ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID, "Output queue ids not match model: output_queue=%zu output_data=%zu",
GELOGE(ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID,
"Output queue ids not match model: output_queue=%zu output_data=%zu",
output_queue_ids_.size(), new_output_data_info_.size());
return ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID;
}
@@ -3391,14 +3392,14 @@ bool DavinciModel::CheckInputAndModelSize(const int64_t &input_size, const int64
///
Status DavinciModel::CopyModelData(const InputData &input_data, OutputData &output_data, bool is_dynamic) {
if (UpdateIoTaskArgs(new_input_data_info_, true, input_data.blobs, is_dynamic, input_data.batch_label) != SUCCESS) {
GELOGE(PARAM_INVALID, "[ZCPY] Update input data to model failed.");
return PARAM_INVALID;
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[ZCPY] Update input data to model failed.");
return ACL_ERROR_GE_PARAM_INVALID;
}

if (UpdateIoTaskArgs(new_output_data_info_, false, output_data.blobs, is_dynamic, input_data.batch_label) !=
SUCCESS) {
GELOGE(PARAM_INVALID, "[ZCPY] Update output data to model failed.");
return PARAM_INVALID;
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[ZCPY] Update output data to model failed.");
return ACL_ERROR_GE_PARAM_INVALID;
}

for (ZeroCopyTask &task : zero_copy_tasks_) {
@@ -3861,7 +3862,8 @@ Status DavinciModel::NnExecute(rtStream_t stream, bool async_mode, const InputDa
if (!is_async_mode_) {
GE_IF_BOOL_EXEC(ProfilingManager::Instance().ProfilingModelExecuteOn(), SetProfileTime(MODEL_AFTER_PROC_START));
ret = CopyOutputData(input_data.index, output_data, RT_MEMCPY_DEVICE_TO_DEVICE);
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ret != SUCCESS, return ret, "Copy Output data to user failed.");
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ret != SUCCESS, return ACL_ERROR_GE_INTERNAL_ERROR,
"Copy Output data to user failed.");
GE_IF_BOOL_EXEC(ProfilingManager::Instance().ProfilingModelExecuteOn(), SetProfileTime(MODEL_AFTER_PROC_END));
}

@@ -4061,7 +4063,7 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &compute_graph) {
data_dumper_.SetDeviceId(device_id);

// set loop count addr
auto get_var_addr = [](const OpDescPtr &op, const RuntimeParam &runtime_param) -> void * {
auto get_var_addr = [](const OpDescPtr &op, const RuntimeParam &runtime_param) -> void *{
if (op != nullptr) {
auto v_output_size = ModelUtils::GetOutputSize(op);
auto v_output_addr = ModelUtils::GetOutputDataAddrs(runtime_param, op);


+ 2
- 1
ge/graph/load/new_model_manager/model_manager.cc View File

@@ -1254,7 +1254,8 @@ Status ModelManager::ExecuteModel(uint32_t model_id, rtStream_t stream, bool asy
}

std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id);
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, PARAM_INVALID, "Invalid model id %u.", model_id);
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID,
"Invalid model id %u, check weather model has been loaded or not.", model_id);

if (davinci_model->NeedDestroyAicpuKernel()) {
GELOGI("Start to destroy specified aicpu kernel.");


+ 2
- 1
ge/graph/load/new_model_manager/task_info/hccl_task_info.cc View File

@@ -281,7 +281,8 @@ Status HcclTaskInfo::SetAddrs(const std::shared_ptr<OpDesc> &op_desc,
kernel_hccl_infos[i].inputDataAddr = input_data_addr;
if (hccl_type == HCOMALLGATHER || hccl_type == HCOMRECEIVE || hccl_type == HVDCALLBACKALLGATHER) {
kernel_hccl_infos[i].outputDataAddr = output_data_addr;
} else if (hccl_type == HCOMALLREDUCE || hccl_type == HCOMREDUCESCATTER || hccl_type == HVDCALLBACKALLREDUCE || hccl_type == HCOMREDUCE) {
} else if (hccl_type == HCOMALLREDUCE ||
hccl_type == HCOMREDUCESCATTER || hccl_type == HVDCALLBACKALLREDUCE || hccl_type == HCOMREDUCE) {
GE_CHK_STATUS_RET(HcomOmeUtil::GetHcclOperationType(op_desc, op_type),
"davinci_model: GetHcomOperationType fail!");
kernel_hccl_infos[i].outputDataAddr = output_data_addr;


+ 2
- 2
ge/graph/load/new_model_manager/task_info/kernel_task_info.cc View File

@@ -1172,8 +1172,8 @@ Status KernelTaskInfo::CceUpdateKernelArgs(const domi::KernelContext &context, u
}
ccStatus_t cc_ret;
std::string update_kernel_args = "ccUpdateKernelArgs";
auto cceUpdateKernelArgs = (ccStatus_t(*)(ccOpContext &, uint64_t, uint64_t, uint64_t, void *, uint64_t,
void *))mmDlsym(handle, const_cast<char *>(update_kernel_args.c_str()));
auto cceUpdateKernelArgs = (ccStatus_t(*)(ccOpContext &, uint64_t, uint64_t,
uint64_t, void *, uint64_t, void *))mmDlsym(handle, const_cast<char *>(update_kernel_args.c_str()));
if (cceUpdateKernelArgs == nullptr) {
GELOGE(FAILED, "Failed to invoke function ccUpdateKernelArgs");
if (mmDlclose(handle) != 0) {


+ 7
- 2
ge/graph/manager/graph_manager.cc View File

@@ -549,8 +549,13 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr
if (!op_compile_strategy.empty()) {
(void) AttrUtils::SetStr(subgraph->GetSubGraph(), ATTR_NAME_OP_COMPILE_STRATEGY, op_compile_strategy);
}
std::future<Status> f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this,
compute_graph->GetGraphID(), subgraph, compute_graph, session_id, GetThreadLocalContext());
std::future<Status> f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads,
this,
compute_graph->GetGraphID(),
subgraph,
compute_graph,
session_id,
GetThreadLocalContext());
if (!f.valid()) {
GELOGE(FAILED, "Future is invalid");
return FAILED;


+ 2
- 1
ge/graph/manager/util/hcom_util.cc View File

@@ -263,7 +263,8 @@ Status HcomOmeUtil::GetHcclRootId(const ge::ConstOpDescPtr &op_desc, int64_t &ro
Status HcomOmeUtil::GetAllRootId(const ge::ConstOpDescPtr &op_desc,
std::vector<GETaskKernelHcclInfo> &kernel_hccl_infos) {
GE_CHECK_NOTNULL(op_desc);
if (op_desc->GetType() == HCOMBROADCAST || op_desc->GetType() == HVDCALLBACKBROADCAST || op_desc->GetType() == HCOMREDUCE) {
if (op_desc->GetType() == HCOMBROADCAST ||
op_desc->GetType() == HVDCALLBACKBROADCAST || op_desc->GetType() == HCOMREDUCE) {
GELOGI("GetAllRootId Node[%s] opType[%s] get hccl rootId.", op_desc->GetName().c_str(), op_desc->GetType().c_str());
int64_t root_id = 0;
Status dmrt = GetHcclRootId(op_desc, root_id);


+ 4
- 4
ge/graph/passes/subgraph_pass.cc View File

@@ -149,10 +149,10 @@ Status SubgraphPass::SubgraphOutputNode(const ComputeGraphPtr &graph, const Node
// 5. While->NetOutput in known subgraph
std::string op_type;
bool insert_flag = NodeUtils::GetConstOpType(in_node, op_type) ||
IsAtomicRequired(in_node, peer_out_anchor->GetIdx()) || IsOutputContinuesRequired(in_node) ||
((in_node->GetType() == DATA) && (kWhileOpTypes.count(graph->GetParentNode()->GetType()) == 0)) ||
(!graph->GetGraphUnknownFlag() && NodeUtils::IsDynamicShape(node) &&
(kWhileOpTypes.count(in_node->GetType()) != 0));
IsAtomicRequired(in_node, peer_out_anchor->GetIdx()) || IsOutputContinuesRequired(in_node) ||
((in_node->GetType() == DATA) && (kWhileOpTypes.count(graph->GetParentNode()->GetType()) == 0)) ||
(!graph->GetGraphUnknownFlag() && NodeUtils::IsDynamicShape(node) &&
(kWhileOpTypes.count(in_node->GetType()) != 0));
if (insert_flag) {
GELOGD("Insert MemcpyAsync node between %s and %s.", in_node->GetName().c_str(), node->GetName().c_str());
std::string name = node->GetName() + "_input_" + std::to_string(in_data_anchor->GetIdx()) + "_Memcpy";


+ 2
- 1
ge/graph/preprocess/graph_preprocess.cc View File

@@ -1621,7 +1621,8 @@ Status GraphPrepare::CheckUserInput(const std::vector<GeTensor> &user_input) {

for (size_t i = 0; i < desc.GetShape().GetDimNum(); ++i) {
if (desc.GetShape().GetDim(i) < 0) {
std::string situation = "data dim[" + std::to_string(i) + "][" + std::to_string(desc.GetShape().GetDim(i)) + "]" ;
std::string situation = "data dim[" + std::to_string(i) + "][" +
std::to_string(desc.GetShape().GetDim(i)) + "]" ;
std::string reason = "it need >= 0";
ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, {situation, reason});
GELOGE(GE_GRAPH_INIT_FAILED, "data dim %zu is not supported, need >= 0, real:%ld.", i,


+ 6
- 2
ge/host_kernels/ssd_prior_box_kernel.cc View File

@@ -180,8 +180,12 @@ Status SsdPriorboxKernel::SetVariance(const vector<float> &variance, const int d
return SUCCESS;
}

Status SsdPriorboxKernel::GetNumPriorAndDimSize(uint32_t aspect_ratios_size, uint32_t min_sizes_size, uint32_t max_sizes_size,
int layer_width, int layer_height, int &num_priors,
Status SsdPriorboxKernel::GetNumPriorAndDimSize(uint32_t aspect_ratios_size,
uint32_t min_sizes_size,
uint32_t max_sizes_size,
int layer_width,
int layer_height,
int &num_priors,
int &dim_size) const {
if (ge::CheckUint32MulOverflow(min_sizes_size, aspect_ratios_size) != SUCCESS) {
return PARAM_INVALID;


+ 4
- 2
ge/hybrid/executor/hybrid_model_async_executor.cc View File

@@ -379,11 +379,13 @@ Status HybridModelAsyncExecutor::Execute(const std::vector<DataBuffer> &inputs,
}
if (output_real_size > 0) {
if (outputs[i].length < static_cast<uint64_t>(output_real_size)) {
GELOGE(FAILED, "output idx[%zu], the memory size of output[%lu] given by user should be greater than or equal to the real size of output[%ld]",
GELOGE(FAILED, "output idx[%zu], the memory size of output[%lu] given by "
"user should be greater than or equal to the real size of output[%ld]",
i, outputs[i].length, output_real_size);
return FAILED;
}
GE_CHK_RT_RET(rtMemcpy(outputs[i].data, outputs[i].length, args.outputs[i].GetData(), output_real_size, RT_MEMCPY_DEVICE_TO_DEVICE));
GE_CHK_RT_RET(rtMemcpy(outputs[i].data, outputs[i].length,
args.outputs[i].GetData(), output_real_size, RT_MEMCPY_DEVICE_TO_DEVICE));
}
outputs[i].length = output_real_size;
}


+ 2
- 1
ge/hybrid/executor/worker/shape_inference_engine.cc View File

@@ -62,7 +62,8 @@ Status ShapeInferenceEngine::InferShape(NodeState &node_state) {
{
std::lock_guard<std::mutex> lk(mu_);
RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] Start");
GE_CHK_STATUS_RET(ShapeRefiner::InferShapeAndTypeForRunning(node_item.node, true), "Invoke InferShapeAndType failed.");
GE_CHK_STATUS_RET(ShapeRefiner::InferShapeAndTypeForRunning(node_item.node, true),
"Invoke InferShapeAndType failed.");
RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] End");
}
// Check again to make sure shape is valid after shape inference


+ 12
- 6
ge/hybrid/model/hybrid_model.cc View File

@@ -176,7 +176,8 @@ Status HybridModel::GetInputOutputDescInfo(vector<InputOutputDescInfo> &input_de
return SUCCESS;
}

void HybridModel::SetInputDimsAndShapeRangesInfo(const vector<int64_t> &model_input_dims, std::vector<std::pair<int64_t,int64_t>> &shape_ranges,
void HybridModel::SetInputDimsAndShapeRangesInfo(const vector<int64_t> &model_input_dims,
std::vector<std::pair<int64_t, int64_t>> &shape_ranges,
InputOutputDescInfo &input) {
for (auto model_input_dim : model_input_dims) {
input.shape_info.dims.push_back(model_input_dim);
@@ -245,7 +246,8 @@ Status HybridModel::GetInputDescInfo(vector<InputOutputDescInfo> &input_desc, st
return SUCCESS;
}

void HybridModel::CreateOutput(ConstGeTensorDescPtr &output_desc, InputOutputDescInfo &output_desc_info, uint32_t &format_result) {
void HybridModel::CreateOutput(ConstGeTensorDescPtr &output_desc,
InputOutputDescInfo &output_desc_info, uint32_t &format_result) {
GE_IF_BOOL_EXEC(output_desc == nullptr, GELOGE(FAILED, "output desc ptr is nullptr"); return );
Format format = output_desc->GetFormat();
GeShape shape = output_desc->GetShape();
@@ -283,7 +285,8 @@ void HybridModel::CreateOutput(ConstGeTensorDescPtr &output_desc, InputOutputDes

Status HybridModel::GetOutputDescInfo(vector<InputOutputDescInfo> &output_desc, std::vector<uint32_t> &formats) {
std::vector<ConstGeTensorDescPtr> output_desc_list;
GE_CHK_STATUS_RET(root_graph_item_->GetOutputDescList(output_desc_list), "get output desc info failed"); // output_desc_list contains vaild input desc
// output_desc_list contains vaild input desc
GE_CHK_STATUS_RET(root_graph_item_->GetOutputDescList(output_desc_list), "get output desc info failed");

vector<std::string> out_node_names;
(void)ge::AttrUtils::GetListStr(ge_root_model_->GetRootGraph(), ATTR_MODEL_OUT_NODES_NAME, out_node_names);
@@ -293,7 +296,8 @@ Status HybridModel::GetOutputDescInfo(vector<InputOutputDescInfo> &output_desc,
GE_CHECK_NOTNULL(op_desc);

auto out_size = static_cast<uint32_t>(op_desc->GetInputsSize());
GE_CHK_BOOL_RET_STATUS(out_size == output_desc_list.size(), FAILED, "output size[%u] not match output_desc_list size[%zu]", out_size, output_desc_list.size());
GE_CHK_BOOL_RET_STATUS(out_size == output_desc_list.size(),
FAILED, "output size[%u] not match output_desc_list size[%zu]", out_size, output_desc_list.size());

for (uint32_t index = 0; index < out_size; ++index) {
string output_name;
@@ -301,9 +305,11 @@ Status HybridModel::GetOutputDescInfo(vector<InputOutputDescInfo> &output_desc,
std::vector<int64_t> src_index = op_desc->GetSrcIndex();
if (out_size == out_node_names.size()) {
bool contains_colon = out_node_names[index].find(":") != std::string::npos;
output_name = contains_colon ? out_node_names[index] : out_node_names[index] + ":" + std::to_string(src_index[index]);
output_name = contains_colon ? out_node_names[index] : out_node_names[index] +
":" + std::to_string(src_index[index]);
} else {
output_name = std::string("output_") + std::to_string(index) + "_" + src_name[index] + "_" + std::to_string(src_index[index]);
output_name = std::string("output_") + std::to_string(index) + "_" + src_name[index] +
"_" + std::to_string(src_index[index]);
}

InputOutputDescInfo output_desc_info;


+ 2
- 1
ge/hybrid/model/hybrid_model.h View File

@@ -104,7 +104,8 @@ class HybridModel {

void SetModelDescVersion(bool is_new_model_desc) { is_new_model_desc_ = is_new_model_desc; }

void SetInputDimsAndShapeRangesInfo(const vector<int64_t> &model_input_dims, std::vector<std::pair<int64_t, int64_t>> &shape_ranges,
void SetInputDimsAndShapeRangesInfo(const vector<int64_t> &model_input_dims,
std::vector<std::pair<int64_t, int64_t>> &shape_ranges,
InputOutputDescInfo &input);

private:


+ 2
- 2
ge/ir_build/ge_ir_build.cc View File

@@ -590,7 +590,7 @@ graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &m
GELOGE(GRAPH_PARAM_INVALID, "input model is illegal");
return GRAPH_PARAM_INVALID;
}
return FileSaver::SaveToFile((output_file + ".om"), reinterpret_cast<void*>(model.data.get()),
return FileSaver::SaveToFile((output_file + ".om"), reinterpret_cast<void *>(model.data.get()),
static_cast<uint32_t>(model.length));
}

@@ -605,7 +605,7 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod
return GRAPH_PARAM_INVALID;
}
std::string str_output_file = output_file;
return FileSaver::SaveToFile((str_output_file + ".om"), reinterpret_cast<void*>(model.data.get()),
return FileSaver::SaveToFile((str_output_file + ".om"), reinterpret_cast<void *>(model.data.get()),
static_cast<uint32_t>(model.length));
}



+ 4
- 4
ge/opskernel_manager/ops_kernel_manager.cc View File

@@ -175,8 +175,8 @@ Status OpsKernelManager::ParsePluginOptions(const map<string, string> &options,
} else if (flag == 1) {
enable_flag = true;
} else {
GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(),
iter->second.c_str());
GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:%s, its value %s is invalid, it must be 0 or 1.",
plugin_name.c_str(), iter->second.c_str());
return GE_GRAPH_OPTIONS_INVALID;
}
} catch (std::invalid_argument &) {
@@ -188,8 +188,8 @@ Status OpsKernelManager::ParsePluginOptions(const map<string, string> &options,
iter->second.c_str());
return GE_GRAPH_OPTIONS_INVALID;
} catch (...) {
GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(),
iter->second.c_str());
GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:%s, its value %s is invalid, it must be 0 or 1.",
plugin_name.c_str(), iter->second.c_str());
return GE_GRAPH_OPTIONS_INVALID;
}
} else {


+ 2
- 1
ge/session/omg.cc View File

@@ -644,7 +644,8 @@ Status ParseOutNodes(const string &out_nodes) {
if (!domi::GetContext().user_out_nodes_top_vec.empty()) {
ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"},
{"--out_nodes", out_nodes, "is not all index or top_name"});
GELOGE(PARAM_INVALID, "This out_nodes str must be all index or top_name, while the actual input is %s", out_nodes.c_str());
GELOGE(PARAM_INVALID,
"This out_nodes str must be all index or top_name, while the actual input is %s", out_nodes.c_str());
return PARAM_INVALID;
}
// stoi: The method may throw an exception: invalid_argument/out_of_range


+ 6
- 3
ge/single_op/single_op.cc View File

@@ -109,7 +109,8 @@ Status SingleOp::ValidateArgs(const std::vector<DataBuffer> &inputs, const std::

auto num_outputs = outputs.size();
if (num_outputs != output_sizes_.size()) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "output num mismatch. model expect %zu, but given %zu", output_sizes_.size(), outputs.size());
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "output num mismatch. model expect %zu, but given %zu",
output_sizes_.size(), outputs.size());
return ACL_ERROR_GE_PARAM_INVALID;
}

@@ -248,12 +249,14 @@ Status DynamicSingleOp::ValidateParams(const vector<GeTensorDesc> &input_desc,
}

if (input_desc.size() != num_inputs_) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Input number mismatches. expect %zu, but given %zu", num_inputs_, input_desc.size());
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Input number mismatches. expect %zu, but given %zu",
num_inputs_, input_desc.size());
return ACL_ERROR_GE_PARAM_INVALID;
}

if (output_desc.size() != num_outputs_) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Output number mismatches. expect %zu, but given %zu", num_outputs_, output_desc.size());
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Output number mismatches. expect %zu, but given %zu",
num_outputs_, output_desc.size());
return ACL_ERROR_GE_PARAM_INVALID;
}



+ 2
- 1
ge/single_op/single_op_model.cc View File

@@ -263,7 +263,8 @@ Status SingleOpModel::BuildTaskList(SingleOp &single_op) {
task->SetModelArgs(model_name_, model_id_);
single_op.tasks_.emplace_back(task);
} else {
GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, "Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type());
GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID,
"Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type());
return ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID;
}
} else if (task_type == RT_MODEL_TASK_KERNEL_EX) {


+ 2
- 1
ge/single_op/task/tbe_task_builder.cc View File

@@ -173,7 +173,8 @@ Status TbeTaskBuilder::RegisterKernel(TbeOpTask &task, const SingleOpModelParam

auto tbe_kernel = GetTbeKernel(op_desc_);
if (tbe_kernel == nullptr) {
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "OP EXT ATTR NAME TBE_KERNEL not found. op = %s", op_desc_->GetName().c_str());
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "OP EXT ATTR NAME TBE_KERNEL not found. op = %s",
op_desc_->GetName().c_str());
return ACL_ERROR_GE_INTERNAL_ERROR;
}



+ 1
- 1
inc/framework/common/taskdown_common.h View File

@@ -21,7 +21,7 @@

namespace ge {

#define CC_FUSION_OP_MAX 32
const int CC_FUSION_OP_MAX = 32;

typedef enum tagCcStatus {
CC_STATUS_SUCCESS = 0, /**< succ */


Loading…
Cancel
Save