Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] Skip ReadValue execution if its already set (#30399)

Roman Lyamin06a5f6daf8cd
diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
index 4423d83d1c1..aa9c8eeee80 100644
--- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
+++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
@@ -1875,6 +1875,15 @@ void primitive_inst::prepare_primitive() {
return;
}
+ if (_node->is_type<read_value>()) {
+ auto prim = get_node().as<read_value>().get_primitive();
+ auto& variable = get_network().get_variable(prim->variable_id);
+
+ if (variable.is_set() && can_be_optimized()) {
+ set_flag(ExecutionFlags::SKIP);
+ }
+ }
+
// Check successor reorder if layouts are same
// Need to set can_be_optimized for user reorder at predecessor because
// if the user is can_be_optimized and output node then current nodes' output should be allocated to host.