[GPU] fix issue of optimized out reorder during event sync (#20223)

* fix confliction

* remove debug code

* fix unit test failure

* update condition of reorder check

* apply the condition for only opt out reorder user
This commit is contained in:
Wilson Seok 2023-10-13 12:39:35 +09:00 committed by GitHub
parent 56d74a82cb
commit 5170350cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -685,6 +685,7 @@ void primitive_inst::do_runtime_skip_reorder() {
GPU_DEBUG_TRACE_DETAIL << "[do runtime skip reorder] update shape for user " << u->id() << std::endl;
u->update_shape();
u->update_shape_done_by_other = true;
if (u->_impl_params->get_input_layout() == u->_impl_params->get_output_layout()) {
std::function<void(std::vector<std::shared_ptr<primitive_inst>>)> update_memory_dependencies;
update_memory_dependencies = [&](std::vector<std::shared_ptr<primitive_inst>> users) {
@ -699,6 +700,10 @@ void primitive_inst::do_runtime_skip_reorder() {
update_memory_dependencies(u->get_user_insts());
u->set_can_be_optimized(true);
// Opt out reorder which has _needs_completion_event = true causes syncronization failed in dGPU.
if (_needs_completion_event == false && u->_needs_completion_event == true) {
_needs_completion_event = true;
}
GPU_DEBUG_TRACE_DETAIL << "[do runtime skip reorder] set user " << u->id() << " as can_be_optimized" << std::endl;
} else {
GPU_DEBUG_TRACE_DETAIL << "[do runtime skip reorder] user " << u->id() << " cannot be optimized" << std::endl;