@@ -203,8 +203,6 @@ network::network(program::ptr program, stream::ptr stream, bool is_internal, boo
203
203
calculate_weights_cache_capacity ();
204
204
allocate_primitives ();
205
205
configure_primitives_second_output ();
206
- if (!_program->is_loaded_from_cache ())
207
- check_names ();
208
206
build_insts_deps ();
209
207
build_exec_order ();
210
208
validate_primitives ();
@@ -333,11 +331,7 @@ void network::reset_execution(bool wait) {
333
331
334
332
event::ptr network::set_input_data (const primitive_id& id, memory::ptr data) {
335
333
GPU_DEBUG_TRACE_DETAIL << " Set input " << id << " " << data->get_layout ().to_short_string () << std::endl;
336
- std::shared_ptr<primitive_inst> primitive_inst;
337
-
338
- primitive_inst = find_primitive (id);
339
-
340
- OPENVINO_ASSERT (primitive_inst != nullptr , " [GPU] topology doesn't contain primitive: " , id);
334
+ auto primitive_inst = find_primitive (id);
341
335
342
336
if (primitive_inst->type () != input_layout::type_id ()) {
343
337
CLDNN_ERROR_MESSAGE (id, " primitive " + id + " is not an input" );
@@ -481,11 +475,8 @@ network::output_chains_map::iterator network::add_output_chain(std::shared_ptr<p
481
475
482
476
std::vector<event::ptr> network::set_output_memory (const primitive_id& id, memory::ptr mem_new) {
483
477
GPU_DEBUG_TRACE_DETAIL << " Set output " << id << " " << mem_new->get_layout ().to_short_string () << std::endl;
484
- std::shared_ptr<primitive_inst> p_inst;
485
478
std::vector<event::ptr> ret_ev;
486
- p_inst = find_primitive (id);
487
-
488
- OPENVINO_ASSERT (p_inst != nullptr , " [GPU] topology doesn't contain primitive: " , id);
479
+ std::shared_ptr<primitive_inst> p_inst = find_primitive (id);
489
480
490
481
auto iter = std::find (_outputs.begin (), _outputs.end (), p_inst);
491
482
if (iter == _outputs.end ())
@@ -513,35 +504,10 @@ std::vector<event::ptr> network::set_output_memory(const primitive_id& id, memor
513
504
return ret_ev;
514
505
}
515
506
516
- void cldnn::network::check_names () {
517
- for (auto const & prim : _primitives) {
518
- if (find_in_internal_networks (prim.first ) != nullptr )
519
- CLDNN_ERROR_MESSAGE (" Network" , " Found primitive with id: " + prim.first + " in anotother network." );
520
- }
521
- }
522
-
523
507
std::shared_ptr<primitive_inst> cldnn::network::find_primitive (const primitive_id& id) const {
524
- if (_primitives.find (id) != _primitives.end ())
525
- return _primitives.at (id);
526
-
527
- return find_in_internal_networks (id);
528
- }
529
-
530
- std::shared_ptr<primitive_inst> cldnn::network::find_in_internal_networks (const primitive_id& id) const {
531
- std::shared_ptr<primitive_inst> ret;
532
-
533
- for (auto const & prim : _primitives) {
534
- if (prim.second ->type () == condition::type_id ()) { // currently only condition inst contains mini networks
535
- auto cond_inst = std::static_pointer_cast<condition_inst>(prim.second );
536
- ret = cond_inst->get_net_true ()->find_primitive (id);
537
- if (ret != nullptr )
538
- return ret;
539
- ret = cond_inst->get_net_false ()->find_primitive (id);
540
- if (ret != nullptr )
541
- return ret;
542
- }
543
- }
544
- return nullptr ;
508
+ auto it = _primitives.find (id);
509
+ OPENVINO_ASSERT (it != _primitives.end (), " [GPU] Network doesn't contain primitive " , id);
510
+ return it->second ;
545
511
}
546
512
547
513
std::string network::get_primitive_info (const primitive_id& id) const {
@@ -552,9 +518,6 @@ std::string network::get_primitive_info(const primitive_id& id) const {
552
518
bool network::does_node_need_lockable_output (const primitive_id& id) const {
553
519
auto prim_inst = find_primitive (id);
554
520
555
- OPENVINO_ASSERT (prim_inst, " [GPU] Can't get implementation type, since topology " ,
556
- " doesn't contain primitive with requested id: " , id);
557
-
558
521
const auto & node = prim_inst->get_node ();
559
522
if (node.is_type <input_layout>()) {
560
523
for (const auto & user : node.get_users ()) {
@@ -574,15 +537,6 @@ std::string network::get_implementation_info(const primitive_id& id) const {
574
537
return _program->get_implementation_info (id);
575
538
}
576
539
577
- layout network::get_node_output_layout (const primitive_id& output_id) const {
578
- auto res = std::find_if (_outputs.begin (), _outputs.end (), [&](const std::shared_ptr<primitive_inst>& v) {
579
- return v->id () == output_id;
580
- });
581
- OPENVINO_ASSERT (res != _outputs.end (), " [GPU] Couldn't get output layout for " , output_id, " . Output with such name is not found in the outputs list" );
582
-
583
- return (*res)->get_node_output_layout ();
584
- }
585
-
586
540
memory::ptr network::get_output_memory (const primitive_id& output_id) {
587
541
return get_primitive (output_id)->output_memory_ptr ();
588
542
}
@@ -729,17 +683,6 @@ void network::add_to_exec_order(const primitive_id& id) {
729
683
}
730
684
731
685
std::map<primitive_id, network_output> network::execute (const std::vector<event::ptr>& dependencies) {
732
- execute_impl (dependencies);
733
-
734
- auto output_ids = get_output_ids ();
735
- std::map<primitive_id, network_output> result;
736
- for (auto & id : output_ids) {
737
- result.emplace (id, get_output (id));
738
- }
739
- return result;
740
- }
741
-
742
- void network::execute_impl (const std::vector<event::ptr>& events) {
743
686
OV_ITT_SCOPED_TASK (ov::intel_gpu::itt::domains::intel_gpu_plugin, " NetworkImpl::Execute" );
744
687
NETWORK_DEBUG (*this );
745
688
@@ -779,6 +722,21 @@ void network::execute_impl(const std::vector<event::ptr>& events) {
779
722
// in some cases.
780
723
auto surf_lock = surfaces_lock::create (get_engine ().type (), in_out_mem, get_stream ());
781
724
725
+ execute_impl (dependencies);
726
+
727
+ std::map<primitive_id, network_output> result;
728
+ for (auto & inst : _outputs) {
729
+ event::ptr ev = nullptr ;
730
+ const auto & id = inst->id ();
731
+ if (get_stream ().get_queue_type () == QueueTypes::out_of_order || _enable_profiling)
732
+ ev = _events.at (id);
733
+
734
+ result.emplace (id, network_output (ev, inst->output_memory_ptr (0 ), get_stream_ptr (), inst->get_output_layout (0 )));
735
+ }
736
+ return result;
737
+ }
738
+
739
+ void network::execute_impl (const std::vector<event::ptr>& events) {
782
740
set_arguments ();
783
741
784
742
// This extra flush command is needed for dynamic models in both cases of out_of_order / in_order operating mode
@@ -904,10 +862,6 @@ const program::graph_optimizer_info& network::get_optimizer_passes_info() const
904
862
}
905
863
906
864
std::map<primitive_id, primitive_id> network::get_ext_id_mapping () const {
907
- if (_program == nullptr ) {
908
- return _ext_id_mapping;
909
- }
910
-
911
865
std::map<primitive_id, primitive_id> result;
912
866
for (auto & prim : _primitives) {
913
867
result.emplace (prim.first , prim.second ->get_node ().get_primitive ()->origin_op_name );
@@ -1008,9 +962,6 @@ void network::allocate_primitive_instance(program_node const& node) {
1008
962
if (node.is_type <data>())
1009
963
_data_outputs.push_back (inst);
1010
964
}
1011
- if (node.is_type <kv_cache>()) {
1012
- kv_cache_ids.push_back (node.id ());
1013
- }
1014
965
if (auto state_prim = std::dynamic_pointer_cast<memory_state::variable>(inst)) {
1015
966
auto prim = inst->get_node ().get_primitive ();
1016
967
set_variables_state_info (state_prim->variable_id (), node.get_output_layout (0 ), state_prim->get_user_specified_type (), prim.get ());
0 commit comments