Skip to content

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

[gpu] fix coverity issue (#30317)

Sungeun Kim78dd4f308abe
diff --git a/src/plugins/intel_gpu/src/graph/broadcast.cpp b/src/plugins/intel_gpu/src/graph/broadcast.cpp
index dcf5bc1e8f5..4f93abbdf4d 100644
--- a/src/plugins/intel_gpu/src/graph/broadcast.cpp
+++ b/src/plugins/intel_gpu/src/graph/broadcast.cpp
@@ -141,16 +141,14 @@ void broadcast_inst::update_output_memory() {
if (static_cast<bool>(_outputs[0]) && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
GPU_DEBUG_TRACE_DETAIL << id() << " : update_output_memory with mem of input " << get_node().get_dependency(0).id()
<< " : " << input_memory_ptr()->buffer_ptr() << std::endl;
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
- if (static_cast<bool>(_outputs[0]) && _node != nullptr &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ if (static_cast<bool>(_outputs[0]) && get_node().get_program().get_config().get_enable_memory_pool()) {
+ get_network().get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), get_network_id());
}
_outputs[0] = input_memory_ptr();
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/condition.cpp b/src/plugins/intel_gpu/src/graph/condition.cpp
index ed3b4efb423..19e48476569 100644
--- a/src/plugins/intel_gpu/src/graph/condition.cpp
+++ b/src/plugins/intel_gpu/src/graph/condition.cpp
@@ -221,27 +221,27 @@ condition_inst::typed_primitive_inst(network& network, condition_node const& nod
}
void condition_inst::update_output_layout() {
- auto memory_deps = _node->get_const_memory_deps();
- for (auto& i : _node->get_shape_infer_dependencies()) {
- if (memory_deps.count(i) > 0 || i >= _node->get_dependencies().size()) {
+ auto memory_deps = get_node().get_const_memory_deps();
+ for (auto& i : get_node().get_shape_infer_dependencies()) {
+ if (memory_deps.count(i) > 0 || i >= get_node().get_dependencies().size()) {
continue;
}
- auto dep_id = _node->get_dependency(i).id();
+ auto dep_id = get_node().get_dependency(i).id();
auto dep_mem = _network.get_output_memory(dep_id);
memory_deps.insert({i, dep_mem});
}
_impl_params->memory_deps = memory_deps;
- auto new_layouts = _node->type()->calc_output_layouts(*_node, *_impl_params);
+ auto new_layouts = get_node().type()->calc_output_layouts(*_node, *_impl_params);
if (new_layouts.empty()) {
- auto new_layout = _node->type()->calc_output_layout(*_node, *_impl_params);
- new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(0), new_layout.data_padding);
+ auto new_layout = get_node().type()->calc_output_layout(*_node, *_impl_params);
+ new_layout.data_padding = padding::max(get_node().get_primitive()->get_output_padding(0), new_layout.data_padding);
_impl_params->output_layouts[0] = new_layout;
} else {
for (size_t i = 0; i != new_layouts.size(); ++i) {
auto new_layout = new_layouts[i];
- new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(i), new_layout.data_padding);
+ new_layout.data_padding = padding::max(get_node().get_primitive()->get_output_padding(i), new_layout.data_padding);
_impl_params->output_layouts[i] = new_layout;
}
}
diff --git a/src/plugins/intel_gpu/src/graph/crop.cpp b/src/plugins/intel_gpu/src/graph/crop.cpp
index fec36fb9ff5..d7499504c1a 100644
--- a/src/plugins/intel_gpu/src/graph/crop.cpp
+++ b/src/plugins/intel_gpu/src/graph/crop.cpp
@@ -266,20 +266,19 @@ void crop_inst::update_output_memory() {
if (!can_be_optimized())
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
- if (node->get_program().is_new_shape_infer() && input_memory_ptr() == nullptr)
+ if (get_node().get_program().is_new_shape_infer() && input_memory_ptr() == nullptr)
return;
- if (_outputs[0] && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
+ if (_outputs[0] && get_network().get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ get_network().get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), get_network_id());
}
_outputs[0] = _network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout());
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/dynamic_quantize.cpp b/src/plugins/intel_gpu/src/graph/dynamic_quantize.cpp
index e2f3e784906..162dce3a713 100644
--- a/src/plugins/intel_gpu/src/graph/dynamic_quantize.cpp
+++ b/src/plugins/intel_gpu/src/graph/dynamic_quantize.cpp
@@ -142,8 +142,8 @@ void dynamic_quantize_inst::update_output_memory() {
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs[0] = input_memory_ptr();
diff --git a/src/plugins/intel_gpu/src/graph/gather.cpp b/src/plugins/intel_gpu/src/graph/gather.cpp
index 9d947967a46..3ed83bf0e7f 100644
--- a/src/plugins/intel_gpu/src/graph/gather.cpp
+++ b/src/plugins/intel_gpu/src/graph/gather.cpp
@@ -144,16 +144,15 @@ void gather_inst::update_output_memory() {
if (static_cast<bool>(_outputs[0]) && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
GPU_DEBUG_TRACE_DETAIL << id() << " : update_output_memory with mem of input " << get_node().get_dependency(0).id()
<< " : " << input_memory_ptr()->buffer_ptr() << std::endl;
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs[0] = input_memory_ptr();
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/slice.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/slice.cpp
index 5af6c62755c..f5ff4579eb0 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl/slice.cpp
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl/slice.cpp
@@ -74,7 +74,7 @@ struct slice_impl : typed_primitive_impl_ocl<slice> {
kernel_arguments_data get_arguments(const slice_inst& instance) const override {
kernel_arguments_data args;
- const SliceKernelRefNeededInputs inputs = SliceKernelRefNeededInputs::Create(*instance.node);
+ const SliceKernelRefNeededInputs inputs = SliceKernelRefNeededInputs::Create(instance.get_node());
for (auto idx : inputs.GetNeededInputIndexes()) {
args.inputs.push_back(instance.input_memory_ptr(idx));
diff --git a/src/plugins/intel_gpu/src/graph/include/condition_inst.h b/src/plugins/intel_gpu/src/graph/include/condition_inst.h
index 35d5fbc2909..1177f648df5 100644
--- a/src/plugins/intel_gpu/src/graph/include/condition_inst.h
+++ b/src/plugins/intel_gpu/src/graph/include/condition_inst.h
@@ -75,8 +75,12 @@ public:
memory::ptr pred_memory_ptr() const { return dep_memory_ptr(0); }
network::ptr get_net_true() const { return _net_true; }
network::ptr get_net_false() const { return _net_false; }
- condition::branch get_branch_true() const { return node->get_branch_true(); }
- condition::branch get_branch_false() const { return node->get_branch_false(); }
+ condition::branch get_branch_true() const {
+ return get_node().as<condition>().get_branch_true();
+ }
+ condition::branch get_branch_false() const {
+ return get_node().as<condition>().get_branch_false();
+ }
void update_output_layout();
void postprocess_output_memory(network::ptr executed_net, cldnn::condition::branch& branch);
diff --git a/src/plugins/intel_gpu/src/graph/include/primitive_inst.h b/src/plugins/intel_gpu/src/graph/include/primitive_inst.h
index 53f3e6138b0..56e76daffda 100644
--- a/src/plugins/intel_gpu/src/graph/include/primitive_inst.h
+++ b/src/plugins/intel_gpu/src/graph/include/primitive_inst.h
@@ -205,21 +205,24 @@ public:
this->_can_be_optimized = optimized;
}
std::shared_ptr<const primitive> desc() const { return _impl_params->desc; }
- program_node const& get_node() const { return *_node; }
+ program_node const& get_node() const {
+ OPENVINO_ASSERT(_node != nullptr, "_node should not be nullptr for build_deps.");
+ return *_node;
+ }
network& get_network() const { return _network; }
uint32_t get_network_id() const;
const ExecutionConfig& get_config() const { return get_network().get_config(); }
virtual event::ptr set_output_memory(memory::ptr mem, bool check = true, size_t idx = 0);
void check_memory_to_set(const memory& mem, const layout& layout) const;
- const std::list<const cldnn::program_node *>& get_users() const { return _node->get_users(); }
+ const std::list<const cldnn::program_node *>& get_users() const { return get_node().get_users(); }
const std::vector<primitive_inst*>& get_user_insts() const { return _users; }
void init_users() {
std::vector<primitive_id> users;
for (auto u : get_users()) {
users.push_back(u->id());
}
- _users = _network.get_primitives(users);
+ _users = get_network().get_primitives(users);
}
const memory_restricter<uint32_t>& get_runtime_memory_dependencies() const { return _runtime_memory_dependencies; }
@@ -305,7 +308,7 @@ public:
static memory::ptr allocate_output(engine& engine,
memory_pool& pool,
- const program_node& _node,
+ const program_node& node,
const kernel_impl_params& impl_params,
const memory_restricter<uint32_t>& memory_dependencies,
uint32_t net_id,
@@ -488,7 +491,7 @@ protected:
continue;
}
- if (user_inst->need_reset_input_memory(user_inst->get_node().get_dependency_index(*_node)))
+ if (user_inst->need_reset_input_memory(user_inst->get_node().get_dependency_index(get_node())))
return true;
}
return false;
@@ -560,7 +563,6 @@ public:
using typed_node = typed_program_node<PType>;
using typed_impl = typed_primitive_impl<PType>;
- const typed_node* node;
std::shared_ptr<const PType> argument;
template<typename T>
@@ -574,11 +576,11 @@ public:
: typed_primitive_inst_base(network, node, do_allocate_memory(node)) {}
typed_primitive_inst_base(network& network)
- : primitive_inst(network), node(nullptr), argument(nullptr) {}
+ : primitive_inst(network), argument(nullptr) {}
protected:
typed_primitive_inst_base(network& network, typed_node const& node, bool allocate_memory)
- : primitive_inst(network, node, allocate_memory), node(&node), argument(node.get_primitive()) {}
+ : primitive_inst(network, node, allocate_memory), argument(node.get_primitive()) {}
typed_primitive_inst_base(network& network, typed_node const& node, memory::ptr buffer)
: typed_primitive_inst_base(network, node, false) {
diff --git a/src/plugins/intel_gpu/src/graph/input_layout.cpp b/src/plugins/intel_gpu/src/graph/input_layout.cpp
index 70911e8acec..6011470dc88 100644
--- a/src/plugins/intel_gpu/src/graph/input_layout.cpp
+++ b/src/plugins/intel_gpu/src/graph/input_layout.cpp
@@ -72,7 +72,7 @@ void input_layout_inst::update_shape() {
auto mem_layout = _outputs[0]->get_layout();
// Set SHAPE_CHANGED flag if the actual data layout has changed, or if the node is included
// into shape_of subgraph to trigger proper shape_of subgraph shape recalculation
- if (_impl_params->get_output_layout() != mem_layout || _node->is_in_shape_of_subgraph()) {
+ if (_impl_params->get_output_layout() != mem_layout || get_node().is_in_shape_of_subgraph()) {
set_flag(ExecutionFlags::SHAPE_CHANGED);
}
_impl_params->output_layouts[0] = mem_layout;
diff --git a/src/plugins/intel_gpu/src/graph/kv_cache.cpp b/src/plugins/intel_gpu/src/graph/kv_cache.cpp
index 382f2a305ac..01ba3d92c28 100644
--- a/src/plugins/intel_gpu/src/graph/kv_cache.cpp
+++ b/src/plugins/intel_gpu/src/graph/kv_cache.cpp
@@ -116,8 +116,8 @@ void kv_cache_inst::update_shape_info_tensor(const kernel_impl_params& params) {
size_t i = 0;
// [kv_state, kv_new_token, [beam_idx, bt_past]]
- for (i = 0; i < _node->get_dependencies().size(); i++) {
- const auto& node_in_lay = _node->get_input_layout(i);
+ for (i = 0; i < get_node().get_dependencies().size(); i++) {
+ const auto& node_in_lay = get_node().get_input_layout(i);
const auto& runtime_in_lay = params.input_layouts[i];
GPU_DEBUG_TRACE_DETAIL << id() << " : update shape_info for input[" << i << "]" << std::endl;
@@ -141,9 +141,9 @@ void kv_cache_inst::update_shape_info_tensor(const kernel_impl_params& params) {
fill_shape_info_data(bt_layout, bt_state->get_initial_layout(), shape_info_ptr, offset);
}
- for (size_t i = 0; i < _node->get_output_layouts().size(); i++) {
+ for (size_t i = 0; i < get_node().get_output_layouts().size(); i++) {
GPU_DEBUG_TRACE_DETAIL << id() << " : update shape_info for output[" << i << "]" << std::endl;
- const auto& node_out_lay = _node->get_output_layout(i);
+ const auto& node_out_lay = get_node().get_output_layout(i);
const auto& runtime_out_lay = params.output_layouts[i];
fill_shape_info_data(runtime_out_lay, node_out_lay, shape_info_ptr, offset);
}
diff --git a/src/plugins/intel_gpu/src/graph/loop.cpp b/src/plugins/intel_gpu/src/graph/loop.cpp
index f4d82eaa60b..1ef5f56d4d0 100644
--- a/src/plugins/intel_gpu/src/graph/loop.cpp
+++ b/src/plugins/intel_gpu/src/graph/loop.cpp
@@ -767,10 +767,10 @@ void loop_inst::update_output_layout() {
if (_node == nullptr)
return;
- auto memory_deps = _node->get_const_memory_deps();
- for (auto& i : _node->get_shape_infer_dependencies()) {
- auto dep_id = _node->get_dependency(i).id();
- if (memory_deps.count(i) > 0 || i >= _node->get_dependencies().size()) {
+ auto memory_deps = get_node().get_const_memory_deps();
+ for (auto& i : get_node().get_shape_infer_dependencies()) {
+ auto dep_id = get_node().get_dependency(i).id();
+ if (memory_deps.count(i) > 0 || i >= get_node().get_dependencies().size()) {
continue;
}
@@ -779,10 +779,10 @@ void loop_inst::update_output_layout() {
}
_impl_params->memory_deps = memory_deps;
- auto new_layouts = _node->type()->calc_output_layouts(*_node, *_impl_params);
+ auto new_layouts = get_node().type()->calc_output_layouts(*_node, *_impl_params);
if (new_layouts.empty()) {
- auto new_layout = _node->type()->calc_output_layout(*_node, *_impl_params);
- new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(0), new_layout.data_padding);
+ auto new_layout = get_node().type()->calc_output_layout(*_node, *_impl_params);
+ new_layout.data_padding = padding::max(get_node().get_primitive()->get_output_padding(0), new_layout.data_padding);
_impl_params->output_layouts[0] = new_layout;
} else {
if (_impl_params->output_layouts.size() < new_layouts.size()) {
@@ -790,7 +790,7 @@ void loop_inst::update_output_layout() {
}
for (size_t i = 0; i < new_layouts.size(); ++i) {
auto new_layout = new_layouts[i];
- new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(i), new_layout.data_padding);
+ new_layout.data_padding = padding::max(get_node().get_primitive()->get_output_padding(i), new_layout.data_padding);
_impl_params->output_layouts[i] = new_layout;
}
}
diff --git a/src/plugins/intel_gpu/src/graph/mutable_data.cpp b/src/plugins/intel_gpu/src/graph/mutable_data.cpp
index bbcd904ca78..a2b9465b8ee 100644
--- a/src/plugins/intel_gpu/src/graph/mutable_data.cpp
+++ b/src/plugins/intel_gpu/src/graph/mutable_data.cpp
@@ -57,7 +57,7 @@ std::string mutable_data_inst::to_string(mutable_data_node const& node) {
event::ptr mutable_data_inst::set_output_memory(memory::ptr mem_new, bool check, size_t idx) {
event::ptr input_ev = nullptr;
- if (_node != nullptr) {
+ if (has_node()) {
auto& eng = _network.get_engine();
auto& mem_node = const_cast<program_node*>(_node)->as<mutable_data>();
auto& mem_attached = mem_node.get_attached_memory();
diff --git a/src/plugins/intel_gpu/src/graph/non_max_suppression.cpp b/src/plugins/intel_gpu/src/graph/non_max_suppression.cpp
index df29ed36a7f..19e15fe5ecb 100644
--- a/src/plugins/intel_gpu/src/graph/non_max_suppression.cpp
+++ b/src/plugins/intel_gpu/src/graph/non_max_suppression.cpp
@@ -148,7 +148,7 @@ void non_max_suppression_gather_inst::update_output_memory() {
return;
for (size_t i = 0; i < inputs_memory_count(); i++) {
- if (node->get_program().is_new_shape_infer() && input_memory_ptr(i) == nullptr)
+ if (get_node().get_program().is_new_shape_infer() && input_memory_ptr(i) == nullptr)
return;
if (output_memory_ptr(i) != nullptr && _network.get_engine().is_the_same_buffer(output_memory(i), input_memory(i)))
@@ -157,8 +157,8 @@ void non_max_suppression_gather_inst::update_output_memory() {
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[i]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[i].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[i].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs[i] = {_network.get_engine().reinterpret_buffer(input_memory(i), _impl_params->get_output_layout(i))};
}
diff --git a/src/plugins/intel_gpu/src/graph/permute.cpp b/src/plugins/intel_gpu/src/graph/permute.cpp
index c4fddfde978..202aa7134e4 100644
--- a/src/plugins/intel_gpu/src/graph/permute.cpp
+++ b/src/plugins/intel_gpu/src/graph/permute.cpp
@@ -138,18 +138,17 @@ void permute_inst::update_output_memory() {
&& _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
GPU_DEBUG_TRACE_DETAIL << id() << " : update_output_memory with mem of input " << get_node().get_dependency(0).id()
<< " : " << input_memory_ptr()->buffer_ptr() << std::endl;
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ get_network().get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), get_network_id());
}
- _outputs = {_network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
+ _outputs = {get_network().get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
_mem_allocated = false;
}
diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
index 15b4cf70aac..ae8988abc04 100644
--- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
+++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp
@@ -206,7 +206,7 @@ kernel_impl_params primitive_impl::static_canonicalize_shapes(const kernel_impl_
return updated_impl_params;
}
-uint32_t primitive_inst::get_network_id() const { return _network.get_id(); }
+uint32_t primitive_inst::get_network_id() const { return get_network().get_id(); }
void primitive_inst::check_memory_to_set(const memory& mem, const layout& l) const {
// The layout with empty tensor (scalar) is regarded as 1 dimension with value 1
@@ -254,7 +254,7 @@ void primitive_inst::check_memory_to_set(const memory& mem, const layout& l) con
}
event::ptr primitive_inst::set_output_memory(memory::ptr mem_new, bool check, size_t idx) {
- auto& eng = _network.get_engine();
+ auto& eng = get_network().get_engine();
// skip all the buzz if no action actually required
event::ptr ev = nullptr;
if (_outputs[idx] && eng.is_the_same_buffer(*mem_new, *_outputs[idx])) {
@@ -267,7 +267,7 @@ event::ptr primitive_inst::set_output_memory(memory::ptr mem_new, bool check, si
check_memory_to_set(*mem_new, ol);
if (is_constant()) {
- ev = mem_new->copy_from(_network.get_stream(), *_outputs[idx], false);
+ ev = mem_new->copy_from(get_network().get_stream(), *_outputs[idx], false);
} else {
_outputs[idx] = mem_new;
_max_output_layout_count[idx] = mem_new->get_layout().get_linear_size();
@@ -354,18 +354,18 @@ void primitive_inst::update_shape() {
set_flag(ExecutionFlags::SHAPE_CHANGED, input_shape_changed);
// We assume that tensor ranks are static, thus shape_of doesn't need to update anything even if input shape is dynamic
- if (_node->is_type<shape_of>() && !input_shape_changed) {
+ if (get_node().is_type<shape_of>() && !input_shape_changed) {
return;
}
// if input shape is not changed, loop doesn't need to update anything.
// because actual output layout will be calculated after the end of body network execution.
- if (_node->is_type<loop>() && !input_shape_changed) {
+ if (get_node().is_type<loop>() && !input_shape_changed) {
return;
}
// Do not update shapes in shape_of subraph if shape_of's input shape is not changed
- if (_node->is_in_shape_of_subgraph()) {
+ if (get_node().is_in_shape_of_subgraph()) {
bool subgraph_input_changed = false;
for (size_t i = 0; i < dependant_shape_of_insts.size(); i++) {
if (dependant_shape_of_insts[i]->get_flag(ExecutionFlags::SHAPE_CHANGED)) {
@@ -381,8 +381,8 @@ void primitive_inst::update_shape() {
}
// Even though the predecessors' shapes are not changed, the output shape might be updated by the mem_dep
- auto memory_deps = _node->get_const_memory_deps();
- for (auto& i : _node->get_shape_infer_dependencies()) {
+ auto memory_deps = get_node().get_const_memory_deps();
+ for (auto& i : get_node().get_shape_infer_dependencies()) {
if (memory_deps.count(i) > 0) {
continue;
}
@@ -404,22 +404,22 @@ void primitive_inst::update_shape() {
input_shape_changed = true;
}
- if (!_node->is_type<kv_cache>() && !input_shape_changed && _impl_params->get_output_layout().is_static())
+ if (!get_node().is_type<kv_cache>() && !input_shape_changed && _impl_params->get_output_layout().is_static())
return;
std::vector<event::ptr> dependencies_events;
auto queue_type = get_network().get_stream().get_queue_type();
bool has_runtime_deps = false;
- for (auto& i : _node->get_shape_infer_dependencies()) {
+ for (auto& i : get_node().get_shape_infer_dependencies()) {
// Some primitives may have flexible count of deps (e.g. reshape), thus allow skipping some deps
- if (memory_deps.count(i) > 0 || i >= _node->get_dependencies().size()) {
+ if (memory_deps.count(i) > 0 || i >= get_node().get_dependencies().size()) {
continue;
}
auto& dep = _deps[i].first;
auto& dep_port = _deps[i].second;
// exclude fused node from memory_deps
- if (_node->is_fused_dep(i)) {
+ if (get_node().is_fused_dep(i)) {
break;
}
@@ -448,21 +448,21 @@ void primitive_inst::update_shape() {
OV_ITT_SCOPED_TASK(ov::intel_gpu::itt::domains::intel_gpu_plugin, openvino::itt::handle("update_shape_sync: " + id()));
GPU_DEBUG_TRACE_DETAIL << "runtime synchronization for " << id() << " shape inference\n";
if (!dependencies_events.empty() && queue_type == QueueTypes::out_of_order) {
- _network.get_stream().wait_for_events(dependencies_events);
+ get_network().get_stream().wait_for_events(dependencies_events);
} else if (queue_type == QueueTypes::in_order) {
- _network.get_stream().finish();
+ get_network().get_stream().finish();
}
}
_impl_params->memory_deps = memory_deps;
- auto new_layouts = _node->type()->calc_output_layouts(*_node, *_impl_params);
+ auto new_layouts = get_node().type()->calc_output_layouts(*_node, *_impl_params);
for (size_t idx = 0; idx != new_layouts.size(); ++idx) {
auto& new_layout = new_layouts[idx];
- if (!_node->is_type<reshape>() || (!_node->get_input_layout(0).data_padding.is_dynamic() && !_node->can_be_optimized())) {
+ if (!get_node().is_type<reshape>() || (!get_node().get_input_layout(0).data_padding.is_dynamic() && !get_node().can_be_optimized())) {
auto data_padding = padding::max(_impl_params->get_output_layout(idx).data_padding, new_layout.data_padding);
- new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(idx), data_padding);
+ new_layout.data_padding = padding::max(get_node().get_primitive()->get_output_padding(idx), data_padding);
}
if (_impl_params->get_output_layout(idx) != new_layout) {
@@ -522,7 +522,7 @@ void primitive_inst::update_shape() {
}
kernel_impl_params primitive_inst::get_fake_aligned_params_if_possible(kernel_impl_params const& orig_impl_param) {
- auto updated_params = _node->type()->get_fake_aligned_params(orig_impl_param);
+ auto updated_params = get_node().type()->get_fake_aligned_params(orig_impl_param);
const auto &dev_info = get_node().get_program().get_engine().get_device_info();
@@ -609,7 +609,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
}
// input_layout node is supposed to always use external memory in dynamic case
- if (_node->is_type<input_layout>())
+ if (get_node().is_type<input_layout>())
return;
auto& sp = *get_network().get_shape_predictor();
@@ -621,7 +621,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
if (auto stateful_prim = dynamic_cast<memory_state::variable*>(this)) {
auto& variable_id = stateful_prim->variable_id();
auto& variable = get_network().get_variable(variable_id);
- if (_node->is_type<kv_cache>()) {
+ if (get_node().is_type<kv_cache>()) {
// Reuse state memory as output for kv cache if possible
// otherwise clear _outputs for the cases when mem was reused previously
if (_impl_params->can_be_optimized()) {
@@ -691,7 +691,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
_max_output_layout_count[0] = variable.get_actual_mem_size() / dt_sizes_in_B[0];
if (auto compressed_cache_variable = dynamic_cast<ov::intel_gpu::VariableStateIndirectKVCacheCompressed*>(&variable)) {
- const size_t scale_idx = _node->is_type<read_value>() ? 1 : 2; // kv_cache or read_value
+ const size_t scale_idx = get_node().is_type<read_value>() ? 1 : 2; // kv_cache or read_value
_max_output_layout_count[scale_idx] = compressed_cache_variable->get_compression_scale_state()->get_actual_mem_size() / dt_sizes_in_B[1];
if (compressed_cache_variable->has_zp_state()) {
_max_output_layout_count[scale_idx + 1] = compressed_cache_variable->get_compression_zp_state()->get_actual_mem_size() / dt_sizes_in_B[2];
@@ -789,7 +789,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
}
// Clear out memory if was previously reused, but now primitive can't be optimized
- if (!_node->is_type<concatenation>() && (_node->is_runtime_skippable() || _node->is_type<crop>())) {
+ if (!get_node().is_type<concatenation>() && (get_node().is_runtime_skippable() || get_node().is_type<crop>())) {
std::function<void(cldnn::primitive_inst*, cldnn::memory::ptr)> reset_user_output_memory
= [&](cldnn::primitive_inst* curr_inst, cldnn::memory::ptr target_mem_ptr) {
for (auto& user_inst : curr_inst->get_user_insts()) {
@@ -811,12 +811,12 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
// * iter0: node1(executed) -> node2(skipped) -> node3(skipped)
// * iter1: node1(skipped) -> node2(skipped) -> node3(executed)
if (_outputs[0] && dep_memory_ptr(0)
- && !_network.get_engine().is_the_same_buffer(dep_memory(0), output_memory(0))) {
+ && !get_network().get_engine().is_the_same_buffer(dep_memory(0), output_memory(0))) {
reset_user_output_memory(this, dep_memory_ptr(0));
}
return;
} else if (_outputs[0] && dep_memory_ptr(0) &&
- _network.get_engine().is_the_same_buffer(dep_memory(0), output_memory(0))) {
+ get_network().get_engine().is_the_same_buffer(dep_memory(0), output_memory(0))) {
if (mem_allocated()) {
get_network().get_memory_pool().release_memory(_outputs[0].get(),
get_node().get_unique_id(), id(), get_network_id());
@@ -857,7 +857,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
update_padding(updated_layouts[0]);
// Update scales and zero points buffers paddings, skipping beam_table
- if (_node->is_type<kv_cache>()) {
+ if (get_node().is_type<kv_cache>()) {
for (size_t i = 2; i < updated_layouts.size(); ++i) {
update_padding(updated_layouts[i]);
}
@@ -869,9 +869,9 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
for (size_t i = 0; i < updated_layouts.size(); ++i) {
bool reclaim = 0;
size_t required_buffer_size = 0;
- if (_node->is_type<kv_cache>() && i != 1) {
+ if (get_node().is_type<kv_cache>() && i != 1) {
// Relax reclaiming condition for kv cache
- const auto& desc = _node->as<kv_cache>().get_primitive();
+ const auto& desc = get_node().as<kv_cache>().get_primitive();
auto prealloc_shape = updated_layouts[i].get_shape();
const auto shape_rank = prealloc_shape.size();
const auto seq_axis = i == 0 ? kv_cache_inst::get_sequence_axis(desc->concat_axis, shape_rank)
@@ -894,7 +894,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
}
// Handle runtime dynamic concat optimization
- if (_node->is_type<concatenation>() && can_be_optimized() && allocation_done_by_other) {
+ if (get_node().is_type<concatenation>() && can_be_optimized() && allocation_done_by_other) {
allocation_done_by_other = false;
GPU_DEBUG_PROFILED_STAGE_MEMALLOC_INFO("concat_alloc_by_other");
return;
@@ -903,8 +903,8 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
for (size_t i = 0; i < actual_layouts.size(); ++i) {
bool can_reuse_buffer = (_outputs[i] && updated_layouts[i].get_linear_size() <= _max_output_layout_count[i]);
std::pair<bool, ov::Shape> prealloc_info;
- if (_node->is_type<kv_cache>() && i != 1) {
- const auto& desc = _node->as<kv_cache>().get_primitive();
+ if (get_node().is_type<kv_cache>() && i != 1) {
+ const auto& desc = get_node().as<kv_cache>().get_primitive();
const auto shape_rank = updated_layouts[i].get_shape().size();
const auto seq_axis = i == 0 ? kv_cache_inst::get_sequence_axis(desc->concat_axis, shape_rank)
: kv_cache_inst::get_scale_zp_sequence_axis();
@@ -924,10 +924,10 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
GPU_DEBUG_TRACE_DETAIL << id() << ": reuse previously allocated output buffer[" << i << "] - "
<< actual_layouts[i].get_linear_size() << "/" << _max_output_layout_count[i]
<< std::endl;
- if (_node->is_type<kv_cache>() && i != 1) {
+ if (get_node().is_type<kv_cache>() && i != 1) {
// kv_cache has already assigned memory.
// No need to reinterpret output memory but need to update padding
- const auto& desc = _node->as<kv_cache>().get_primitive();
+ const auto& desc = get_node().as<kv_cache>().get_primitive();
auto& present_layout = _impl_params->output_layouts[i];
const auto present_layout_rank = present_layout.get_partial_shape().size();
const auto sequence_axis = i == 0 ? kv_cache_inst::get_sequence_axis(desc->concat_axis, present_layout_rank)
@@ -941,12 +941,12 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
GPU_DEBUG_TRACE_DETAIL << i << ". " << _impl_params->output_layouts[i].to_string() << std::endl;
set_flag(ExecutionFlags::SHAPE_CHANGED);
} else {
- _outputs[i] = _network.get_engine().reinterpret_buffer(*_outputs[i], actual_layouts[i]);
+ _outputs[i] = get_network().get_engine().reinterpret_buffer(*_outputs[i], actual_layouts[i]);
}
// TODO: check need_reset_output_memory per output
if (need_reset_output_memory() && !can_be_optimized()) {
GPU_DEBUG_TRACE_DETAIL << id() << " : Need reset output memory considering user" << std::endl;
- add_dep_event(_outputs[i]->fill(_network.get_stream()));
+ add_dep_event(_outputs[i]->fill(get_network().get_stream()));
}
GPU_DEBUG_PROFILED_STAGE_MEMALLOC_INFO("reuse_buffer");
} else {
@@ -955,13 +955,13 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
<< " Current buffer_size=" << _max_output_layout_count[i]
<< " Requested buffer_size=" << updated_layouts[i].get_linear_size()
<< std::endl;
- _outputs[i] = allocate_output(_network.get_engine(),
- _network.get_memory_pool(),
+ _outputs[i] = allocate_output(get_network().get_engine(),
+ get_network().get_memory_pool(),
*_node,
updated_params,
_runtime_memory_dependencies,
get_network_id(),
- _network.is_internal(),
+ get_network().is_internal(),
i,
need_reset_output_memory(),
is_output_buffer(this, true),
@@ -977,8 +977,8 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
}
// Set variable memory same as output memory
- if (_node->is_type<kv_cache>()) {
- const auto& desc = _node->as<kv_cache>().get_primitive();
+ if (get_node().is_type<kv_cache>()) {
+ const auto& desc = get_node().as<kv_cache>().get_primitive();
auto& variable = get_network().get_variable(desc->variable_info.variable_id);
auto present_layout = _impl_params->output_layouts[0];
auto present_layout_rank = present_layout.get_partial_shape().size();
@@ -1090,7 +1090,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) {
(!need_lockable && alloc_type != cldnn::allocation_type::usm_host);
if (can_reuse) {
- _intermediates_memory[i] = _network.get_engine().reinterpret_buffer(*_intermediates_memory[i], buffer_descs[i].m_layout);
+ _intermediates_memory[i] = get_network().get_engine().reinterpret_buffer(*_intermediates_memory[i], buffer_descs[i].m_layout);
GPU_DEBUG_CODE(memalloc_info += ((_intermediates_memory.size() > 1) ? ("i" + to_string(i) + ":") : "") + "reuse_buffer");
} else {
// TODO: If there is a kernel which requires reset internal buffer in the future,
@@ -1118,9 +1118,9 @@ bool primitive_inst::use_async_compilation() {
return false;
}
- bool compile_fc_impls = _node->is_type<fully_connected>();
+ bool compile_fc_impls = get_node().is_type<fully_connected>();
if (compile_fc_impls) {
- const auto& fc_node = _node->as<fully_connected>();
+ const auto& fc_node = get_node().as<fully_connected>();
if (fc_node.get_primitive()->compressed_weights) {
auto weights_dt = fc_node.weights().get_output_layout().data_type;
auto input_shape = _impl_params->get_input_layout().get_shape();
@@ -1135,17 +1135,17 @@ bool primitive_inst::use_async_compilation() {
}
}
- bool compile_gemm_impls = _node->is_type<gemm>();
+ bool compile_gemm_impls = get_node().is_type<gemm>();
if (compile_gemm_impls) {
// Do not async-compile if opt_gemm is chosen for iGPU
// Do async-compile if it is to be executed from onednn
- compile_gemm_impls = _node->get_selected_impl() && _node->get_selected_impl()->get_kernel_name().find("gemm_ref") != std::string::npos;
- compile_gemm_impls |= _impls_factory->has(impl_types::onednn) && _node->get_selected_impl() && !_node->get_selected_impl()->is_onednn();
+ compile_gemm_impls = get_node().get_selected_impl() && get_node().get_selected_impl()->get_kernel_name().find("gemm_ref") != std::string::npos;
+ compile_gemm_impls |= _impls_factory->has(impl_types::onednn) && get_node().get_selected_impl() && !get_node().get_selected_impl()->is_onednn();
}
- return (_node->is_type<convolution>() || compile_fc_impls || compile_gemm_impls ||
- (_node->is_type<softmax>() && _node->get_selected_impl() &&
- _node->get_selected_impl()->get_kernel_name().find("softmax_gpu_ref") != std::string::npos));
+ return (get_node().is_type<convolution>() || compile_fc_impls || compile_gemm_impls ||
+ (get_node().is_type<softmax>() && get_node().get_selected_impl() &&
+ get_node().get_selected_impl()->get_kernel_name().find("softmax_gpu_ref") != std::string::npos));
}
void primitive_inst::fill_shape_info_data(const layout& runtime_layout, const layout& node_layout, int32_t* shape_info_ptr, size_t& offset) {
@@ -1183,8 +1183,8 @@ void primitive_inst::set_shape_info_memory_subbuffer(memory::ptr addr) {
}
void primitive_inst::allocate_shape_info_memory() {
- int64_t shape_elements = _node->get_total_shape_info_size();
- _shape_info_memory = _network.get_engine().allocate_memory(layout{{shape_elements}, data_types::i32, format::bfyx}, false);
+ int64_t shape_elements = get_node().get_total_shape_info_size();
+ _shape_info_memory = get_network().get_engine().allocate_memory(layout{{shape_elements}, data_types::i32, format::bfyx}, false);
}
void primitive_inst::update_shape_info_tensor(const kernel_impl_params& params) {
@@ -1192,18 +1192,18 @@ void primitive_inst::update_shape_info_tensor(const kernel_impl_params& params)
allocate_shape_info_memory();
}
- mem_lock<int32_t> lock(_shape_info_memory, _network.get_stream());
+ mem_lock<int32_t> lock(_shape_info_memory, get_network().get_stream());
auto shape_info_ptr = lock.data();
size_t offset = 0;
- for (size_t i = 0; i < _node->get_dependencies().size(); i++) {
+ for (size_t i = 0; i < get_node().get_dependencies().size(); i++) {
GPU_DEBUG_TRACE_DETAIL << id() << " : update shape_info for input[" << i << "]" << std::endl;
- const auto& node_in_lay = _node->get_input_layout(i);
+ const auto& node_in_lay = get_node().get_input_layout(i);
const auto& runtime_in_lay = params.input_layouts[i];
fill_shape_info_data(runtime_in_lay, node_in_lay, shape_info_ptr, offset);
}
- for (size_t i = 0; i < _node->get_output_layouts().size(); i++) {
+ for (size_t i = 0; i < get_node().get_output_layouts().size(); i++) {
GPU_DEBUG_TRACE_DETAIL << id() << " : update shape_info for output[" << i << "]" << std::endl;
- const auto& node_out_lay = _node->get_output_layout(i);
+ const auto& node_out_lay = get_node().get_output_layout(i);
const auto& runtime_out_lay = params.output_layouts[i];
fill_shape_info_data(runtime_out_lay, node_out_lay, shape_info_ptr, offset);
}
@@ -1228,7 +1228,7 @@ void primitive_inst::update_impl(bool use_async_compilation) {
return;
}
- if (!_node->is_type<data>() && !(_node->is_type<mutable_data>() && _node->get_dependencies().empty())) {
+ if (!get_node().is_type<data>() && !(get_node().is_type<mutable_data>() && get_node().get_dependencies().empty())) {
#ifdef ENABLE_ONEDNN_FOR_GPU
if (_impls_factory->has(impl_types::onednn)) {
auto attrs_onednn = std::make_shared<dnnl::primitive_attr>();
@@ -1257,9 +1257,9 @@ void primitive_inst::update_paddings() {
auto reset_pad = [](kernel_impl_params& params, const program_node* node, size_t idx = 0) {
params.output_layouts[idx].data_padding = node->get_output_layout(idx).data_padding;
};
- if (_node->is_type<read_value>() || _node->is_type<kv_cache>()) {
- auto variable_id = _node->is_type<read_value>() ? (_node->as<read_value>().get_primitive()->variable_id)
- : (_node->as<kv_cache>().get_primitive()->variable_info.variable_id);
+ if (get_node().is_type<read_value>() || get_node().is_type<kv_cache>()) {
+ auto variable_id = get_node().is_type<read_value>() ? (get_node().as<read_value>().get_primitive()->variable_id)
+ : (get_node().as<kv_cache>().get_primitive()->variable_info.variable_id);
auto& variable = get_network().get_variable(variable_id);
// Reset paddings for read_value and users with dynamic pad when variable is reset
// to avoid wrong pad used for some nodes due to pad propagation logic (which uses previous iter pad values)
@@ -1269,14 +1269,14 @@ void primitive_inst::update_paddings() {
reset_pad(*inst->_impl_params, inst->_node);
if (inst == this) {
if (auto compressed_cache_variable = dynamic_cast<ov::intel_gpu::VariableStateIndirectKVCacheCompressed*>(&variable)) {
- const size_t scale_idx = _node->is_type<read_value>() ? 1 : 2;
+ const size_t scale_idx = get_node().is_type<read_value>() ? 1 : 2;
reset_pad(*inst->_impl_params, inst->_node, scale_idx);
if (compressed_cache_variable->has_zp_state()) {
reset_pad(*inst->_impl_params, inst->_node, scale_idx + 1);
}
}
}
- auto& users = inst->_node->get_users();
+ auto& users = inst->get_node().get_users();
if (users.size() == 1 && users.front()->get_output_layout(0).data_padding.is_dynamic()) {
inst = inst->get_user_insts().front();
} else {
@@ -1287,7 +1287,7 @@ void primitive_inst::update_paddings() {
return;
}
- if (_node->is_type<gather>() && _impl_params->output_layouts[0].data_padding.is_dynamic()) {
+ if (get_node().is_type<gather>() && _impl_params->output_layouts[0].data_padding.is_dynamic()) {
if (can_be_optimized())
_impl_params->output_layouts[0] = _impl_params->input_layouts[0];
else
@@ -1365,7 +1365,7 @@ void primitive_inst::do_runtime_skip_reorder() {
void primitive_inst::do_runtime_in_place_kv_cache() {
OV_ITT_SCOPED_TASK(ov::intel_gpu::itt::domains::intel_gpu_plugin, openvino::itt::handle("do_runtime_in_place_kv_cache: " + id()));
- if (!_node->is_type<kv_cache>())
+ if (!get_node().is_type<kv_cache>())
return;
_impl_params->_can_be_optimized = false;
@@ -1373,7 +1373,7 @@ void primitive_inst::do_runtime_in_place_kv_cache() {
if (_impl_params->get_input_layout(0).count() == 0) {
return;
}
- const auto& desc = _node->as<kv_cache>().get_primitive();
+ const auto& desc = get_node().as<kv_cache>().get_primitive();
auto& past_layout = _impl_params->input_layouts[0];
auto& new_layout = _impl_params->input_layouts[1];
auto& present_layout = _impl_params->output_layouts[0];
@@ -1490,8 +1490,8 @@ void primitive_inst::do_runtime_skip_gather() {
if (queue_type == QueueTypes::out_of_order)
get_network().get_stream().wait_for_events({_deps[1].first->get_impl_params()->out_event});
else
- _network.get_stream().finish();
- mem_lock<int32_t, mem_lock_type::read> idx_data(dep_memory_ptr(1), _network.get_stream());
+ get_network().get_stream().finish();
+ mem_lock<int32_t, mem_lock_type::read> idx_data(dep_memory_ptr(1), get_network().get_stream());
for (int64_t i = 0; i < static_cast<int32_t>(idx_shape[0]); ++i) {
if (idx_data[i] != i) {
GPU_DEBUG_TRACE_DETAIL << "--- Cannot optimize because idx_data [" << i << "] (" << idx_data[i] << ") != " << i << std::endl;
@@ -1528,7 +1528,7 @@ void primitive_inst::do_runtime_skip_permute() {
return;
GPU_DEBUG_TRACE_DETAIL << "[do_runtime_skip_permute] " << id() << " : check optimizability" << std::endl;
- auto desc = _node->as<permute>().get_primitive();
+ auto desc = get_node().as<permute>().get_primitive();
auto input_shape = _impl_params->get_input_layout(0).get_shape();
const auto& permute_order = desc->permute_order;
// Can skip if the transposed dim keeps the original order
@@ -1846,9 +1846,8 @@ void primitive_inst::prepare_primitive() {
const bool prev_execution_skipped = can_be_optimized()
|| (_impl_params->output_layouts[0].is_static() && _impl_params->output_layouts[0].count() == 0);
const auto orig_outputs = _outputs;
- if ((is_dynamic() || _node->is_in_shape_of_subgraph()) && !has_inner_networks()) {
+ if ((is_dynamic() || get_node().is_in_shape_of_subgraph()) && !has_inner_networks()) {
do_runtime_in_place_concat();
- OPENVINO_ASSERT(_node != nullptr, "[GPU] Invalid primitive_inst object for dynamic shapes case: program_node can't be null");
update_shape();
if (_impl_params->output_layouts[0].count() == 0) {
@@ -1858,7 +1857,7 @@ void primitive_inst::prepare_primitive() {
// subgraph_input_changed can be available only shape_of is dynamic.
// shape_of_subgraph for static shape_of could be run every inference if constant propagation does not work.
- if (_node->is_in_shape_of_subgraph() && dependant_shape_of_insts.front()->is_dynamic()) {
+ if (get_node().is_in_shape_of_subgraph() && dependant_shape_of_insts.front()->is_dynamic()) {
bool subgraph_input_changed = false;
for (size_t i = 0; i < dependant_shape_of_insts.size(); i++) {
if (dependant_shape_of_insts[i]->get_flag(ExecutionFlags::SHAPE_CHANGED)) {
@@ -1910,7 +1909,7 @@ void primitive_inst::prepare_primitive() {
// Paged Attention may require dispatch data update and internal buffers reallocation
// even if the input shapes haven't been changed
- if (_node->is_type<paged_attention>() && !get_flag(ExecutionFlags::IMPL_CHANGED) && _impl->requires_update(*this, *_impl_params)) {
+ if (get_node().is_type<paged_attention>() && !get_flag(ExecutionFlags::IMPL_CHANGED) && _impl->requires_update(*this, *_impl_params)) {
_impl->update(*this, *_impl_params);
realloc_if_needed(prev_execution_skipped);
@@ -1947,7 +1946,7 @@ void primitive_inst::prepare_primitive() {
}
on_execute();
- if (!_node->is_type<condition>() && !_node->is_type<loop>()) {
+ if (!get_node().is_type<condition>() && !get_node().is_type<loop>()) {
for (size_t i = 0; i < _outputs.size(); ++i) {
if (!orig_outputs[i] && !_outputs[i])
continue;
@@ -1956,7 +1955,7 @@ void primitive_inst::prepare_primitive() {
set_flag(ExecutionFlags::MEMORY_CHANGED);
break;
}
- if (!_network.get_engine().is_the_same_buffer(*orig_outputs[i], *_outputs[i])) {
+ if (!get_network().get_engine().is_the_same_buffer(*orig_outputs[i], *_outputs[i])) {
set_flag(ExecutionFlags::MEMORY_CHANGED);
break;
}
@@ -1979,7 +1978,7 @@ void primitive_inst::prepare_primitive() {
// Replace multiple events with single grouped event in case of barriers synchronization to prevent `_last_barrier_ev` usage as a dependency
// event of optimized_out instance's users, which may lead to unwanted extra synchronization of CPU impls with GPU kernels
- if (_node->is_in_shape_of_subgraph() && can_be_optimized() && _impl_params->dep_events.size() > 1 && out_of_order_queue) {
+ if (get_node().is_in_shape_of_subgraph() && can_be_optimized() && _impl_params->dep_events.size() > 1 && out_of_order_queue) {
auto grouped_ev = get_network().get_stream().group_events(_impl_params->dep_events);
_impl_params->dep_events = {grouped_ev};
}
@@ -1997,7 +1996,7 @@ void primitive_inst::execute() {
if (!d.first->get_node().is_type<data>()) {
auto allocated_mem = d.first->output_memory_ptr();
auto actual_input_layout = d.first->get_output_layout();
- auto& engine = _network.get_engine();
+ auto& engine = get_network().get_engine();
cldnn::memory_ptr actual_mem = nullptr;
// Need to use actual layout, not the fake aligned memory layout
if (actual_input_layout.count() != 0) {
@@ -2049,21 +2048,16 @@ void primitive_inst::set_arguments() {
}
void primitive_inst::build_deps() {
- if (!_deps.empty())
- return;
-
- OPENVINO_ASSERT(_node != nullptr, "_node should not be nullptr for build_deps.");
-
- if (_deps.empty() && !_node->get_dependencies().empty()) {
- _deps = _network.get_primitives(_node->get_dependencies());
+ if (_deps.empty() && !get_node().get_dependencies().empty()) {
+ _deps = get_network().get_primitives(get_node().get_dependencies());
_exec_deps = build_exec_deps(_deps);
}
}
void primitive_inst::configure_shape_of_dependencies() {
- if (dependant_shape_of_insts.empty() && _node != nullptr) {
- for (auto shape_of : _node->get_dependant_shape_of_nodes()) {
- dependant_shape_of_insts.push_back(_network.get_primitive(shape_of->id()).get());
+ if (dependant_shape_of_insts.empty()) {
+ for (auto shape_of : get_node().get_dependant_shape_of_nodes()) {
+ dependant_shape_of_insts.push_back(get_network().get_primitive(shape_of->id()).get());
}
}
}
@@ -2146,10 +2140,10 @@ primitive_inst::primitive_inst(network & network, program_node const& node, bool
}
}
if (_node) {
- GPU_DEBUG_TRACE_DETAIL << _node->type()->to_string(*_node) << "\n";
+ GPU_DEBUG_TRACE_DETAIL << get_node().type()->to_string(*_node) << "\n";
}
_impls_factory = std::make_shared<ImplementationsFactory>(_node);
- _impl_params->strm = _network.get_stream_ptr();
+ _impl_params->strm = get_network().get_stream_ptr();
for (size_t i = 0; i < get_node().get_output_layouts().size(); ++i) {
if (_outputs.size() > i) {
_max_output_layout_count.push_back(_outputs[i] ? _outputs[i]->get_layout().get_linear_size() : 0);
@@ -2182,7 +2176,7 @@ memory::ptr primitive_inst::allocate_internal_buffer(const layout& layout, size_
// NOTE: Currently the ocl driver aborts at runtime when there are layers using device memory close to max size within multiple streams.
// Decided the limitation as 85 % empirically, but still it needs further investigation.
- const auto& inst_deps = _network.get_primitives(_node->get_dependencies());
+ const auto& inst_deps = get_network().get_primitives(get_node().get_dependencies());
auto total_device_mem_size = std::accumulate(inst_deps.begin(), inst_deps.end(), size_t(0), device_mem_acc);
for (const auto& output : _outputs) {
@@ -2204,10 +2198,10 @@ memory::ptr primitive_inst::allocate_internal_buffer(const layout& layout, size_
}
// allocate intermediate memory for the updated layout of buffer
auto alloc_type = allocation_type::unknown;
- GPU_DEBUG_LOG << "[" << _node->id() << ": internal buf " << idx << "] "
+ GPU_DEBUG_LOG << "[" << get_node().id() << ": internal buf " << idx << "] "
<< layout.to_short_string() << " lockable=" << lockable << std::endl;
if ((int64_t)available_device_mem_size - (int64_t)layout.bytes_count() >= 0 &&
- (input_device_mem || _node->get_preferred_impl_type() == impl_types::onednn) && !lockable) {
+ (input_device_mem || get_node().get_preferred_impl_type() == impl_types::onednn) && !lockable) {
// scratchpad memory type enforces to device mem.
GPU_DEBUG_LOG << " input is device mem and available device mem size (" << available_device_mem_size
<< ") > requested memory (" << layout.bytes_count() << " )" << std::endl;
@@ -2222,9 +2216,9 @@ memory::ptr primitive_inst::allocate_internal_buffer(const layout& layout, size_
// Reuse intermediate buffer like output buffer.
bool reuse_internal_buf = true;
auto ret_mem =
- get_memory_from_pool(_network.get_engine(),
- _network.get_id(),
- _network.get_memory_pool(),
+ get_memory_from_pool(get_network().get_engine(),
+ get_network_id(),
+ get_network().get_memory_pool(),
*_node,
layout,
alloc_type,
@@ -2232,7 +2226,7 @@ memory::ptr primitive_inst::allocate_internal_buffer(const layout& layout, size_
_runtime_memory_dependencies,
reset,
_intermediates_memory.size() > idx ? _intermediates_memory[idx].get() : nullptr);
- GPU_DEBUG_LOG << " [" << _network.get_id() << ":" << _node->id() << ": internal buf " << idx << "] " << alloc_type
+ GPU_DEBUG_LOG << " [" << get_network().get_id() << ":" << get_node().id() << ": internal buf " << idx << "] " << alloc_type
<< " " << ret_mem->buffer_ptr() << std::endl;
return ret_mem;
}
@@ -2261,17 +2255,17 @@ void primitive_inst::update_weights() {
if (!_impl)
return;
- bool weightable_node = _node->is_type<fully_connected>() || _node->is_type<convolution>() || _node->is_type<deconvolution>();
+ bool weightable_node = get_node().is_type<fully_connected>() || get_node().is_type<convolution>() || get_node().is_type<deconvolution>();
if (!weightable_node)
return;
- auto& engine = _network.get_engine();
+ auto& engine = get_network().get_engine();
auto reorder_kernel_params = _impl->get_weights_reorder_kernel_params();
if (reorder_kernel_params)
reorder_kernel_params->prog = get_network().get_program().get();
- auto weights_idx = _node->get_primitive()->input.size();
+ auto weights_idx = get_node().get_primitive()->input.size();
auto original_weights_memory = dep_memory_ptr(weights_idx);
const auto& original_layout = original_weights_memory->get_layout();
@@ -2388,7 +2382,7 @@ static bool user_requesting_mem_reuse_false(const program_node& node) {
memory::ptr primitive_inst::allocate_output(engine& _engine,
memory_pool& pool,
- const program_node& _node,
+ const program_node& node,
const kernel_impl_params& impl_params,
const memory_restricter<uint32_t>& memory_dependencies,
uint32_t net_id,
@@ -2416,38 +2410,38 @@ memory::ptr primitive_inst::allocate_output(engine& _engine,
if (total_device_input_mem_size > device_info.max_global_mem_size)
usm_device_allocatable = false;
- bool reusable_across_network = (runtime_alloc && _node.is_dynamic_output_layout())
- || !user_requesting_mem_reuse_false(_node);
+ bool reusable_across_network = (runtime_alloc && node.is_dynamic_output_layout())
+ || !user_requesting_mem_reuse_false(node);
// Do not use memory pool for nodes from shape_of subgraphs, because such nodes mostly use CPU impls and may be executed in parallel with predecessors
// GPU kernels and cause accuracy problems. This significantly improves performance (because provides an ability not to synchronize shape_of subgraphs
// execution with other nodes) at the cost of tiny increase in memory consumption.
- if (_node.is_in_shape_of_subgraph())
+ if (node.is_in_shape_of_subgraph())
reusable_across_network = false;
- if (reusable_across_network && _node.get_program().is_body_program() && is_output_buffer && runtime_alloc)
+ if (reusable_across_network && node.get_program().is_body_program() && is_output_buffer && runtime_alloc)
reusable_across_network = false;
// For outputs, cpu prim we want to have lockable alloc type
// Also if the successor of a node is an cpu, then memory needs to be lockable.
- bool is_cpu = _node.get_selected_impl() ? _node.get_selected_impl()->is_cpu() :
- _node.get_preferred_impl_type() == impl_types::cpu;
+ bool is_cpu = node.get_selected_impl() ? node.get_selected_impl()->is_cpu() :
+ node.get_preferred_impl_type() == impl_types::cpu;
auto total_output_bytes = layout.bytes_count();
auto use_lockable_memory =
(is_output_buffer && ov::intel_gpu::can_use_usm_host(_engine, total_output_bytes)) ||
- is_cpu || has_any_cpu_user_not_shape_of(_node.get_users()) ||
+ is_cpu || has_any_cpu_user_not_shape_of(node.get_users()) ||
!_engine.supports_allocation(allocation_type::usm_device) ||
- (_node.is_shape_infer_dep() && device_info.dev_type == device_type::integrated_gpu);
+ (node.is_shape_infer_dep() && device_info.dev_type == device_type::integrated_gpu);
const auto& lockable_mem_type = _engine.get_lockable_preferred_memory_allocation_type(layout.format.is_image_2d());
auto alloc_type = use_lockable_memory ? lockable_mem_type
: !usm_device_allocatable ? lockable_mem_type : allocation_type::usm_device;
if (is_internal) {
- bool is_reorder_weights = _node.is_type<reorder>() && _node.as<reorder>().get_primitive()->weights_reorder_params;
- if (_node.can_be_optimized() || is_reorder_weights) {
- GPU_DEBUG_LOG << "[" << _node.id() << ": output]" << std::endl;
+ bool is_reorder_weights = node.is_type<reorder>() && node.as<reorder>().get_primitive()->weights_reorder_params;
+ if (node.can_be_optimized() || is_reorder_weights) {
+ GPU_DEBUG_LOG << "[" << node.id() << ": output]" << std::endl;
// Use usm_device memory for weights reordering
if (is_internal && is_reorder_weights &&
_engine.supports_allocation(allocation_type::usm_device))
@@ -2455,7 +2449,7 @@ memory::ptr primitive_inst::allocate_output(engine& _engine,
return get_memory_from_pool(_engine,
net_id,
pool,
- _node,
+ node,
layout,
alloc_type,
false,
@@ -2463,19 +2457,19 @@ memory::ptr primitive_inst::allocate_output(engine& _engine,
reset,
curr_memory);
} else {
- if ((_node.is_output() && is_reorder_weights) || (!_node.is_output() && _node.is_type<input_layout>()))
+ if ((node.is_output() && is_reorder_weights) || (!node.is_output() && node.is_type<input_layout>()))
reset = false;
- GPU_DEBUG_LOG << "[" << _node.id() << ": constant]" << std::endl;
+ GPU_DEBUG_LOG << "[" << node.id() << ": constant]" << std::endl;
return _engine.allocate_memory(layout, alloc_type, reset);
}
- } else if (!_node.can_share_buffer() || impl_params.can_be_optimized() || _node.is_output()) {
- GPU_DEBUG_LOG << "[" << _node.id() << ": output]" << std::endl;
+ } else if (!node.can_share_buffer() || impl_params.can_be_optimized() || node.is_output()) {
+ GPU_DEBUG_LOG << "[" << node.id() << ": output]" << std::endl;
return _engine.allocate_memory(layout, alloc_type, reset);
} else {
return get_memory_from_pool(_engine,
net_id,
pool,
- _node,
+ node,
layout,
alloc_type,
reusable_across_network,
@@ -2498,13 +2492,13 @@ std::vector<memory::ptr> primitive_inst::allocate_outputs(kernel_impl_params* up
auto current_memory_ptr = _outputs.size() > i ? output_memory_ptr(i).get() : nullptr;
auto is_output = is_output_buffer(this, runtime_alloc);
- outputs.push_back(allocate_output(_network.get_engine(),
- _network.get_memory_pool(),
- *_node,
+ outputs.push_back(allocate_output(get_network().get_engine(),
+ get_network().get_memory_pool(),
+ get_node(),
impl_params,
_runtime_memory_dependencies,
get_network_id(),
- _network.is_internal(),
+ get_network().is_internal(),
i,
reset_mem,
is_output,
@@ -2559,7 +2553,7 @@ cldnn::network::ptr primitive_inst::get_unfused_subgraph() {
// Any other primitive types are replaced with input_layout
auto prim_of_fused_node = std::const_pointer_cast<primitive>(_impl_params->desc);
size_t dep_idx = 0;
- for (auto& dep : _node->get_dependencies()) {
+ for (auto& dep : get_node().get_dependencies()) {
cldnn::primitive_id dep_id = dep.first->id();
if (dep.first->is_type<data>()) {
@@ -2579,8 +2573,8 @@ cldnn::network::ptr primitive_inst::get_unfused_subgraph() {
}
// Create the primitive itself
- t.add_primitive(std::const_pointer_cast<primitive>(_node->get_primitive()));
- outer_dep_ids.push_back(_node->id());
+ t.add_primitive(std::const_pointer_cast<primitive>(get_node().get_primitive()));
+ outer_dep_ids.push_back(get_node().id());
// Add primitives for fused-ops
for (auto& fd : _impl_params->fused_desc) {
@@ -2603,17 +2597,17 @@ cldnn::network::ptr primitive_inst::get_unfused_subgraph() {
}) == outer_dep_ids.end()) {
if (fd.has_outer_dep()) {
size_t dep_id = fd.outer_dep_start_idx;
- auto outer_dep_id = _node->get_dependency(dep_id).id();
+ auto outer_dep_id = get_node().get_dependency(dep_id).id();
if (std::find_if(fd.deps.begin(), fd.deps.end(), [&](const std::pair<cldnn::primitive_id, size_t>& dep_info) {
return (dep_info.first == outer_dep_id && dep_info.second == i);
}) == fd.deps.end()) {
- in = _node->id();
+ in = get_node().id();
} else {
in = outer_dep_id;
}
} else {
- in = _node->id();
+ in = get_node().id();
}
}
}
@@ -2627,7 +2621,7 @@ cldnn::network::ptr primitive_inst::get_unfused_subgraph() {
[&](const primitive_id& pid) {
return pid == in.pid;
}) == outer_dep_ids.end()) {
- in = _node->get_dependency(i).id();
+ in = get_node().get_dependency(i).id();
}
}
ExecutionConfig subgraph_config{
@@ -2664,11 +2658,11 @@ bool primitive_inst::is_valid_fusion() const {
if (fd.is_type<reorder>() || fd.is_type<quantize>())
continue;
if (fd.is_type<swiglu>()) {
- OPENVINO_ASSERT(_node->is_type<fully_connected>() && _node->get_preferred_impl_type() == impl_types::ocl);
- if (!_node->get_selected_impl())
+ OPENVINO_ASSERT(get_node().is_type<fully_connected>() && get_node().get_preferred_impl_type() == impl_types::ocl);
+ if (!get_node().get_selected_impl())
return false;
// TODO : support ref kernel too
- if (_node->get_selected_impl()->get_kernel_name().find("fully_connected_gpu_bf_tiled") != std::string::npos)
+ if (get_node().get_selected_impl()->get_kernel_name().find("fully_connected_gpu_bf_tiled") != std::string::npos)
return true;
else
return false;
@@ -2681,26 +2675,26 @@ bool primitive_inst::is_valid_fusion() const {
if (fused_eltwise_prims.empty())
return true;
- if (_node->is_type<fully_connected>() || _node->is_type<gemm>() || _node->is_type<convolution>()) {
+ if (get_node().is_type<fully_connected>() || get_node().is_type<gemm>() || get_node().is_type<convolution>()) {
if (_impl_params->input_layouts[0].count() == 0 ||
_impl_params->input_layouts[1].count() == 0) {
return false;
}
}
- if (_node->is_type<fully_connected>() && _node->get_preferred_impl_type() == impl_types::ocl) {
+ if (get_node().is_type<fully_connected>() && get_node().get_preferred_impl_type() == impl_types::ocl) {
// TODO: Only fc_bf_tiled_kernel & ref kernel are verified for fused eltwise. To support more fc kernels for eltwise fusion
- if (!_node->get_selected_impl())
+ if (!get_node().get_selected_impl())
return false;
- if (!data_type_traits::is_i8_u8(_node->get_input_layout(0).data_type) &&
- (_node->get_selected_impl()->get_kernel_name().find("fully_connected_gpu_bf_tiled") == std::string::npos) &&
- (_node->get_selected_impl()->get_kernel_name().find("fully_connected_gpu_bfyx_ref") == std::string::npos)) {
+ if (!data_type_traits::is_i8_u8(get_node().get_input_layout(0).data_type) &&
+ (get_node().get_selected_impl()->get_kernel_name().find("fully_connected_gpu_bf_tiled") == std::string::npos) &&
+ (get_node().get_selected_impl()->get_kernel_name().find("fully_connected_gpu_bfyx_ref") == std::string::npos)) {
return false;
}
}
const auto& out_pshape = (_unfused_subgraph != nullptr && !get_flag(ExecutionFlags::SHAPE_CHANGED)) ?
- _unfused_subgraph->get_primitive(_node->id())->get_output_layout().get_partial_shape() :
+ _unfused_subgraph->get_primitive(get_node().id())->get_output_layout().get_partial_shape() :
_impl_params->get_output_layout().get_partial_shape();
for (auto& fd : fused_eltwise_prims) {
auto outer_dep_idx = fd.outer_dep_start_idx;
@@ -2723,7 +2717,7 @@ bool primitive_inst::is_valid_fusion() const {
// * Gemm fused op shape: (1,f,y,x) -> OneDNN shape: (1*f,y,x)
// If batch dimension of gemm output is not equal to 1, then OneDNN will not be able to broadcast fused op data
// correctly and we need to do it manually
- if (_node->is_type<gemm>() && _node->get_preferred_impl_type() == impl_types::onednn) {
+ if (get_node().is_type<gemm>() && get_node().get_preferred_impl_type() == impl_types::onednn) {
const auto& gemm_layout = _impl_params->get_output_layout();
const auto& data_layout = outer_dep.first->_impl_params->get_output_layout();
auto gemm_dims = onednn::convert_gemm_tensor(gemm_layout.get_tensor(),
@@ -2749,7 +2743,7 @@ bool primitive_inst::is_valid_fusion() const {
void primitive_inst::add_profiling_data(instrumentation::pipeline_stage stage, bool cache_hit, std::string memalloc_info, int64_t time, bool per_iter_mode) {
instrumentation::perf_counter_key key {
- _network.get_input_layouts(),
+ get_network().get_input_layouts(),
_impl_params->input_layouts,
_impl_params->output_layouts,
get_implementation_name(),
diff --git a/src/plugins/intel_gpu/src/graph/reorder.cpp b/src/plugins/intel_gpu/src/graph/reorder.cpp
index 75a4011eeef..4951abc3f5b 100644
--- a/src/plugins/intel_gpu/src/graph/reorder.cpp
+++ b/src/plugins/intel_gpu/src/graph/reorder.cpp
@@ -287,8 +287,8 @@ void reorder_inst::update_output_memory() {
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
if (requires_reinterpret()) {
diff --git a/src/plugins/intel_gpu/src/graph/reshape.cpp b/src/plugins/intel_gpu/src/graph/reshape.cpp
index 84988b37ee9..669f9e84944 100644
--- a/src/plugins/intel_gpu/src/graph/reshape.cpp
+++ b/src/plugins/intel_gpu/src/graph/reshape.cpp
@@ -336,15 +336,15 @@ void reshape_inst::update_output_memory() {
return;
build_deps(); // reshape need deps
- if (node->get_program().is_new_shape_infer() && input_memory_ptr() == nullptr)
+ if (get_node().get_program().is_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");
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs = {_network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/scatter_elements_update.cpp b/src/plugins/intel_gpu/src/graph/scatter_elements_update.cpp
index a651baa5000..380a065abd0 100644
--- a/src/plugins/intel_gpu/src/graph/scatter_elements_update.cpp
+++ b/src/plugins/intel_gpu/src/graph/scatter_elements_update.cpp
@@ -69,14 +69,13 @@ void scatter_elements_update_inst::update_output_memory() {
&& _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs = {_network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/scatter_nd_update.cpp b/src/plugins/intel_gpu/src/graph/scatter_nd_update.cpp
index fb5baf43e1f..4d0e4c77994 100644
--- a/src/plugins/intel_gpu/src/graph/scatter_nd_update.cpp
+++ b/src/plugins/intel_gpu/src/graph/scatter_nd_update.cpp
@@ -81,14 +81,13 @@ void scatter_nd_update_inst::update_output_memory() {
&& _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs = {_network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/scatter_update.cpp b/src/plugins/intel_gpu/src/graph/scatter_update.cpp
index 94750753379..dc081a80488 100644
--- a/src/plugins/intel_gpu/src/graph/scatter_update.cpp
+++ b/src/plugins/intel_gpu/src/graph/scatter_update.cpp
@@ -66,8 +66,8 @@ void scatter_update_inst::update_output_memory() {
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ _network.get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), _network.get_id());
}
_outputs = {_network.get_engine().reinterpret_buffer(input_memory(), _impl_params->get_output_layout())};
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/src/graph/slice.cpp b/src/plugins/intel_gpu/src/graph/slice.cpp
index 6b247e6eb8d..e95d4f2c259 100644
--- a/src/plugins/intel_gpu/src/graph/slice.cpp
+++ b/src/plugins/intel_gpu/src/graph/slice.cpp
@@ -107,13 +107,13 @@ void slice_inst::update_shape_info_tensor(const kernel_impl_params& params) {
for (auto idx : inputs.GetNeededInputIndexes()) {
GPU_DEBUG_TRACE_DETAIL << id() << " : update shape_info for input[" << idx << "]" << std::endl;
- const auto& node_in_lay = _node->get_input_layout(idx);
+ const auto& node_in_lay = get_node().get_input_layout(idx);
const auto& runtime_in_lay = params.input_layouts[idx];
fill_shape_info_data(runtime_in_lay, node_in_lay, shape_info_ptr, offset);
}
- for (size_t i = 0; i < _node->get_output_layouts().size(); i++) {
+ for (size_t i = 0; i < get_node().get_output_layouts().size(); i++) {
GPU_DEBUG_TRACE_DETAIL << id() << " : update shape_info for output[" << i << "]" << std::endl;
- const auto& node_out_lay = _node->get_output_layout(i);
+ const auto& node_out_lay = get_node().get_output_layout(i);
const auto& runtime_out_lay = params.output_layouts[i];
fill_shape_info_data(runtime_out_lay, node_out_lay, shape_info_ptr, offset);
}
diff --git a/src/plugins/intel_gpu/src/graph/strided_slice.cpp b/src/plugins/intel_gpu/src/graph/strided_slice.cpp
index 6ac0182928d..44b2b7149bc 100644
--- a/src/plugins/intel_gpu/src/graph/strided_slice.cpp
+++ b/src/plugins/intel_gpu/src/graph/strided_slice.cpp
@@ -192,25 +192,25 @@ void strided_slice_inst::on_execute() {
void strided_slice_inst::update_output_memory() {
OPENVINO_ASSERT(!_outputs.empty(), "outputs is empty.");
+ OPENVINO_ASSERT(_node != nullptr, "_node should not be nullptr.");
if (!can_be_optimized())
return;
- if (node->get_program().is_new_shape_infer() && input_memory_ptr() == nullptr)
+ if (get_node().get_program().is_new_shape_infer() && input_memory_ptr() == nullptr)
return;
if (static_cast<bool>(_outputs[0]) && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
- if (_node != nullptr)
- build_deps();
+ build_deps();
GPU_DEBUG_TRACE_DETAIL << id() << " : update_output_memory with mem of input " << get_node().get_dependency(0).id()
<< " : " << input_memory_ptr()->buffer_ptr() << std::endl;
// Can_be_optimized nodes are allocating from memory_pool too. In this case,
// we need release the legacy output memory from memory pool explicitly.
if (static_cast<bool>(_outputs[0]) &&
- _node->get_program().get_config().get_enable_memory_pool()) {
- _network.get_memory_pool().release_memory(_outputs[0].get(), _node->get_unique_id(), _node->id(), _network.get_id());
+ get_node().get_program().get_config().get_enable_memory_pool()) {
+ get_network().get_memory_pool().release_memory(_outputs[0].get(), get_node().get_unique_id(), get_node().id(), get_network_id());
}
_outputs[0] = input_memory_ptr();
_mem_allocated = false;
diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/concatenation_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/concatenation_gpu_test.cpp
index 4f1338205b8..0681ef403c0 100644
--- a/src/plugins/intel_gpu/tests/unit/test_cases/concatenation_gpu_test.cpp
+++ b/src/plugins/intel_gpu/tests/unit/test_cases/concatenation_gpu_test.cpp
@@ -1708,7 +1708,7 @@ public:
auto outputs = concat_network.execute();
bool concat_opt_enabled = config.get_optimize_data();
- bool concat_opt_result = std::static_pointer_cast<concatenation_inst>(concat_network.get_primitive("concat"))->node->can_be_optimized();
+ bool concat_opt_result = std::static_pointer_cast<concatenation_inst>(concat_network.get_primitive("concat"))->get_node().can_be_optimized();
EXPECT_EQ(concat_opt_enabled, concat_opt_result);
return outputs.at("reorder").get_memory();
@@ -1871,7 +1871,7 @@ public:
auto outputs = concat_network.execute();
bool concat_opt_enabled = config.get_optimize_data();
- bool concat_opt_result = std::static_pointer_cast<concatenation_inst>(concat_network.get_primitive("concat"))->node->can_be_optimized();
+ bool concat_opt_result = std::static_pointer_cast<concatenation_inst>(concat_network.get_primitive("concat"))->get_node().can_be_optimized();
// If sibling is using onednn impl and batch > 1, the onednn impl cannot process the implicit concat'ed buffer.
// Onednn impls can process implicit concat'ed buffer only through buffer pointer manipulation.