Browse Source

回退 'Pull Request !1269 : fix suojin'

tags/v1.3.0
王笑天 Gitee 3 years ago
parent
commit
9da074ec6b
6 changed files with 141 additions and 165 deletions
  1. +16
    -17
      ge/graph/build/logical_stream_allocator.cc
  2. +71
    -93
      ge/graph/build/memory/block_mem_assigner.cc
  3. +0
    -1
      ge/plugin/engine/CMakeLists.txt
  4. +17
    -17
      tests/ut/ge/common/format_transfer_fractal_nz_unittest.cc
  5. +8
    -8
      tests/ut/ge/common/format_transfer_nhwc_fractalz_unittest.cc
  6. +29
    -29
      tests/ut/ge/common/format_transfer_unittest.cc

+ 16
- 17
ge/graph/build/logical_stream_allocator.cc View File

@@ -70,7 +70,7 @@ Status AssignByLabelPass::Run(ComputeGraphPtr graph, const vector<SubgraphPtr> &
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 vector<SubgraphPt
auto iter = label_streams.find(stream_label);
if (iter == label_streams.end()) {
subgraph->stream_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 vector<SubgraphP
} else {
int64_t stream_id = AssignNewStream(reusable_subgraph);
subgraph->stream_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 vector<SubgraphP

subgraph->reused_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 vector<SubgraphPtr
engine_name.c_str());
return INTERNAL_ERROR;
} else {
GELOGI("[Assign][StreamId] %ld for Subgraph %s (engine: %s).", subgraph->stream_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 vector<SubgraphPtr
GELOGD("Node %s of type %s in subgraph %s is assigned parent stream %ld (engine: %s).", node->GetName().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 vector<Subgr
int64_t inout_stream = GetSingleInoutStream(node);
if (inout_stream != kInvalidStream) {
op_desc->SetStreamId(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);
}
}
}


+ 71
- 93
ge/graph/build/memory/block_mem_assigner.cc View File

@@ -597,13 +597,11 @@ void BlockMemAssigner::GetOutAndWorkSpaceMem(vector<int64_t> &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<bool> &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<int64_t> &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 vector<in

if (!isAllOutputRef && isOutputHasRef) {
REPORT_INNER_ERROR("E19999", "continuous output node ref part input, not support now. node_name:%s",
n->GetName().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 vector<in
auto output_op_desc = node_op_desc->GetOutputDescPtr(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 vector<in
int64_t size = 0;
if (ge::TensorUtils::GetSize(*output_op_desc, size) != SUCCESS) {
REPORT_CALL_ERROR("E19999", "get tensor_size failed, node_name:%s, output_index:%u",
n->GetName().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 vector<in
++(block->ref_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<in

MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, const vector<int64_t> &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<bool> 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<int64_t> &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;


+ 0
- 1
ge/plugin/engine/CMakeLists.txt View File

@@ -41,7 +41,6 @@ target_link_options(engine PRIVATE
target_link_libraries(engine PRIVATE
$<BUILD_INTERFACE:intf_pub>
-Wl,--no-as-needed
c_sec
slog
-Wl,--as-needed
-lrt


+ 17
- 17
tests/ut/ge/common/format_transfer_fractal_nz_unittest.cc View File

@@ -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<uint8_t *>(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<uint8_t *>(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};


+ 8
- 8
tests/ut/ge/common/format_transfer_nhwc_fractalz_unittest.cc View File

@@ -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<uint8_t *>(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<uint8_t *>(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};


+ 29
- 29
tests/ut/ge/common/format_transfer_unittest.cc View File

@@ -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

Loading…
Cancel
Save