From 9da074ec6b6d0a5b7db73e407fd5e93d4a8da896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AC=91=E5=A4=A9?= Date: Wed, 17 Mar 2021 16:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!1269=20?= =?UTF-8?q?:=20fix=20suojin'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/graph/build/logical_stream_allocator.cc | 33 ++-- ge/graph/build/memory/block_mem_assigner.cc | 164 ++++++++---------- ge/plugin/engine/CMakeLists.txt | 1 - .../format_transfer_fractal_nz_unittest.cc | 34 ++-- .../format_transfer_nhwc_fractalz_unittest.cc | 16 +- .../ut/ge/common/format_transfer_unittest.cc | 58 +++---- 6 files changed, 141 insertions(+), 165 deletions(-) diff --git a/ge/graph/build/logical_stream_allocator.cc b/ge/graph/build/logical_stream_allocator.cc index 1828c13a..3bc29b70 100644 --- a/ge/graph/build/logical_stream_allocator.cc +++ b/ge/graph/build/logical_stream_allocator.cc @@ -70,7 +70,7 @@ Status AssignByLabelPass::Run(ComputeGraphPtr graph, const vector & auto iter = label_streams.find(stream_label); if (iter == label_streams.end()) { subgraph->stream_id = next_stream; - GELOGI("[Assign][NewStreamId] %ld for label %s.", next_stream, stream_label.c_str()); + GELOGI("Assign new stream %ld for label %s.", next_stream, stream_label.c_str()); label_streams.emplace(stream_label, next_stream); next_stream++; @@ -102,7 +102,7 @@ Status IndependentStreamPass::Run(ComputeGraphPtr graph, const vectorstream_id = next_stream; - GELOGI("[Assign][NewStreamId:independent] %ld for engine %s (label: %s).", next_stream, engine.c_str(), + GELOGI("Assign new independent stream %ld for engine %s (label: %s).", next_stream, engine.c_str(), stream_label.c_str()); label_streams.emplace(stream_label, next_stream); @@ -137,8 +137,8 @@ Status AssignByDependencyPass::Run(ComputeGraphPtr graph, const vectorstream_id = stream_id; - GELOGI("[Assign][NewStreamId] %ld for Reusable subgraph %s cause has not been assigned before.", - stream_id, reusable_subgraph->name.c_str()); + GELOGI("Reusable subgraph %s has not been assigned a stream, now assign new stream %ld.", + reusable_subgraph->name.c_str(), stream_id); } if (reusable_subgraph->reused_subgraph != nullptr) { @@ -147,8 +147,7 @@ Status AssignByDependencyPass::Run(ComputeGraphPtr graph, const vectorreused_subgraph = reusable_subgraph; reused_subgraphs_.emplace_back(subgraph, reusable_subgraph); - GELOGI("[Reuse][Stream]Subgraph %s of engine %s reuses stream of subgraph %s of engine %s.", - subgraph->name.c_str(), + GELOGI("Subgraph %s of engine %s reuses stream of subgraph %s of engine %s.", subgraph->name.c_str(), subgraph->engine_conf.id.c_str(), reusable_subgraph->name.c_str(), reusable_subgraph->engine_conf.id.c_str()); } @@ -260,7 +259,7 @@ int64_t AssignByDependencyPass::AssignNewStream(SubgraphPtr subgraph) { engine_stream_num_[engine_name] = stream_id + 1; } - GELOGI("[Assign][NewStreamId:temp]id:%ld for Subgraph %s (engine: %s).", stream_id, subgraph->name.c_str(), + GELOGI("Subgraph %s assigns new temp stream %ld (engine: %s).", subgraph->name.c_str(), stream_id, engine_name.c_str()); return stream_id; @@ -293,7 +292,7 @@ void AssignByDependencyPass::UpdateAssignedSubgraphs(Context &context) { GELOGI("Subgraph %s of engine %s reuses default stream %ld.", subgraph->name.c_str(), subgraph->engine_conf.id.c_str(), context.default_stream); } else { - GELOGI("[Update][StreamId]id:%ld for subgraph %s.", subgraph->stream_id, subgraph->name.c_str()); + GELOGI("Stream of subgraph %s has been updated to %ld.", subgraph->name.c_str(), subgraph->stream_id); } } } @@ -304,7 +303,7 @@ void AssignByDependencyPass::UpdateReusedSubgraphs() { auto &cur_subgraph = item.first; auto &reused_graph = item.second; cur_subgraph->stream_id = reused_graph->stream_id; - GELOGI("[Update][StreamId]id:%ld for subgraph %s.", cur_subgraph->stream_id, cur_subgraph->name.c_str()); + GELOGI("Stream of subgraph %s has been updated to %ld.", cur_subgraph->name.c_str(), cur_subgraph->stream_id); } } @@ -341,7 +340,7 @@ Status NodeStreamUpdatePass::Run(ComputeGraphPtr graph, const vectorstream_id, subgraph->name.c_str(), + GELOGI("Subgraph %s is assigned stream %ld (engine: %s).", subgraph->name.c_str(), subgraph->stream_id, engine_name.c_str()); } } @@ -364,12 +363,12 @@ Status NodeStreamUpdatePass::Run(ComputeGraphPtr graph, const vectorGetName().c_str(), node->GetType().c_str(), subgraph->name.c_str(), context.default_stream, engine_name.c_str()); } else if (IsEngineSkip(*subgraph) && node->GetInNodes().empty()) { - GELOGD("[Skip][StreamIdAssign]Node %s of type %s in subgraph %s doesn't need (engine: %s).", + GELOGD("Node %s of type %s in subgraph %s doesn't need to assign a stream (engine: %s).", node->GetName().c_str(), node->GetType().c_str(), subgraph->name.c_str(), engine_name.c_str()); } else { node->GetOpDesc()->SetStreamId(stream_id); - GELOGD("[Assign][StreamId]id:%ld for Node %s of type %s in subgraph %s (engine: %s).", stream_id, - node->GetName().c_str(), node->GetType().c_str(), subgraph->name.c_str(), engine_name.c_str()); + GELOGD("Node %s of type %s in subgraph %s is assigned stream %ld (engine: %s).", node->GetName().c_str(), + node->GetType().c_str(), subgraph->name.c_str(), stream_id, engine_name.c_str()); } } } @@ -398,8 +397,8 @@ int64_t UpdateForSkippedEnginePass::GetSingleInoutStream(const NodePtr &node) co if (stream_ids.size() == 1) { int64_t stream_id = *(stream_ids.begin()); - GELOGI("[Get][SingleStreamId]The stream of all input and output nodes of node %s (type: %s) is %ld.", - node->GetName().c_str(), node->GetType().c_str(), stream_id); + GELOGI("The stream of all input and output nodes of node %s (type: %s) is %ld.", node->GetName().c_str(), + node->GetType().c_str(), stream_id); return stream_id; } @@ -438,8 +437,8 @@ Status UpdateForSkippedEnginePass::Run(ComputeGraphPtr graph, const vectorSetStreamId(inout_stream); - GELOGI("[Reassign][StreamId]%ld for %ld Node %s of type %s from stream %ld.", - inout_stream, node->GetName().c_str(), node->GetType().c_str(), stream_id); + GELOGI("Node %s of type %s reassign to stream %ld from stream %ld.", node->GetName().c_str(), + node->GetType().c_str(), inout_stream, stream_id); } } } diff --git a/ge/graph/build/memory/block_mem_assigner.cc b/ge/graph/build/memory/block_mem_assigner.cc index f9921044..288b7b29 100755 --- a/ge/graph/build/memory/block_mem_assigner.cc +++ b/ge/graph/build/memory/block_mem_assigner.cc @@ -597,13 +597,11 @@ void BlockMemAssigner::GetOutAndWorkSpaceMem(vector &all_memory_size) { int64_t size = 0; GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(output_desc, size) != SUCCESS, GELOGI("Get size failed")); GE_IF_BOOL_EXEC(size < 0, - GELOGE(FAILED, "[Check][TensorSize]tensor_size:%ld is invalid, " - "maybe it is unknown shape node, Node_name:%s", - size, node_op_desc->GetName().c_str()); - REPORT_INNER_ERROR("E19999", "tensor_size:%ld is invalid, " - "maybe it is unknown shape node, Node_name:%s", - size, node_op_desc->GetName().c_str()); - return;); + GELOGE(FAILED, "[Check][TensorSize]tensor_size:%ld is invalid, maybe it is unknown shape node, Node_name:%s", + size, node_op_desc->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "tensor_size:%ld is invalid, maybe it is unknown shape node, Node_name:%s", + size, node_op_desc->GetName().c_str()); + return;); batch_all_memory_size[batch_label].emplace_back(size); if (batch_total_size.find(batch_label) == batch_total_size.end()) { batch_total_size[batch_label] = size; @@ -694,23 +692,23 @@ bool BlockMemAssigner::IsOutNodeSetContinuousInput(const NodePtr &n, uint32_t ou auto out_anchor = n->GetOutDataAnchor(out_index); GE_IF_BOOL_EXEC(out_anchor == nullptr, GELOGE(FAILED, "[Check][Anchor]Node[%s] output[%u] anchor is null.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); REPORT_INNER_ERROR("E19999", "output anchor is null, node_name: %s output_index: %u.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); return false;); for (auto const &peer_in_anchor : out_anchor->GetPeerInDataAnchors()) { GE_IF_BOOL_EXEC(peer_in_anchor == nullptr, GELOGE(FAILED, "[Check][Anchor]Node[%s] output[%u] peer_in_anchor 0 is null.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); REPORT_INNER_ERROR("E19999", "output anchor peer is null, node_name: %s output_index: %u.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); return false;); auto peer_node = peer_in_anchor->GetOwnerNode(); GE_IF_BOOL_EXEC(peer_node == nullptr, GELOGE(FAILED, "[Check][Node]Node[%s] output[%u] peer node is null.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); REPORT_INNER_ERROR("E19999", "output anchor peer node is null, node_name: %s output_index: %u.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); return false;); // Get the continuous input type of the node, default is false @@ -718,9 +716,9 @@ bool BlockMemAssigner::IsOutNodeSetContinuousInput(const NodePtr &n, uint32_t ou auto peer_in_node_desc = peer_node->GetOpDesc(); GE_IF_BOOL_EXEC(peer_in_node_desc == nullptr, GELOGE(FAILED, "[Check][OpDesc]Node[%s] output[%u] nodedesc is null.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); REPORT_INNER_ERROR("E19999", "output anchor peer op_desc is null, node_name:%s output_index:%u.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); return false;); // If GetBool fail, is_input_continuous is false. @@ -821,7 +819,7 @@ bool BlockMemAssigner::IsContinuousMemoryReuse(const NodePtr &n, const NodePtr & (in_anchor->GetPeerOutAnchor()->GetOwnerNode() == nullptr) || (in_anchor->GetPeerOutAnchor()->GetOwnerNode()->GetOpDesc() == nullptr)) { GELOGE(FAILED, "[Check][OpDesc]Node[%s] output[%u] peer input node desc is null.", - n->GetName().c_str(), out_index); + n->GetName().c_str(), out_index); REPORT_INNER_ERROR("E19999", "get output anchor peer op_desc fail, node_name: %s output_index: %u.", n->GetName().c_str(), out_index); return false; @@ -1107,10 +1105,9 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size, OpMemoryType mem_type, const NodePtr &n, uint32_t out_index, const vector &workspace_reuse_flag, const bool is_op_reuse_mem, const bool continuous, int64_t memory_type) { - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - n == nullptr, - REPORT_INNER_ERROR("E19999", "Input parameter n(type:node_ptr) is null, apply memory failed"); - return nullptr, "[Check][Param]Input parameter n(type:node_ptr) is null."); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(n == nullptr, + REPORT_INNER_ERROR("E19999", "Input parameter n(type:node_ptr) is null, apply memory failed"); + return nullptr, "[Check][Param]Input parameter n(type:node_ptr) is null."); auto node_op_desc = n->GetOpDesc(); GE_IF_BOOL_EXEC(node_op_desc == nullptr, return nullptr); std::string batch_label; @@ -1162,12 +1159,10 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size, } auto block = new (std::nothrow) MemoryBlock(block_size, node_op_desc->GetStreamId(), is_reuse_memory, memory_type); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - block == nullptr, - REPORT_INNER_ERROR("E19999", "new a memoryblock object failed. node_name:%s out_index:%u", - n->GetName().c_str(), out_index); - return nullptr, - "[New][Object]new MemoryBlock failed, node_name:%s out_index:%u", n->GetName().c_str(), out_index); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(block == nullptr, + REPORT_INNER_ERROR("E19999", "new a memoryblock object failed. node_name:%s out_index:%u", + n->GetName().c_str(), out_index); + return nullptr, "[New][Object]new MemoryBlock failed, node_name:%s out_index:%u", n->GetName().c_str(), out_index); // Data and netoutput need zero copy block block->is_zero_copy_ = IsZeroCopyBlock(n, continuous); @@ -1226,15 +1221,13 @@ void BlockMemAssigner::ContinuousOutRefCheck(bool &isAllOutputRef, bool &isOutpu Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector &ranges, const bool is_op_reuse_mem) { - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - n == nullptr, - REPORT_INNER_ERROR("E19999", "Input parameter n(type:node_ptr) is null"); - return INTERNAL_ERROR, "[check][param]Input parameter n(type:NodePtr) is null."); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(n == nullptr, + REPORT_INNER_ERROR("E19999", "Input parameter n(type:node_ptr) is null"); + return INTERNAL_ERROR, "[check][param]Input parameter n(type:NodePtr) is null."); auto node_op_desc = n->GetOpDesc(); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - node_op_desc == nullptr, - REPORT_INNER_ERROR("E19999", "Input parameter n(type:OpDescPtr) is null"); - return INTERNAL_ERROR, "[Check][Param]Input parameter n(type:OpDescPtr) is null"); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(node_op_desc == nullptr, + REPORT_INNER_ERROR("E19999", "Input parameter n(type:OpDescPtr) is null"); + return INTERNAL_ERROR, "[Check][Param]Input parameter n(type:OpDescPtr) is null"); // continuous output support ref only when all output ref input bool isAllOutputRef = true; @@ -1249,7 +1242,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vectorGetName().c_str()); + n->GetName().c_str()); GELOGE(INTERNAL_ERROR, "[Check][OutRefStatus]continuous output node ref part input, not support, node_name:%s", n->GetName().c_str()); return INTERNAL_ERROR; @@ -1262,7 +1255,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vectorGetOutputDescPtr(index); if (output_op_desc == nullptr) { REPORT_INNER_ERROR("E19999", "get output_desc failed, node_name:%s, output_index:%u", - n->GetName().c_str(), index); + n->GetName().c_str(), index); GELOGE(INTERNAL_ERROR, "[Get][OutputDesc]node_name:%s, output_index:%u", n->GetName().c_str(), index); return INTERNAL_ERROR; } @@ -1275,7 +1268,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vectorGetName().c_str(), index); + n->GetName().c_str(), index); GELOGE(INTERNAL_ERROR, "[Get][TensorSize]node_name:%s, output_index:%u", n->GetName().c_str(), index); return INTERNAL_ERROR; } @@ -1317,7 +1310,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vectorref_count_); } else { REPORT_CALL_ERROR("E19999", "apply continuousMemory failed, node_name:%s, total_size:%ld", - n->GetName().c_str(), total_size); + n->GetName().c_str(), total_size); GELOGE(INTERNAL_ERROR, "[Apply][ContinuousMemory]node_name:%s, total_size:%ld", n->GetName().c_str(), total_size); return INTERNAL_ERROR; } @@ -1326,33 +1319,26 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector &ranges, const bool is_op_reuse_mem, const bool continuous) { - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - n == nullptr, - REPORT_INNER_ERROR("E19999", "Input parameter n(type:NodePtr) is null"); - return nullptr, "[Check][Param]Input parameter n(type:NodePtr) is null"); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(n == nullptr, + REPORT_INNER_ERROR("E19999", "Input parameter n(type:NodePtr) is null"); + return nullptr, "[Check][Param]Input parameter n(type:NodePtr) is null"); auto node_op_desc = n->GetOpDesc(); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - node_op_desc == nullptr, - REPORT_INNER_ERROR("E19999", "Input parameter n(type:OpDescPtr) is null"); - return nullptr, "[Check][Param]Input parameter n(type:OpDescPtr) is null"); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(node_op_desc == nullptr, + REPORT_INNER_ERROR("E19999", "Input parameter n(type:OpDescPtr) is null"); + return nullptr, "[Check][Param]Input parameter n(type:OpDescPtr) is null"); MemoryBlock *block = nullptr; NodeIndexIO node_index_io(n, index, kOut); int64_t size = 0; auto output_op_desc = node_op_desc->GetOutputDescPtr(index); - GE_IF_BOOL_EXEC( - output_op_desc == nullptr, - REPORT_INNER_ERROR("E19999", "get output_desc failed, node_name:%s, output_index:%u", - n->GetName().c_str(), index); - GELOGE(FAILED, "[Get][OutputDesc]node_name:%s, output_index:%u", n->GetName().c_str(), index); - return nullptr); + GE_IF_BOOL_EXEC(output_op_desc == nullptr, + REPORT_INNER_ERROR("E19999", "get output_desc failed, node_name:%s, output_index:%u", n->GetName().c_str(), index); + GELOGE(FAILED, "[Get][OutputDesc]node_name:%s, output_index:%u", n->GetName().c_str(), index); + return nullptr); GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(*output_op_desc, size) != SUCCESS, GELOGI("Get size failed")); size_t no_align_size = 0; - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - GetNoAlignSize(*node_op_desc, index, no_align_size) != SUCCESS, - REPORT_CALL_ERROR("E19999", "Get no align size failed, node_name:%s, output_index:%u", - n->GetName().c_str(), index); - return nullptr, - "[Get][TensorSize]Get no align size, node_name:%s, output_index:%u", n->GetName().c_str(), index); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(GetNoAlignSize(*node_op_desc, index, no_align_size) != SUCCESS, + REPORT_CALL_ERROR("E19999", "Get no align size failed, node_name:%s, output_index:%u", n->GetName().c_str(), index); + return nullptr, "[Get][TensorSize]Get no align size, node_name:%s, output_index:%u", n->GetName().c_str(), index); std::string symbol; bool reuse_input = false; @@ -1360,9 +1346,9 @@ MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, block = symbol_blocks_[symbol]; GE_IF_BOOL_EXEC(block == nullptr, REPORT_INNER_ERROR("E19999", "get ref block failed, node_name:%s, symbol:%s", - node_op_desc->GetName().c_str(), node_index_io.ToString().c_str()); + node_op_desc->GetName().c_str(), node_index_io.ToString().c_str()); GELOGE(FAILED, "[Get][RefBlock]node_name:%s, symbol:%s", - node_op_desc->GetName().c_str(), node_index_io.ToString().c_str()); + node_op_desc->GetName().c_str(), node_index_io.ToString().c_str()); return nullptr); // reduce old size size_t align_size = block->Size(); @@ -1406,28 +1392,24 @@ MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, vector workspace_reuse_flag; block = ApplyMemory(block_size, size, no_align_size, kOutput, n, index, workspace_reuse_flag, is_op_reuse_mem, continuous, memory_type); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - block == nullptr, - REPORT_CALL_ERROR("E19999", "apply out Memory failed, node_name:%s, block_size:%ld, out_index:%u", - n->GetName().c_str(), block_size, index); - return nullptr, - "[Apply][Memory]node_name:%s, block_size:%ld, out_index:%u", + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(block == nullptr, + REPORT_CALL_ERROR("E19999", "apply out Memory failed, node_name:%s, block_size:%ld, out_index:%u", + n->GetName().c_str(), block_size, index); + return nullptr, "[Apply][Memory]node_name:%s, block_size:%ld, out_index:%u", n->GetName().c_str(), block_size, index); } int out_count = 0; - GE_IF_BOOL_EXEC( - index >= n->GetAllOutDataAnchors().size(), - REPORT_INNER_ERROR("E19999", "out index:%u exceed out_size:%lu, node_name:%s", - index, n->GetAllOutDataAnchors().size(), n->GetName().c_str()); - GELOGE(FAILED, "[Check][OutIndex]index:%u exceed out_size:%lu, node_name:%s", - index, n->GetAllOutDataAnchors().size(), n->GetName().c_str()); - return nullptr); + GE_IF_BOOL_EXEC(index >= n->GetAllOutDataAnchors().size(), + REPORT_INNER_ERROR("E19999", "out index:%u exceed out_size:%lu, node_name:%s", + index, n->GetAllOutDataAnchors().size(), n->GetName().c_str()); + GELOGE(FAILED, "[Check][OutIndex]index:%u exceed out_size:%lu, node_name:%s", + index, n->GetAllOutDataAnchors().size(), n->GetName().c_str()); + return nullptr); auto out_data_anchor = n->GetOutDataAnchor(index); - GE_IF_BOOL_EXEC( - out_data_anchor == nullptr, - REPORT_INNER_ERROR("E19999", "out anchor is null, index:%u, node_name:%s", index, n->GetName().c_str()); - GELOGE(FAILED, "[Check][OutAnchor]is null, index:%u, node_name:%s", index, n->GetName().c_str()); - return nullptr); + GE_IF_BOOL_EXEC(out_data_anchor == nullptr, + REPORT_INNER_ERROR("E19999", "out anchor is null, index:%u, node_name:%s", index, n->GetName().c_str()); + GELOGE(FAILED, "[Check][OutAnchor]is null, index:%u, node_name:%s", index, n->GetName().c_str()); + return nullptr); for (const auto &in_anchor : out_data_anchor->GetPeerInDataAnchors()) { auto owner_node = in_anchor->GetOwnerNode(); auto op_desc = owner_node->GetOpDesc(); @@ -1634,13 +1616,12 @@ Status BlockMemAssigner::AssignOutputMemoryWithReuse(const NodePtr &node, vector op_desc->GetOutputsSize(), memorys_type.size()); if (has_mem_type_attr && (memorys_type.size() != op_desc->GetOutputsSize())) { REPORT_INNER_ERROR("E19999", "Attr[%s] size:%zu not equal to node output size:%zu, node_name:%s", - ATTR_NAME_OUTPUT_MEM_TYPE_LIST.c_str(), memorys_type.size(), - op_desc->GetOutputsSize(), op_desc->GetName().c_str()); - GELOGE( - INTERNAL_ERROR, - "[Check][MemTypeAttr]Attr %s size:%zu not equal to node output size:%zu, node_name:%s", - ATTR_NAME_OUTPUT_MEM_TYPE_LIST.c_str(), memorys_type.size(), - op_desc->GetOutputsSize(), op_desc->GetName().c_str()); + ATTR_NAME_OUTPUT_MEM_TYPE_LIST.c_str(), memorys_type.size(), + op_desc->GetOutputsSize(), op_desc->GetName().c_str()); + GELOGE(INTERNAL_ERROR, + "[Check][MemTypeAttr]Attr %s size:%zu not equal to node output size:%zu, node_name:%s", + ATTR_NAME_OUTPUT_MEM_TYPE_LIST.c_str(), memorys_type.size(), + op_desc->GetOutputsSize(), op_desc->GetName().c_str()); return INTERNAL_ERROR; } @@ -1767,11 +1748,9 @@ void BlockMemAssigner::AssignMemoryWithReuse(vector &ranges) { if (has_tvm_workspace_mem_type_attr && (temp.size() != tvm_workspace_memory_type.size())) { REPORT_INNER_ERROR("E19999", "Attr[%s]size:%zu is not equal to workspace size:%zu, node_name:%s", - TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), tvm_workspace_memory_type.size(), - temp.size(), n->GetName().c_str()); + TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), tvm_workspace_memory_type.size(), temp.size(), n->GetName().c_str()); GELOGE(INTERNAL_ERROR, "[Check][Attr]Attr %s size:%zu is not equal to workspace size:%zu, node_name:%s", - TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), tvm_workspace_memory_type.size(), - temp.size(), n->GetName().c_str()); + TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), tvm_workspace_memory_type.size(), temp.size(), n->GetName().c_str()); return; } for (size_t i = 0; i < temp.size(); i++) { @@ -2181,11 +2160,10 @@ bool BlockMemAssigner::GetWorkSpaceMemoryType(const NodePtr &node, size_t index, ge::AttrUtils::GetListInt(op_desc, TVM_ATTR_NAME_WORKSPACE_TYPE, workspace_memory_type); if (has_workspace_mem_type_attr && (workspace_memory_type.size() <= index)) { REPORT_INNER_ERROR("E19999", "get workspace mem_type failed, " - "index %zu invalid, bigger than attr %s size:%zu, node_name:%s", - index, TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), - workspace_memory_type.size(), node->GetName().c_str()); + "index %zu invalid, bigger than attr %s size:%zu, node_name:%s", + index, TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), workspace_memory_type.size(), node->GetName().c_str()); GELOGE(INTERNAL_ERROR, "[Get][WorkspaceMemType]index %zu invalid, bigger than attr %s size:%zu, node_name:%s", - index, TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), workspace_memory_type.size(), node->GetName().c_str()); + index, TVM_ATTR_NAME_WORKSPACE_TYPE.c_str(), workspace_memory_type.size(), node->GetName().c_str()); return false; } memory_type = has_workspace_mem_type_attr ? workspace_memory_type[index] : RT_MEMORY_HBM; diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index 3aace4ac..e5736b51 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -41,7 +41,6 @@ target_link_options(engine PRIVATE target_link_libraries(engine PRIVATE $ -Wl,--no-as-needed - c_sec slog -Wl,--as-needed -lrt diff --git a/tests/ut/ge/common/format_transfer_fractal_nz_unittest.cc b/tests/ut/ge/common/format_transfer_fractal_nz_unittest.cc index 02f8251a..5bbc5776 100644 --- a/tests/ut/ge/common/format_transfer_fractal_nz_unittest.cc +++ b/tests/ut/ge/common/format_transfer_fractal_nz_unittest.cc @@ -9136,23 +9136,23 @@ TEST_F(UtestFormatTransferNdFractNz, invalid_src_data_type2) { EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID); } -TEST_F(UtestFormatTransferNdFractNz, invalid_src_data_type3) { - uint16_t data[1 * 1 * 1 * 16 * 16] = {0}; - TransArgs args{reinterpret_cast(data), - FORMAT_FRACTAL_NZ, - FORMAT_NHWC, - {1, 1, 1, 16, 16}, - { - 1, - 1, - 4, - 4, - }, - DT_STRING}; - TransResult result; - FormatTransferFractalNzND transfer; - EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID); -} +// TEST_F(UtestFormatTransferNdFractNz, invalid_src_data_type3) { +// uint16_t data[1 * 1 * 1 * 16 * 16] = {0}; +// TransArgs args{reinterpret_cast(data), +// FORMAT_FRACTAL_NZ, +// FORMAT_NHWC, +// {1, 1, 1, 16, 16}, +// { +// 1, +// 1, +// 4, +// 4, +// }, +// DT_VARIANT}; +// TransResult result; +// FormatTransferFractalNzND transfer; +// EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID); +// } TEST_F(UtestFormatTransferNdFractNz, invalid_dst_format2) { uint16_t data[1 * 1 * 1 * 1 * 16 * 16] = {0}; diff --git a/tests/ut/ge/common/format_transfer_nhwc_fractalz_unittest.cc b/tests/ut/ge/common/format_transfer_nhwc_fractalz_unittest.cc index 7431440b..b2cfe2db 100644 --- a/tests/ut/ge/common/format_transfer_nhwc_fractalz_unittest.cc +++ b/tests/ut/ge/common/format_transfer_nhwc_fractalz_unittest.cc @@ -5354,14 +5354,14 @@ TEST_F(UtestFormatTransferNhwcFz, build_transfer_uint8) { EXPECT_NE(transfer, nullptr); } -TEST_F(UtestFormatTransferNhwcFz, invalid_data_type) { - uint16_t data[1 * 4 * 4 * 1] = {0}; - TransArgs args{ - reinterpret_cast(data), FORMAT_NHWC, FORMAT_FRACTAL_NZ, {1, 4, 4}, {1, 1, 1, 16, 16}, DT_STRING}; - FormatTransferFractalZ transfer; - EXPECT_EQ(transfer.TransShape(args.src_format, args.src_shape, args.src_data_type, args.dst_format, args.dst_shape), - ACL_ERROR_GE_DATATYPE_INVALID); -} +// TEST_F(UtestFormatTransferNhwcFz, invalid_data_type) { +// uint16_t data[1 * 4 * 4 * 1] = {0}; +// TransArgs args{ +// reinterpret_cast(data), FORMAT_NHWC, FORMAT_FRACTAL_NZ, {1, 4, 4}, {1, 1, 1, 16, 16}, DT_VARIANT}; +// FormatTransferFractalZ transfer; +// EXPECT_EQ(transfer.TransShape(args.src_format, args.src_shape, args.src_data_type, args.dst_format, args.dst_shape), +// ACL_ERROR_GE_DATATYPE_INVALID); +// } TEST_F(UtestFormatTransferNhwcFz, invalid_data_format) { uint16_t data[1 * 4 * 4 * 1] = {0}; diff --git a/tests/ut/ge/common/format_transfer_unittest.cc b/tests/ut/ge/common/format_transfer_unittest.cc index 73b7703d..1a56d2f9 100644 --- a/tests/ut/ge/common/format_transfer_unittest.cc +++ b/tests/ut/ge/common/format_transfer_unittest.cc @@ -52,34 +52,34 @@ TEST_F(UtestFormatTransfer, build_unsupported_transfer) { EXPECT_EQ(transfer2, nullptr); } -TEST_F(UtestFormatTransfer, get_size_by_data_type) { - EXPECT_EQ(GetSizeByDataType(DT_FLOAT), 4); - EXPECT_EQ(GetSizeByDataType(DT_FLOAT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_INT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_INT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_UINT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_UINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_INT32), 4); - EXPECT_EQ(GetSizeByDataType(DT_INT64), 8); - EXPECT_EQ(GetSizeByDataType(DT_UINT32), 4); - EXPECT_EQ(GetSizeByDataType(DT_UINT64), 8); - EXPECT_EQ(GetSizeByDataType(DT_BOOL), 1); - EXPECT_EQ(GetSizeByDataType(DT_DOUBLE), 8); - EXPECT_EQ(GetSizeByDataType(DT_STRING), -1); - EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_INT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_UINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_COMPLEX64), 8); - EXPECT_EQ(GetSizeByDataType(DT_COMPLEX128), 16); - EXPECT_EQ(GetSizeByDataType(DT_QINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_QINT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_QINT32), 4); - EXPECT_EQ(GetSizeByDataType(DT_QUINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_QUINT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_RESOURCE), 8); - EXPECT_EQ(GetSizeByDataType(DT_STRING_REF), -1); - EXPECT_EQ(GetSizeByDataType(DT_DUAL), 5); - EXPECT_EQ(GetSizeByDataType(DT_UNDEFINED), -1); - EXPECT_EQ(DT_UNDEFINED, 28); -} +// TEST_F(UtestFormatTransfer, get_size_by_data_type) { +// EXPECT_EQ(GetSizeByDataType(DT_FLOAT), 4); +// EXPECT_EQ(GetSizeByDataType(DT_FLOAT16), 2); +// EXPECT_EQ(GetSizeByDataType(DT_INT8), 1); +// EXPECT_EQ(GetSizeByDataType(DT_INT16), 2); +// EXPECT_EQ(GetSizeByDataType(DT_UINT16), 2); +// EXPECT_EQ(GetSizeByDataType(DT_UINT8), 1); +// EXPECT_EQ(GetSizeByDataType(DT_INT32), 4); +// EXPECT_EQ(GetSizeByDataType(DT_INT64), 8); +// EXPECT_EQ(GetSizeByDataType(DT_UINT32), 4); +// EXPECT_EQ(GetSizeByDataType(DT_UINT64), 8); +// EXPECT_EQ(GetSizeByDataType(DT_BOOL), 1); +// EXPECT_EQ(GetSizeByDataType(DT_DOUBLE), 8); +// EXPECT_EQ(GetSizeByDataType(DT_STRING), -1); +// EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_INT8), 1); +// EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_UINT8), 1); +// EXPECT_EQ(GetSizeByDataType(DT_COMPLEX64), 8); +// EXPECT_EQ(GetSizeByDataType(DT_COMPLEX128), 16); +// EXPECT_EQ(GetSizeByDataType(DT_QINT8), 1); +// EXPECT_EQ(GetSizeByDataType(DT_QINT16), 2); +// EXPECT_EQ(GetSizeByDataType(DT_QINT32), 4); +// EXPECT_EQ(GetSizeByDataType(DT_QUINT8), 1); +// EXPECT_EQ(GetSizeByDataType(DT_QUINT16), 2); +// EXPECT_EQ(GetSizeByDataType(DT_RESOURCE), -1); +// EXPECT_EQ(GetSizeByDataType(DT_STRING_REF), -1); +// EXPECT_EQ(GetSizeByDataType(DT_DUAL), 5); +// EXPECT_EQ(GetSizeByDataType(DT_UNDEFINED), -1); +// EXPECT_EQ(DT_UNDEFINED, 27); +// } } // namespace formats } // namespace ge