Skip to content

Commit

Permalink
Run build_deps before update_output_memory (openvinotoolkit#22845)
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-y committed Mar 4, 2024
1 parent ff51076 commit ab99634
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/plugins/intel_gpu/src/graph/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ void network::allocate_primitives() {
if (!node->get_dependencies().empty() && opt_inst->dependencies().empty()) {
opt_inst->build_deps();
}
opt_inst->update_output_memory();
if (opt_inst->input_memory_ptr())
opt_inst->update_output_memory();
}
}

Expand Down
16 changes: 9 additions & 7 deletions src/plugins/intel_gpu/src/graph/reshape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,22 @@ reshape_inst::typed_primitive_inst(network& network, reshape_node const& node) :
_outputs = allocate_outputs();
_mem_allocated = true;
} else {
update_output_memory();
build_deps(); // reshape need deps
if (input_memory_ptr())
update_output_memory();
}
} else {
if (_exec_deps.size() > 0 && input_memory_ptr())
if (_exec_deps.size() > 0 && input_memory_ptr()) {
build_deps(); // reshape need deps
update_output_memory();
}
}
}

void reshape_inst::on_execute() {
update_output_memory();
build_deps(); // reshape need deps
if (input_memory_ptr())
update_output_memory();
}

void reshape_inst::update_output_memory() {
Expand All @@ -206,10 +212,6 @@ void reshape_inst::update_output_memory() {
if (_outputs[0] && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;

build_deps(); // reshape need deps
if (node->get_program().get_config().get_property(ov::intel_gpu::allow_new_shape_infer) &&
input_memory_ptr() == nullptr)
return;
OPENVINO_ASSERT(input_memory_ptr() != nullptr, "[GPU] Failed to reuse input in ", id(), " primitive: input memory was not allocated");
_outputs = {_network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
}
Expand Down

0 comments on commit ab99634

Please sign in to comment.