|
|
|
@ -545,7 +545,8 @@ bool CanReuseBySize(const map<string, uint64_t> &reusable_block_counts, const Me
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BlockMemAssigner::IsOutNodeSetContinuousInput(const NodePtr &n, uint32_t out_index, std::string &peer_name,
|
|
|
|
|
uint32_t &peer_input_index, bool &no_need_assign_memory) {
|
|
|
|
|
uint32_t &peer_input_index,
|
|
|
|
|
bool &no_need_assign_memory, bool &reset_zero_copy_flag) {
|
|
|
|
|
if (n == nullptr || n->GetAllOutDataAnchors().size() <= 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -571,6 +572,13 @@ bool BlockMemAssigner::IsOutNodeSetContinuousInput(const NodePtr &n, uint32_t ou
|
|
|
|
|
return false;);
|
|
|
|
|
|
|
|
|
|
// If GetBool fail, is_input_continuous is false.
|
|
|
|
|
bool is_input_continuous_no_padding = false;
|
|
|
|
|
(void)ge::AttrUtils::GetBool(peer_in_node_desc, ATTR_NAME_NOPADDING_CONTINUOUS_INPUT,
|
|
|
|
|
is_input_continuous_no_padding);
|
|
|
|
|
if (is_input_continuous_no_padding) {
|
|
|
|
|
reset_zero_copy_flag = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
(void)ge::AttrUtils::GetBool(peer_in_node_desc, ATTR_NAME_CONTINUOUS_INPUT, is_input_continuous);
|
|
|
|
|
|
|
|
|
|
GE_IF_BOOL_EXEC(is_input_continuous && CheckIsZeroMemNodeType(peer_node->GetType()),
|
|
|
|
@ -1249,10 +1257,11 @@ Status BlockMemAssigner::AssignOutputMemoryWithReuse(const NodePtr &node, vector
|
|
|
|
|
std::string peer_name;
|
|
|
|
|
uint32_t peer_input_index = 0;
|
|
|
|
|
bool out_node_set_continuous_input = false;
|
|
|
|
|
bool reset_zero_copy_flag = false;
|
|
|
|
|
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);
|
|
|
|
|
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););
|
|
|
|
|
}
|
|
|
|
@ -1269,6 +1278,9 @@ Status BlockMemAssigner::AssignOutputMemoryWithReuse(const NodePtr &node, vector
|
|
|
|
|
|
|
|
|
|
MemoryBlock *mem_block = ApplyOutMemory(node, i, ranges, is_op_reuse_mem_, out_node_set_continuous_input);
|
|
|
|
|
if (mem_block != nullptr) {
|
|
|
|
|
GE_IF_BOOL_EXEC(reset_zero_copy_flag,
|
|
|
|
|
memory_block->is_zero_copy_ = false;
|
|
|
|
|
GELOGI("Node[%s] output[%u] need assign memory before reassign.", op_desc->GetName().c_str(), i););
|
|
|
|
|
node_out_blocks_[node->GetName()].emplace_back(mem_block);
|
|
|
|
|
if (out_node_set_continuous_input) {
|
|
|
|
|
node_continuous_input_blocks_[peer_name][peer_input_index] = mem_block;
|
|
|
|
|