Skip to content

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

[GPU] bug fix for MEMORY_CHANGED (#30006)

Mingyu Kim637fc24286f0
diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp
index f62ec1c324d..a155cd03545 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp
@@ -25,11 +25,12 @@ struct program;
struct network;
-struct ExecutionFlags : public std::bitset<4> {
+struct ExecutionFlags : public std::bitset<5> {
static const size_t SHAPE_CHANGED = 0;
static const size_t IMPL_CHANGED = 1;
static const size_t MEMORY_CHANGED = 2;
- static const size_t SKIP = 3;
+ static const size_t ARG_UPDATE_REQUIRED = 3;
+ static const size_t SKIP = 4;
};
struct kernel_impl_params final {
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/primitive_ocl_base.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/primitive_ocl_base.hpp
index 5d5d1be3d05..9d71acd86aa 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/primitive_ocl_base.hpp
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/primitive_ocl_base.hpp
@@ -198,7 +198,7 @@ struct PrimitiveImplOCL : public cldnn::primitive_impl {
void update_stages_flags(const cldnn::primitive_inst& instance) {
const auto current_flags = instance.get_impl_params()->flags.to_ulong();
- constexpr size_t mask_args = (1 << cldnn::ExecutionFlags::MEMORY_CHANGED) | (1 << cldnn::ExecutionFlags::IMPL_CHANGED);
+ constexpr size_t mask_args = (1 << cldnn::ExecutionFlags::ARG_UPDATE_REQUIRED) | (1 << cldnn::ExecutionFlags::IMPL_CHANGED);
constexpr size_t mask_dispatch = (1 << cldnn::ExecutionFlags::SHAPE_CHANGED);
for (auto& stage : _stages) {
stage->kd.need_args_update = (current_flags & mask_args) != 0;
diff --git a/src/plugins/intel_gpu/src/graph/network.cpp b/src/plugins/intel_gpu/src/graph/network.cpp
index 2db07baea65..0f1fcab5a2d 100644
--- a/src/plugins/intel_gpu/src/graph/network.cpp
+++ b/src/plugins/intel_gpu/src/graph/network.cpp
@@ -969,9 +969,13 @@ void network::allocate_primitive_instance(program_node const& node) {
if (inst->is_dynamic()) {
_is_dynamic = true;
}
- inst->set_flag(ExecutionFlags::IMPL_CHANGED);
- inst->set_flag(ExecutionFlags::SHAPE_CHANGED);
- inst->set_flag(ExecutionFlags::MEMORY_CHANGED);
+
+ if (!node.is_type<data>()) {
+ inst->set_flag(ExecutionFlags::IMPL_CHANGED);
+ inst->set_flag(ExecutionFlags::SHAPE_CHANGED);
+ inst->set_flag(ExecutionFlags::MEMORY_CHANGED);
+ }
+
_primitives[node.id()] = inst;
if (node.is_type<input_layout>()) {
diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
index 8e7cbef62d3..0d880999f1e 100644
--- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
+++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
@@ -1942,7 +1942,7 @@ void primitive_inst::prepare_primitive() {
// 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() || has_dynamic_dependencies_insts(this) || _use_shared_kernels) {
// For ocl_v2 impls we call set args based in flag in the execute() impl, so need to update the flag here
- set_flag(ExecutionFlags::MEMORY_CHANGED);
+ set_flag(ExecutionFlags::ARG_UPDATE_REQUIRED);
set_arguments();
}
on_execute();