Skip to content

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

[GPU] Fix network c-tor to avoid config mismatch (#26485)

Vladimir Paramuzov014e13ccdcef
diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
index b33bd37807a..71623f32843 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
@@ -67,7 +67,8 @@ struct network {
public:
using ptr = std::shared_ptr<network>;
- explicit network(program::ptr program, const ExecutionConfig& config, stream::ptr stream, bool is_internal = false, bool is_primary_stream = true);
+ network(program::ptr program, stream::ptr stream, bool is_internal, bool is_primary_stream);
+ network(program::ptr program, bool is_internal, bool is_primary_stream);
network(engine& engine,
const topology& topo,
const ExecutionConfig& config = {},
diff --git a/src/plugins/intel_gpu/src/graph/network.cpp b/src/plugins/intel_gpu/src/graph/network.cpp
index 429cbc32c19..e457ff95433 100644
--- a/src/plugins/intel_gpu/src/graph/network.cpp
+++ b/src/plugins/intel_gpu/src/graph/network.cpp
@@ -373,17 +373,17 @@ static std::string get_file_path_for_binary_dump(cldnn::layout layout, std::stri
Network will always have net_id = 0 when it will be cldnn internal micronetwork (created i.e by propagate_constants
opt pass).
*/
-network::network(program::ptr program, const ExecutionConfig& config, stream::ptr stream, bool is_internal, bool is_primary_stream)
+network::network(program::ptr program, stream::ptr stream, bool is_internal, bool is_primary_stream)
: _program(program)
- , _config(config)
+ , _config(program->get_config())
, _engine(program->get_engine())
, _stream(stream)
, _memory_pool(new memory_pool(program->get_engine()))
, _internal(is_internal)
, _is_primary_stream(is_primary_stream)
- , _enable_profiling(config.get_property(ov::enable_profiling))
+ , _enable_profiling(program->get_config().get_property(ov::enable_profiling))
, _reset_arguments(true)
- , _shape_predictor(new ShapePredictor(&program->get_engine(), config.get_property(ov::intel_gpu::buffers_preallocation_ratio))) {
+ , _shape_predictor(new ShapePredictor(&program->get_engine(), program->get_config().get_property(ov::intel_gpu::buffers_preallocation_ratio))) {
if (!_internal) {
net_id = get_unique_net_id();
}
@@ -413,25 +413,28 @@ network::network(program::ptr program, const ExecutionConfig& config, stream::pt
add_default_output_chains();
}
+network::network(program::ptr program, bool is_internal, bool is_primary_stream)
+ : network(program, program->get_engine().create_stream(program->get_config()), is_internal, is_primary_stream) {}
+
network::network(engine& engine,
const topology& topo,
const ExecutionConfig& config,
bool is_internal,
std::shared_ptr<ov::threading::IStreamsExecutor> task_executor)
- : network(program::build_program(engine, topo, config, task_executor, is_internal), config, engine.create_stream(config), is_internal) {}
+ : network(program::build_program(engine, topo, config, task_executor, is_internal), is_internal, true) {}
network::network(engine& engine,
const std::set<std::shared_ptr<program_node>>& nodes,
const ExecutionConfig& config,
std::shared_ptr<ov::threading::IStreamsExecutor> task_executor,
bool is_internal)
- : network(program::build_program(engine, nodes, config, task_executor, is_internal), config, engine.create_stream(config), is_internal) {}
+ : network(program::build_program(engine, nodes, config, task_executor, is_internal), is_internal, true) {}
network::network(program::ptr program, uint16_t stream_id)
- : network(program, program->get_config(), program->get_engine().create_stream(program->get_config()), false, stream_id == 0) {}
+ : network(program, program->get_engine().create_stream(program->get_config()), false, stream_id == 0) {}
network::network(program::ptr program, stream::ptr stream, uint16_t stream_id)
- : network(program, program->get_config(), stream, false, stream_id == 0) {}
+ : network(program, stream, false, stream_id == 0) {}
network::~network() {
if (_program != nullptr)
@@ -444,12 +447,12 @@ network::~network() {
}
network::ptr network::allocate_network(stream::ptr stream, program::ptr program, bool is_internal, bool is_primary_stream) {
- return std::make_shared<network>(program, program->get_config(), stream, is_internal, is_primary_stream);
+ return std::make_shared<network>(program, stream, is_internal, is_primary_stream);
}
network::ptr network::allocate_network(engine& engine, program::ptr program, bool is_internal, bool is_primary_stream) {
auto stream = engine.create_stream(program->get_config());
- return std::make_shared<network>(program, program->get_config(), stream, is_internal, is_primary_stream);
+ return std::make_shared<network>(program, stream, is_internal, is_primary_stream);
}
network::ptr network::build_network(engine& engine,
diff --git a/src/plugins/intel_gpu/src/graph/program.cpp b/src/plugins/intel_gpu/src/graph/program.cpp
index 4f18facce3e..55b87fea9fe 100644
--- a/src/plugins/intel_gpu/src/graph/program.cpp
+++ b/src/plugins/intel_gpu/src/graph/program.cpp
@@ -153,7 +153,7 @@ program::program(engine& engine_ref,
_compilation_context(compilation_context) {
_config.apply_user_properties(_engine.get_device_info());
init_primitives();
- GPU_DEBUG_INFO << "Program config\n" << config.to_string();
+ GPU_DEBUG_INFO << "Program config\n" << _config.to_string();
init_program();
prepare_nodes(topology);
program_node::reset_unique_id();
@@ -202,8 +202,7 @@ program::program(engine& engine_ref,
build_program(is_internal);
}
-program::program(engine& engine,
- const ExecutionConfig& config)
+program::program(engine& engine, const ExecutionConfig& config)
: _engine(engine),
_stream(_engine.create_stream({})),
_config(config),
@@ -211,6 +210,7 @@ program::program(engine& engine,
init_primitives();
_config.apply_user_properties(_engine.get_device_info());
new_shape_infer = _config.get_property(ov::intel_gpu::allow_new_shape_infer);
+ _layout_optimizer = cldnn::make_unique<layout_optimizer>();
}
program::~program() {