|
@@ -597,11 +597,13 @@ void BlockMemAssigner::GetOutAndWorkSpaceMem(vector<int64_t> &all_memory_size) { |
|
|
int64_t size = 0; |
|
|
int64_t size = 0; |
|
|
GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(output_desc, size) != SUCCESS, GELOGI("Get size failed")); |
|
|
GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(output_desc, size) != SUCCESS, GELOGI("Get size failed")); |
|
|
GE_IF_BOOL_EXEC(size < 0, |
|
|
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); |
|
|
batch_all_memory_size[batch_label].emplace_back(size); |
|
|
if (batch_total_size.find(batch_label) == batch_total_size.end()) { |
|
|
if (batch_total_size.find(batch_label) == batch_total_size.end()) { |
|
|
batch_total_size[batch_label] = size; |
|
|
batch_total_size[batch_label] = size; |
|
@@ -692,23 +694,23 @@ bool BlockMemAssigner::IsOutNodeSetContinuousInput(const NodePtr &n, uint32_t ou |
|
|
auto out_anchor = n->GetOutDataAnchor(out_index); |
|
|
auto out_anchor = n->GetOutDataAnchor(out_index); |
|
|
GE_IF_BOOL_EXEC(out_anchor == nullptr, |
|
|
GE_IF_BOOL_EXEC(out_anchor == nullptr, |
|
|
GELOGE(FAILED, "[Check][Anchor]Node[%s] output[%u] anchor is null.", |
|
|
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.", |
|
|
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;); |
|
|
return false;); |
|
|
for (auto const &peer_in_anchor : out_anchor->GetPeerInDataAnchors()) { |
|
|
for (auto const &peer_in_anchor : out_anchor->GetPeerInDataAnchors()) { |
|
|
GE_IF_BOOL_EXEC(peer_in_anchor == nullptr, |
|
|
GE_IF_BOOL_EXEC(peer_in_anchor == nullptr, |
|
|
GELOGE(FAILED, "[Check][Anchor]Node[%s] output[%u] peer_in_anchor 0 is null.", |
|
|
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.", |
|
|
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;); |
|
|
return false;); |
|
|
auto peer_node = peer_in_anchor->GetOwnerNode(); |
|
|
auto peer_node = peer_in_anchor->GetOwnerNode(); |
|
|
GE_IF_BOOL_EXEC(peer_node == nullptr, |
|
|
GE_IF_BOOL_EXEC(peer_node == nullptr, |
|
|
GELOGE(FAILED, "[Check][Node]Node[%s] output[%u] peer node is null.", |
|
|
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.", |
|
|
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;); |
|
|
return false;); |
|
|
|
|
|
|
|
|
// Get the continuous input type of the node, default is false |
|
|
// Get the continuous input type of the node, default is false |
|
@@ -716,9 +718,9 @@ bool BlockMemAssigner::IsOutNodeSetContinuousInput(const NodePtr &n, uint32_t ou |
|
|
auto peer_in_node_desc = peer_node->GetOpDesc(); |
|
|
auto peer_in_node_desc = peer_node->GetOpDesc(); |
|
|
GE_IF_BOOL_EXEC(peer_in_node_desc == nullptr, |
|
|
GE_IF_BOOL_EXEC(peer_in_node_desc == nullptr, |
|
|
GELOGE(FAILED, "[Check][OpDesc]Node[%s] output[%u] nodedesc is null.", |
|
|
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.", |
|
|
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;); |
|
|
return false;); |
|
|
|
|
|
|
|
|
// If GetBool fail, is_input_continuous is false. |
|
|
// If GetBool fail, is_input_continuous is false. |
|
@@ -819,7 +821,7 @@ bool BlockMemAssigner::IsContinuousMemoryReuse(const NodePtr &n, const NodePtr & |
|
|
(in_anchor->GetPeerOutAnchor()->GetOwnerNode() == nullptr) || |
|
|
(in_anchor->GetPeerOutAnchor()->GetOwnerNode() == nullptr) || |
|
|
(in_anchor->GetPeerOutAnchor()->GetOwnerNode()->GetOpDesc() == nullptr)) { |
|
|
(in_anchor->GetPeerOutAnchor()->GetOwnerNode()->GetOpDesc() == nullptr)) { |
|
|
GELOGE(FAILED, "[Check][OpDesc]Node[%s] output[%u] peer input node desc is null.", |
|
|
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.", |
|
|
REPORT_INNER_ERROR("E19999", "get output anchor peer op_desc fail, node_name: %s output_index: %u.", |
|
|
n->GetName().c_str(), out_index); |
|
|
n->GetName().c_str(), out_index); |
|
|
return false; |
|
|
return false; |
|
@@ -1105,9 +1107,10 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size, |
|
|
OpMemoryType mem_type, const NodePtr &n, uint32_t out_index, |
|
|
OpMemoryType mem_type, const NodePtr &n, uint32_t out_index, |
|
|
const vector<bool> &workspace_reuse_flag, const bool is_op_reuse_mem, |
|
|
const vector<bool> &workspace_reuse_flag, const bool is_op_reuse_mem, |
|
|
const bool continuous, int64_t memory_type) { |
|
|
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(); |
|
|
auto node_op_desc = n->GetOpDesc(); |
|
|
GE_IF_BOOL_EXEC(node_op_desc == nullptr, return nullptr); |
|
|
GE_IF_BOOL_EXEC(node_op_desc == nullptr, return nullptr); |
|
|
std::string batch_label; |
|
|
std::string batch_label; |
|
@@ -1159,10 +1162,12 @@ 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); |
|
|
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 |
|
|
// Data and netoutput need zero copy block |
|
|
block->is_zero_copy_ = IsZeroCopyBlock(n, continuous); |
|
|
block->is_zero_copy_ = IsZeroCopyBlock(n, continuous); |
|
@@ -1221,13 +1226,15 @@ void BlockMemAssigner::ContinuousOutRefCheck(bool &isAllOutputRef, bool &isOutpu |
|
|
|
|
|
|
|
|
Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<int64_t> &ranges, |
|
|
Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<int64_t> &ranges, |
|
|
const bool is_op_reuse_mem) { |
|
|
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(); |
|
|
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 |
|
|
// continuous output support ref only when all output ref input |
|
|
bool isAllOutputRef = true; |
|
|
bool isAllOutputRef = true; |
|
@@ -1242,7 +1249,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<in |
|
|
|
|
|
|
|
|
if (!isAllOutputRef && isOutputHasRef) { |
|
|
if (!isAllOutputRef && isOutputHasRef) { |
|
|
REPORT_INNER_ERROR("E19999", "continuous output node ref part input, not support now. node_name:%s", |
|
|
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", |
|
|
GELOGE(INTERNAL_ERROR, "[Check][OutRefStatus]continuous output node ref part input, not support, node_name:%s", |
|
|
n->GetName().c_str()); |
|
|
n->GetName().c_str()); |
|
|
return INTERNAL_ERROR; |
|
|
return INTERNAL_ERROR; |
|
@@ -1255,7 +1262,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<in |
|
|
auto output_op_desc = node_op_desc->GetOutputDescPtr(index); |
|
|
auto output_op_desc = node_op_desc->GetOutputDescPtr(index); |
|
|
if (output_op_desc == nullptr) { |
|
|
if (output_op_desc == nullptr) { |
|
|
REPORT_INNER_ERROR("E19999", "get output_desc failed, node_name:%s, output_index:%u", |
|
|
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); |
|
|
GELOGE(INTERNAL_ERROR, "[Get][OutputDesc]node_name:%s, output_index:%u", n->GetName().c_str(), index); |
|
|
return INTERNAL_ERROR; |
|
|
return INTERNAL_ERROR; |
|
|
} |
|
|
} |
|
@@ -1268,7 +1275,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<in |
|
|
int64_t size = 0; |
|
|
int64_t size = 0; |
|
|
if (ge::TensorUtils::GetSize(*output_op_desc, size) != SUCCESS) { |
|
|
if (ge::TensorUtils::GetSize(*output_op_desc, size) != SUCCESS) { |
|
|
REPORT_CALL_ERROR("E19999", "get tensor_size failed, node_name:%s, output_index:%u", |
|
|
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); |
|
|
GELOGE(INTERNAL_ERROR, "[Get][TensorSize]node_name:%s, output_index:%u", n->GetName().c_str(), index); |
|
|
return INTERNAL_ERROR; |
|
|
return INTERNAL_ERROR; |
|
|
} |
|
|
} |
|
@@ -1310,7 +1317,7 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<in |
|
|
++(block->ref_count_); |
|
|
++(block->ref_count_); |
|
|
} else { |
|
|
} else { |
|
|
REPORT_CALL_ERROR("E19999", "apply continuousMemory failed, node_name:%s, total_size:%ld", |
|
|
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); |
|
|
GELOGE(INTERNAL_ERROR, "[Apply][ContinuousMemory]node_name:%s, total_size:%ld", n->GetName().c_str(), total_size); |
|
|
return INTERNAL_ERROR; |
|
|
return INTERNAL_ERROR; |
|
|
} |
|
|
} |
|
@@ -1319,26 +1326,33 @@ Status BlockMemAssigner::ApplyContinuousMemory(const NodePtr &n, const vector<in |
|
|
|
|
|
|
|
|
MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, const vector<int64_t> &ranges, |
|
|
MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, const vector<int64_t> &ranges, |
|
|
const bool is_op_reuse_mem, const bool continuous) { |
|
|
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(); |
|
|
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; |
|
|
MemoryBlock *block = nullptr; |
|
|
NodeIndexIO node_index_io(n, index, kOut); |
|
|
NodeIndexIO node_index_io(n, index, kOut); |
|
|
int64_t size = 0; |
|
|
int64_t size = 0; |
|
|
auto output_op_desc = node_op_desc->GetOutputDescPtr(index); |
|
|
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")); |
|
|
GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(*output_op_desc, size) != SUCCESS, GELOGI("Get size failed")); |
|
|
size_t no_align_size = 0; |
|
|
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; |
|
|
std::string symbol; |
|
|
bool reuse_input = false; |
|
|
bool reuse_input = false; |
|
@@ -1346,9 +1360,9 @@ MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, |
|
|
block = symbol_blocks_[symbol]; |
|
|
block = symbol_blocks_[symbol]; |
|
|
GE_IF_BOOL_EXEC(block == nullptr, |
|
|
GE_IF_BOOL_EXEC(block == nullptr, |
|
|
REPORT_INNER_ERROR("E19999", "get ref block failed, node_name:%s, symbol:%s", |
|
|
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", |
|
|
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); |
|
|
return nullptr); |
|
|
// reduce old size |
|
|
// reduce old size |
|
|
size_t align_size = block->Size(); |
|
|
size_t align_size = block->Size(); |
|
@@ -1392,24 +1406,28 @@ MemoryBlock *BlockMemAssigner::ApplyOutMemory(const NodePtr &n, uint32_t index, |
|
|
vector<bool> workspace_reuse_flag; |
|
|
vector<bool> workspace_reuse_flag; |
|
|
block = ApplyMemory(block_size, size, no_align_size, kOutput, n, index, |
|
|
block = ApplyMemory(block_size, size, no_align_size, kOutput, n, index, |
|
|
workspace_reuse_flag, is_op_reuse_mem, continuous, memory_type); |
|
|
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); |
|
|
n->GetName().c_str(), block_size, index); |
|
|
} |
|
|
} |
|
|
int out_count = 0; |
|
|
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); |
|
|
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()) { |
|
|
for (const auto &in_anchor : out_data_anchor->GetPeerInDataAnchors()) { |
|
|
auto owner_node = in_anchor->GetOwnerNode(); |
|
|
auto owner_node = in_anchor->GetOwnerNode(); |
|
|
auto op_desc = owner_node->GetOpDesc(); |
|
|
auto op_desc = owner_node->GetOpDesc(); |
|
@@ -1616,12 +1634,13 @@ Status BlockMemAssigner::AssignOutputMemoryWithReuse(const NodePtr &node, vector |
|
|
op_desc->GetOutputsSize(), memorys_type.size()); |
|
|
op_desc->GetOutputsSize(), memorys_type.size()); |
|
|
if (has_mem_type_attr && (memorys_type.size() != op_desc->GetOutputsSize())) { |
|
|
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", |
|
|
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; |
|
|
return INTERNAL_ERROR; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1748,9 +1767,11 @@ void BlockMemAssigner::AssignMemoryWithReuse(vector<int64_t> &ranges) { |
|
|
|
|
|
|
|
|
if (has_tvm_workspace_mem_type_attr && (temp.size() != tvm_workspace_memory_type.size())) { |
|
|
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", |
|
|
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", |
|
|
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; |
|
|
return; |
|
|
} |
|
|
} |
|
|
for (size_t i = 0; i < temp.size(); i++) { |
|
|
for (size_t i = 0; i < temp.size(); i++) { |
|
@@ -2160,10 +2181,11 @@ bool BlockMemAssigner::GetWorkSpaceMemoryType(const NodePtr &node, size_t index, |
|
|
ge::AttrUtils::GetListInt(op_desc, TVM_ATTR_NAME_WORKSPACE_TYPE, workspace_memory_type); |
|
|
ge::AttrUtils::GetListInt(op_desc, TVM_ATTR_NAME_WORKSPACE_TYPE, workspace_memory_type); |
|
|
if (has_workspace_mem_type_attr && (workspace_memory_type.size() <= index)) { |
|
|
if (has_workspace_mem_type_attr && (workspace_memory_type.size() <= index)) { |
|
|
REPORT_INNER_ERROR("E19999", "get workspace mem_type failed, " |
|
|
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", |
|
|
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; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
memory_type = has_workspace_mem_type_attr ? workspace_memory_type[index] : RT_MEMORY_HBM; |
|
|
memory_type = has_workspace_mem_type_attr ? workspace_memory_type[index] : RT_MEMORY_HBM; |
|
|