[GPU] Add set_arguments() call in case of dynamic dependencies of static inst (#21664)

This commit is contained in:
Sergey Shlyapnikov 2023-12-22 20:56:59 +04:00 committed by GitHub
parent 5da132bdfe
commit 3c63a0afe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,7 +493,7 @@ event::ptr primitive_inst::realloc_if_needed() {
for (auto user : get_user_insts()) {
// Since fake alignment is applicable for input tensor as well, make sure we allocate enough memory
// to prevemt reading beyound the allocated memory bounds
if (user->get_node().is_type<fully_connected>()) {
if (user->get_node().is_type<fully_connected>() && user->is_dynamic()) {
user->update_shape();
user->update_shape_done_by_other = true;
@ -1116,8 +1116,14 @@ event::ptr primitive_inst::execute(const std::vector<event::ptr>& events) {
update_shape_done_by_other = false; // reset
OPENVINO_ASSERT(_impl != nullptr, "[GPU] Implementation is nullptr for ", primitive_id, " primitive");
// Dynamic insts may reallocate its' output buffer, so we need to update kernel's args respectively
bool has_dynamic_dependencies_insts = std::any_of(_deps.begin(), _deps.end(),
[](const std::pair<std::shared_ptr<primitive_inst>, int32_t>& dep) {
return dep.first->is_dynamic();
});
// Output buffer may be changed under the following conditions, so we need to set args to kernel on each iteration
if ((is_dynamic() && need_args_update) || has_mutable_input() || is_output()) {
if ((is_dynamic() && need_args_update) || has_mutable_input() || is_output() || (!is_dynamic() && has_dynamic_dependencies_insts)) {
set_arguments();
}
on_execute();