From 4035cfefc2cd3f3c771133c289f608d5a5cecca0 Mon Sep 17 00:00:00 2001 From: Vladimir Paramuzov Date: Wed, 4 Aug 2021 10:17:59 +0300 Subject: [PATCH] [GPU] Refactored network/program/topology classes (#6800) --- .../src/cldnn_engine/cldnn_graph.cpp | 4 +- .../src/cldnn_engine/cldnn_program.cpp | 8 +- .../clDNN/api/cldnn/graph/build_options.hpp | 463 +++++++++++ .../clDNN/api/cldnn/graph/network.hpp | 243 +++--- .../clDNN/api/cldnn/graph/program.hpp | 774 +++++++----------- .../clDNN/api/cldnn/graph/topology.hpp | 63 +- .../api/cldnn/runtime/debug_configuration.hpp | 1 + .../core/kernel_selector_params.h | 2 +- .../clDNN/runtime/debug_configuration.cpp | 2 + .../clDNN/runtime/kernels_cache.cpp | 8 +- .../thirdparty/clDNN/src/activation.cpp | 2 +- .../thirdparty/clDNN/src/arg_max_min.cpp | 2 +- .../clDNN/src/average_unpooling.cpp | 2 +- .../thirdparty/clDNN/src/batch_to_space.cpp | 2 +- .../clDNN/src/binary_convolution.cpp | 2 +- .../thirdparty/clDNN/src/border.cpp | 2 +- .../thirdparty/clDNN/src/broadcast.cpp | 2 +- .../thirdparty/clDNN/src/concatenation.cpp | 2 +- .../thirdparty/clDNN/src/condition.cpp | 6 +- .../thirdparty/clDNN/src/convolution.cpp | 2 +- .../thirdparty/clDNN/src/crop.cpp | 2 +- .../clDNN/src/ctc_greedy_decoder.cpp | 2 +- .../thirdparty/clDNN/src/cum_sum.cpp | 2 +- .../clDNN/src/custom_gpu_primitive.cpp | 2 +- .../thirdparty/clDNN/src/data.cpp | 6 +- .../thirdparty/clDNN/src/deconvolution.cpp | 2 +- .../clDNN/src/deformable_convolution.cpp | 4 +- .../thirdparty/clDNN/src/depth_to_space.cpp | 2 +- .../thirdparty/clDNN/src/detection_output.cpp | 3 +- .../thirdparty/clDNN/src/eltwise.cpp | 2 +- .../thirdparty/clDNN/src/embedding_bag.cpp | 2 +- .../clDNN/src/extract_image_patches.cpp | 2 +- .../thirdparty/clDNN/src/fully_connected.cpp | 2 +- .../clDNN/src/fused_conv_eltwise.cpp | 2 +- .../thirdparty/clDNN/src/gather.cpp | 2 +- .../thirdparty/clDNN/src/gather_elements.cpp | 2 +- .../thirdparty/clDNN/src/gather_nd.cpp | 2 +- .../thirdparty/clDNN/src/gather_tree.cpp | 2 +- .../thirdparty/clDNN/src/gemm.cpp | 2 +- .../thirdparty/clDNN/src/generic_layer.cpp | 4 +- .../graph_optimizer/add_required_reorders.cpp | 6 +- .../basic_memory_dependencies.cpp | 4 +- .../graph_optimizer/calculate_prior_boxes.cpp | 4 +- .../src/graph_optimizer/compile_graph.cpp | 2 +- .../graph_optimizer/concat_input_order.cpp | 4 +- .../graph_optimizer/eltwise_remove_stride.cpp | 4 +- .../src/graph_optimizer/eltwise_shrinking.cpp | 2 +- .../graph_optimizer/graph_initializations.cpp | 10 +- .../graph_optimizer/handle_input_padding.cpp | 2 +- .../src/graph_optimizer/handle_reshape.cpp | 2 +- .../clDNN/src/graph_optimizer/mark_nodes.cpp | 4 +- .../oooq_memory_dependencies.cpp | 4 +- .../graph_optimizer/post_input_reorder.cpp | 6 +- .../graph_optimizer/post_optimize_weights.cpp | 4 +- .../src/graph_optimizer/pre_optimize_bias.cpp | 14 +- .../graph_optimizer/pre_replace_deconv.cpp | 2 +- .../graph_optimizer/prepare_buffer_fusing.cpp | 2 +- .../src/graph_optimizer/prepare_padding.cpp | 2 +- .../prepare_primitive_fusing.cpp | 24 +- .../graph_optimizer/prepare_quantization.cpp | 16 +- .../graph_optimizer/propagate_constants.cpp | 16 +- .../remove_redundant_reorders.cpp | 2 +- .../src/graph_optimizer/reorder_inputs.cpp | 18 +- .../reverse_optional_nodes_outputs.cpp | 2 +- .../skipped_branch_memory_dependencies.cpp | 4 +- .../strided_slice_optimize.cpp | 2 +- .../src/graph_optimizer/trim_to_outputs.cpp | 4 +- .../update_loop_primitive_map.cpp | 2 +- inference-engine/thirdparty/clDNN/src/grn.cpp | 2 +- .../clDNN/src/impls/common/condition.cpp | 3 +- .../clDNN/src/impls/common/loop.cpp | 1 - .../src/impls/common/wait_for_events.cpp | 1 - .../clDNN/src/impls/cpu/detection_output.cpp | 1 - .../src/impls/cpu/non_max_suppression.cpp | 2 +- .../clDNN/src/impls/cpu/proposal.cpp | 1 - .../clDNN/src/impls/ocl/custom_primitive.cpp | 1 - .../clDNN/src/impls/ocl/fully_connected.cpp | 1 - .../clDNN/src/impls/ocl/generic_layer.cpp | 1 - .../src/impls/ocl/lstm_dynamic_input.cpp | 1 - .../src/impls/ocl/lstm_dynamic_timeloop.cpp | 1 - .../clDNN/src/impls/ocl/lstm_elt.cpp | 1 - .../clDNN/src/impls/ocl/lstm_gemm.cpp | 1 - .../clDNN/src/impls/ocl/max_unpooling.cpp | 2 +- .../clDNN/src/impls/ocl/primitive_base.hpp | 4 +- .../clDNN/src/impls/ocl/pyramid_roi_align.cpp | 1 - .../clDNN/src/include/activation_inst.h | 4 +- .../clDNN/src/include/arg_max_min_inst.h | 4 +- .../src/include/average_unpooling_inst.h | 2 +- .../clDNN/src/include/batch_to_space_inst.h | 2 +- .../src/include/binary_convolution_inst.h | 4 +- .../clDNN/src/include/border_inst.h | 4 +- .../clDNN/src/include/broadcast_inst.h | 4 +- .../clDNN/src/include/concatenation_inst.h | 4 +- .../clDNN/src/include/condition_inst.h | 39 +- .../clDNN/src/include/convolution_inst.h | 4 +- .../thirdparty/clDNN/src/include/crop_inst.h | 4 +- .../src/include/ctc_greedy_decoder_inst.h | 2 +- .../clDNN/src/include/cum_sum_inst.h | 2 +- .../src/include/custom_gpu_primitive_inst.h | 2 +- .../thirdparty/clDNN/src/include/data_inst.h | 4 +- .../clDNN/src/include/deconvolution_inst.h | 4 +- .../src/include/deformable_convolution_inst.h | 8 +- .../clDNN/src/include/depth_to_space_inst.h | 2 +- .../clDNN/src/include/detection_output_inst.h | 3 +- .../clDNN/src/include/eltwise_inst.h | 5 +- .../clDNN/src/include/embedding_bag_inst.h | 2 +- .../src/include/extract_image_patches_inst.h | 2 +- .../clDNN/src/include/fully_connected_inst.h | 4 +- .../src/include/fused_conv_eltwise_inst.h | 4 +- .../clDNN/src/include/gather_elements_inst.h | 2 +- .../clDNN/src/include/gather_inst.h | 2 +- .../clDNN/src/include/gather_nd_inst.h | 2 +- .../clDNN/src/include/gather_tree_inst.h | 4 +- .../thirdparty/clDNN/src/include/gemm_inst.h | 2 +- .../clDNN/src/include/generic_layer_inst.h | 4 +- .../thirdparty/clDNN/src/include/grn_inst.h | 2 +- .../clDNN/src/include/input_layout_inst.h | 4 +- .../src/include/kernel_selector_helper.h | 8 +- .../thirdparty/clDNN/src/include/loop_inst.h | 31 +- .../thirdparty/clDNN/src/include/lrn_inst.h | 2 +- .../src/include/lstm_dynamic_input_inst.h | 4 +- .../clDNN/src/include/lstm_dynamic_inst.h | 4 +- .../src/include/lstm_dynamic_timeloop_inst.h | 4 +- .../clDNN/src/include/lstm_elt_inst.h | 2 +- .../clDNN/src/include/lstm_gemm_inst.h | 2 +- .../thirdparty/clDNN/src/include/lstm_inst.h | 2 +- .../clDNN/src/include/max_unpooling_inst.h | 4 +- .../clDNN/src/include/mutable_data_inst.h | 4 +- .../thirdparty/clDNN/src/include/mvn_inst.h | 2 +- .../clDNN/src/include/network_impl.h | 138 ---- .../src/include/non_max_suppression_inst.h | 4 +- .../clDNN/src/include/normalize_inst.h | 2 +- .../clDNN/src/include/one_hot_inst.h | 4 +- .../clDNN/src/include/pass_manager.h | 130 +-- .../clDNN/src/include/permute_inst.h | 4 +- .../clDNN/src/include/pooling_inst.h | 2 +- .../clDNN/src/include/primitive_inst.h | 14 +- .../clDNN/src/include/primitive_type.h | 8 +- .../clDNN/src/include/primitive_type_base.h | 6 +- .../clDNN/src/include/prior_box_inst.h | 4 +- .../clDNN/src/include/program_dump_graph.h | 10 +- .../clDNN/src/include/program_helpers.h | 28 +- .../clDNN/src/include/program_impl.h | 339 -------- .../clDNN/src/include/program_node.h | 14 +- .../clDNN/src/include/proposal_inst.h | 2 +- .../src/include/pyramid_roi_align_inst.h | 4 +- .../clDNN/src/include/quantize_inst.h | 2 +- .../clDNN/src/include/reduce_inst.h | 2 +- .../clDNN/src/include/region_yolo_inst.h | 2 +- .../clDNN/src/include/reorder_inst.h | 4 +- .../clDNN/src/include/reorg_yolo_inst.h | 2 +- .../clDNN/src/include/resample_inst.h | 5 +- .../clDNN/src/include/reshape_inst.h | 4 +- .../clDNN/src/include/reverse_sequence_inst.h | 2 +- .../thirdparty/clDNN/src/include/scale_inst.h | 4 +- .../include/scatter_elements_update_inst.h | 2 +- .../src/include/scatter_nd_update_inst.h | 2 +- .../clDNN/src/include/scatter_update_inst.h | 2 +- .../clDNN/src/include/select_inst.h | 2 +- .../clDNN/src/include/shuffle_channels_inst.h | 2 +- .../clDNN/src/include/softmax_inst.h | 2 +- .../clDNN/src/include/space_to_batch_inst.h | 2 +- .../clDNN/src/include/space_to_depth_inst.h | 2 +- .../thirdparty/clDNN/src/include/split_inst.h | 2 +- .../clDNN/src/include/strided_slice_inst.h | 2 +- .../thirdparty/clDNN/src/include/tile_inst.h | 2 +- .../clDNN/src/include/topology_impl.h | 66 -- .../thirdparty/clDNN/src/input_layout.cpp | 4 +- .../clDNN/src/kernel_selector_helper.cpp | 7 +- .../thirdparty/clDNN/src/layout_optimizer.cpp | 2 - .../thirdparty/clDNN/src/loop.cpp | 8 +- inference-engine/thirdparty/clDNN/src/lrn.cpp | 2 +- .../thirdparty/clDNN/src/lstm.cpp | 2 +- .../thirdparty/clDNN/src/lstm_dynamic.cpp | 2 +- .../clDNN/src/lstm_dynamic_input.cpp | 2 +- .../clDNN/src/lstm_dynamic_timeloop.cpp | 2 +- .../thirdparty/clDNN/src/lstm_elt.cpp | 2 +- .../thirdparty/clDNN/src/lstm_gemm.cpp | 2 +- .../thirdparty/clDNN/src/max_unpooling.cpp | 4 +- .../thirdparty/clDNN/src/mutable_data.cpp | 6 +- inference-engine/thirdparty/clDNN/src/mvn.cpp | 2 +- .../thirdparty/clDNN/src/network.cpp | 218 ++--- .../thirdparty/clDNN/src/nodes_ordering.cpp | 10 +- .../thirdparty/clDNN/src/normalize.cpp | 2 +- .../thirdparty/clDNN/src/one_hot.cpp | 2 +- .../thirdparty/clDNN/src/pass_manager.cpp | 6 +- .../thirdparty/clDNN/src/permute.cpp | 2 +- .../thirdparty/clDNN/src/primitive_inst.cpp | 4 +- .../thirdparty/clDNN/src/prior_box.cpp | 4 +- .../thirdparty/clDNN/src/program.cpp | 183 +++-- .../clDNN/src/program_dump_graph.cpp | 8 +- .../thirdparty/clDNN/src/program_helpers.cpp | 2 +- .../thirdparty/clDNN/src/program_node.cpp | 4 +- .../thirdparty/clDNN/src/proposal.cpp | 2 +- .../clDNN/src/pyramid_roi_align.cpp | 2 +- .../thirdparty/clDNN/src/quantize.cpp | 2 +- .../thirdparty/clDNN/src/reduce.cpp | 2 +- .../thirdparty/clDNN/src/region_yolo.cpp | 2 +- .../thirdparty/clDNN/src/reorder.cpp | 2 +- .../thirdparty/clDNN/src/reorg_yolo.cpp | 2 +- .../thirdparty/clDNN/src/resample.cpp | 2 +- .../thirdparty/clDNN/src/reshape.cpp | 2 +- .../thirdparty/clDNN/src/reverse_sequence.cpp | 2 +- .../thirdparty/clDNN/src/scale.cpp | 2 +- .../clDNN/src/scatter_elements_update.cpp | 2 +- .../clDNN/src/scatter_nd_update.cpp | 2 +- .../thirdparty/clDNN/src/scatter_update.cpp | 2 +- .../thirdparty/clDNN/src/select.cpp | 2 +- .../thirdparty/clDNN/src/shuffle_channels.cpp | 2 +- .../thirdparty/clDNN/src/softmax.cpp | 2 +- .../thirdparty/clDNN/src/space_to_batch.cpp | 2 +- .../thirdparty/clDNN/src/space_to_depth.cpp | 2 +- .../thirdparty/clDNN/src/split.cpp | 2 +- .../thirdparty/clDNN/src/strided_slice.cpp | 2 +- .../thirdparty/clDNN/src/tile.cpp | 2 +- .../thirdparty/clDNN/src/topology.cpp | 42 +- .../graph_manipulation_gpu_test.cpp | 46 +- .../module_tests/prepare_conv_eltw_fusing.cpp | 25 +- ...ogram_impl_wrapper.h => program_wrapper.h} | 26 +- .../module_tests/reorder_inputs_test.cpp | 18 +- .../tests/module_tests/usm_memory_test.cpp | 8 +- .../test_cases/activation_simple_gpu_test.cpp | 2 +- .../clDNN/tests/test_cases/cache_test.cpp | 2 +- .../tests/test_cases/convolution_gpu_test.cpp | 8 +- .../clDNN/tests/test_cases/crop_gpu_test.cpp | 6 +- .../test_cases/deconvolution_gpu_test.cpp | 2 +- .../test_cases/depth_concatenate_gpu_test.cpp | 4 +- .../tests/test_cases/eltwise_gpu_test.cpp | 6 +- .../test_cases/non_max_suppression_test.cpp | 10 +- .../tests/test_cases/pooling_gpu_test.cpp | 2 +- .../test_cases/pyramid_roi_align_gpu_test.cpp | 2 +- .../tests/test_cases/resample_gpu_test.cpp | 6 +- .../clDNN/tests/test_cases/streams_test.cpp | 4 +- .../clDNN/tests/test_cases/topology_test.cpp | 2 +- .../clDNN/tests/test_utils/network_test.h | 10 +- 235 files changed, 1638 insertions(+), 2001 deletions(-) create mode 100644 inference-engine/thirdparty/clDNN/api/cldnn/graph/build_options.hpp delete mode 100644 inference-engine/thirdparty/clDNN/src/include/network_impl.h delete mode 100644 inference-engine/thirdparty/clDNN/src/include/program_impl.h delete mode 100644 inference-engine/thirdparty/clDNN/src/include/topology_impl.h rename inference-engine/thirdparty/clDNN/tests/module_tests/{program_impl_wrapper.h => program_wrapper.h} (51%) diff --git a/inference-engine/src/cldnn_engine/cldnn_graph.cpp b/inference-engine/src/cldnn_engine/cldnn_graph.cpp index 2b333a38ee9d20..53cefa30cf76e0 100644 --- a/inference-engine/src/cldnn_engine/cldnn_graph.cpp +++ b/inference-engine/src/cldnn_engine/cldnn_graph.cpp @@ -88,11 +88,11 @@ void CLDNNGraph::Build() { std::shared_ptr CLDNNGraph::BuildNetwork(std::shared_ptr program) { OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "CLDNNGraph::BuildNetwork"); - auto network = std::make_shared(*program, m_stream_id); + auto network = std::make_shared(program, m_stream_id); if (!m_config.graph_dumps_dir.empty() && m_stream_id == 0) { static int net_id = 0; - auto steps_info = network->get_optimization_steps_info(); + auto steps_info = network->get_optimizer_passes_info(); size_t step_idx = 0; for (auto& step : steps_info) { CNNNetwork net(GetExecGraphInfoByPrimitivesInfo(step.second, true)); diff --git a/inference-engine/src/cldnn_engine/cldnn_program.cpp b/inference-engine/src/cldnn_engine/cldnn_program.cpp index 275aeca31ca789..7386501f0b1671 100644 --- a/inference-engine/src/cldnn_engine/cldnn_program.cpp +++ b/inference-engine/src/cldnn_engine/cldnn_program.cpp @@ -6,7 +6,6 @@ #include "ngraph/ops.hpp" #include "ngraph_ops/nms_ie_internal.hpp" #include "cldnn_itt.h" -#include "cldnn/runtime/debug_configuration.hpp" using namespace InferenceEngine; using namespace InferenceEngine::details; @@ -178,16 +177,11 @@ std::shared_ptr Program::BuildProgram(const std::vectordump_graphs.empty()) { - options.set_option(cldnn::build_option::graph_dumps_dir(debug_config->dump_graphs)); - } - options.set_option(cldnn::build_option::optimize_data(true)); options.set_option(cldnn::build_option::tuning_config(m_config.tuningConfig)); @@ -199,7 +193,7 @@ std::shared_ptr Program::BuildProgram(const std::vector(*m_engine, *m_topology, options); + auto program = cldnn::program::build_program(*m_engine, *m_topology, options); CleanupBuild(); return program; diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/build_options.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/build_options.hpp new file mode 100644 index 00000000000000..5ddcac49534f02 --- /dev/null +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/build_options.hpp @@ -0,0 +1,463 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "cldnn/runtime/engine.hpp" +#include "cldnn/primitives/implementation_desc.hpp" + +#include "topology.hpp" + +#include +#include +#include +#include +#include + +namespace cldnn { + +/// @addtogroup cpp_api C++ API +/// @{ + +/// @defgroup cpp_program Program compilation +/// @{ + +/// @brief Represents user-provided program build option type. +enum class build_option_type { + /// @brief Allow primitives fusing during program build (default: false). + fusing, + + /// @brief Enable implicit reordering for user inputs (default: false). + optimize_data, + + /// @brief Enable implicit static input reordering for user inputs (default: false). + allow_static_input_reorder, + + /// @brief Enable debug mode (default: false). + /// @details This option enforce all program primitives to be accessible as outputs. + debug, + + /// @brief User selected list of program outputs. + outputs, + + /// @brief User defined learning parameters. + learning_config, + + /// @brief Tuning config (default: Tuning is disabled). + /// @details The tuner will automatically find the optimal kernel/config for each node in the graph, + /// by running multiple implementations and configurations per node and storing the optimal one in cache. + /// Expect long execution time in the first run. + /// After the first run a cache with the tuning results will be created in the path provided. + /// This cache will be used in the next runs. + tuning_config, + + /// @brief Specifies a directory to which stages of network compilation should be dumped. (default: empty, i.e. no dumping) + graph_dumps_dir, + /// @brief Specifies a directory to which compiled kernels should be cached or can be loaded from. (default: empty, i.e. no caching) + kernels_cache_dir, + /// @brief Name for serialization process + serialize_network, + load_program, + force_implementations +}; + +/// @brief Tuning mode. +enum class tuning_mode { + /// @brief Tuning is disabled. + tuning_disabled, + + /// @brief Tuning using the cached data (no on-line tuning for non-existing data). + tuning_use_cache, + + /// @brief Tuning using the cached data if exist, tune and update cache otherwise. + tuning_tune_and_cache, + + /// @brief Tuning using the cached data and update tasks. + /// @details Performs updating tasks like removal of invalid caches, promoting to new format, etc. + /// No tuning for non-existing data. + tuning_use_and_update, + + /// @brief Retune the cache data even if it exists. + tuning_retune_and_cache +}; + +/// @brief Tuning configuration. +struct tuning_config_options { + tuning_mode mode; + std::string cache_file_path; + + tuning_config_options() : mode(tuning_mode::tuning_disabled), cache_file_path("") {} +}; + +/// @brief Learning parameters. +struct learning_params { + float momentum = 0.0; + float weights_decay = 0.0; + + learning_params() : momentum(0.9f), weights_decay(0.0005f) {} +}; + +/// @brief Represents user-provided program build option. +struct build_option { + /// @brief Allow primitives fusing during program build (default: false). + static std::shared_ptr fusing(bool enable = false); + + /// @brief Enable implicit reordering for user inputs (default: false). + static std::shared_ptr optimize_data(bool enable = false); + + /// @brief Enable implicit reordering for static user inputs (default: false). + static std::shared_ptr allow_static_input_reorder(bool enable = false); + + /// @brief Enable debug mode (default: false). + /// @details This option enforce all program primitives to be accessible as outputs. + static std::shared_ptr debug(bool enable = false); + + /// @brief User selected list of program outputs. + static std::shared_ptr outputs(const std::vector& outs); + + /// @brief Tuning configuration (default: false). + /// @details This option will automatically find the optimal kernel/config for each node in the graph, + /// by running multiple implementations and configurations per node and storing the optimal one in cache. + /// Expect long execution time in the first run (unless the cache only mode is enabled). + /// After the first run a cache with the tuning results will be created in the path provided. + /// This cache will be used in the next runs. + static std::shared_ptr tuning_config( + const tuning_config_options& config = tuning_config_options()); + + /// @brief Specifies a directory to which stages of network compilation should be dumped (default: empty, i.e. no dumping) + static std::shared_ptr graph_dumps_dir(const std::string& dir_path); + + /// @brief Specifies a directory to which compiled kernels should be cached or can be loaded from. (default: empty, i.e. no caching) + static std::shared_ptr kernels_cache_dir(const std::string& dir_path); + + /// @brief Specifies a name for serialization process. + static std::shared_ptr serialize_network(const std::string& network_name); + /// @brief Specifies a name of load_program process. + static std::shared_ptr load_program(const std::string& network_name); + + /// @brief User defined learning parameters. + static std::shared_ptr learning_config(const learning_params& params = learning_params()); + /// @brief Specifies user defined implementation details to use. + static std::shared_ptr force_implementations(implementation_forcing_map forcing); + + virtual ~build_option() = default; + +private: + /// @brief Returns option type represented by this object. + virtual build_option_type get_type() const = 0; + + friend class build_options; +}; + +/// @brief @ref build_option specialization for boolean options. +template +struct build_option_bool : build_option { + /// @brief Constructs option. + /// @param value Is option enabled. + explicit build_option_bool(bool value) : _value(value ? 1 : 0) {} + + /// @brief Is option enabled. + bool enabled() const { return _value != 0; } + +private: + build_option_type get_type() const override { return OptType; } + uintptr_t _value; +}; + +/// @brief @ref build_option specialization for program outputs list. +struct build_option_outputs : build_option { + /// @brief The list of output ids (names) + const std::vector outputs; + + /// @brief Constructs option. + /// @param outs List of ouput ids (names) + explicit build_option_outputs(const std::vector& outs) + : outputs(outs) {} + +private: + /// @brief Returns build_option_type::outputs. + build_option_type get_type() const override { return build_option_type::outputs; } + + build_option_outputs(const build_option_outputs& other) = delete; + build_option_outputs& operator=(const build_option_outputs& other) = delete; +}; + +/// @brief @ref build_option specialization for learning config. +struct build_option_learning_config : build_option { + /// @brief Learning parameters. + const learning_params params; + + /// @brief Constructs learning config build option. + /// @param learning_params Parameters for learning. + explicit build_option_learning_config(const learning_params& params) + : params(params) {} + +private: + /// @brief Returns build_option_type::learning_config. + build_option_type get_type() const override { return build_option_type::learning_config; } + + build_option_learning_config(const build_option_learning_config& other) = delete; + build_option_learning_config& operator=(const build_option_learning_config& other) = delete; +}; + +/// @brief @ref build_option specialization for tuning config. +struct build_option_tuning_config : build_option { + /// @brief Tuning configuration + const tuning_config_options config; + + /// @brief Constructs tuning config build option. + /// @param tuning_config Configuration for the tuning. + explicit build_option_tuning_config(const tuning_config_options& tuning_config) + : config(tuning_config) {} + +private: + /// @brief Returns build_option_type::tuning_config. + build_option_type get_type() const override { return build_option_type::tuning_config; } + + build_option_tuning_config(const build_option_tuning_config& other) = delete; + build_option_tuning_config& operator=(const build_option_tuning_config& other) = delete; +}; + +/// @brief @ref build_option specialization for selecting a directory. +template +struct build_option_directory : build_option { + const std::string directory_path; + + /// @brief Constructs option. + /// @param outs List of ouput ids (names) + explicit build_option_directory(const std::string& dir_path) : directory_path(dir_path) {} + +private: + /// @brief Returns build_option_type::graph_dumps_dir. + build_option_type get_type() const override { return build_option_type::graph_dumps_dir; } + + build_option_directory(const build_option_directory& other) = delete; + build_option_directory& operator=(const build_option_directory& other) = delete; +}; + +/// @brief @ref build_option specialization for selecting a directory. +template +struct build_option_kernels_cache_dir : build_option { + const std::string directory_path; + + explicit build_option_kernels_cache_dir(const std::string& dir_path) : directory_path(dir_path) {} + +private: + /// @brief Returns build_option_type::kernels_cache_dir. + build_option_type get_type() const override { return build_option_type::kernels_cache_dir; } + + build_option_kernels_cache_dir(const build_option_kernels_cache_dir& other) = delete; + build_option_kernels_cache_dir& operator=(const build_option_kernels_cache_dir& other) = delete; +}; + +/// @brief @ref build_option specialization for serialization process. +template +struct build_option_serialization : build_option { + const std::string serialization_network_name; + + explicit build_option_serialization(const std::string& name) : serialization_network_name(name) {} + +private: + build_option_type get_type() const override { return build_option_type::serialize_network; } + + build_option_serialization(const build_option_serialization& other) = delete; + build_option_serialization& operator=(const build_option_serialization& other) = delete; +}; + +/// @brief @ref build_option specialization for load_program process. +template +struct build_option_load_program : build_option { + const std::string load_program_name; + + explicit build_option_load_program(const std::string& name) : load_program_name(name) {} + +private: + build_option_type get_type() const override { return build_option_type::load_program; } + + build_option_load_program(const build_option_load_program& other) = delete; + build_option_load_program& operator=(const build_option_load_program& other) = delete; +}; + +struct build_option_force_implementations : build_option { + implementation_forcing_map forcing; + + explicit build_option_force_implementations(implementation_forcing_map _forcing) : forcing(std::move(_forcing)) {} +private: + build_option_type get_type() const override { return build_option_type::force_implementations; } + + build_option_force_implementations(const build_option_force_implementations& other) = delete; + build_option_force_implementations& operator=(const build_option_force_implementations& other) = delete; +}; + +namespace detail { +/// @brief Helper template to convert @ref build_option_type value to particular @ref build_option class. +template +struct build_option_traits { + /// @brief @ref build_option object type which represents the particular @p OptType. + typedef build_option object_type; + /// @brief Make default @ref build_option corresponding @p OptType + static std::shared_ptr make_default(); +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +struct build_option_traits { + typedef build_option_bool object_type; + static std::shared_ptr make_default() { return build_option::fusing(); } +}; +template <> +struct build_option_traits { + typedef build_option_bool object_type; + static std::shared_ptr make_default() { return build_option::optimize_data(); } +}; +template <> +struct build_option_traits { + typedef build_option_bool object_type; + static std::shared_ptr make_default() { return build_option::allow_static_input_reorder(); } +}; +template <> +struct build_option_traits { + typedef build_option_bool object_type; + static std::shared_ptr make_default() { return build_option::debug(); } +}; +template <> +struct build_option_traits { + typedef build_option_outputs object_type; + static std::shared_ptr make_default() { return build_option::outputs({}); } +}; +template <> +struct build_option_traits { + typedef build_option_learning_config object_type; + static std::shared_ptr make_default() { return build_option::learning_config(); } +}; +template <> +struct build_option_traits { + typedef build_option_tuning_config object_type; + static std::shared_ptr make_default() { return build_option::tuning_config(); } +}; +template <> +struct build_option_traits { + typedef build_option_directory object_type; + static std::shared_ptr make_default() { return build_option::graph_dumps_dir({}); } +}; +template <> +struct build_option_traits { + typedef build_option_directory object_type; + static std::shared_ptr make_default() { return build_option::kernels_cache_dir({}); } +}; +template <> +struct build_option_traits { + typedef build_option_serialization object_type; + static std::shared_ptr make_default() { return build_option::serialize_network({}); } +}; +template <> +struct build_option_traits { + typedef build_option_load_program object_type; + static std::shared_ptr make_default() { return build_option::load_program({}); } +}; +template <> +struct build_option_traits { + using object_type = build_option_force_implementations; + static std::shared_ptr make_default() { return build_option::force_implementations({}); } +}; + +#endif +} // namespace detail + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +inline std::shared_ptr build_option::fusing(bool enable) { + return std::make_shared>(enable); +} + +inline std::shared_ptr build_option::optimize_data(bool enable) { + return std::make_shared>(enable); +} + +inline std::shared_ptr build_option::allow_static_input_reorder(bool enable) { + return std::make_shared>(enable); +} + +inline std::shared_ptr build_option::debug(bool enable) { + return std::make_shared>(enable); +} + +inline std::shared_ptr build_option::outputs(const std::vector& outs) { + return std::make_shared(outs); +} + +inline std::shared_ptr build_option::learning_config(const learning_params& params) { + return std::make_shared(params); +} + +inline std::shared_ptr build_option::tuning_config(const tuning_config_options& config) { + return std::make_shared(config); +} + +inline std::shared_ptr build_option::graph_dumps_dir(const std::string& dir_path) { + return std::make_shared>(dir_path); +} + +inline std::shared_ptr build_option::kernels_cache_dir(const std::string& dir_path) { + return std::make_shared>(dir_path); +} +inline std::shared_ptr build_option::serialize_network(const std::string& name) { + return std::make_shared>(name); +} +inline std::shared_ptr build_option::load_program(const std::string& name) { + return std::make_shared>(name); +} +inline std::shared_ptr build_option::force_implementations(implementation_forcing_map forcing) { + return std::make_shared(std::move(forcing)); +} +#endif + +/// @brief Represents program build options list. +class build_options { +public: + /// @brief Adds or replace option to the options list + void set_option(std::shared_ptr opt) { add_or_replace_option(opt); } + + /// @brief Adds or replace options to the options list + template + void set_option(std::shared_ptr opt, Args... args) { + add_or_replace_option(opt); + set_option(args...); + } + + /// @brief Constructs build options list from its arguments. + template + explicit build_options(Args... args) { + set_option(args...); + } + + /// @brief Returns program build option for @p OptType + template + std::shared_ptr::object_type> get() const { + using T = typename detail::build_option_traits::object_type; + for (auto& option : _options) { + if (option->get_type() == OptType) + return std::static_pointer_cast(option); + } + return std::static_pointer_cast(detail::build_option_traits::make_default()); + } + +private: + friend struct program; + std::vector> _options; + void set_option(void) {} + + void add_or_replace_option(std::shared_ptr opt) { + for (auto& p : _options) { + if (p->get_type() == opt->get_type()) { + p = opt; + return; + } + } + _options.push_back(opt); + } +}; + +/// @} +/// @} +} // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp index 61134cacc2faa5..7ac6b11e9db6e3 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp @@ -2,31 +2,26 @@ // SPDX-License-Identifier: Apache-2.0 // -/////////////////////////////////////////////////////////////////////////////////////////////////// - #pragma once +#include "cldnn/graph/topology.hpp" +#include "cldnn/graph/program.hpp" #include "cldnn/runtime/compounds.hpp" #include "cldnn/runtime/memory.hpp" +#include "cldnn/runtime/engine.hpp" #include "cldnn/runtime/event.hpp" #include "cldnn/runtime/stream.hpp" -#include "program.hpp" -#include -#include #include #include -#include +#include #include +#include +#include +#include namespace cldnn { -/// @addtogroup cpp_api C++ API -/// @{ - -/// @defgroup cpp_network Network Execution -/// @{ - /// @brief Represents network output returned by @ref network::get_output(). struct network_output { /// @brief Returns @ref event associated with the output. @@ -52,101 +47,76 @@ struct network_output { friend struct network; }; -struct network_impl; +class primitive_inst; -/// @brief Executable network allocated from @ref program. struct network { - /// @brief Allocate network - /// @param program The program object which contains compiled primitives this network should allocate memory for. - /// @param stream_id Stream ID of this network. 0 is for primary stream, the others are secondary. - /// Used to determine whether an extra copy of primitive's memory needed. - explicit network(program const& program, uint16_t stream_id); - - /// @brief Constructs network object from implicitly created program object. This is a shorthand for network(program(engine, topology, options)) - /// @param engine - /// @param topology - /// @param options - /// @param options +public: + using ptr = std::shared_ptr; + explicit network(program::ptr program, stream::ptr stream, bool is_internal = false, bool is_primary_stream = true); network(engine& engine, - const topology& topology, + const topology& topo, const build_options& options = build_options(), - uint16_t stream_id = 0) - : network(program(engine, topology, options), stream_id) {} - - /// @brief Constructs network object from C API @ref cldnn_network. - explicit network(std::shared_ptr impl) : _impl(impl) { - if (_impl == nullptr) - throw std::invalid_argument("implementation pointer should not be null"); + bool is_internal = false); + network(engine& engine, + const std::set>& nodes, + const build_options& options, + bool is_internal); + + network(program::ptr program, + uint16_t stream_id = 0); + + ~network(); + + + static ptr build_network(engine& engine, + const topology& topology, + const build_options& options = build_options(), + bool is_internal = false); + static ptr build_network(engine& engine, + const std::set>& nodes, + const build_options& options, + bool is_internal); + + static ptr allocate_network(stream::ptr stream, + program::ptr program, + bool is_internal = false, + bool is_primary_stream = false); + + static ptr allocate_network(engine& engine, + program::ptr program, + bool is_internal = false, + bool is_primary_stream = false); + program::cptr get_program() const { return _program; } + program::ptr get_program() { return _program; } + engine& get_engine() const { return _program->get_engine(); } + + void reset_execution(bool wait = true); + void set_input_data(const primitive_id& id, memory::ptr data); + void set_output_memory(const primitive_id& id, memory::ptr mem); + + std::vector> const& get_outputs() { return _outputs; } + + const std::vector>& get_outputs() const { + return reinterpret_cast>&>(_outputs); } - /// @brief Copy construction. - network(const network& other) : _impl(other._impl) { } - - /// @brief Copy assignment. - network& operator=(const network& other) { - if (_impl == other._impl) - return *this; - _impl = other._impl; - return *this; + network_output get_output(const primitive_id& output_id) { + return network_output(get_primitive_event(output_id), get_output_memory(output_id), get_stream_ptr()); } - friend bool operator==(const network& lhs, const network& rhs) { return lhs._impl == rhs._impl; } - friend bool operator!=(const network& lhs, const network& rhs) { return !(lhs == rhs); } - - /// @brief Returns @ref engine by which network was built. - engine& get_engine() const; - - /// @brief Returns network internal @ref program. - program get_program() const; - - /// @brief Provides @ref memory for @ref input_layout primitives defined by user in source @ref topology. - void set_input_data(const primitive_id& id, memory::ptr mem) const; - - /// @brief Provides user-supplied @ref memory for output primitives defined by user in source @ref topology. - void set_output_memory(const primitive_id& id, memory::ptr mem) const; - - /// @brief Return stream id. - uint16_t get_stream_id(); - - stream& get_stream() const; - - stream::ptr get_stream_ptr() const; - - /// @brief Return internal network id. - uint32_t get_id(); - - std::string get_primitive_info(const primitive_id& id) const; - - /// @brief Returns description of final runtime graph - std::vector get_primitives_info(); - - /// @brief Returns description of all optimization stages - std::vector>> get_optimization_steps_info(); - - /// @brief Returns the list of executed primitives. - std::vector get_executed_primitive_ids() const; - - /// @brief Returns the list of all primitives ids in network. - std::vector get_all_primitive_ids() const; - - /// @brief Returns the list of all primitives ids in network before graph optimization. - std::vector get_all_primitive_org_ids() const; - - /// @brief Returns the list of network inputs. - std::vector get_input_ids() const; - - /// @brief Returns the list of available network outputs. - std::vector get_output_ids() const; - - /// @brief Returns @ref memory object for particular @p output. Can be called before network execution - memory::ptr get_output_memory(const primitive_id& output_id) const; - - /// @brief Returns @ref event object for particular @p primitive. Can't be called before network execution - event::ptr get_primitive_event(const primitive_id& output_id) const; + memory::ptr get_output_memory(const primitive_id& output_id); - /// @brief Returns @ref network_output object for particular @p output. Can't be called before network execution - network_output get_output(const primitive_id& output_id) const { - return network_output(get_primitive_event(output_id), get_output_memory(output_id), get_stream_ptr()); + /// @brief Returns the list of primitive ids before and after graph optimization. + /// @details If primitive was not optimized, the old and actual id will be the same. + /// @n If primitive was optimized during graph optimization, the actual id will be "_optimized_". + std::map get_all_primitives() const { + auto primitive_ids = get_all_primitive_ids(); + auto primitive_org_ids = get_all_primitive_org_ids(); + std::map result; + for (decltype(primitive_org_ids.size()) i = 0; i < primitive_org_ids.size(); i++) { + result.emplace(primitive_org_ids[i], primitive_ids[i]); + } + return result; } /// @brief Returns the list of @ref event for the primitives that were executed in network. @@ -168,32 +138,71 @@ struct network { return result; } - /// @brief Returns the list of primitive ids before and after graph optimization. - /// @details If primitive was not optimized, the old and actual id will be the same. - /// @n If primitive was optimized during graph optimization, the actual id will be "_optimized_". - std::map get_all_primitives() const { - auto primitive_ids = get_all_primitive_ids(); - auto primitive_org_ids = get_all_primitive_org_ids(); - std::map result; - for (decltype(primitive_org_ids.size()) i = 0; i < primitive_org_ids.size(); i++) { - result.emplace(primitive_org_ids[i], primitive_ids[i]); - } - return result; - } + std::vector get_output_ids() const; + std::vector get_input_ids() const; + std::vector get_executed_primitive_ids() const; + std::vector get_all_primitive_ids() const; + std::vector get_all_primitive_org_ids() const; + const program::primitives_info& get_primitives_info() const; + const program::graph_optimizer_info& get_optimizer_passes_info() const; + void execute_impl(const std::vector& events); /// @brief Executes network and returns the list of @ref network_output. /// @param dependencies List of @ref event objects to be waited before network execution. /// @note User should call set_input_data() for every @ref input_layout defined in source @ref topology /// before network execution. - std::map execute(const std::vector& dependencies = {}) const; + std::map execute(const std::vector& dependencies = {}); - /// @brief Returns wrapped C API @ref cldnn_network handler. - network_impl* get() const { return _impl.get(); } + void validate_primitives(); + void set_arguments(); + // Implementation specific calls + std::shared_ptr get_primitive(const primitive_id& id); + std::string get_primitive_info(const primitive_id& id) const; + const event::ptr& get_primitive_event(const primitive_id& id) const { return _events.at(id); } + bool has_event(const primitive_id& id) const { return _events.count(id); } + std::vector> get_primitives(const std::vector& ids); + std::vector> get_primitives(const std::vector& nodes); + void execute_primitive(const std::shared_ptr& primitive, + const std::vector& events); + void allocate_primitives(); + void build_insts_deps(); + uint32_t get_id() const { return net_id; } + stream& get_stream() const { return *_stream; } + stream::ptr get_stream_ptr() const { return _stream; } + bool is_internal() const { return _internal; } + bool is_primary_stream() { return _is_primary_stream; } + + /// Create memory object with specified @p layout and allocation @p type for primitive with @p id + /// Underlying memory handle can be reused with other primitives from memory pool based on @p dependencies + memory_ptr get_memory_from_pool(const layout& layout, + primitive_id id, + std::set dependencies, + allocation_type type, + bool reusable = true); private: - std::shared_ptr _impl; + uint32_t net_id = 0; + program::ptr _program; + stream::ptr _stream; + std::unique_ptr _memory_pool; + bool _internal; + bool _is_primary_stream; + bool _reset_arguments; + + std::map> _primitives; + std::vector> _inputs; + std::vector> _outputs; + std::list> _exec_order; + std::list> _data_outputs; + + std::unordered_map _events; + + void build_exec_order(); + void allocate_primitive_instance(program_node const& node); + void transfer_memory_to_device(std::shared_ptr instance, program_node const& node); + void add_to_exec_order(const primitive_id& id); + std::shared_ptr find_in_internal_networks(const primitive_id& id); + std::shared_ptr find_primitive(const primitive_id& id); + void check_names(); }; -CLDNN_API_CLASS(network) -/// @} -/// @} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp index 5f1a7cc4925af6..ee98838c740b85 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp @@ -5,501 +5,323 @@ #pragma once #include "cldnn/runtime/engine.hpp" -#include "cldnn/primitives/implementation_desc.hpp" +#include "cldnn/runtime/stream.hpp" +#include "build_options.hpp" -#include "topology.hpp" - -#include -#include +#include #include +#include +#include #include #include +#include -namespace cldnn { - -/// @addtogroup cpp_api C++ API -/// @{ - -/// @defgroup cpp_program Program compilation -/// @{ - -/// @brief Represents user-provided program build option type. -enum class build_option_type { - /// @brief Allow primitives fusing during program build (default: false). - fusing, - - /// @brief Enable implicit reordering for user inputs (default: false). - optimize_data, - - /// @brief Enable implicit static input reordering for user inputs (default: false). - allow_static_input_reorder, - - /// @brief Enable debug mode (default: false). - /// @details This option enforce all program primitives to be accessible as outputs. - debug, - - /// @brief User selected list of program outputs. - outputs, - - /// @brief User defined learning parameters. - learning_config, - - /// @brief Tuning config (default: Tuning is disabled). - /// @details The tuner will automatically find the optimal kernel/config for each node in the graph, - /// by running multiple implementations and configurations per node and storing the optimal one in cache. - /// Expect long execution time in the first run. - /// After the first run a cache with the tuning results will be created in the path provided. - /// This cache will be used in the next runs. - tuning_config, - - /// @brief Specifies a directory to which stages of network compilation should be dumped. (default: empty, i.e. no dumping) - graph_dumps_dir, - /// @brief Specifies a directory to which compiled kernels should be cached or can be loaded from. (default: empty, i.e. no caching) - kernels_cache_dir, - /// @brief Name for serialization process - serialize_network, - load_program, - force_implementations -}; - -/// @brief Tuning mode. -enum class tuning_mode { - /// @brief Tuning is disabled. - tuning_disabled, - - /// @brief Tuning using the cached data (no on-line tuning for non-existing data). - tuning_use_cache, - - /// @brief Tuning using the cached data if exist, tune and update cache otherwise. - tuning_tune_and_cache, - - /// @brief Tuning using the cached data and update tasks. - /// @details Performs updating tasks like removal of invalid caches, promoting to new format, etc. - /// No tuning for non-existing data. - tuning_use_and_update, - - /// @brief Retune the cache data even if it exists. - tuning_retune_and_cache -}; - -/// @brief Tuning configuration. -struct tuning_config_options { - tuning_mode mode; - std::string cache_file_path; - - tuning_config_options() : mode(tuning_mode::tuning_disabled), cache_file_path("") {} -}; - -/// @brief Learning parameters. -struct learning_params { - float momentum = 0.0; - float weights_decay = 0.0; - - learning_params() : momentum(0.9f), weights_decay(0.0005f) {} -}; - -/// @brief Represents user-provided program build option. -struct build_option { - /// @brief Allow primitives fusing during program build (default: false). - static std::shared_ptr fusing(bool enable = false); - - /// @brief Enable implicit reordering for user inputs (default: false). - static std::shared_ptr optimize_data(bool enable = false); - - /// @brief Enable implicit reordering for static user inputs (default: false). - static std::shared_ptr allow_static_input_reorder(bool enable = false); - - /// @brief Enable debug mode (default: false). - /// @details This option enforce all program primitives to be accessible as outputs. - static std::shared_ptr debug(bool enable = false); +namespace kernel_selector { +class TuningCache; +} // namespace kernel_selector - /// @brief User selected list of program outputs. - static std::shared_ptr outputs(const std::vector& outs); - - /// @brief Tuning configuration (default: false). - /// @details This option will automatically find the optimal kernel/config for each node in the graph, - /// by running multiple implementations and configurations per node and storing the optimal one in cache. - /// Expect long execution time in the first run (unless the cache only mode is enabled). - /// After the first run a cache with the tuning results will be created in the path provided. - /// This cache will be used in the next runs. - static std::shared_ptr tuning_config( - const tuning_config_options& config = tuning_config_options()); - - /// @brief Specifies a directory to which stages of network compilation should be dumped (default: empty, i.e. no dumping) - static std::shared_ptr graph_dumps_dir(const std::string& dir_path); - - /// @brief Specifies a directory to which compiled kernels should be cached or can be loaded from. (default: empty, i.e. no caching) - static std::shared_ptr kernels_cache_dir(const std::string& dir_path); - - /// @brief Specifies a name for serialization process. - static std::shared_ptr serialize_network(const std::string& network_name); - /// @brief Specifies a name of load_program process. - static std::shared_ptr load_program(const std::string& network_name); - - /// @brief User defined learning parameters. - static std::shared_ptr learning_config(const learning_params& params = learning_params()); - /// @brief Specifies user defined implementation details to use. - static std::shared_ptr force_implementations(implementation_forcing_map forcing); - - virtual ~build_option() = default; - -private: - /// @brief Returns option type represented by this object. - virtual build_option_type get_type() const = 0; - - friend class build_options; -}; - -/// @brief @ref build_option specialization for boolean options. -template -struct build_option_bool : build_option { - /// @brief Constructs option. - /// @param value Is option enabled. - explicit build_option_bool(bool value) : _value(value ? 1 : 0) {} - - /// @brief Is option enabled. - bool enabled() const { return _value != 0; } - -private: - build_option_type get_type() const override { return OptType; } - uintptr_t _value; -}; - -/// @brief @ref build_option specialization for program outputs list. -struct build_option_outputs : build_option { - /// @brief The list of output ids (names) - const std::vector outputs; - - /// @brief Constructs option. - /// @param outs List of ouput ids (names) - explicit build_option_outputs(const std::vector& outs) - : outputs(outs) {} - -private: - /// @brief Returns build_option_type::outputs. - build_option_type get_type() const override { return build_option_type::outputs; } - - build_option_outputs(const build_option_outputs& other) = delete; - build_option_outputs& operator=(const build_option_outputs& other) = delete; -}; - -/// @brief @ref build_option specialization for learning config. -struct build_option_learning_config : build_option { - /// @brief Learning parameters. - const learning_params params; - - /// @brief Constructs learning config build option. - /// @param learning_params Parameters for learning. - explicit build_option_learning_config(const learning_params& params) - : params(params) {} - -private: - /// @brief Returns build_option_type::learning_config. - build_option_type get_type() const override { return build_option_type::learning_config; } - - build_option_learning_config(const build_option_learning_config& other) = delete; - build_option_learning_config& operator=(const build_option_learning_config& other) = delete; -}; - -/// @brief @ref build_option specialization for tuning config. -struct build_option_tuning_config : build_option { - /// @brief Tuning configuration - const tuning_config_options config; - - /// @brief Constructs tuning config build option. - /// @param tuning_config Configuration for the tuning. - explicit build_option_tuning_config(const tuning_config_options& tuning_config) - : config(tuning_config) {} - -private: - /// @brief Returns build_option_type::tuning_config. - build_option_type get_type() const override { return build_option_type::tuning_config; } - - build_option_tuning_config(const build_option_tuning_config& other) = delete; - build_option_tuning_config& operator=(const build_option_tuning_config& other) = delete; -}; - -/// @brief @ref build_option specialization for selecting a directory. -template -struct build_option_directory : build_option { - const std::string directory_path; - - /// @brief Constructs option. - /// @param outs List of ouput ids (names) - explicit build_option_directory(const std::string& dir_path) : directory_path(dir_path) {} - -private: - /// @brief Returns build_option_type::graph_dumps_dir. - build_option_type get_type() const override { return build_option_type::graph_dumps_dir; } - - build_option_directory(const build_option_directory& other) = delete; - build_option_directory& operator=(const build_option_directory& other) = delete; -}; - -/// @brief @ref build_option specialization for selecting a directory. -template -struct build_option_kernels_cache_dir : build_option { - const std::string directory_path; - - explicit build_option_kernels_cache_dir(const std::string& dir_path) : directory_path(dir_path) {} - -private: - /// @brief Returns build_option_type::kernels_cache_dir. - build_option_type get_type() const override { return build_option_type::kernels_cache_dir; } - - build_option_kernels_cache_dir(const build_option_kernels_cache_dir& other) = delete; - build_option_kernels_cache_dir& operator=(const build_option_kernels_cache_dir& other) = delete; -}; - -/// @brief @ref build_option specialization for serialization process. -template -struct build_option_serialization : build_option { - const std::string serialization_network_name; - - explicit build_option_serialization(const std::string& name) : serialization_network_name(name) {} - -private: - build_option_type get_type() const override { return build_option_type::serialize_network; } - - build_option_serialization(const build_option_serialization& other) = delete; - build_option_serialization& operator=(const build_option_serialization& other) = delete; -}; - -/// @brief @ref build_option specialization for load_program process. -template -struct build_option_load_program : build_option { - const std::string load_program_name; - - explicit build_option_load_program(const std::string& name) : load_program_name(name) {} - -private: - build_option_type get_type() const override { return build_option_type::load_program; } - - build_option_load_program(const build_option_load_program& other) = delete; - build_option_load_program& operator=(const build_option_load_program& other) = delete; -}; - -struct build_option_force_implementations : build_option { - implementation_forcing_map forcing; - - explicit build_option_force_implementations(implementation_forcing_map _forcing) : forcing(std::move(_forcing)) {} -private: - build_option_type get_type() const override { return build_option_type::force_implementations; } +namespace cldnn { - build_option_force_implementations(const build_option_force_implementations& other) = delete; - build_option_force_implementations& operator=(const build_option_force_implementations& other) = delete; -}; +struct topology; +struct program_node; +class layout_optimizer; +class pass_manager; +class base_pass; +class program_wrapper; +class kernels_cache; -namespace detail { -/// @brief Helper template to convert @ref build_option_type value to particular @ref build_option class. -template -struct build_option_traits { - /// @brief @ref build_option object type which represents the particular @p OptType. - typedef build_option object_type; - /// @brief Make default @ref build_option corresponding @p OptType - static std::shared_ptr make_default(); -}; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -template <> -struct build_option_traits { - typedef build_option_bool object_type; - static std::shared_ptr make_default() { return build_option::fusing(); } -}; -template <> -struct build_option_traits { - typedef build_option_bool object_type; - static std::shared_ptr make_default() { return build_option::optimize_data(); } -}; -template <> -struct build_option_traits { - typedef build_option_bool object_type; - static std::shared_ptr make_default() { return build_option::allow_static_input_reorder(); } -}; -template <> -struct build_option_traits { - typedef build_option_bool object_type; - static std::shared_ptr make_default() { return build_option::debug(); } -}; -template <> -struct build_option_traits { - typedef build_option_outputs object_type; - static std::shared_ptr make_default() { return build_option::outputs({}); } -}; -template <> -struct build_option_traits { - typedef build_option_learning_config object_type; - static std::shared_ptr make_default() { return build_option::learning_config(); } -}; -template <> -struct build_option_traits { - typedef build_option_tuning_config object_type; - static std::shared_ptr make_default() { return build_option::tuning_config(); } -}; -template <> -struct build_option_traits { - typedef build_option_directory object_type; - static std::shared_ptr make_default() { return build_option::graph_dumps_dir({}); } -}; -template <> -struct build_option_traits { - typedef build_option_directory object_type; - static std::shared_ptr make_default() { return build_option::kernels_cache_dir({}); } -}; -template <> -struct build_option_traits { - typedef build_option_serialization object_type; - static std::shared_ptr make_default() { return build_option::serialize_network({}); } -}; -template <> -struct build_option_traits { - typedef build_option_load_program object_type; - static std::shared_ptr make_default() { return build_option::load_program({}); } -}; -template <> -struct build_option_traits { - using object_type = build_option_force_implementations; - static std::shared_ptr make_default() { return build_option::force_implementations({}); } -}; -#endif -} // namespace detail - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -inline std::shared_ptr build_option::fusing(bool enable) { - return std::make_shared>(enable); -} - -inline std::shared_ptr build_option::optimize_data(bool enable) { - return std::make_shared>(enable); -} - -inline std::shared_ptr build_option::allow_static_input_reorder(bool enable) { - return std::make_shared>(enable); -} - -inline std::shared_ptr build_option::debug(bool enable) { - return std::make_shared>(enable); -} - -inline std::shared_ptr build_option::outputs(const std::vector& outs) { - return std::make_shared(outs); -} - -inline std::shared_ptr build_option::learning_config(const learning_params& params) { - return std::make_shared(params); -} - -inline std::shared_ptr build_option::tuning_config(const tuning_config_options& config) { - return std::make_shared(config); -} - -inline std::shared_ptr build_option::graph_dumps_dir(const std::string& dir_path) { - return std::make_shared>(dir_path); -} - -inline std::shared_ptr build_option::kernels_cache_dir(const std::string& dir_path) { - return std::make_shared>(dir_path); -} -inline std::shared_ptr build_option::serialize_network(const std::string& name) { - return std::make_shared>(name); -} -inline std::shared_ptr build_option::load_program(const std::string& name) { - return std::make_shared>(name); -} -inline std::shared_ptr build_option::force_implementations(implementation_forcing_map forcing) { - return std::make_shared(std::move(forcing)); -} -#endif - -/// @brief Represents program build options list. -class build_options { +struct program { + using ptr = std::shared_ptr; + using cptr = std::shared_ptr; + friend class calculate_prior_boxes; // to be removed when possible + friend class graph_initializations; // to be removed when possible + friend class prepare_padding; // to be removed when possible + friend class propagate_constants; // to be removed when possible + friend class pre_replace_deconv; // to be removed when possible + friend class prepare_primitive_fusing; // to be removed when possible + friend class prepare_quantization; // to be removed when possible + friend class prepare_conv_eltw_fusing; // to be removed when possible + friend class reorder_inputs; // to be removed when possible + friend class remove_redundant_reorders; // to be removed when possible + friend class program_wrapper; // this class is intended to extend the interface of program for + // the usage within tests_core_internal project only public: - /// @brief Adds or replace option to the options list - void set_option(std::shared_ptr opt) { add_or_replace_option(opt); } - - /// @brief Adds or replace options to the options list - template - void set_option(std::shared_ptr opt, Args... args) { - add_or_replace_option(opt); - set_option(args...); - } - - /// @brief Constructs build options list from its arguments. - template - explicit build_options(Args... args) { - set_option(args...); - } - - /// @brief Returns program build option for @p OptType - template - std::shared_ptr::object_type> get() const { - using T = typename detail::build_option_traits::object_type; - for (auto& option : _options) { - if (option->get_type() == OptType) - return std::static_pointer_cast(option); + struct nodes_ordering { + public: + typedef std::list list_of_nodes; + typedef list_of_nodes::const_iterator const_iterator; + typedef list_of_nodes::const_reverse_iterator const_reverse_iterator; + typedef list_of_nodes::iterator node_iterator; + typedef list_of_nodes::reverse_iterator node_reverse_iterator; + const_iterator begin() const { return _processing_order.begin(); } + const_iterator end() const { return _processing_order.end(); } + const_reverse_iterator rbegin() const { return _processing_order.rbegin(); } + const_reverse_iterator rend() const { return _processing_order.rend(); } + + void calc_processing_order_visit(program_node* node); + void calc_processing_order(program& p); + int32_t get_processing_number(program_node* node) const { + return get_processing_number(get_processing_iterator(*node)); } - return std::static_pointer_cast(detail::build_option_traits::make_default()); - } - -private: - friend struct program; - std::vector> _options; - void set_option(void) {} - - void add_or_replace_option(std::shared_ptr opt) { - for (auto& p : _options) { - if (p->get_type() == opt->get_type()) { - p = opt; - return; - } + int32_t get_processing_number(node_iterator iter) const { + return 1 + (int32_t)std::distance(_processing_order.begin(), const_iterator(iter)); + } + void calculate_BFS_processing_order(); + size_t size() { return _processing_order.size(); } + bool is_correct(program_node* node); + + node_iterator get_processing_iterator(program_node& node) const { return processing_order_iterators.at(&node); } + void clear() { + processing_order_iterators.clear(); + _processing_order.clear(); } - _options.push_back(opt); - } -}; - -struct program_impl; - -/// @brief Compiled program build from @ref topology by @ref engine -struct program { - friend struct network; -public: - /// @brief Builds executable program based on user-defined @p topology by specified @p engine. - /// @param[in] engine The engine which will be used to build the program. - /// @param[in] topology The user-defined topology on which the network will be based. - /// @param[in] options Program build options. See @ref build_option and @ref build_options for details. - program(engine& engine, const topology& topology, const build_options& options = build_options()); + void insert(program_node* key_node, program_node* node) { + node_iterator _where = processing_order_iterators.at(key_node); + processing_order_iterators[node] = _processing_order.insert(_where, node); + } - /// @brief Copy constructor. - program(const program& other) : _impl(other._impl) { } + void insert_next(program_node* key_node, program_node* node) { + node_iterator _where = std::next(processing_order_iterators.at(key_node)); + processing_order_iterators[node] = _processing_order.insert(_where, node); + } - /// @brief Dereferences the counter of the underlying C API @ref cldnn_program handler. - ~program() { } + void erase(program_node* key_node) { + node_iterator i = processing_order_iterators.at(key_node); + processing_order_iterators.erase(key_node); + _processing_order.erase(i); + } - /// @brief Assigns new value by releasing previously referenced C API @ref cldnn_program handler and retaining the one referenced by @p other. - program& operator=(const program& other) { - if (_impl == other._impl) + private: + list_of_nodes _processing_order; + std::map processing_order_iterators; + }; + + template + struct single_element_container { + explicit single_element_container(T& t) : elem(&t) {} + constexpr size_t size() const { return 1; } + single_element_container begin() const { return single_element_container(elem); } + single_element_container end() const { return single_element_container(nullptr); } + single_element_container& operator++() { + elem = nullptr; return *this; - _impl = other._impl; - return *this; - } - - /// @brief Checks whether @p lhs and @p rhs reference the same C API @ref cldnn_program handler - friend bool operator==(const program& lhs, const program& rhs) { return lhs._impl == rhs._impl; } - /// @brief Checks whether @p lhs and @p rhs reference different C API @ref cldnn_program handlers - friend bool operator!=(const program& lhs, const program& rhs) { return !(lhs == rhs); } - - std::shared_ptr get() const { return _impl; } + } + bool operator!=(single_element_container const& sec) { return elem != sec.elem; } + + T operator*() { return *elem; } + + private: + explicit single_element_container(T* t) : elem(t) {} + + T* elem; + }; + + typedef std::vector primitives_info; + typedef std::vector> graph_optimizer_info; + typedef std::pair> optimized_info; + + program(engine& engine_ref, + topology const& topology, + build_options const& options, + bool is_internal = false, + bool no_optimizations = false, + bool is_body_program = false); + /* constructor used to build a program from subset of nodes of other program (used in propagate_constants) */ + program(engine& engine_ref, + std::set> const& nodes, + build_options const& options, + bool is_internal); + ~program(); + engine& get_engine() const { return _engine; } + const build_options& get_options() const { return options; } + std::list& get_inputs() { + return inputs; + } // ToDo: redesign trim to ouptut pass to make it const as_well as get_engine and get options + std::vector& get_outputs() { + return outputs; + } // ToDo: redesign reorder-inputs pass to make it const as_well as get_engine and get options + bool is_loop_body() const { return is_body_program; } + bool is_debug_build() const { return options.get()->enabled(); } + const nodes_ordering& get_processing_order() const; + nodes_ordering& get_processing_order(); + uint32_t get_prog_id() { return prog_id; } + stream& get_stream() { return *_stream; } + const std::list& get_optimized_out() const { return optimized_out; } + const std::list& get_optimized() const { return optimized; } + bool has_node(const primitive_id& prim) const { return nodes_map.count(prim) > 0; } + program_node& get_node(primitive_id const& id); + program_node const& get_node(primitive_id const& id) const; + std::shared_ptr get_node_ptr(const primitive_id& prim) { return nodes_map.at(prim); } + std::shared_ptr get_node_ptr(const primitive_id& prim) const { return nodes_map.at(prim); } + + // returns already existing program_node for given primitive 'prim' (lookup in 'nodes_map') + // if it was previously created, otherwise creates and then returns program_node + program_node& get_or_create(std::shared_ptr prim); + + // Inserts given program_node 'node' as an intermediate node between 'next' and it's + // dependency at 'prev_idx' index. + void add_intermediate(program_node& node, + program_node& next, + size_t prev_idx, + bool connect_int_node_with_old_dep = true, + bool move_usrs_of_prev_to_node = false); + + // Gets or creates program_node for given primitive 'prim' and inserts it as an intermediate + // node between 'next' and it's dependency at 'prev_idx' index. + void add_intermediate(std::shared_ptr prim, + program_node& next, + size_t prev_idx, + bool connect_int_node_with_old_dep = true, + bool move_usrs_of_prev_to_node = false); + + // Inserts given program_node 'node' as an intermediate node between 'next' and it's + // dependency prev + void add_intermediate(program_node& node, + program_node& next, + program_node& prev, + bool connect_int_node_with_old_dep = true, + bool move_usrs_of_prev_to_node = false); + + // removes a node from the graph and deletes it afterwards, + // prereq: node cannot be marked as output and has to have exactly one dependency + // returns if 'node' has been extracted and removed successfully + bool extract_and_remove(program_node& node); + + // Fuses two nodes into fused_node and removes peer_node from graph + void fuse_nodes(program_node& fused_node, program_node& peer_node, std::map>* fusing_history); + + // returns if 'node' has been removed + bool remove_if_dangling(program_node& node); + + void mark_if_constant(program_node& node); + // mark if the node is in data flow assuming that all dependencies are marked properly + void mark_if_data_flow(program_node& node); + // Reverses connection - user becomes dependency. + + void remove_nodes(std::vector& to_remove); + void dump_program(const char* stage, + bool with_full_info, + std::function const& filter = nullptr) const; + + const primitives_info& get_primitives_info() const; + const graph_optimizer_info& get_optimizer_passes_info() const; + void save_pass_info(std::string pass_name); + + void add_optimized_primitive_info(primitive_id optimized_primitive_id, std::vector replaced_with_ids = {}); + + void reset_program(); + uint32_t get_id() const { return prog_id; } + + static ptr build_program(engine& engine, + const topology& topology, + const build_options& options, + bool is_internal = false, + bool no_optimizations = false, + bool is_body_program = false); + static ptr build_program(engine& engine, + const std::set>& nodes, + const build_options& options, + bool is_internal); + static void init_primitives(); + void compile(); + void init_kernels(); + kernel_id add_kernel(const std::shared_ptr kernel_sring); + kernel::ptr get_kernel(kernel_id id); + + void load_tuning_cache(); + std::shared_ptr get_tuning_cache() const { return tuning_cache; } private: - std::shared_ptr _impl; - - explicit program(std::shared_ptr impl) : _impl(impl) { - if (_impl == nullptr) - throw std::invalid_argument("implementation pointer should not be null"); + uint32_t prog_id = 0; + engine& _engine; + stream::ptr _stream; + // TODO: Consider moving it to engine + std::unique_ptr _kernels_cache; + build_options options; + std::list inputs; + std::vector outputs; + nodes_ordering processing_order; + std::unique_ptr pm; + std::shared_ptr tuning_cache; + bool is_body_program; + + std::map> nodes_map; + std::list optimized_out; + + std::list optimized; + primitives_info prim_info; + graph_optimizer_info optimizer_passes_info; + + primitives_info get_current_stage_info() const; + /* + ** High-level functions, in order of usage + */ + /* build nodes internal structure based on topology */ + void prepare_nodes(topology const& topology); + /* build nodes internal structure based on the subset of nodes of other program (used in propagate_constants) */ + void prepare_nodes(std::set> const& nodes); + void add_node_dependencies(program_node* node_ptr); + void copy_node_dependencies(program_node* dest, program_node* src); + void build_program(bool is_internal); + void init_graph(); + void set_options(); + void set_layout_optimizer_attributes(layout_optimizer& lo); + + void apply_opt_pass(base_pass& pass); + + template + typename std::enable_if::value && + std::is_constructible::value>::type + apply_opt_pass(Args&&... args) { + auto pass = Pass(std::forward(args)...); + apply_opt_pass(pass); } + + void run_graph_compilation(); + void pre_optimize_graph(bool is_internal); + void post_optimize_graph(bool is_internal); + void cleanup(); + void transfer_memory_to_device(); + + /* + ** Analysis functions + */ + // TODO: Remove once we will get full support for input/output padding in all primitive implementations. + bool analyze_output_size_handling_need(); + + /* + ** Optimization functions + */ + void apply_needed_padding(program_node& node, program_node& prev_node, const padding& needed_padding); + + /* + ** Memory pool functions + */ + void prepare_memory_dependencies(); + std::string get_memory_dependencies_string() const; + + /* + ** Utilities + */ + void add_split_outputs(); + // mark if the node is constant assuming that all dependencies are marked properly + void reverse_connection(program_node& dep_node, program_node& user_node); + + void add_connection(program_node& prev, program_node& next); + + void remove_connection(program_node& prev, program_node& next); + + void remove_all_connections(program_node& node); + + void rename(program_node& node, primitive_id const& new_id); + void swap_names(program_node& node1, program_node& node2); + void replace_all_usages(program_node& old_node, program_node& new_node); + + // old_node - node which will be replaced + // new_node - node which will replace the old one + void replace(program_node& old_node, program_node& new_node); }; -/// @} -/// @} + } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/topology.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/topology.hpp index 4155c7ac529e8b..b2be5d1300b527 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/topology.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/topology.hpp @@ -2,31 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 // -/////////////////////////////////////////////////////////////////////////////////////////////////// - #pragma once -#include "cldnn/runtime/compounds.hpp" #include "cldnn/primitives/primitive.hpp" +#include "cldnn/primitives/input_layout.hpp" -#include -#include +#include #include +#include namespace cldnn { -/// @addtogroup cpp_api C++ API -/// @{ - -/// @defgroup cpp_topology Network Topology -/// @{ +typedef std::map> topology_map; -struct topology_impl; - -/// @brief Network topology to be defined by user. struct topology { - /// @brief Constructs empty network topology. - topology(); +public: + using ptr = std::shared_ptr; + explicit topology(const topology_map& map) : _primitives(map) {} + topology() : _primitives({}) {} /// @brief Constructs topology containing primitives provided in argument(s). template @@ -34,29 +27,6 @@ struct topology { add(args...); } - /// @brief Copy construction. - topology(const topology& other) : _impl(other._impl) { } - - /// @brief Copy assignment. - topology& operator=(const topology& other) { - if (_impl == other._impl) - return *this; - _impl = other._impl; - return *this; - } - - /// Construct C++ topology based on C API @p cldnn_topology - explicit topology(std::shared_ptr other) : _impl(other) { - if (_impl == nullptr) - throw std::invalid_argument("implementation pointer should not be null"); - } - - /// @brief Releases wrapped C API @ref cldnn_topology. - ~topology() { } - - friend bool operator==(const topology& lhs, const topology& rhs) { return lhs._impl == rhs._impl; } - friend bool operator!=(const topology& lhs, const topology& rhs) { return !(lhs == rhs); } - void add_primitive(std::shared_ptr desc); /// @brief Adds a primitive to topology. @@ -72,22 +42,15 @@ struct topology { add(args...); } - /// @brief Returns wrapped implementation pointer. - std::shared_ptr get() const { return _impl; } + const std::shared_ptr& at(primitive_id id) const; - const std::vector get_primitive_ids() const; + void change_input_layout(const primitive_id& id, const layout& new_layout); - void change_input_layout(primitive_id id, const layout& new_layout); + const topology_map& get_primitives() const { return _primitives; } - const std::shared_ptr& at(const primitive_id& id) const; + const std::vector get_primitives_ids() const; private: - friend class engine; - friend struct network; - std::shared_ptr _impl; + topology_map _primitives; }; - -CLDNN_API_CLASS(topology) -/// @} -/// @} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp index c16eb97862fcde..c43abac85e344b 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp @@ -28,6 +28,7 @@ class debug_configuration { int print_multi_kernel_perf; // Print execution time of each kernel in multi-kernel primitimive int disable_usm; // Disable usm usage std::string dump_graphs; // Dump optimized graph + std::string dump_sources; // Dump opencl sources std::string dump_layers_path; // Enable dumping intermediate buffers and set the dest path std::string dump_layers; // Dump intermediate buffers of specified layers only, separated by space int dump_layers_dst_only; // Dump only output of layers diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h index 67b393e6e10af6..4638de3fbe93e2 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h @@ -507,7 +507,7 @@ struct FusedOpsConfiguration { FusedOpsConfiguration& SetShuffleVarName(std::string val) { shuffle_var_name = val; return *this; } }; -// Instance of fused_operation_desc is added to fused_ops vector if a node has been fused to current one using program_impl::fuse_nodes +// Instance of fused_operation_desc is added to fused_ops vector if a node has been fused to current one using program::fuse_nodes // method. In order to process fused ops following modifications should be done in a kernel: // option 1 - using common generator: // - create FusedOpsConfiguration object that contains configuration for common code generator. diff --git a/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp b/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp index 959ca340326da9..00085cf9d07af3 100644 --- a/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp @@ -99,6 +99,7 @@ debug_configuration::debug_configuration() , print_multi_kernel_perf(0) , disable_usm(0) , dump_graphs(std::string()) + , dump_sources(std::string()) , dump_layers_path(std::string()) , dump_layers(std::string()) , dump_layers_dst_only(0) { @@ -107,6 +108,7 @@ debug_configuration::debug_configuration() get_gpu_debug_env_var("PrintMultiKernelPerf", print_multi_kernel_perf); get_gpu_debug_env_var("DisableUsm", disable_usm); get_gpu_debug_env_var("DumpGraphs", dump_graphs); + get_gpu_debug_env_var("DumpSources", dump_sources); get_gpu_debug_env_var("DumpLayersPath", dump_layers_path); get_gpu_debug_env_var("DumpLayers", dump_layers); get_gpu_debug_env_var("DumpLayersDstOnly", dump_layers_dst_only); diff --git a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp index 3e8f3034de2068..483471830283ea 100644 --- a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp @@ -279,12 +279,18 @@ void kernels_cache::build_batch(const engine& build_engine, const batch_program& auto& cl_build_engine = dynamic_cast(build_engine); bool dump_sources = !_engine.configuration().sources_dumps_dir.empty() || batch.dump_custom_program; + std::string dump_sources_dir = _engine.configuration().sources_dumps_dir; + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(!debug_config->dump_sources.empty()) { + dump_sources = true; + dump_sources_dir = debug_config->dump_sources; + } std::string err_log; // accumulated build log from all program's parts (only contains messages from parts which std::string current_dump_file_name = ""; if (dump_sources) { - current_dump_file_name = _engine.configuration().sources_dumps_dir; + current_dump_file_name = dump_sources_dir; if (!current_dump_file_name.empty() && current_dump_file_name.back() != '/') current_dump_file_name += '/'; diff --git a/inference-engine/thirdparty/clDNN/src/activation.cpp b/inference-engine/thirdparty/clDNN/src/activation.cpp index 0987286ab4e51b..b1c478fd3a0953 100644 --- a/inference-engine/thirdparty/clDNN/src/activation.cpp +++ b/inference-engine/thirdparty/clDNN/src/activation.cpp @@ -59,7 +59,7 @@ std::string activation_inst::to_string(activation_node const& node) { return primitive_description.str(); } -activation_inst::typed_primitive_inst(network_impl& network, activation_node const& node) : parent(network, node) { +activation_inst::typed_primitive_inst(network& network, activation_node const& node) : parent(network, node) { auto input_arg = node.input().get_output_layout(); auto output_arg = node.get_output_layout(); diff --git a/inference-engine/thirdparty/clDNN/src/arg_max_min.cpp b/inference-engine/thirdparty/clDNN/src/arg_max_min.cpp index 0d2f1f4beae215..a264d8f9ff06b6 100644 --- a/inference-engine/thirdparty/clDNN/src/arg_max_min.cpp +++ b/inference-engine/thirdparty/clDNN/src/arg_max_min.cpp @@ -166,5 +166,5 @@ std::string arg_max_min_inst::to_string(arg_max_min_node const& node) { return primitive_description.str(); } -arg_max_min_inst::typed_primitive_inst(network_impl& network, arg_max_min_node const& node) : parent(network, node) {} +arg_max_min_inst::typed_primitive_inst(network& network, arg_max_min_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/average_unpooling.cpp b/inference-engine/thirdparty/clDNN/src/average_unpooling.cpp index 3082862f302e74..121269847c97d6 100644 --- a/inference-engine/thirdparty/clDNN/src/average_unpooling.cpp +++ b/inference-engine/thirdparty/clDNN/src/average_unpooling.cpp @@ -78,7 +78,7 @@ std::string average_unpooling_inst::to_string(average_unpooling_node const& node return primitive_description.str(); } -average_unpooling_inst::typed_primitive_inst(network_impl& network, average_unpooling_node const& node) +average_unpooling_inst::typed_primitive_inst(network& network, average_unpooling_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/batch_to_space.cpp b/inference-engine/thirdparty/clDNN/src/batch_to_space.cpp index aa34ab8da536ff..bfa50bf8115854 100644 --- a/inference-engine/thirdparty/clDNN/src/batch_to_space.cpp +++ b/inference-engine/thirdparty/clDNN/src/batch_to_space.cpp @@ -86,7 +86,7 @@ std::string batch_to_space_inst::to_string(batch_to_space_node const& node) { return primitive_description.str(); } -batch_to_space_inst::typed_primitive_inst(network_impl& network, batch_to_space_node const& node) +batch_to_space_inst::typed_primitive_inst(network& network, batch_to_space_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/binary_convolution.cpp b/inference-engine/thirdparty/clDNN/src/binary_convolution.cpp index a2ffcdc02ca996..27c9ad04b97e92 100644 --- a/inference-engine/thirdparty/clDNN/src/binary_convolution.cpp +++ b/inference-engine/thirdparty/clDNN/src/binary_convolution.cpp @@ -66,7 +66,7 @@ std::string binary_convolution_inst::to_string(binary_convolution_node const& no return primitive_description.str(); } -binary_convolution_inst::typed_primitive_inst(network_impl& network, binary_convolution_node const& node) +binary_convolution_inst::typed_primitive_inst(network& network, binary_convolution_node const& node) : parent(network, node) { auto stride = argument.stride; diff --git a/inference-engine/thirdparty/clDNN/src/border.cpp b/inference-engine/thirdparty/clDNN/src/border.cpp index cdeca46d8b1e35..886275d6719562 100644 --- a/inference-engine/thirdparty/clDNN/src/border.cpp +++ b/inference-engine/thirdparty/clDNN/src/border.cpp @@ -84,7 +84,7 @@ std::string border_inst::to_string(border_node const& node) { return primitive_description.str(); } -border_inst::typed_primitive_inst(network_impl& network, border_node const& node) : parent(network, node) { +border_inst::typed_primitive_inst(network& network, border_node const& node) : parent(network, node) { auto input_layout = node.input().get_output_layout(); const auto input_format = input_layout.format; diff --git a/inference-engine/thirdparty/clDNN/src/broadcast.cpp b/inference-engine/thirdparty/clDNN/src/broadcast.cpp index d6cc15067075e1..f3d97a27ff8c8d 100644 --- a/inference-engine/thirdparty/clDNN/src/broadcast.cpp +++ b/inference-engine/thirdparty/clDNN/src/broadcast.cpp @@ -52,7 +52,7 @@ std::string broadcast_inst::to_string(broadcast_node const& node) { return primitive_description.str(); } -broadcast_inst::typed_primitive_inst(network_impl& network, broadcast_node const& node) : parent(network, node) { +broadcast_inst::typed_primitive_inst(network& network, broadcast_node const& node) : parent(network, node) { auto input_layout = node.input().get_output_layout(); const auto& input_sizes = input_layout.size; diff --git a/inference-engine/thirdparty/clDNN/src/concatenation.cpp b/inference-engine/thirdparty/clDNN/src/concatenation.cpp index d341566679ee22..253ff0812e0e94 100644 --- a/inference-engine/thirdparty/clDNN/src/concatenation.cpp +++ b/inference-engine/thirdparty/clDNN/src/concatenation.cpp @@ -66,7 +66,7 @@ std::string concatenation_inst::to_string(concatenation_node const& node) { return primitive_description.str(); } -concatenation_inst::typed_primitive_inst(network_impl& network, concatenation_node const& node) +concatenation_inst::typed_primitive_inst(network& network, concatenation_node const& node) : parent(network, node) { auto input_layout = node.input().get_output_layout(); auto output_layout = node.get_output_layout(); diff --git a/inference-engine/thirdparty/clDNN/src/condition.cpp b/inference-engine/thirdparty/clDNN/src/condition.cpp index c31e6cb80e780a..0b7d2ecc8bbb8b 100644 --- a/inference-engine/thirdparty/clDNN/src/condition.cpp +++ b/inference-engine/thirdparty/clDNN/src/condition.cpp @@ -69,10 +69,10 @@ std::string condition_inst::to_string(condition_node const& node) { /* Condition primitive is resuing memory with the input. */ -condition_inst::typed_primitive_inst(network_impl& network, condition_node const& node) +condition_inst::typed_primitive_inst(network& network, condition_node const& node) : parent(network, node), - _net_true(network_impl::allocate_network(node.get_program().get_engine(), node.get_branch_true(), true)), - _net_false(network_impl::allocate_network(node.get_program().get_engine(), node.get_branch_false(), true)) { + _net_true(network::allocate_network(node.get_program().get_engine(), node.get_branch_true(), true)), + _net_false(network::allocate_network(node.get_program().get_engine(), node.get_branch_false(), true)) { auto compare_tensor = node.compare().get_output_layout().size; auto input_tensor = node.input().get_output_layout().size; CLDNN_ERROR_TENSOR_SIZES_GREATER_THAN(node.id(), diff --git a/inference-engine/thirdparty/clDNN/src/convolution.cpp b/inference-engine/thirdparty/clDNN/src/convolution.cpp index c145dfc339cec9..a240a952c13881 100644 --- a/inference-engine/thirdparty/clDNN/src/convolution.cpp +++ b/inference-engine/thirdparty/clDNN/src/convolution.cpp @@ -311,7 +311,7 @@ std::string convolution_inst::to_string(convolution_node const& node) { return primitive_description.str(); } -convolution_inst::typed_primitive_inst(network_impl& network, convolution_node const& node) : parent(network, node) { +convolution_inst::typed_primitive_inst(network& network, convolution_node const& node) : parent(network, node) { auto stride = argument.stride; auto input_inst = node.input().get_output_layout(); diff --git a/inference-engine/thirdparty/clDNN/src/crop.cpp b/inference-engine/thirdparty/clDNN/src/crop.cpp index 7d35ad1e04f3a0..fe45ed3baf88dd 100644 --- a/inference-engine/thirdparty/clDNN/src/crop.cpp +++ b/inference-engine/thirdparty/clDNN/src/crop.cpp @@ -68,7 +68,7 @@ std::string crop_inst::to_string(crop_node const& node) { return primitive_description.str(); } -crop_inst::typed_primitive_inst(network_impl& network, crop_node const& node) : parent(network, node) { +crop_inst::typed_primitive_inst(network& network, crop_node const& node) : parent(network, node) { const auto& ref_in_sizes = argument.reference_input; const auto in_layout = node.input().get_output_layout(); const auto& in_sizes = in_layout.size; diff --git a/inference-engine/thirdparty/clDNN/src/ctc_greedy_decoder.cpp b/inference-engine/thirdparty/clDNN/src/ctc_greedy_decoder.cpp index 6727a9a702b6b3..14f92ef1a717a6 100644 --- a/inference-engine/thirdparty/clDNN/src/ctc_greedy_decoder.cpp +++ b/inference-engine/thirdparty/clDNN/src/ctc_greedy_decoder.cpp @@ -43,5 +43,5 @@ std::string ctc_greedy_decoder_inst::to_string(ctc_greedy_decoder_node const& no return primitive_description.str(); } -ctc_greedy_decoder_inst::typed_primitive_inst(network_impl& network, ctc_greedy_decoder_node const& node) : parent(network, node) {} +ctc_greedy_decoder_inst::typed_primitive_inst(network& network, ctc_greedy_decoder_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/cum_sum.cpp b/inference-engine/thirdparty/clDNN/src/cum_sum.cpp index b7e0b144b90e44..c04685f4314cbc 100644 --- a/inference-engine/thirdparty/clDNN/src/cum_sum.cpp +++ b/inference-engine/thirdparty/clDNN/src/cum_sum.cpp @@ -37,7 +37,7 @@ std::string cum_sum_inst::to_string(cum_sum_node const& node) { return primitive_description.str(); } -cum_sum_inst::typed_primitive_inst(network_impl& network, cum_sum_node const& node) +cum_sum_inst::typed_primitive_inst(network& network, cum_sum_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/custom_gpu_primitive.cpp b/inference-engine/thirdparty/clDNN/src/custom_gpu_primitive.cpp index 374f9c7158d1ab..66414c04f4ce3d 100644 --- a/inference-engine/thirdparty/clDNN/src/custom_gpu_primitive.cpp +++ b/inference-engine/thirdparty/clDNN/src/custom_gpu_primitive.cpp @@ -35,6 +35,6 @@ std::string custom_gpu_primitive_inst::to_string(custom_gpu_primitive_node const return primitive_description.str(); } -custom_gpu_primitive_inst::typed_primitive_inst(network_impl& network, custom_gpu_primitive_node const& node) +custom_gpu_primitive_inst::typed_primitive_inst(network& network, custom_gpu_primitive_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/data.cpp b/inference-engine/thirdparty/clDNN/src/data.cpp index c08b6a28ce394c..babc40a1245285 100644 --- a/inference-engine/thirdparty/clDNN/src/data.cpp +++ b/inference-engine/thirdparty/clDNN/src/data.cpp @@ -19,7 +19,7 @@ primitive_type_id data::type_id() { } namespace { -memory::ptr attach_or_copy_data(network_impl& network, memory::ptr mem) { +memory::ptr attach_or_copy_data(network& network, memory::ptr mem) { auto& engine = network.get_engine(); if (mem->is_allocated_by(engine)) return mem; @@ -32,7 +32,7 @@ memory::ptr attach_or_copy_data(network_impl& network, memory::ptr mem) { } } // namespace -data_node::typed_program_node(const std::shared_ptr dprim, program_impl& prog) +data_node::typed_program_node(const std::shared_ptr dprim, program& prog) : parent(dprim, prog), mem(dprim->mem) { constant = true; can_share_buffer(false); @@ -53,7 +53,7 @@ std::string data_inst::to_string(data_node const& node) { return primitive_description.str(); } -data_inst::typed_primitive_inst(network_impl& network, data_node const& node) +data_inst::typed_primitive_inst(network& network, data_node const& node) : parent(network, node, attach_or_copy_data(network, node.get_attached_memory_ptr())) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/deconvolution.cpp b/inference-engine/thirdparty/clDNN/src/deconvolution.cpp index 6ddc0373f5f376..9b79cd811296b9 100644 --- a/inference-engine/thirdparty/clDNN/src/deconvolution.cpp +++ b/inference-engine/thirdparty/clDNN/src/deconvolution.cpp @@ -145,7 +145,7 @@ std::string deconvolution_inst::to_string(deconvolution_node const& node) { return primitive_description.str(); } -deconvolution_inst::typed_primitive_inst(network_impl& network, deconvolution_node const& node) +deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node const& node) : parent(network, node) { auto stride = argument.stride; diff --git a/inference-engine/thirdparty/clDNN/src/deformable_convolution.cpp b/inference-engine/thirdparty/clDNN/src/deformable_convolution.cpp index 237ed6929f67da..7066ca6825fa3a 100644 --- a/inference-engine/thirdparty/clDNN/src/deformable_convolution.cpp +++ b/inference-engine/thirdparty/clDNN/src/deformable_convolution.cpp @@ -54,7 +54,7 @@ std::string deformable_conv_inst::to_string(deformable_conv_node const& node) { return primitive_description.str(); } -deformable_conv_inst::typed_primitive_inst(network_impl& network, deformable_conv_node const& node) : parent(network, node) { +deformable_conv_inst::typed_primitive_inst(network& network, deformable_conv_node const& node) : parent(network, node) { } primitive_type_id deformable_interp::type_id() { @@ -107,7 +107,7 @@ std::string deformable_interp_inst::to_string(deformable_interp_node const& node return primitive_description.str(); } -deformable_interp_inst::typed_primitive_inst(network_impl& network, deformable_interp_node const& node) : parent(network, node) { +deformable_interp_inst::typed_primitive_inst(network& network, deformable_interp_node const& node) : parent(network, node) { } } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/depth_to_space.cpp b/inference-engine/thirdparty/clDNN/src/depth_to_space.cpp index 09f16b6f7c6877..8e329a818c836a 100644 --- a/inference-engine/thirdparty/clDNN/src/depth_to_space.cpp +++ b/inference-engine/thirdparty/clDNN/src/depth_to_space.cpp @@ -73,7 +73,7 @@ std::string depth_to_space_inst::to_string(depth_to_space_node const& node) { return primitive_description.str(); } -depth_to_space_inst::typed_primitive_inst(network_impl& network, depth_to_space_node const& node) +depth_to_space_inst::typed_primitive_inst(network& network, depth_to_space_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/detection_output.cpp b/inference-engine/thirdparty/clDNN/src/detection_output.cpp index c4e0fa86e2b810..fab8a936de65e2 100644 --- a/inference-engine/thirdparty/clDNN/src/detection_output.cpp +++ b/inference-engine/thirdparty/clDNN/src/detection_output.cpp @@ -4,7 +4,6 @@ #include "detection_output_inst.h" #include "primitive_type_base.h" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" #include "json_object.h" #include @@ -118,7 +117,7 @@ std::string detection_output_inst::to_string(detection_output_node const& node) return primitive_description.str(); } -detection_output_inst::typed_primitive_inst(network_impl& network, detection_output_node const& node) +detection_output_inst::typed_primitive_inst(network& network, detection_output_node const& node) : parent(network, node) { auto location_layout = node.location().get_output_layout(); auto confidence_layout = node.confidence().get_output_layout(); diff --git a/inference-engine/thirdparty/clDNN/src/eltwise.cpp b/inference-engine/thirdparty/clDNN/src/eltwise.cpp index a7f544a3a75af8..a59865210606b0 100644 --- a/inference-engine/thirdparty/clDNN/src/eltwise.cpp +++ b/inference-engine/thirdparty/clDNN/src/eltwise.cpp @@ -194,7 +194,7 @@ std::string eltwise_inst::to_string(eltwise_node const& node) { return primitive_description.str(); } -eltwise_inst::typed_primitive_inst(network_impl& network, eltwise_node const& node) : parent(network, node) { +eltwise_inst::typed_primitive_inst(network& network, eltwise_node const& node) : parent(network, node) { check_inputs_count(node); // check for stride auto prim = node.get_primitive(); diff --git a/inference-engine/thirdparty/clDNN/src/embedding_bag.cpp b/inference-engine/thirdparty/clDNN/src/embedding_bag.cpp index 84e5483dff0d6c..a2a51a583f52ce 100644 --- a/inference-engine/thirdparty/clDNN/src/embedding_bag.cpp +++ b/inference-engine/thirdparty/clDNN/src/embedding_bag.cpp @@ -53,6 +53,6 @@ std::string embedding_bag_inst::to_string(embedding_bag_node const& node) { return primitive_description.str(); } -embedding_bag_inst::typed_primitive_inst(network_impl& network, embedding_bag_node const& node) +embedding_bag_inst::typed_primitive_inst(network& network, embedding_bag_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/extract_image_patches.cpp b/inference-engine/thirdparty/clDNN/src/extract_image_patches.cpp index fffa064d13b236..8e7c067aa11e79 100644 --- a/inference-engine/thirdparty/clDNN/src/extract_image_patches.cpp +++ b/inference-engine/thirdparty/clDNN/src/extract_image_patches.cpp @@ -52,6 +52,6 @@ std::string extract_image_patches_inst::to_string(extract_image_patches_node con return primitive_description.str(); } -extract_image_patches_inst::typed_primitive_inst(network_impl& network, extract_image_patches_node const& node) : parent(network, node) {} +extract_image_patches_inst::typed_primitive_inst(network& network, extract_image_patches_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/fully_connected.cpp b/inference-engine/thirdparty/clDNN/src/fully_connected.cpp index 71130b19a188cd..c90cbf0afe3ff0 100644 --- a/inference-engine/thirdparty/clDNN/src/fully_connected.cpp +++ b/inference-engine/thirdparty/clDNN/src/fully_connected.cpp @@ -128,7 +128,7 @@ std::string fully_connected_inst::to_string(fully_connected_node const& node) { return primitive_description.str(); } -fully_connected_inst::typed_primitive_inst(network_impl& network, fully_connected_node const& node) +fully_connected_inst::typed_primitive_inst(network& network, fully_connected_node const& node) : parent(network, node) { auto input_layout = node.input().get_output_layout(); auto output_layout = node.get_output_layout(); diff --git a/inference-engine/thirdparty/clDNN/src/fused_conv_eltwise.cpp b/inference-engine/thirdparty/clDNN/src/fused_conv_eltwise.cpp index 9d11b1ad4c5056..99bf31885b7fa1 100644 --- a/inference-engine/thirdparty/clDNN/src/fused_conv_eltwise.cpp +++ b/inference-engine/thirdparty/clDNN/src/fused_conv_eltwise.cpp @@ -250,7 +250,7 @@ std::string fused_conv_eltwise_inst::to_string(fused_conv_eltwise_node const& no return primitive_description.str(); } -fused_conv_eltwise_inst::typed_primitive_inst(network_impl& network, fused_conv_eltwise_node const& node) +fused_conv_eltwise_inst::typed_primitive_inst(network& network, fused_conv_eltwise_node const& node) : parent(network, node) { auto stride = argument.conv.stride; diff --git a/inference-engine/thirdparty/clDNN/src/gather.cpp b/inference-engine/thirdparty/clDNN/src/gather.cpp index 5a264d2505b448..a8f0d2f97e946d 100644 --- a/inference-engine/thirdparty/clDNN/src/gather.cpp +++ b/inference-engine/thirdparty/clDNN/src/gather.cpp @@ -49,6 +49,6 @@ std::string gather_inst::to_string(gather_node const& node) { return primitive_description.str(); } -gather_inst::typed_primitive_inst(network_impl& network, gather_node const& node) : parent(network, node) {} +gather_inst::typed_primitive_inst(network& network, gather_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/gather_elements.cpp b/inference-engine/thirdparty/clDNN/src/gather_elements.cpp index 7a3a920aa6277e..74daa47115d98c 100644 --- a/inference-engine/thirdparty/clDNN/src/gather_elements.cpp +++ b/inference-engine/thirdparty/clDNN/src/gather_elements.cpp @@ -57,6 +57,6 @@ std::string gather_elements_inst::to_string(gather_elements_node const& node) { return primitive_description.str(); } -gather_elements_inst::typed_primitive_inst(network_impl& network, gather_elements_node const& node) : parent(network, node) {} +gather_elements_inst::typed_primitive_inst(network& network, gather_elements_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/gather_nd.cpp b/inference-engine/thirdparty/clDNN/src/gather_nd.cpp index 998df5a76b2198..84c283072c024f 100644 --- a/inference-engine/thirdparty/clDNN/src/gather_nd.cpp +++ b/inference-engine/thirdparty/clDNN/src/gather_nd.cpp @@ -97,6 +97,6 @@ std::string gather_nd_inst::to_string(gather_nd_node const& node) { return primitive_description.str(); } -gather_nd_inst::typed_primitive_inst(network_impl& network, gather_nd_node const& node) : parent(network, node) {} +gather_nd_inst::typed_primitive_inst(network& network, gather_nd_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/gather_tree.cpp b/inference-engine/thirdparty/clDNN/src/gather_tree.cpp index 6610df3523c777..d26bd44187f5aa 100644 --- a/inference-engine/thirdparty/clDNN/src/gather_tree.cpp +++ b/inference-engine/thirdparty/clDNN/src/gather_tree.cpp @@ -29,7 +29,7 @@ std::string gather_tree_inst::to_string(gather_tree_node const& node) { return primitive_description.str(); } -gather_tree_inst::typed_primitive_inst(network_impl& network, gather_tree_node const& node) : parent(network, node) { +gather_tree_inst::typed_primitive_inst(network& network, gather_tree_node const& node) : parent(network, node) { auto input_layout = node.input().get_output_layout(); const auto input_format = input_layout.format; diff --git a/inference-engine/thirdparty/clDNN/src/gemm.cpp b/inference-engine/thirdparty/clDNN/src/gemm.cpp index 2652116b90a7c3..9c2cbeabf0c0ca 100644 --- a/inference-engine/thirdparty/clDNN/src/gemm.cpp +++ b/inference-engine/thirdparty/clDNN/src/gemm.cpp @@ -73,7 +73,7 @@ std::string gemm_inst::to_string(gemm_node const& node) { return primitive_description.str(); } -gemm_inst::typed_primitive_inst(network_impl& network, gemm_node const& node) : parent(network, node) { +gemm_inst::typed_primitive_inst(network& network, gemm_node const& node) : parent(network, node) { auto input0_layout = node.input(0).get_output_layout(); auto input1_layout = node.input(1).get_output_layout(); bool transpose_input0 = node.get_primitive()->transpose_input0; diff --git a/inference-engine/thirdparty/clDNN/src/generic_layer.cpp b/inference-engine/thirdparty/clDNN/src/generic_layer.cpp index b1477872d925a8..faffd92da8e1d3 100644 --- a/inference-engine/thirdparty/clDNN/src/generic_layer.cpp +++ b/inference-engine/thirdparty/clDNN/src/generic_layer.cpp @@ -19,12 +19,12 @@ primitive_type_id generic_layer::type_id() { return &instance; } -generic_layer_node::typed_program_node(const std::shared_ptr prim, program_impl& prog) +generic_layer_node::typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { can_share_buffer(false); } -generic_layer_inst::typed_primitive_inst(network_impl& network, generic_layer_node const& node) +generic_layer_inst::typed_primitive_inst(network& network, generic_layer_node const& node) : parent(network, node) {} std::string generic_layer_inst::to_string(generic_layer_node const& node) { diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/add_required_reorders.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/add_required_reorders.cpp index 4a36fb44f38790..cebf249cd1b92f 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/add_required_reorders.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/add_required_reorders.cpp @@ -23,7 +23,7 @@ If not than required reorder is added to the network. /* Add a reorder in between node and usr */ -void add_required_reorders::add_reorder(program_impl& p, program_node* node, program_node* usr) { +void add_required_reorders::add_reorder(program& p, program_node* node, program_node* usr) { layout reorder_layout = node->get_output_layout(); reorder_layout.format = usr->get_output_layout().format; reorder_layout.data_type = usr->get_output_layout().data_type; @@ -31,7 +31,7 @@ void add_required_reorders::add_reorder(program_impl& p, program_node* node, pro auto new_reorder = std::make_shared(node->id() + "_reorder_" + usr->id(), node->id(), reorder_layout); auto& new_reorder_node = p.get_or_create(new_reorder); - // ToDo: add a method to program_impl class which adds an intermediate node given a node and its user + // ToDo: add a method to program class which adds an intermediate node given a node and its user auto it = std::find(usr->get_dependencies().begin(), usr->get_dependencies().end(), node); if (it == usr->get_dependencies().end()) { throw std::runtime_error("Inconcistency in topology description: user of a node is not present among its dependecies."); @@ -43,7 +43,7 @@ void add_required_reorders::add_reorder(program_impl& p, program_node* node, pro p.add_intermediate(new_reorder_node, *usr, idx); } -void add_required_reorders::run(program_impl& p) { +void add_required_reorders::run(program& p) { auto usr_itr = p.get_processing_order().begin(); while (usr_itr != p.get_processing_order().end()) { auto& usr = *usr_itr++; diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/basic_memory_dependencies.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/basic_memory_dependencies.cpp index 1dd8b0af12adc1..37acd2f86e08c4 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/basic_memory_dependencies.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/basic_memory_dependencies.cpp @@ -7,7 +7,7 @@ #include "pass_manager.h" #include "program_node.h" #include "layout_optimizer.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "program_helpers.h" #include "runtime/cldnn_itt.hpp" #include @@ -18,7 +18,7 @@ using namespace cldnn; -void basic_memory_dependencies::run(program_impl& p) { +void basic_memory_dependencies::run(program& p) { OV_ITT_SCOPED_TASK(itt::domains::CLDNN, "CLDNN::pass::BasicMemoryDependencies"); auto itr = p.get_processing_order().begin(); std::vector past_outputs; diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/calculate_prior_boxes.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/calculate_prior_boxes.cpp index 00f74be859345a..73aa0cc34f1af4 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/calculate_prior_boxes.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/calculate_prior_boxes.cpp @@ -7,12 +7,12 @@ #include "pass_manager.h" #include "prior_box_inst.h" #include "program_node.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include using namespace cldnn; -void calculate_prior_boxes::run(program_impl& p) { +void calculate_prior_boxes::run(program& p) { auto itr = p.get_processing_order().begin(); while (itr != p.get_processing_order().end()) { auto& node = (*itr++); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp index 477c1508fedd5d..e4d0c16c7a3aab 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp @@ -21,7 +21,7 @@ using namespace cldnn; -void compile_graph::run(program_impl& p) { +void compile_graph::run(program& p) { OV_ITT_SCOPED_TASK(itt::domains::CLDNN, "CLDNN::pass::CompileGraph"); size_t order_idx = 0; for (auto& node : p.get_processing_order()) { diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/concat_input_order.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/concat_input_order.cpp index 9acd92fc7266bb..6faabb90988f0d 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/concat_input_order.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/concat_input_order.cpp @@ -10,7 +10,7 @@ #include "fully_connected_inst.h" #include "data_inst.h" #include "cldnn/runtime/memory.hpp" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include #include @@ -111,7 +111,7 @@ void shuffle_features(program_node& node, const std::vector& rang } // namespace -void concat_input_order::run(program_impl& p) { +void concat_input_order::run(program& p) { for (auto node : p.get_processing_order()) { // Check that optimization can be performed: // 1. Not an output diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_remove_stride.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_remove_stride.cpp index b0c28bd93a60d0..dd8b3cdfe878e8 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_remove_stride.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_remove_stride.cpp @@ -15,7 +15,7 @@ using namespace cldnn; -void eltwise_remove_stride::conv_stride_extend(program_impl& p, program_node& node, cldnn::tensor& tensor) { +void eltwise_remove_stride::conv_stride_extend(program& p, program_node& node, cldnn::tensor& tensor) { // make sure we have only 1 user if (node.get_users().size() > 1) return; @@ -51,7 +51,7 @@ void eltwise_remove_stride::conv_stride_extend(program_impl& p, program_node& no } } -void eltwise_remove_stride::run(program_impl& p) { +void eltwise_remove_stride::run(program& p) { for (auto& node : p.get_processing_order()) { if (node->is_type()) { // TODO: make fp16 work diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_shrinking.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_shrinking.cpp index 9b52e8740eae5d..b5f513ed9683a8 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_shrinking.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/eltwise_shrinking.cpp @@ -8,7 +8,7 @@ using namespace cldnn; -void eltwise_shrinking::run(program_impl& p) { +void eltwise_shrinking::run(program& p) { std::vector convs_to_shrink; for (auto& node : p.get_processing_order()) { diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/graph_initializations.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/graph_initializations.cpp index dcd198568d6e8b..24d45ecca785bb 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/graph_initializations.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/graph_initializations.cpp @@ -38,7 +38,7 @@ std::string get_id_string(size_t i) { return ss.str(); } -void graph_initializations::handle_split_node(program_impl& p, split_node& node) { +void graph_initializations::handle_split_node(program& p, split_node& node) { if (!node.get_users().empty()) { throw std::logic_error("Split layer cannot be used directly! Please use split output \"" + node.id() + ":\"!"); @@ -97,7 +97,7 @@ void graph_initializations::handle_split_node(program_impl& p, split_node& node) p.nodes_map.erase(node.id()); } -void graph_initializations::handle_lstm_node(program_impl& p, lstm_node& node) { +void graph_initializations::handle_lstm_node(program& p, lstm_node& node) { // lstm_node& lstm_node = node->as(); bool initial_hidden_term = node.initial_hidden_term(); bool initial_cell_term = node.initial_cell_term(); @@ -329,7 +329,7 @@ void graph_initializations::handle_lstm_node(program_impl& p, lstm_node& node) { p.nodes_map.erase(node.id()); } -void graph_initializations::handle_dynamic_lstm_node(program_impl& p, lstm_dynamic_node& node) { +void graph_initializations::handle_dynamic_lstm_node(program& p, lstm_dynamic_node& node) { // [0] Prepare helper temp variables. // auto& lstm_dynamic_node = node->as(); auto& node_id = node.id(); @@ -402,7 +402,7 @@ void graph_initializations::handle_dynamic_lstm_node(program_impl& p, lstm_dynam // we dont have to set output since it will be done in next graph_opts step } -void graph_initializations::set_outputs(program_impl& p) { +void graph_initializations::set_outputs(program& p) { auto outputs_option = p.get_options().get(); if (!outputs_option->outputs.empty()) { for (auto const& output : outputs_option->outputs) { @@ -419,7 +419,7 @@ void graph_initializations::set_outputs(program_impl& p) { } } -void graph_initializations::run(program_impl& p) { +void graph_initializations::run(program& p) { auto itr = p.nodes_map.begin(); while (itr != p.nodes_map.end()) { auto node_itr = itr++; diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_input_padding.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_input_padding.cpp index 84496690536dca..4b35d4d77f25bb 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_input_padding.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_input_padding.cpp @@ -17,7 +17,7 @@ using namespace cldnn; // Symmetric padding can be done using input_offset parameter for primitives. // Asymmetric padding can be done by adding border primitive before them. It's safe way without modyfing optimized // kernels. -void handle_input_padding::run(program_impl& p) { +void handle_input_padding::run(program& p) { for (auto& node : p.get_processing_order()) { if (!node->is_type()) { continue; diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_reshape.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_reshape.cpp index 54423a6d758be7..288f52de7a961d 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_reshape.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/handle_reshape.cpp @@ -22,7 +22,7 @@ using namespace cldnn; // primitives with single user //- in case of reshape->reorder sequence, the additional reorder before reshape will be added, // if last reorder does not contain padding or mean subtract, it will be removed later in the graph -void handle_reshape::run(program_impl& p) { +void handle_reshape::run(program& p) { // Remove reshapes that don't change the layout of output auto node_itr = p.get_processing_order().begin(); while (node_itr != p.get_processing_order().end()) { diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/mark_nodes.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/mark_nodes.cpp index c7b74650a8a696..9621e31b3a0432 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/mark_nodes.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/mark_nodes.cpp @@ -5,11 +5,11 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include "pass_manager.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" using namespace cldnn; -void mark_nodes::run(program_impl& p) { +void mark_nodes::run(program& p) { for (const auto& node : p.get_processing_order()) { p.mark_if_constant(*node); p.mark_if_data_flow(*node); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/oooq_memory_dependencies.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/oooq_memory_dependencies.cpp index ccf9903701a897..248b9b7e57a733 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/oooq_memory_dependencies.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/oooq_memory_dependencies.cpp @@ -7,7 +7,7 @@ #include "pass_manager.h" #include "program_node.h" #include "layout_optimizer.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "program_helpers.h" #include "runtime/cldnn_itt.hpp" #include @@ -69,7 +69,7 @@ class bits_64 { } // namespace -void oooq_memory_dependencies::run(program_impl& p) { +void oooq_memory_dependencies::run(program& p) { OV_ITT_SCOPED_TASK(itt::domains::CLDNN, "CLDNN::pass::OooqMemoryDependencies"); // For oooq memory dependencies nodes A and B can't share memory if // processing_num(A) < processing_num(B) and there is no path from A to B. diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp index bb80f2ed2ed848..f30e3720ddbce2 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp @@ -18,14 +18,14 @@ If not than required reorder is added to the network. /* Add a reorder in between node and usr with reorder_layout as layout */ -program_node& post_input_reorder::add_reorder(program_impl& p, +program_node& post_input_reorder::add_reorder(program& p, program_node* node, program_node* usr, const layout& reorder_layout) { auto new_reorder = std::make_shared(node->id() + "_reorder_" + usr->id(), node->id(), reorder_layout); auto& new_reorder_node = p.get_or_create(new_reorder); - // ToDo: add a method to program_impl class which adds an intermediate node given a node and its user + // ToDo: add a method to program class which adds an intermediate node given a node and its user auto it = std::find(usr->get_dependencies().begin(), usr->get_dependencies().end(), node); if (it == usr->get_dependencies().end()) { throw std::runtime_error("Inconcistency in topology description: user of a node is not present among its dependecies."); @@ -38,7 +38,7 @@ program_node& post_input_reorder::add_reorder(program_impl& p, return new_reorder_node; } -void post_input_reorder::run(program_impl& p) { +void post_input_reorder::run(program& p) { auto node_itr = p.get_processing_order().begin(); while (node_itr != p.get_processing_order().end()) { auto& node = *node_itr++; diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_optimize_weights.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_optimize_weights.cpp index bc32bc1fdfa923..2072e2f74cf02d 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_optimize_weights.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_optimize_weights.cpp @@ -34,7 +34,7 @@ post_optimize_weights::weights_bias_offset post_optimize_weights::get_weights_bi // function which prepares given primitive for weights optimization template -void post_optimize_weights::optimize_weights(T& node, program_impl& p) { +void post_optimize_weights::optimize_weights(T& node, program& p) { auto offsets = get_weights_bias_offset(node); auto impl = node.get_selected_impl(); auto output_layout = node.get_output_layout(); @@ -69,7 +69,7 @@ void post_optimize_weights::optimize_weights(T& node, program_impl& p) { node.set_output_layout(output_layout, false); } -void post_optimize_weights::run(program_impl& p) { +void post_optimize_weights::run(program& p) { for (auto& node : p.get_processing_order()) { if (node->type() == convolution::type_id()) { optimize_weights(node->as(), p); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_optimize_bias.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_optimize_bias.cpp index 9314d6ad873700..53538750860c69 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_optimize_bias.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_optimize_bias.cpp @@ -7,7 +7,7 @@ #include "pass_manager.h" #include "program_node.h" #include "layout_optimizer.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "program_helpers.h" #include "fully_connected_inst.h" @@ -15,11 +15,11 @@ using namespace cldnn; pre_optimize_bias::pre_optimize_bias(reorder_factory& rf_ref) : base_pass("pre_optimize_bias"), _rf(rf_ref) {} -void pre_optimize_bias::run(program_impl& p) { run(p, _rf); } +void pre_optimize_bias::run(program& p) { run(p, _rf); } // function which prepares given primitive for weights optimization template -void pre_optimize_bias::optimize_bias(T& node, reorder_factory& rf, program_impl& p) { +void pre_optimize_bias::optimize_bias(T& node, reorder_factory& rf, program& p) { size_t weights_offset = node.get_primitive()->input.size(); size_t bias_offset = weights_offset + program_helpers::wrap_if_single(node.get_primitive()->weights).size(); for (size_t i = bias_offset; i < node.get_dependencies().size() - node.get_fused_inputs_count(); ++i) { @@ -38,15 +38,15 @@ void pre_optimize_bias::optimize_bias(T& node, reorder_factory& rf, program_impl } template void pre_optimize_bias::optimize_bias(convolution_node& node, reorder_factory& rf, - program_impl& p); + program& p); template void pre_optimize_bias::optimize_bias(deconvolution_node& node, reorder_factory& rf, - program_impl& p); + program& p); template void pre_optimize_bias::optimize_bias(fully_connected_node& node, reorder_factory& rf, - program_impl& p); + program& p); -void pre_optimize_bias::run(program_impl& p, reorder_factory& rf) { +void pre_optimize_bias::run(program& p, reorder_factory& rf) { for (auto& prim : p.get_processing_order()) { if (prim->type() == convolution::type_id()) { optimize_bias(prim->as(), rf, p); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp index bfc02321d0e3f2..db2db73e4d587d 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/pre_replace_deconv.cpp @@ -18,7 +18,7 @@ #include #include "cldnn/runtime/error_handler.hpp" -void pre_replace_deconv::run(program_impl& p) { +void pre_replace_deconv::run(program& p) { bool update_processing_order = false; auto& stream = p.get_stream(); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_buffer_fusing.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_buffer_fusing.cpp index c57e72ad5f4a4e..29f653e55f217d 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_buffer_fusing.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_buffer_fusing.cpp @@ -240,7 +240,7 @@ void concat_in_place_optimization::optimize_cascade(concatenation_node& node, st } // namespace // ToDo remove friendship relation from program_node -void prepare_buffer_fusing::run(program_impl& p) { +void prepare_buffer_fusing::run(program& p) { bool is_debug = p.get_options().get()->enabled(); /* We need to take care of proper ordering by types. diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_padding.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_padding.cpp index 6108607dcaf382..d6bb80a836425a 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_padding.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_padding.cpp @@ -13,7 +13,7 @@ using namespace cldnn; -void prepare_padding::run(program_impl& p) { +void prepare_padding::run(program& p) { if (output_size_handling_enabled) { // Prepare upper padding for primitives that support output_size parameter. for (const auto& node : p.get_processing_order()) { diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_primitive_fusing.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_primitive_fusing.cpp index 7b82fb54e3c409..d58593acde895a 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_primitive_fusing.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_primitive_fusing.cpp @@ -53,7 +53,7 @@ #include #include "cldnn/runtime/error_handler.hpp" -void prepare_primitive_fusing::run(program_impl& p) { +void prepare_primitive_fusing::run(program& p) { fuse_reorders(p); fuse_sigmoid_mul_to_swish(p); fuse_bias(p); @@ -62,7 +62,7 @@ void prepare_primitive_fusing::run(program_impl& p) { optimize_fused_ops(p); } -void prepare_primitive_fusing::fuse_sigmoid_mul_to_swish(program_impl &p) { +void prepare_primitive_fusing::fuse_sigmoid_mul_to_swish(program &p) { auto itr = p.get_processing_order().begin(); while (itr != p.get_processing_order().end()) { auto node_itr = itr++; @@ -127,7 +127,7 @@ void prepare_primitive_fusing::fuse_sigmoid_mul_to_swish(program_impl &p) { } } -void prepare_primitive_fusing::fuse_reorders(program_impl &p) { +void prepare_primitive_fusing::fuse_reorders(program &p) { // This loop tries fusing several reorders one by one (if present) into one reorder auto itr = p.get_processing_order().begin(); while (itr != p.get_processing_order().end()) { @@ -164,7 +164,7 @@ void prepare_primitive_fusing::fuse_reorders(program_impl &p) { } } -void prepare_primitive_fusing::fuse_activations(program_impl &p) { +void prepare_primitive_fusing::fuse_activations(program &p) { bool is_debug = p.get_options().get()->enabled(); std::map> fusing_history; auto itr = p.get_processing_order().begin(); @@ -238,7 +238,7 @@ void prepare_primitive_fusing::fuse_activations(program_impl &p) { } } -void prepare_primitive_fusing::fuse_bias(program_impl &p) { +void prepare_primitive_fusing::fuse_bias(program &p) { auto itr = p.get_processing_order().begin(); while (itr != p.get_processing_order().end()) { auto node_itr = itr++; @@ -352,7 +352,7 @@ void prepare_primitive_fusing::fuse_bias(program_impl &p) { } } -void prepare_primitive_fusing::fuse_simple_primitives(program_impl &p) { +void prepare_primitive_fusing::fuse_simple_primitives(program &p) { bool recalc_processing_order = false; std::map> fusing_history; @@ -1010,7 +1010,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program_impl &p) { p.get_processing_order().calc_processing_order(p); } -void prepare_primitive_fusing::optimize_fused_ops(program_impl& p) { +void prepare_primitive_fusing::optimize_fused_ops(program& p) { auto itr = p.get_processing_order().begin(); while (itr != p.get_processing_order().end()) { auto node_itr = itr++; @@ -1070,7 +1070,7 @@ void prepare_primitive_fusing::optimize_fused_ops(program_impl& p) { } } -void prepare_conv_eltw_fusing::fuse_conv_depth_to_space(program_impl& p, program_node* node) { +void prepare_conv_eltw_fusing::fuse_conv_depth_to_space(program& p, program_node* node) { std::map> fusing_history; // make sure this convolution have only 1 user and it's depth_to_space // make sure convolution is not an output @@ -1103,7 +1103,7 @@ void prepare_conv_eltw_fusing::fuse_conv_depth_to_space(program_impl& p, program p.fuse_nodes(*conv_node, *d_t_s_node, &fusing_history); } -void prepare_conv_eltw_fusing::fuse_conv_eltwise(program_impl& p, program_node* node) { +void prepare_conv_eltw_fusing::fuse_conv_eltwise(program& p, program_node* node) { // make sure this convolution have only 1 user and it's eltwise // make sure convolution is not an output if (node->get_users().size() != 1 || node->is_output()) @@ -1296,7 +1296,7 @@ void prepare_conv_eltw_fusing::fuse_conv_eltwise(program_impl& p, program_node* p.add_optimized_primitive_info(eltw_id, {new_node.id()}); } -void prepare_conv_eltw_fusing::run(program_impl& p) { +void prepare_conv_eltw_fusing::run(program& p) { std::list conv_nodes; // note we need to use iterators since currently processed element can be removed auto itr = p.get_processing_order().begin(); @@ -1324,7 +1324,7 @@ void prepare_conv_eltw_fusing::run(program_impl& p) { } } -void prepare_conv_eltw_read_write_opt::conv_eltwise_read_write_opt(program_impl& p, program_node* node) { +void prepare_conv_eltw_read_write_opt::conv_eltwise_read_write_opt(program& p, program_node* node) { fused_conv_eltwise_node* fused_conv_eltw_node = static_cast(node); program_node* second_input_node = &fused_conv_eltw_node->get_dependency(1); // output layouts must match @@ -1383,7 +1383,7 @@ void prepare_conv_eltw_read_write_opt::conv_eltwise_read_write_opt(program_impl& prim->second_input_in_output = true; } -void prepare_conv_eltw_read_write_opt::run(program_impl& p) { +void prepare_conv_eltw_read_write_opt::run(program& p) { std::list fused_conv_eltw_nodes; auto itr = p.get_processing_order() .begin(); // note we need to use iterators since currently processed element can be removed diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_quantization.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_quantization.cpp index 277676f87ac717..819cb87dd405be 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_quantization.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/prepare_quantization.cpp @@ -21,7 +21,7 @@ #include template -bool check_binarization(memory::ptr mem_input_low, memory::ptr mem_input_high, program_impl& p) { +bool check_binarization(memory::ptr mem_input_low, memory::ptr mem_input_high, program& p) { bool is_binarization = true; const auto& stream = p.get_stream(); mem_lock data_input_low_lock{mem_input_low, stream}; @@ -39,7 +39,7 @@ bool check_binarization(memory::ptr mem_input_low, memory::ptr mem_input_high, p } -void prepare_quantization::prepare_scale_shift_opt(program_impl &p, quantize_node& quantize_node) { +void prepare_quantization::prepare_scale_shift_opt(program &p, quantize_node& quantize_node) { const auto& stream = p.get_stream(); program_node &input_low_node = quantize_node.get_dependency(1); program_node &input_high_node = quantize_node.get_dependency(2); @@ -286,7 +286,7 @@ void prepare_quantization::prepare_scale_shift_opt(program_impl &p, quantize_no } } -void prepare_quantization::handle_quantize_node(program_impl& p, quantize_node& quantize_node) { +void prepare_quantization::handle_quantize_node(program& p, quantize_node& quantize_node) { if (quantize_node.get_primitive()->levels == 2) { prepare_packed_quantize(p, quantize_node); } else if (quantize_node.get_primitive()->levels <= 256 && !quantize_node.get_scale_shift_opt() && !quantize_node.is_constant()) { @@ -294,7 +294,7 @@ void prepare_quantization::handle_quantize_node(program_impl& p, quantize_node& } } -void prepare_quantization::prepare_packed_quantize(program_impl& p, quantize_node& quantize_node) { +void prepare_quantization::prepare_packed_quantize(program& p, quantize_node& quantize_node) { program_node &input_low_node = quantize_node.get_dependency(1); program_node &input_high_node = quantize_node.get_dependency(2); @@ -331,7 +331,7 @@ void prepare_quantization::prepare_packed_quantize(program_impl& p, quantize_nod quantize_node.recalc_output_layout(); } -void prepare_quantization::prepare_dequantize_merge(program_impl& p, eltwise_node& eltwise_node) { +void prepare_quantization::prepare_dequantize_merge(program& p, eltwise_node& eltwise_node) { for (size_t i = 1; i < eltwise_node.get_dependencies().size(); i++) { if (!eltwise_node.get_dependency(i).is_type()) { return; @@ -403,7 +403,7 @@ void prepare_quantization::prepare_dequantize_merge(program_impl& p, eltwise_nod } } -void prepare_quantization::remove_fake_reorders(program_impl& p, reorder_node& reorder_node) { +void prepare_quantization::remove_fake_reorders(program& p, reorder_node& reorder_node) { if (!reorder_node.is_in_data_flow() || reorder_node.get_users().size() != 1 || reorder_node.get_dependencies().size() != 1) { return; } @@ -447,7 +447,7 @@ void fill_compensation_typed(W_T* w, AZP_T* azp, W_T* wzp, float* comp, const in } } -void prepare_quantization::prepare_asymmetric_quantization(program_impl &p, convolution_node& convolution_node) { +void prepare_quantization::prepare_asymmetric_quantization(program &p, convolution_node& convolution_node) { // Detects if given eltwise node performs zero point subtraction auto is_zero_point_node = [](const eltwise_node& node) -> bool { auto prim = node.get_primitive(); @@ -718,7 +718,7 @@ void prepare_quantization::prepare_asymmetric_quantization(program_impl &p, conv new_conv_node.recalc_output_layout(); } -void prepare_quantization::run(program_impl& p) { +void prepare_quantization::run(program& p) { auto itr = p.get_processing_order().begin(); while (itr != p.get_processing_order().end()) { auto &node = (*itr++); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/propagate_constants.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/propagate_constants.cpp index 83e2742063f713..ad78e700f492ec 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/propagate_constants.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/propagate_constants.cpp @@ -7,8 +7,8 @@ #include "pass_manager.h" #include "program_node.h" #include "cldnn/runtime/engine.hpp" -#include "program_impl.h" -#include "network_impl.h" +#include "cldnn/graph/program.hpp" +#include "cldnn/graph/network.hpp" #include "data_inst.h" #include "runtime/cldnn_itt.hpp" #include @@ -18,8 +18,8 @@ using namespace cldnn; -// ToDo remove friendship relation from program_node and program_impl -void propagate_constants::run(program_impl& p) { +// ToDo remove friendship relation from program_node and program +void propagate_constants::run(program& p) { OV_ITT_SCOPED_TASK(itt::domains::CLDNN, "CLDNN::pass::PropagateConstants"); for (auto& node : p.get_processing_order()) { if (node->is_constant()) @@ -113,7 +113,7 @@ std::list> propagate_constants::calculate(e bo.set_option(build_option::optimize_data(false)); bo.set_option(build_option::outputs(const_outputs)); - network_impl::ptr net = network_impl::build_network(engine, nodes, bo, true); + network::ptr net = network::build_network(engine, nodes, bo, true); for (auto& cin : const_inputs) net->set_input_data(cin->id(), cin->get_attached_memory_ptr()); @@ -127,7 +127,7 @@ std::list> propagate_constants::calculate(e return ret; } -void propagate_constants::handle_constant(program_impl& prog, program_node& node) { +void propagate_constants::handle_constant(program& prog, program_node& node) { if (!node.is_type()) { add_constant(prog, node); if (has_non_const_user(node)) @@ -135,7 +135,7 @@ void propagate_constants::handle_constant(program_impl& prog, program_node& node } } -void propagate_constants::add_constant(program_impl& prog, program_node& node) { +void propagate_constants::add_constant(program& prog, program_node& node) { if (node.is_type()) return; nodes.insert(prog.get_node_ptr(node.get_primitive()->id)); @@ -149,7 +149,7 @@ void propagate_constants::add_constant(program_impl& prog, program_node& node) { add_deps_to_tpl(prog, node.get_dependencies()); } -void propagate_constants::add_deps_to_tpl(program_impl& prog, const std::vector& deps) { +void propagate_constants::add_deps_to_tpl(program& prog, const std::vector& deps) { /* Nodes can share dependencies, if we already have dep in tpl, don't add it again. example: diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp index bb6563ee617d8e..fc7ce14f260c87 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp @@ -22,7 +22,7 @@ remove_redundant_reorders::remove_redundant_reorders(layout_optimizer& lo_ref, b : base_pass("remove_redundant_reorders"), lo(lo_ref), enable_reorder_fusing(enable_reorder_fusing), update_implementations(update_implementations), remove_output_reorders(remove_output_reorders) {} -void remove_redundant_reorders::run(program_impl& p) { +void remove_redundant_reorders::run(program& p) { auto update_implementation = [&](program_node& node) { if (!update_implementations) return; diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/reorder_inputs.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/reorder_inputs.cpp index 98cd58b5062c10..5adf2194015a38 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/reorder_inputs.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/reorder_inputs.cpp @@ -7,7 +7,7 @@ #include "pass_manager.h" #include "program_node.h" #include "layout_optimizer.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "program_helpers.h" #include "binary_convolution_inst.h" #include "mvn_inst.h" @@ -43,15 +43,15 @@ using namespace cldnn; -// ToDo remove friendship relation from program_impl +// ToDo remove friendship relation from program reorder_inputs::reorder_inputs(layout_optimizer& lo_ref, reorder_factory& rf_ref) : base_pass("reorder_inputs"), _lo(lo_ref), _rf(rf_ref) {} -void reorder_inputs::run(program_impl& p) { run(p, _lo, _rf); } +void reorder_inputs::run(program& p) { run(p, _lo, _rf); } namespace { -std::map get_preferred_formats(program_impl& p, layout_optimizer& lo) { +std::map get_preferred_formats(program& p, layout_optimizer& lo) { std::map fmt_map; for (auto n : p.get_processing_order()) { if (!n->is_in_data_flow()) @@ -200,7 +200,7 @@ void propagate_formats_in_dir(std::map& fmt_map, } } -void propagate_formats(program_impl& p, std::map& fmt_map, layout_optimizer& lo) { +void propagate_formats(program& p, std::map& fmt_map, layout_optimizer& lo) { auto it = p.get_processing_order().begin(); while (it != p.get_processing_order().end()) { auto node = *it++; @@ -251,7 +251,7 @@ reorder_cnt count_reorders(const std::map& fmt_map, return { fwd.number + bwd.number, fwd.total_sizes + bwd.total_sizes }; } -void minimize_local_reorders(program_impl& p, std::map& fmt_map, layout_optimizer& lo) { +void minimize_local_reorders(program& p, std::map& fmt_map, layout_optimizer& lo) { for (auto node : p.get_processing_order()) { if (!node->is_in_data_flow()) continue; @@ -334,7 +334,7 @@ void minimize_local_reorders(program_impl& p, std::map -void insert_reorders_in_dir(program_impl& p, const std::map& fmt_map, reorder_factory& rf, program_node* node) { +void insert_reorders_in_dir(program& p, const std::map& fmt_map, reorder_factory& rf, program_node* node) { auto fmt = fmt_map.at(node); auto next_cpy = travel_direction_wrapper::next_nodes(node); @@ -369,7 +369,7 @@ void insert_reorders_in_dir(program_impl& p, const std::map& fmt_map, reorder_factory& rf) { +void insert_reorders(program& p, const std::map& fmt_map, reorder_factory& rf) { auto fwd_it = p.get_processing_order().begin(); while (fwd_it != p.get_processing_order().end()) { auto node = *(fwd_it++); @@ -401,7 +401,7 @@ void insert_reorders(program_impl& p, const std::mapis_type()) { auto& typed_node = node->as(); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/skipped_branch_memory_dependencies.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/skipped_branch_memory_dependencies.cpp index a3ac6478673d13..73cd13d2177537 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/skipped_branch_memory_dependencies.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/skipped_branch_memory_dependencies.cpp @@ -7,7 +7,7 @@ #include "pass_manager.h" #include "program_node.h" #include "layout_optimizer.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "program_helpers.h" #include "runtime/cldnn_itt.hpp" #include @@ -18,7 +18,7 @@ using namespace cldnn; -void skipped_branch_memory_dependencies::run(program_impl& p) { +void skipped_branch_memory_dependencies::run(program& p) { OV_ITT_SCOPED_TASK(itt::domains::CLDNN, "CLDNN::pass::SkippedBranchMemoryDependencies"); // Primitive A can't use primitive B buffer if processing_num(B) < processing_num(A) and for any usr - the user of B // processing_num(usr) > processing_num(A) Otherwise it could override data that has to be used in the future. diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/strided_slice_optimize.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/strided_slice_optimize.cpp index 3546a7d427cab4..9ea65a9b3e5fa4 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/strided_slice_optimize.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/strided_slice_optimize.cpp @@ -15,7 +15,7 @@ using namespace cldnn; -void strided_slice_optimize::run(program_impl& p) { +void strided_slice_optimize::run(program& p) { auto node_itr = p.get_processing_order().begin(); while (node_itr != p.get_processing_order().end()) { auto& node = (*node_itr++); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/trim_to_outputs.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/trim_to_outputs.cpp index a981b93b886b2a..482e3a2fdbfdf2 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/trim_to_outputs.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/trim_to_outputs.cpp @@ -16,7 +16,7 @@ using namespace cldnn; // This pass optimizes out nodes which have no impact on outputs -void trim_to_outputs::run(program_impl& p) { +void trim_to_outputs::run(program& p) { const size_t actual_nodes = p.get_processing_order().size(); if (actual_nodes == 0 || actual_nodes == p.get_outputs().size()) { return; @@ -58,4 +58,4 @@ void trim_to_outputs::run(program_impl& p) { to_rem.push_back(node); } p.remove_nodes(to_rem); -} \ No newline at end of file +} diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/update_loop_primitive_map.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/update_loop_primitive_map.cpp index b34762d2ed64d2..d8880116a920e1 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/update_loop_primitive_map.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/update_loop_primitive_map.cpp @@ -14,7 +14,7 @@ using namespace cldnn; -void update_loop_primitive_map::run(program_impl& p) { +void update_loop_primitive_map::run(program& p) { for (auto& node : p.get_processing_order()) { if (!node->is_type()) { continue; diff --git a/inference-engine/thirdparty/clDNN/src/grn.cpp b/inference-engine/thirdparty/clDNN/src/grn.cpp index 23e6b54aa8bbac..2c22d8dc716dda 100644 --- a/inference-engine/thirdparty/clDNN/src/grn.cpp +++ b/inference-engine/thirdparty/clDNN/src/grn.cpp @@ -38,5 +38,5 @@ std::string grn_inst::to_string(grn_node const& node) { return primitive_description.str(); } -grn_inst::typed_primitive_inst(network_impl& network, grn_node const& node) : parent(network, node) {} +grn_inst::typed_primitive_inst(network& network, grn_node const& node) : parent(network, node) {} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/impls/common/condition.cpp b/inference-engine/thirdparty/clDNN/src/impls/common/condition.cpp index 10071a3cfb6493..6a509b0fc27640 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/common/condition.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/common/condition.cpp @@ -3,7 +3,6 @@ // #include "condition_inst.h" -#include "network_impl.h" #include "impls/implementation_map.hpp" #include "register.hpp" @@ -106,7 +105,7 @@ struct condition_impl : typed_primitive_impl { return true; } - memory::ptr execute_branch(network_impl::ptr branch, + memory::ptr execute_branch(network::ptr branch, const primitive_id& input_id, memory::ptr input_memory) const { branch->set_input_data(input_id, input_memory); diff --git a/inference-engine/thirdparty/clDNN/src/impls/common/loop.cpp b/inference-engine/thirdparty/clDNN/src/impls/common/loop.cpp index 3a185f71edacdb..734e8c50e529b1 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/common/loop.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/common/loop.cpp @@ -4,7 +4,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include "loop_inst.h" -#include "network_impl.h" #include "impls/implementation_map.hpp" #include "register.hpp" #include "mutable_data_inst.h" diff --git a/inference-engine/thirdparty/clDNN/src/impls/common/wait_for_events.cpp b/inference-engine/thirdparty/clDNN/src/impls/common/wait_for_events.cpp index 9298c3e75e8dec..5f3d5e59651648 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/common/wait_for_events.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/common/wait_for_events.cpp @@ -8,7 +8,6 @@ #include "input_layout_inst.h" #include "impls/implementation_map.hpp" #include "register.hpp" -#include "network_impl.h" #include namespace cldnn { diff --git a/inference-engine/thirdparty/clDNN/src/impls/cpu/detection_output.cpp b/inference-engine/thirdparty/clDNN/src/impls/cpu/detection_output.cpp index ba1d145e571d74..ea879410b697e5 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/cpu/detection_output.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/cpu/detection_output.cpp @@ -3,7 +3,6 @@ // #include "detection_output_inst.h" -#include "network_impl.h" #include "impls/implementation_map.hpp" #include "math_utils.h" #include "register.hpp" diff --git a/inference-engine/thirdparty/clDNN/src/impls/cpu/non_max_suppression.cpp b/inference-engine/thirdparty/clDNN/src/impls/cpu/non_max_suppression.cpp index 66ed53df586598..3841f458315338 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/cpu/non_max_suppression.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/cpu/non_max_suppression.cpp @@ -4,9 +4,9 @@ #include "non_max_suppression_inst.h" #include "primitive_inst.h" -#include "network_impl.h" #include "register.hpp" #include "cpu_impl_helpers.hpp" +#include "impls/implementation_map.hpp" #include #include diff --git a/inference-engine/thirdparty/clDNN/src/impls/cpu/proposal.cpp b/inference-engine/thirdparty/clDNN/src/impls/cpu/proposal.cpp index 38efd84fe6761a..dea18f173deadd 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/cpu/proposal.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/cpu/proposal.cpp @@ -5,7 +5,6 @@ #include "proposal_inst.h" #include "cldnn/runtime/engine.hpp" #include "impls/implementation_map.hpp" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" #include "register.hpp" diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/custom_primitive.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/custom_primitive.cpp index 24e2373e5ec4b0..0a574125a12b1f 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/custom_primitive.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/custom_primitive.cpp @@ -6,7 +6,6 @@ #include "cldnn/runtime/engine.hpp" #include "impls/implementation_map.hpp" #include "kernel_selector_helper.h" -#include "network_impl.h" #include "jitter.h" #include "cldnn/runtime/error_handler.hpp" #include "register.hpp" diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/fully_connected.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/fully_connected.cpp index a0a17c48df7020..8a98a16e0f4825 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/fully_connected.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/fully_connected.cpp @@ -11,7 +11,6 @@ #include "fully_connected/fully_connected_kernel_selector.h" #include "fully_connected/fully_connected_params.h" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" #include "kernel_runner.h" diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/generic_layer.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/generic_layer.cpp index f4e4cbf771399f..037ae850fc8754 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/generic_layer.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/generic_layer.cpp @@ -6,7 +6,6 @@ #include "cldnn/runtime/engine.hpp" #include "impls/implementation_map.hpp" #include "kernel_selector_helper.h" -#include "network_impl.h" #include "register.hpp" #include diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_input.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_input.cpp index 937d8390ea5fbb..732a012ae0aa76 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_input.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_input.cpp @@ -10,7 +10,6 @@ #include "kernel_selector_helper.h" #include "lstm_dynamic/lstm_dynamic_input_kernel_selector.h" #include "lstm_dynamic/lstm_dynamic_input_kernel_base.h" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" namespace cldnn { diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_timeloop.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_timeloop.cpp index 8834065f36921b..400e3596566651 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_timeloop.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_dynamic_timeloop.cpp @@ -10,7 +10,6 @@ #include "kernel_selector_helper.h" #include "lstm_dynamic/lstm_dynamic_timeloop_kernel_selector.h" #include "lstm_dynamic/lstm_dynamic_timeloop_kernel_base.h" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" namespace cldnn { diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_elt.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_elt.cpp index 9a7e30ed2ceff6..d7abfcf3db014c 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_elt.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_elt.cpp @@ -10,7 +10,6 @@ #include "kernel_selector_helper.h" #include "lstm/lstm_elt_kernel_selector.h" #include "lstm/lstm_elt_kernel_base.h" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" namespace cldnn { diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_gemm.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_gemm.cpp index 540067ed7b90da..fc5f01fff16aaa 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_gemm.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/lstm_gemm.cpp @@ -10,7 +10,6 @@ #include "kernel_selector_helper.h" #include "lstm/lstm_gemm_kernel_selector.h" #include "lstm/lstm_gemm_kernel_base.h" -#include "network_impl.h" #include "cldnn/runtime/error_handler.hpp" namespace cldnn { diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/max_unpooling.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/max_unpooling.cpp index ebf9cf74897b5c..169ec3b24a0e1c 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/max_unpooling.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/max_unpooling.cpp @@ -6,7 +6,7 @@ #include "primitive_base.hpp" #include "impls/implementation_map.hpp" #include "cldnn/runtime/error_handler.hpp" -#include "network_impl.h" +#include "cldnn/graph/network.hpp" #include "kernel_selector_helper.h" #include "max_unpooling/max_unpooling_kernel_selector.h" #include "max_unpooling/max_unpooling_kernel_base.h" diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/primitive_base.hpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/primitive_base.hpp index 3f6f82c57bd021..4315156be133a8 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/primitive_base.hpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/primitive_base.hpp @@ -7,10 +7,10 @@ #include #include "primitive_inst.h" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "cldnn/runtime/error_handler.hpp" #include "kernel_selector_helper.h" -#include "network_impl.h" +#include "cldnn/graph/network.hpp" #include "register.hpp" #include #include diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/pyramid_roi_align.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/pyramid_roi_align.cpp index b93bf0ec88cd4c..8e94639697ec41 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/pyramid_roi_align.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/pyramid_roi_align.cpp @@ -9,7 +9,6 @@ #include "pyramid_roi_align/pyramid_roi_align_kernel_base.h" #include "cldnn/runtime/error_handler.hpp" #include "pyramid_roi_align_inst.h" -#include "network_impl.h" #include diff --git a/inference-engine/thirdparty/clDNN/src/include/activation_inst.h b/inference-engine/thirdparty/clDNN/src/include/activation_inst.h index 989b2b557242a2..38c3b17c5ecb51 100644 --- a/inference-engine/thirdparty/clDNN/src/include/activation_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/activation_inst.h @@ -16,7 +16,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -48,7 +48,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) : parent(prim, prog) {} + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) {} program_node& input() const { return get_dependency(0); } }; @@ -32,7 +32,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/average_unpooling_inst.h b/inference-engine/thirdparty/clDNN/src/include/average_unpooling_inst.h index 0eef5fe75e221d..4998c8b04d8da5 100644 --- a/inference-engine/thirdparty/clDNN/src/include/average_unpooling_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/average_unpooling_inst.h @@ -27,7 +27,7 @@ class typed_primitive_inst : public typed_primitive_inst_base using parent = typed_primitive_inst_base; public: - typed_primitive_inst(network_impl& network, average_unpooling_node const& desc); + typed_primitive_inst(network& network, average_unpooling_node const& desc); static layout calc_output_layout(average_unpooling_node const& node); static std::string to_string(average_unpooling_node const& node); }; diff --git a/inference-engine/thirdparty/clDNN/src/include/batch_to_space_inst.h b/inference-engine/thirdparty/clDNN/src/include/batch_to_space_inst.h index 1b0feedd2f3dcd..860c5bad5d0448 100644 --- a/inference-engine/thirdparty/clDNN/src/include/batch_to_space_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/batch_to_space_inst.h @@ -31,7 +31,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/binary_convolution_inst.h b/inference-engine/thirdparty/clDNN/src/include/binary_convolution_inst.h index ef7f7afb2a854c..ae008ac3b5dd65 100644 --- a/inference-engine/thirdparty/clDNN/src/include/binary_convolution_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/binary_convolution_inst.h @@ -18,7 +18,7 @@ struct typed_program_node : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), split(this->get_primitive()->split()), depthwise_sep_opt(false) {} void set_split(int32_t node_split) { split = node_split; } @@ -60,7 +60,7 @@ class typed_primitive_inst : public typed_primitive_inst_bas static std::string to_string(binary_convolution_node const& node); public: - typed_primitive_inst(network_impl& network, binary_convolution_node const& node); + typed_primitive_inst(network& network, binary_convolution_node const& node); memory::ptr weights_memory(size_t index) const { if (static_cast(index) >= node.get_split()) diff --git a/inference-engine/thirdparty/clDNN/src/include/border_inst.h b/inference-engine/thirdparty/clDNN/src/include/border_inst.h index ed181ed0b16c3f..a6aeb22d4d2881 100644 --- a/inference-engine/thirdparty/clDNN/src/include/border_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/border_inst.h @@ -19,7 +19,7 @@ struct typed_program_node : typed_program_node_base { public: using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } program_node& input() const { return get_dependency(0); } @@ -34,7 +34,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { public: static layout calc_output_layout(border_node const& node); static std::string to_string(border_node const& node); - typed_primitive_inst(network_impl& network, border_node const& node); + typed_primitive_inst(network& network, border_node const& node); }; using border_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/broadcast_inst.h b/inference-engine/thirdparty/clDNN/src/include/broadcast_inst.h index 75be67373c787e..75f3efc1a36569 100644 --- a/inference-engine/thirdparty/clDNN/src/include/broadcast_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/broadcast_inst.h @@ -20,7 +20,7 @@ struct typed_program_node : typed_program_node_base { public: using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } program_node& input() const { return get_dependency(0); } @@ -35,7 +35,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/concatenation_inst.h b/inference-engine/thirdparty/clDNN/src/include/concatenation_inst.h index 82d3d39676f9ff..6d323fa4fefe6c 100644 --- a/inference-engine/thirdparty/clDNN/src/include/concatenation_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/concatenation_inst.h @@ -15,7 +15,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -38,7 +38,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/condition_inst.h b/inference-engine/thirdparty/clDNN/src/include/condition_inst.h index 4bff69b6e4953b..9906d4113e93a5 100644 --- a/inference-engine/thirdparty/clDNN/src/include/condition_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/condition_inst.h @@ -6,7 +6,6 @@ #pragma once #include -#include "network_impl.h" #include "primitive_inst.h" #include @@ -22,26 +21,26 @@ struct typed_program_node : public typed_program_node_base class branch { public: - explicit branch(topology_impl& tpl) : _topology(tpl) {} + explicit branch(const topology& tpl) : _topology(tpl) {} void set(const program_node& node) { add_or_change_input_layout(node); - _program = program_impl::build_program(node.get_program().get_engine(), - _topology, - node.get_program().get_options(), - true); // rebuild program + _program = program::build_program(node.get_program().get_engine(), + _topology, + node.get_program().get_options(), + true); // rebuild program } - program_impl::ptr get() const { return _program; } + program::ptr get() const { return _program; } private: - topology_impl& _topology; - program_impl::ptr _program = (program_impl::ptr) nullptr; + topology _topology; + program::ptr _program = nullptr; void add_or_change_input_layout(const program_node& node) { auto layout = node.get_dependency(0).get_output_layout(); auto input_id = node.as().result_id(); if (_topology.get_primitives().count(input_id) == 0) { - _topology.add(std::make_shared(input_id, layout)); + _topology.add_primitive(std::make_shared(input_id, layout)); for (auto& prim : _topology.get_primitives()) { for (auto& inp : prim.second->input) { if (inp == node.id()) @@ -57,10 +56,10 @@ struct typed_program_node : public typed_program_node_base public: using parent::parent; - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), - _branch_true(*this->get_primitive()->topology_true.get()), - _branch_false(*this->get_primitive()->topology_false.get()) {} + _branch_true(this->get_primitive()->topology_true), + _branch_false(this->get_primitive()->topology_false) {} program_node& input() const { return get_dependency(0); } program_node& compare() const { return get_dependency(1); } @@ -70,8 +69,8 @@ struct typed_program_node : public typed_program_node_base _branch_true.set(*this); _branch_false.set(*this); } - program_impl::ptr get_branch_true() const { return _branch_true.get(); } - program_impl::ptr get_branch_false() const { return _branch_false.get(); } + program::ptr get_branch_true() const { return _branch_true.get(); } + program::ptr get_branch_false() const { return _branch_false.get(); } primitive_id result_id() const { return id() + ":result"; } private: @@ -88,19 +87,19 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/convolution_inst.h b/inference-engine/thirdparty/clDNN/src/include/convolution_inst.h index 899ad44dc9bc2c..72d1b66e65bfb8 100644 --- a/inference-engine/thirdparty/clDNN/src/include/convolution_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/convolution_inst.h @@ -18,7 +18,7 @@ struct typed_program_node : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), split(this->get_primitive()->split()), depthwise_sep_opt(false), @@ -118,7 +118,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_program_node_base { public: using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } program_node& input() const { return get_dependency(0); } @@ -35,7 +35,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { public: static layout calc_output_layout(crop_node const& node); static std::string to_string(crop_node const& node); - typed_primitive_inst(network_impl& network, crop_node const& node); + typed_primitive_inst(network& network, crop_node const& node); private: void on_execute() override; diff --git a/inference-engine/thirdparty/clDNN/src/include/ctc_greedy_decoder_inst.h b/inference-engine/thirdparty/clDNN/src/include/ctc_greedy_decoder_inst.h index ea5d2bcda58359..6d67c4ef87baac 100644 --- a/inference-engine/thirdparty/clDNN/src/include/ctc_greedy_decoder_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/ctc_greedy_decoder_inst.h @@ -36,7 +36,7 @@ class typed_primitive_inst : public typed_primitive_inst_bas static std::string to_string(ctc_greedy_decoder_node const& node); public: - typed_primitive_inst(network_impl& network, ctc_greedy_decoder_node const& node); + typed_primitive_inst(network& network, ctc_greedy_decoder_node const& node); }; using ctc_greedy_decoder_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/cum_sum_inst.h b/inference-engine/thirdparty/clDNN/src/include/cum_sum_inst.h index fb9cecf7fc5caa..cc0f6c73bf3b4a 100644 --- a/inference-engine/thirdparty/clDNN/src/include/cum_sum_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/cum_sum_inst.h @@ -28,7 +28,7 @@ class typed_primitive_inst : public typed_primitive_inst_base public: static layout calc_output_layout(cum_sum_node const& node); static std::string to_string(cum_sum_node const& node); - typed_primitive_inst(network_impl& network, cum_sum_node const& desc); + typed_primitive_inst(network& network, cum_sum_node const& desc); }; using cum_sum_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/custom_gpu_primitive_inst.h b/inference-engine/thirdparty/clDNN/src/include/custom_gpu_primitive_inst.h index 20c40ecdf741c6..f75cc09afa259f 100644 --- a/inference-engine/thirdparty/clDNN/src/include/custom_gpu_primitive_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/custom_gpu_primitive_inst.h @@ -45,7 +45,7 @@ class typed_primitive_inst : public typed_primitive_inst_b static std::string to_string(custom_gpu_primitive_node const& node); public: - typed_primitive_inst(network_impl& network, custom_gpu_primitive_node const& node); + typed_primitive_inst(network& network, custom_gpu_primitive_node const& node); }; using custom_gpu_primitive_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/data_inst.h b/inference-engine/thirdparty/clDNN/src/include/data_inst.h index e1cafad9c726ad..3071a53e69a7a5 100644 --- a/inference-engine/thirdparty/clDNN/src/include/data_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/data_inst.h @@ -16,7 +16,7 @@ template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog); + typed_program_node(const std::shared_ptr prim, program& prog); memory& get_attached_memory() const { return *mem; } memory::ptr get_attached_memory_ptr() const { return mem; } @@ -37,7 +37,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(data_node const& node); public: - typed_primitive_inst(network_impl& network, data_node const& node); + typed_primitive_inst(network& network, data_node const& node); }; using data_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/deconvolution_inst.h b/inference-engine/thirdparty/clDNN/src/include/deconvolution_inst.h index f8d933002440a4..8cbff911bdd5ae 100644 --- a/inference-engine/thirdparty/clDNN/src/include/deconvolution_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/deconvolution_inst.h @@ -18,7 +18,7 @@ struct typed_program_node : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), split(this->get_primitive()->split()), depthwise_sep_opt(false), @@ -90,7 +90,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), split(this->get_primitive()->split()), depthwise_sep_opt(false), @@ -73,7 +73,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), split(1), depthwise_sep_opt(false), @@ -152,7 +152,7 @@ class typed_primitive_inst : public typed_primitive_inst_base static std::string to_string(deformable_interp_node const& node); public: - typed_primitive_inst(network_impl& network, deformable_interp_node const& node); + typed_primitive_inst(network& network, deformable_interp_node const& node); memory& trans_memory() const { return dep_memory(1); } }; diff --git a/inference-engine/thirdparty/clDNN/src/include/depth_to_space_inst.h b/inference-engine/thirdparty/clDNN/src/include/depth_to_space_inst.h index f551ee7ae341c5..5042b969fd4845 100644 --- a/inference-engine/thirdparty/clDNN/src/include/depth_to_space_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/depth_to_space_inst.h @@ -36,7 +36,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/detection_output_inst.h b/inference-engine/thirdparty/clDNN/src/include/detection_output_inst.h index 6ce0a82eb4b9b7..f2df0539455bef 100644 --- a/inference-engine/thirdparty/clDNN/src/include/detection_output_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/detection_output_inst.h @@ -6,7 +6,6 @@ #pragma once #include "cldnn/primitives/detection_output.hpp" #include "primitive_inst.h" -#include "topology_impl.h" #include @@ -40,7 +39,7 @@ class typed_primitive_inst : public typed_primitive_inst_base< static std::string to_string(detection_output_node const& node); public: - typed_primitive_inst(network_impl& network, detection_output_node const& node); + typed_primitive_inst(network& network, detection_output_node const& node); memory::ptr location_memory() const { return dep_memory_ptr(0); } memory::ptr confidence_memory() const { return dep_memory_ptr(1); } diff --git a/inference-engine/thirdparty/clDNN/src/include/eltwise_inst.h b/inference-engine/thirdparty/clDNN/src/include/eltwise_inst.h index 9b62e0b73b2f64..fe69b31b3d3304 100644 --- a/inference-engine/thirdparty/clDNN/src/include/eltwise_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/eltwise_inst.h @@ -6,7 +6,6 @@ #pragma once #include "cldnn/primitives/eltwise.hpp" #include "primitive_inst.h" -#include "topology_impl.h" #include "kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_base.h" #include @@ -64,7 +63,7 @@ struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -90,7 +89,7 @@ class typed_primitive_inst : public typed_primitive_inst_base static std::string to_string(eltwise_node const& node); public: - typed_primitive_inst(network_impl& network, eltwise_node const& node); + typed_primitive_inst(network& network, eltwise_node const& node); }; using eltwise_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/embedding_bag_inst.h b/inference-engine/thirdparty/clDNN/src/include/embedding_bag_inst.h index 79151251ce97cb..2644a34f289b2e 100644 --- a/inference-engine/thirdparty/clDNN/src/include/embedding_bag_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/embedding_bag_inst.h @@ -30,7 +30,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/extract_image_patches_inst.h b/inference-engine/thirdparty/clDNN/src/include/extract_image_patches_inst.h index 2eb4dd7f7926bd..9602615f638f02 100644 --- a/inference-engine/thirdparty/clDNN/src/include/extract_image_patches_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/extract_image_patches_inst.h @@ -29,7 +29,7 @@ class typed_primitive_inst : public typed_primitive_inst_ static std::string to_string(extract_image_patches_node const& node); public: - typed_primitive_inst(network_impl& network, extract_image_patches_node const& desc); + typed_primitive_inst(network& network, extract_image_patches_node const& desc); }; using extract_image_patches_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/fully_connected_inst.h b/inference-engine/thirdparty/clDNN/src/include/fully_connected_inst.h index db3a156dec5aae..3982507a9373b5 100644 --- a/inference-engine/thirdparty/clDNN/src/include/fully_connected_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/fully_connected_inst.h @@ -16,7 +16,7 @@ struct typed_program_node : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) {} program_node& input() const { return get_dependency(0); } @@ -36,7 +36,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), split(this->get_primitive()->split()), depthwise_sep_opt(false), @@ -81,7 +81,7 @@ class typed_primitive_inst : public typed_primitive_inst_bas static std::string to_string(fused_conv_eltwise_node const& node); public: - typed_primitive_inst(network_impl& network, fused_conv_eltwise_node const& node); + typed_primitive_inst(network& network, fused_conv_eltwise_node const& node); memory::ptr weights_memory(size_t index) const { if (static_cast(index) >= node.get_split()) diff --git a/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h b/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h index ebefc9c032dea6..5bf15b4930c812 100644 --- a/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h @@ -42,7 +42,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/gather_inst.h b/inference-engine/thirdparty/clDNN/src/include/gather_inst.h index 9acd82a499c303..9d733bbc1a8cb7 100644 --- a/inference-engine/thirdparty/clDNN/src/include/gather_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/gather_inst.h @@ -31,7 +31,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(gather_node const& node); public: - typed_primitive_inst(network_impl& network, gather_node const& desc); + typed_primitive_inst(network& network, gather_node const& desc); }; using gather_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/gather_nd_inst.h b/inference-engine/thirdparty/clDNN/src/include/gather_nd_inst.h index 86a3b0b4cec956..2d7ad62e4acc6a 100644 --- a/inference-engine/thirdparty/clDNN/src/include/gather_nd_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/gather_nd_inst.h @@ -29,7 +29,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/gather_tree_inst.h b/inference-engine/thirdparty/clDNN/src/include/gather_tree_inst.h index 589c004af1a095..a08aeb3226caa8 100644 --- a/inference-engine/thirdparty/clDNN/src/include/gather_tree_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/gather_tree_inst.h @@ -16,7 +16,7 @@ struct typed_program_node : typed_program_node_base { using parent = typed_program_node_base; public: using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { } program_node& input() const { return get_dependency(0); } }; @@ -30,7 +30,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/gemm_inst.h b/inference-engine/thirdparty/clDNN/src/include/gemm_inst.h index 670edf130639cf..88f6e5a0d8df05 100644 --- a/inference-engine/thirdparty/clDNN/src/include/gemm_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/gemm_inst.h @@ -32,7 +32,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(gemm_node const& node); public: - typed_primitive_inst(network_impl& network, gemm_node const& node); + typed_primitive_inst(network& network, gemm_node const& node); }; using gemm_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/generic_layer_inst.h b/inference-engine/thirdparty/clDNN/src/include/generic_layer_inst.h index 32c90371abb0d4..3b94d7a6343f85 100644 --- a/inference-engine/thirdparty/clDNN/src/include/generic_layer_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/generic_layer_inst.h @@ -15,7 +15,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog); + typed_program_node(const std::shared_ptr prim, program& prog); public: using parent::parent; @@ -35,7 +35,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/grn_inst.h b/inference-engine/thirdparty/clDNN/src/include/grn_inst.h index c470a44d9dd9a9..db0e5f1f86683f 100644 --- a/inference-engine/thirdparty/clDNN/src/include/grn_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/grn_inst.h @@ -32,7 +32,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(grn_node const& node); public: - typed_primitive_inst(network_impl& network, grn_node const& node); + typed_primitive_inst(network& network, grn_node const& node); }; using grn_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/input_layout_inst.h b/inference-engine/thirdparty/clDNN/src/include/input_layout_inst.h index c6199634634a01..8e837b0e992744 100644 --- a/inference-engine/thirdparty/clDNN/src/include/input_layout_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/input_layout_inst.h @@ -18,7 +18,7 @@ struct typed_program_node : public typed_program_node_base; using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog); + typed_program_node(const std::shared_ptr prim, program& prog); }; using input_layout_node = typed_program_node; @@ -32,7 +32,7 @@ class typed_primitive_inst : public typed_primitive_inst_base -inline optional_params_t get_default_optional_params(const program_impl& program) { +inline optional_params_t get_default_optional_params(const program& program) { optional_params_t params; set_optional_params(program, params); return params; } template -inline optional_params_t get_default_weights_bias_optional_params(const program_impl& program) { +inline optional_params_t get_default_weights_bias_optional_params(const program& program) { return get_default_optional_params(program); } diff --git a/inference-engine/thirdparty/clDNN/src/include/loop_inst.h b/inference-engine/thirdparty/clDNN/src/include/loop_inst.h index 54044d26e8b6fc..f418d3cef636c5 100644 --- a/inference-engine/thirdparty/clDNN/src/include/loop_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/loop_inst.h @@ -13,7 +13,6 @@ #include "cldnn/runtime/memory.hpp" #include "cldnn/runtime/error_handler.hpp" -#include "network_impl.h" #include "primitive_inst.h" #include #include @@ -24,21 +23,19 @@ template<> struct typed_program_node : public typed_program_node_base { private: using parent = typed_program_node_base; - topology body_topology; - topology_impl& body; + mutable topology body; std::vector input_primitive_maps; std::vector output_primitive_maps; mutable std::vector back_edges; bool use_current_iteration; bool use_execution_condition; - mutable program_impl::ptr body_program; + mutable program::ptr body_program; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) : + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog), - body_topology(this->get_primitive()->body), - body(*body_topology.get()), + body(this->get_primitive()->body), input_primitive_maps(this->get_primitive()->input_primitive_maps), output_primitive_maps(this->get_primitive()->output_primitive_maps), back_edges(this->get_primitive()->back_edges), @@ -50,7 +47,7 @@ struct typed_program_node : public typed_program_node_base { int64_t max_iteration; int64_t get_max_iteration() const { return max_iteration; } - program_impl::ptr get_body_program() const { return body_program; } + program::ptr get_body_program() const { return body_program; } bool is_current_iteration_used() const { return use_current_iteration; } bool is_execution_condition_used() const { return use_execution_condition; } @@ -248,7 +245,7 @@ struct typed_program_node : public typed_program_node_base { // add current_iteration primitive if current_iteration primitive is not exist in body if (body_topology_map.find(current_iteration_id) == body_topology_map.end()) { - body.add(std::make_shared(current_iteration_id, body_input_layout)); + body.add_primitive(std::make_shared(current_iteration_id, body_input_layout)); } else { const auto& body_input_prim = body.at(current_iteration_id); const auto input_layout_prim = std::dynamic_pointer_cast(body_input_prim); @@ -265,11 +262,11 @@ struct typed_program_node : public typed_program_node_base { auto mem = get_program().get_engine().allocate_memory(body_input_layout); auto& stream = get_program().get_stream(); write_scalar_value(mem, stream, 1); - body.add(std::make_shared(increment_value_id, mem)); + body.add_primitive(std::make_shared(increment_value_id, mem)); // add eltwise sum updating current_iteration with incremental data const primitive_id updated_currnet_iteration_id = current_iteration_id + "_update"; - body.add(std::make_shared(updated_currnet_iteration_id, + body.add_primitive(std::make_shared(updated_currnet_iteration_id, current_iteration_id, increment_value_id, eltwise_mode::sum)); // set backedge @@ -285,7 +282,7 @@ struct typed_program_node : public typed_program_node_base { if (body_output == body_topology_map.end()) { auto mem = get_program().get_engine().allocate_memory(body_output_layout); auto md = std::make_shared(id, mem); - body.add(md); + body.add_primitive(md); } else { auto body_output_prim = body.at(body_output->first); auto mem = get_program().get_engine().allocate_memory(body_output_layout); @@ -301,7 +298,7 @@ struct typed_program_node : public typed_program_node_base { // add inputs for body network if not exist if (body.get_primitives().count(internal_input_id) == 0) { - body.add(std::make_shared(internal_input_id, calculated_layout)); + body.add_primitive(std::make_shared(internal_input_id, calculated_layout)); } else { body.change_input_layout(internal_input_id, calculated_layout); } @@ -345,7 +342,7 @@ struct typed_program_node : public typed_program_node_base { auto opts = get_program().get_options(); std::vector output_names_vec(output_names.begin(), output_names.end()); opts.set_option(build_option::outputs(output_names_vec)); - body_program = program_impl::build_program(get_program().get_engine(), body, opts, false, false, true); + body_program = program::build_program(get_program().get_engine(), body, opts, false, false, true); } const primitive_id& get_trip_count_id() const { return get_primitive()->trip_count_id; } @@ -558,8 +555,8 @@ class typed_primitive_inst : public typed_primitive_inst_base { size_t current_iteratoin_backedge_mapping_idx = 0; public: - typed_primitive_inst(network_impl& network, const loop_node& node); - network_impl::ptr get_body_network() const { return body_network; } + typed_primitive_inst(network& network, const loop_node& node); + network::ptr get_body_network() const { return body_network; } void preprocess_input_memory(); void preprocess_output_memory(); void preprocess_backedge_memory(); @@ -571,7 +568,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { } private: - network_impl::ptr body_network; + network::ptr body_network; memory::ptr get_external_memory(const primitive_id& external_id) const; std::vector get_sliced_mem(const primitive_id& internal_id) const; }; diff --git a/inference-engine/thirdparty/clDNN/src/include/lrn_inst.h b/inference-engine/thirdparty/clDNN/src/include/lrn_inst.h index a7bcd3f33c0744..01320d60dba072 100644 --- a/inference-engine/thirdparty/clDNN/src/include/lrn_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/lrn_inst.h @@ -22,7 +22,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(lrn_node const& node); public: - typed_primitive_inst(network_impl& network, lrn_node const& node); + typed_primitive_inst(network& network, lrn_node const& node); }; using lrn_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_input_inst.h b/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_input_inst.h index 9ad70dffef0681..0d7dbd41b08d22 100644 --- a/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_input_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_input_inst.h @@ -17,7 +17,7 @@ struct typed_program_node : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) : parent(prim, prog) {} + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) {} program_node& input() const { return get_dependency(0); } program_node& dyn_length() const { return get_dependency(1); } @@ -45,7 +45,7 @@ class typed_primitive_inst : public typed_primitive_inst_bas static std::string to_string(lstm_dynamic_input_node const& node); public: - typed_primitive_inst(network_impl& network, lstm_dynamic_input_node const& node); + typed_primitive_inst(network& network, lstm_dynamic_input_node const& node); memory::ptr dyn_length_memory() const { return dep_memory_ptr(1); } memory::ptr weights_memory() const { return dep_memory_ptr(2); } diff --git a/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_inst.h b/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_inst.h index fe281d35ff4ba7..70618be4c75e59 100644 --- a/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/lstm_dynamic_inst.h @@ -15,7 +15,7 @@ template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(std::shared_ptr prim, program_impl& prog) : parent(prim, prog) {} + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) {} program_node& input() const { return get_dependency(0); } float clip() const { return get_primitive()->clip; } @@ -40,7 +40,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_program_node_bas } public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) { init_params_list(); can_share_buffer(false); @@ -66,7 +66,7 @@ class typed_primitive_inst : public typed_primitive_inst_ static std::string to_string(lstm_dynamic_timeloop_node const& node); public: - typed_primitive_inst(network_impl& network, lstm_dynamic_timeloop_node const& node); + typed_primitive_inst(network& network, lstm_dynamic_timeloop_node const& node); memory::ptr dyn_length_memory() const { return get_dependency_memory("dyn_length"); } memory::ptr recurrent_memory() const { return get_dependency_memory("recurrent"); } diff --git a/inference-engine/thirdparty/clDNN/src/include/lstm_elt_inst.h b/inference-engine/thirdparty/clDNN/src/include/lstm_elt_inst.h index e87d75dba08ecc..61f4f207d7e48d 100644 --- a/inference-engine/thirdparty/clDNN/src/include/lstm_elt_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/lstm_elt_inst.h @@ -42,7 +42,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : public typed_primitive_inst_base : public typed_primitive_inst_base { static std::string to_string(lstm_node const& node); public: - typed_primitive_inst(network_impl& network, lstm_node const& node); + typed_primitive_inst(network& network, lstm_node const& node); memory& weights_memory() const { return dep_memory(1); } memory& recurrent_memory() const { return dep_memory(2); } diff --git a/inference-engine/thirdparty/clDNN/src/include/max_unpooling_inst.h b/inference-engine/thirdparty/clDNN/src/include/max_unpooling_inst.h index 543344011de040..944b446e153d32 100644 --- a/inference-engine/thirdparty/clDNN/src/include/max_unpooling_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/max_unpooling_inst.h @@ -15,7 +15,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog); + typed_program_node(const std::shared_ptr prim, program& prog); public: using parent::parent; @@ -30,7 +30,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; public: - typed_primitive_inst(network_impl& network, max_unpooling_node const& desc); + typed_primitive_inst(network& network, max_unpooling_node const& desc); static layout calc_output_layout(max_unpooling_node const& node); static std::string to_string(max_unpooling_node const& node); }; diff --git a/inference-engine/thirdparty/clDNN/src/include/mutable_data_inst.h b/inference-engine/thirdparty/clDNN/src/include/mutable_data_inst.h index 311873fb01556d..b6f6b8cccc06a9 100644 --- a/inference-engine/thirdparty/clDNN/src/include/mutable_data_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/mutable_data_inst.h @@ -16,7 +16,7 @@ template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog); + typed_program_node(const std::shared_ptr prim, program& prog); memory& get_attached_memory() const { return *mem; } memory::ptr get_attached_memory_ptr() const { return mem; } @@ -38,7 +38,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/mvn_inst.h b/inference-engine/thirdparty/clDNN/src/include/mvn_inst.h index d4787d67608959..0d1429605c14ad 100644 --- a/inference-engine/thirdparty/clDNN/src/include/mvn_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/mvn_inst.h @@ -32,7 +32,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(mvn_node const& node); public: - typed_primitive_inst(network_impl& network, mvn_node const& node); + typed_primitive_inst(network& network, mvn_node const& node); }; using mvn_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/network_impl.h b/inference-engine/thirdparty/clDNN/src/include/network_impl.h deleted file mode 100644 index ebef3ca5190991..00000000000000 --- a/inference-engine/thirdparty/clDNN/src/include/network_impl.h +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "cldnn/graph/network.hpp" -#include "cldnn/runtime/engine.hpp" -#include "cldnn/runtime/event.hpp" -#include "cldnn/runtime/stream.hpp" -#include "program_impl.h" -#include "topology_impl.h" -#include "impls/implementation_map.hpp" - -#include -#include -#include -#include -#include -#include -#include - -namespace cldnn { - -class primitive_inst; - -struct network_impl { -public: - using ptr = std::shared_ptr; - explicit network_impl(program_impl::ptr program, stream::ptr stream, bool is_internal = false, bool is_primary_stream = false); - network_impl(engine& engine, - const topology_impl& topo, - const build_options& options = build_options(), - bool is_internal = false); - network_impl(engine& engine, - const std::set>& nodes, - const build_options& options, - bool is_internal); - ~network_impl(); - - - static ptr build_network(engine& engine, - const topology_impl& topology, - const build_options& options, - bool is_internal = false); - static ptr build_network(engine& engine, - const std::set>& nodes, - const build_options& options, - bool is_internal); - - static ptr allocate_network(stream::ptr stream, - program_impl::ptr program, - bool is_internal = false, - bool is_primary_stream = false); - - static ptr allocate_network(engine& engine, - program_impl::ptr program, - bool is_internal = false, - bool is_primary_stream = false); - program_impl::cptr get_program() const { return _program; } - program_impl::ptr get_program() { return _program; } - engine& get_engine() const { return _program->get_engine(); } - - void reset_execution(bool wait = true); - void set_input_data(const primitive_id& id, memory::ptr data); - void set_output_memory(const primitive_id& id, memory::ptr mem); - - void set_learning_rate(const float lr); - float get_learning_rate(); - - std::vector> const& get_outputs() { return _outputs; } - - const std::vector>& get_outputs() const { - return reinterpret_cast>&>(_outputs); - } - - std::vector get_output_ids() const; - std::vector get_input_ids() const; - std::vector get_executed_primitive_ids() const; - std::vector get_all_primitive_ids() const; - std::vector get_all_primitive_org_ids() const; - const program_impl::primitives_info& get_primitives_info() const; - const program_impl::graph_optimizer_info& get_optimizer_passes_info() const; - void execute(const std::vector& events); - void validate_primitives(); - void set_arguments(); - // Implementation specific calls - std::shared_ptr get_primitive(const primitive_id& id); - std::string get_primitive_info(const primitive_id& id) const; - const event::ptr& get_primitive_event(const primitive_id& id) const { return _events.at(id); } - bool has_event(const primitive_id& id) const { return _events.count(id); } - std::vector> get_primitives(const std::vector& ids); - std::vector> get_primitives(const std::vector& nodes); - void execute_primitive(const std::shared_ptr& primitive, - const std::vector& events); - void allocate_primitives(); - void build_insts_deps(); - uint32_t get_id() const { return net_id; } - stream& get_stream() const { return *_stream; } - stream::ptr get_stream_ptr() const { return _stream; } - void build_exec_order(); - bool is_internal() const { return _internal; } - bool is_primary_stream() { return _is_primary_stream; } - - /// Create memory object with specified @p layout and allocation @p type for primitive with @p id - /// Underlying memory handle can be reused with other primitives from memory pool based on @p dependencies - memory_ptr get_memory_from_pool(const layout& layout, - primitive_id id, - std::set dependencies, - allocation_type type, - bool reusable = true); - -private: - uint32_t net_id = 0; - program_impl::ptr _program; - stream::ptr _stream; - std::unique_ptr _memory_pool; - bool _internal; - bool _is_primary_stream; - bool _reset_arguments; - float _learning_rate = static_cast(0.00001); - - std::map> _primitives; - std::vector> _inputs; - std::vector> _outputs; - std::list> _exec_order; - std::list> _data_outputs; - - std::unordered_map _events; - - void allocate_primitive_instance(program_node const& node); - void transfer_memory_to_device(std::shared_ptr instance, program_node const& node); - void add_to_exec_order(const primitive_id& id); - std::shared_ptr find_in_internal_networks(const primitive_id& id); - std::shared_ptr find_primitive(const primitive_id& id); - void check_names(); -}; -} // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/include/non_max_suppression_inst.h b/inference-engine/thirdparty/clDNN/src/include/non_max_suppression_inst.h index 11e3151ec6bc09..36345261fe07ce 100644 --- a/inference-engine/thirdparty/clDNN/src/include/non_max_suppression_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/non_max_suppression_inst.h @@ -17,7 +17,7 @@ struct typed_program_node : public typed_program_node_base< using parent = typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) {} @@ -87,7 +87,7 @@ class typed_primitive_inst : public typed_primitive_inst_ba using parent = typed_primitive_inst_base; public: - typed_primitive_inst(network_impl& network, non_max_suppression_node const& node) + typed_primitive_inst(network& network, non_max_suppression_node const& node) : parent(network, node) {} diff --git a/inference-engine/thirdparty/clDNN/src/include/normalize_inst.h b/inference-engine/thirdparty/clDNN/src/include/normalize_inst.h index 4f14fe2f3e88a2..6efaec3aa65f01 100644 --- a/inference-engine/thirdparty/clDNN/src/include/normalize_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/normalize_inst.h @@ -33,7 +33,7 @@ class typed_primitive_inst : public typed_primitive_inst_base : typed_program_node_base { public: using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } program_node& input() const { return get_dependency(0); } @@ -34,7 +34,7 @@ class typed_primitive_inst : public typed_primitive_inst_base public: static layout calc_output_layout(one_hot_node const& node); static std::string to_string(one_hot_node const& node); - typed_primitive_inst(network_impl& network, one_hot_node const& node); + typed_primitive_inst(network& network, one_hot_node const& node); }; using one_hot_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/pass_manager.h b/inference-engine/thirdparty/clDNN/src/include/pass_manager.h index f726e1ca1efbe3..156f21dfa2e366 100644 --- a/inference-engine/thirdparty/clDNN/src/include/pass_manager.h +++ b/inference-engine/thirdparty/clDNN/src/include/pass_manager.h @@ -4,7 +4,7 @@ #pragma once -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "layout_optimizer.h" #include "split_inst.h" #include "lstm_inst.h" @@ -28,9 +28,9 @@ class base_pass { public: explicit base_pass(const std::string& pass_name) : name(pass_name) {} - virtual void run(program_impl& p) = 0; + virtual void run(program& p) = 0; std::string get_name() { return name; } - void clean_marks(program_impl& p) { + void clean_marks(program& p) { for (auto& node : p.get_processing_order()) { node->unmark(); } @@ -42,8 +42,8 @@ class base_pass { class pass_manager { public: - explicit pass_manager(program_impl& p); - void run(program_impl& p, base_pass& pass); + explicit pass_manager(program& p); + void run(program& p, base_pass& pass); uint32_t get_pass_count() { return pass_count; } uint32_t inc_pass_count() { return ++pass_count; } ~pass_manager() {} @@ -58,8 +58,8 @@ class add_required_reorders : public base_pass { add_required_reorders() : base_pass("add_required_reorders") {} private: - void run(program_impl& p) override; - void add_reorder(program_impl& p, program_node* node, program_node* usr); + void run(program& p) override; + void add_reorder(program& p, program_node* node, program_node* usr); }; class add_reshape_to_primitives : public base_pass { @@ -67,7 +67,7 @@ class add_reshape_to_primitives : public base_pass { add_reshape_to_primitives() : base_pass("add_reshape_to_primitives_pass") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class calculate_prior_boxes : public base_pass { @@ -75,7 +75,7 @@ class calculate_prior_boxes : public base_pass { calculate_prior_boxes() : base_pass("calculated_prior_boxes") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class compile_graph : public base_pass { @@ -83,7 +83,7 @@ class compile_graph : public base_pass { compile_graph() : base_pass("compile_graph") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class eltwise_shrinking : public base_pass { @@ -91,7 +91,7 @@ class eltwise_shrinking : public base_pass { eltwise_shrinking() : base_pass("eltwise_shrinking") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class eltwise_remove_stride : public base_pass { @@ -99,8 +99,8 @@ class eltwise_remove_stride : public base_pass { eltwise_remove_stride() : base_pass("eltwise_remove_stride") {} private: - void run(program_impl& p) override; - void conv_stride_extend(program_impl& p, program_node& node, cldnn::tensor& tensor); + void run(program& p) override; + void conv_stride_extend(program& p, program_node& node, cldnn::tensor& tensor); }; class graph_initializations : public base_pass { @@ -108,11 +108,11 @@ class graph_initializations : public base_pass { graph_initializations() : base_pass("init") {} private: - void run(program_impl& p) override; - void handle_split_node(program_impl& p, split_node& node); - void handle_lstm_node(program_impl& p, lstm_node& node); - void handle_dynamic_lstm_node(program_impl& p, lstm_dynamic_node& node); - void set_outputs(program_impl& p); + void run(program& p) override; + void handle_split_node(program& p, split_node& node); + void handle_lstm_node(program& p, lstm_node& node); + void handle_dynamic_lstm_node(program& p, lstm_dynamic_node& node); + void set_outputs(program& p); }; class handle_reshape : public base_pass { @@ -120,7 +120,7 @@ class handle_reshape : public base_pass { handle_reshape() : base_pass("handle_reshape") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class handle_input_padding : public base_pass { @@ -128,7 +128,7 @@ class handle_input_padding : public base_pass { handle_input_padding() : base_pass("handle_input_padding") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class mark_nodes : public base_pass { @@ -136,7 +136,7 @@ class mark_nodes : public base_pass { mark_nodes() : base_pass("analyzed_graph") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class prepare_buffer_fusing : public base_pass { @@ -144,7 +144,7 @@ class prepare_buffer_fusing : public base_pass { prepare_buffer_fusing() : base_pass("prepare_buffer_fusing") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class prepare_quantization : public base_pass { @@ -152,13 +152,13 @@ class prepare_quantization : public base_pass { prepare_quantization() : base_pass("prepare_quantization") {} private: - void run(program_impl& p) override; - void handle_quantize_node(program_impl& p, quantize_node& quantize_node); - void prepare_packed_quantize(program_impl& p, quantize_node& quantize_node); - void prepare_dequantize_merge(program_impl& p, eltwise_node& eltwise_node); - void remove_fake_reorders(program_impl& p, reorder_node& reorder_node); - void prepare_asymmetric_quantization(program_impl& p, convolution_node& convolution_node); - void prepare_scale_shift_opt(program_impl &p, quantize_node& quantize_node); + void run(program& p) override; + void handle_quantize_node(program& p, quantize_node& quantize_node); + void prepare_packed_quantize(program& p, quantize_node& quantize_node); + void prepare_dequantize_merge(program& p, eltwise_node& eltwise_node); + void remove_fake_reorders(program& p, reorder_node& reorder_node); + void prepare_asymmetric_quantization(program& p, convolution_node& convolution_node); + void prepare_scale_shift_opt(program &p, quantize_node& quantize_node); }; class prepare_conv_eltw_fusing : public base_pass { @@ -167,9 +167,9 @@ class prepare_conv_eltw_fusing : public base_pass { base_pass("prepare_conv_eltw_fusing"), _lo(lo_ref), b_fs_yx_fsv16_opt(b_fs_yx_fsv16_opt) {} private: - void run(program_impl& p) override; - void fuse_conv_eltwise(program_impl& p, program_node* node); - void fuse_conv_depth_to_space(program_impl& p, program_node* node); + void run(program& p) override; + void fuse_conv_eltwise(program& p, program_node* node); + void fuse_conv_depth_to_space(program& p, program_node* node); layout_optimizer& _lo; bool b_fs_yx_fsv16_opt; }; @@ -179,8 +179,8 @@ class prepare_conv_eltw_read_write_opt : public base_pass { prepare_conv_eltw_read_write_opt() : base_pass("prepare_conv_eltw_read_write_opt") {} private: - void run(program_impl& p) override; - void conv_eltwise_read_write_opt(program_impl& p, program_node* node); + void run(program& p) override; + void conv_eltwise_read_write_opt(program& p, program_node* node); }; class prepare_primitive_fusing : public base_pass { @@ -189,13 +189,13 @@ class prepare_primitive_fusing : public base_pass { base_pass("prepare_primitive_fusing"), _lo(lo_ref) {} private: - void run(program_impl& p) override; - void fuse_sigmoid_mul_to_swish(program_impl &p); - void fuse_bias(program_impl &p); - void fuse_reorders(program_impl& p); - void fuse_activations(program_impl& p); - void fuse_simple_primitives(program_impl &p); - void optimize_fused_ops(program_impl &p); + void run(program& p) override; + void fuse_sigmoid_mul_to_swish(program &p); + void fuse_bias(program &p); + void fuse_reorders(program& p); + void fuse_activations(program& p); + void fuse_simple_primitives(program &p); + void optimize_fused_ops(program &p); layout_optimizer& _lo; }; @@ -205,7 +205,7 @@ class pre_replace_deconv : public base_pass { base_pass("pre_replace_deconv"), _lo(lo_ref) {} private: - void run(program_impl& p) override; + void run(program& p) override; layout_optimizer& _lo; }; @@ -214,10 +214,10 @@ class pre_optimize_bias : public base_pass { explicit pre_optimize_bias(reorder_factory& rf_ref); private: - void run(program_impl& p) override; - virtual void run(program_impl& p, reorder_factory& rf); + void run(program& p) override; + virtual void run(program& p, reorder_factory& rf); template - void optimize_bias(T& node, reorder_factory& rf, program_impl& p); + void optimize_bias(T& node, reorder_factory& rf, program& p); reorder_factory& _rf; }; @@ -227,7 +227,7 @@ class prepare_padding : public base_pass { : base_pass("prepare_padding"), output_size_handling_enabled(output_size_handling_enabled_switch) {} private: - void run(program_impl& p) override; + void run(program& p) override; bool output_size_handling_enabled; }; @@ -236,8 +236,8 @@ class post_input_reorder : public base_pass { post_input_reorder() : base_pass("post_input_reorder") {} private: - void run(program_impl& p) override; - program_node& add_reorder(program_impl& p, program_node* node, program_node* usr, const layout& reorder_layout); + void run(program& p) override; + program_node& add_reorder(program& p, program_node* node, program_node* usr, const layout& reorder_layout); }; class post_optimize_weights : public base_pass { @@ -256,11 +256,11 @@ class post_optimize_weights : public base_pass { {} }; - void run(program_impl& p) override; + void run(program& p) override; template weights_bias_offset get_weights_bias_offset(const T& node); template - void optimize_weights(T& node, program_impl& p); + void optimize_weights(T& node, program& p); reorder_factory& _rf; }; @@ -269,12 +269,12 @@ class propagate_constants : public base_pass { propagate_constants() : base_pass("propagate_constants") {} private: - void run(program_impl& p) override; + void run(program& p) override; std::list> calculate(engine& engine, build_options bo); bool has_non_const_user(program_node& node) const; - void handle_constant(program_impl& prog, program_node& node); - void add_constant(program_impl& prog, program_node& node); - void add_deps_to_tpl(program_impl& prog, const std::vector& node); + void handle_constant(program& prog, program_node& node); + void add_constant(program& prog, program_node& node); + void add_deps_to_tpl(program& prog, const std::vector& node); bool has_non_trivial_constants = false; std::list*> const_inputs; @@ -286,7 +286,7 @@ class remove_redundant_reorders : public base_pass { public: explicit remove_redundant_reorders(layout_optimizer& lo_ref, bool enable_reorder_fusing = false, bool update_implementations = false, bool remove_output_reorders = false); - void run(program_impl& p) override; + void run(program& p) override; private: layout_optimizer& lo; @@ -300,8 +300,8 @@ class reorder_inputs : public base_pass { reorder_inputs(layout_optimizer& lo_ref, reorder_factory& rf_ref); private: - void run(program_impl& p) override; - virtual void run(program_impl& p, layout_optimizer& lo, reorder_factory& rf); + void run(program& p) override; + virtual void run(program& p, layout_optimizer& lo, reorder_factory& rf); layout_optimizer& _lo; reorder_factory& _rf; }; @@ -311,19 +311,19 @@ class trim_to_outputs : public base_pass { trim_to_outputs() : base_pass("trimmed") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; class strided_slice_optimize : public base_pass { public: strided_slice_optimize() : base_pass("strided_slice_optimize") {} - void run(program_impl& p) override; + void run(program& p) override; }; class reverse_optional_nodes_outputs : public base_pass { public: reverse_optional_nodes_outputs() : base_pass("reverse_optional_nodes_outputs") {} - void run(program_impl& p) override; + void run(program& p) override; }; class concat_input_order : public base_pass { @@ -345,7 +345,7 @@ class concat_input_order : public base_pass { // - no fused primitives public: concat_input_order() : base_pass("concat_input_order") {} - void run(program_impl& p) override; + void run(program& p) override; }; class memory_dependency_pass : public base_pass { @@ -369,19 +369,19 @@ class memory_dependency_pass : public base_pass { class basic_memory_dependencies : public memory_dependency_pass { public: basic_memory_dependencies() : memory_dependency_pass("basic_memory_dependencies") {} - void run(program_impl& p) override; + void run(program& p) override; }; class skipped_branch_memory_dependencies : public memory_dependency_pass { public: skipped_branch_memory_dependencies() : memory_dependency_pass("skipped_branch_memory_dependencies") {} - void run(program_impl& p) override; + void run(program& p) override; }; class oooq_memory_dependencies : public memory_dependency_pass { public: oooq_memory_dependencies() : memory_dependency_pass("oooq_memory_dependencies") {} - void run(program_impl& p) override; + void run(program& p) override; }; class update_loop_primitive_map : public base_pass { @@ -389,7 +389,7 @@ class update_loop_primitive_map : public base_pass { update_loop_primitive_map() : base_pass("update_loop_primitive_map") {} private: - void run(program_impl& p) override; + void run(program& p) override; }; } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/include/permute_inst.h b/inference-engine/thirdparty/clDNN/src/include/permute_inst.h index b6250a2b54dc58..5444b3dc20d72b 100644 --- a/inference-engine/thirdparty/clDNN/src/include/permute_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/permute_inst.h @@ -15,7 +15,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -36,7 +36,7 @@ class typed_primitive_inst : public typed_primitive_inst_base static std::string to_string(permute_node const& node); public: - typed_primitive_inst(network_impl& network, permute_node const& node); + typed_primitive_inst(network& network, permute_node const& node); }; using permute_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/pooling_inst.h b/inference-engine/thirdparty/clDNN/src/include/pooling_inst.h index 6bcc208cefbd13..fa1649a97ac9b2 100644 --- a/inference-engine/thirdparty/clDNN/src/include/pooling_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/pooling_inst.h @@ -15,7 +15,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } diff --git a/inference-engine/thirdparty/clDNN/src/include/primitive_inst.h b/inference-engine/thirdparty/clDNN/src/include/primitive_inst.h index 52d1fd4694c9fb..78d6a561cb9103 100644 --- a/inference-engine/thirdparty/clDNN/src/include/primitive_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/primitive_inst.h @@ -9,6 +9,7 @@ #include "cldnn/runtime/error_handler.hpp" #include "cldnn/runtime/event.hpp" #include "cldnn/runtime/memory.hpp" +#include "cldnn/graph/network.hpp" #include "kernel_selector_helper.h" #include "meta_utils.h" #include "program_node.h" @@ -20,7 +21,6 @@ namespace cldnn { -struct network_impl; class primitive_inst; template @@ -86,7 +86,7 @@ class primitive_inst { bool can_be_optimized() const { return _node.can_be_optimized(); } std::shared_ptr desc() const { return _node.get_primitive(); } program_node const& get_node() const { return _node; } - network_impl& get_network() const { return _network; } + network& get_network() const { return _network; } uint32_t get_network_id() const; void set_output_memory(memory::ptr mem); void check_memory_to_set(const memory& mem, const layout& layout) const; @@ -141,9 +141,9 @@ class primitive_inst { } protected: - primitive_inst(network_impl& network, program_node const& node, bool allocate_memory); + primitive_inst(network& network, program_node const& node, bool allocate_memory); - network_impl& _network; + network& _network; program_node const& _node; std::unique_ptr _impl; @@ -242,14 +242,14 @@ class typed_primitive_inst_base : public primitive_inst { const typed_node& node; const PType& argument; - typed_primitive_inst_base(network_impl& network, typed_node const& node) + typed_primitive_inst_base(network& network, typed_node const& node) : typed_primitive_inst_base(network, node, do_allocate_memory(node)) {} protected: - typed_primitive_inst_base(network_impl& network, typed_node const& node, bool allocate_memory) + 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()) {} - typed_primitive_inst_base(network_impl& network, typed_node const& node, memory::ptr buffer) + typed_primitive_inst_base(network& network, typed_node const& node, memory::ptr buffer) : typed_primitive_inst_base(network, node, false) { _output = buffer; } diff --git a/inference-engine/thirdparty/clDNN/src/include/primitive_type.h b/inference-engine/thirdparty/clDNN/src/include/primitive_type.h index 5342556141320c..89e4e85018c6b8 100644 --- a/inference-engine/thirdparty/clDNN/src/include/primitive_type.h +++ b/inference-engine/thirdparty/clDNN/src/include/primitive_type.h @@ -11,20 +11,20 @@ #include namespace cldnn { -struct network_impl; +struct network; class engine; struct program_node; struct primitive_impl; class primitive_inst; -struct program_impl; +struct program; struct primitive; struct primitive_type { virtual ~primitive_type() = default; - virtual std::shared_ptr create_node(program_impl& program, + virtual std::shared_ptr create_node(program& program, const std::shared_ptr prim) const = 0; - virtual std::shared_ptr create_instance(network_impl& network, + virtual std::shared_ptr create_instance(network& network, const program_node& node) const = 0; virtual std::unique_ptr choose_impl(const program_node& node) const = 0; virtual bool does_an_implementation_exist(const program_node& node) const = 0; diff --git a/inference-engine/thirdparty/clDNN/src/include/primitive_type_base.h b/inference-engine/thirdparty/clDNN/src/include/primitive_type_base.h index 5e34a7bba5f54f..58cbe823a17a4e 100644 --- a/inference-engine/thirdparty/clDNN/src/include/primitive_type_base.h +++ b/inference-engine/thirdparty/clDNN/src/include/primitive_type_base.h @@ -11,7 +11,7 @@ #include "primitive_type.h" #include "program_node.h" #include "primitive_inst.h" -#include "network_impl.h" +#include "cldnn/graph/network.hpp" #include "impls/implementation_map.hpp" #include @@ -20,7 +20,7 @@ namespace cldnn { template struct primitive_type_base : primitive_type { - std::shared_ptr create_node(program_impl& program, + std::shared_ptr create_node(program& program, const std::shared_ptr prim) const override { if (prim->type != this) throw std::invalid_argument("primitive_type_base::create_node: primitive type mismatch"); @@ -28,7 +28,7 @@ struct primitive_type_base : primitive_type { return std::make_shared>(std::static_pointer_cast(prim), program); } - std::shared_ptr create_instance(network_impl& network, + std::shared_ptr create_instance(network& network, const cldnn::program_node& node) const override { if (node.type() != this) throw std::invalid_argument("primitive_type_base::create_instance: primitive type mismatch"); diff --git a/inference-engine/thirdparty/clDNN/src/include/prior_box_inst.h b/inference-engine/thirdparty/clDNN/src/include/prior_box_inst.h index 16c6681509fa1a..9099ed068bed2c 100644 --- a/inference-engine/thirdparty/clDNN/src/include/prior_box_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/prior_box_inst.h @@ -16,7 +16,7 @@ template <> struct typed_program_node : typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(std::shared_ptr prim, program_impl& prog); + typed_program_node(std::shared_ptr prim, program& prog); program_node& input() const { return get_dependency(0); } @@ -39,7 +39,7 @@ class typed_primitive_inst : public typed_primitive_inst_base #include @@ -13,8 +13,8 @@ namespace cldnn { std::string get_dir_path(build_options); std::string get_serialization_network_name(build_options); -void dump_graph_optimized(std::ofstream&, const program_impl&); -void dump_graph_processing_order(std::ofstream&, const program_impl&); -void dump_graph_init(std::ofstream&, const program_impl&, std::function const&); -void dump_graph_info(std::ofstream&, const program_impl&, std::function const&); +void dump_graph_optimized(std::ofstream&, const program&); +void dump_graph_processing_order(std::ofstream&, const program&); +void dump_graph_init(std::ofstream&, const program&, std::function const&); +void dump_graph_info(std::ofstream&, const program&, std::function const&); } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/include/program_helpers.h b/inference-engine/thirdparty/clDNN/src/include/program_helpers.h index 60291deb1e7557..564e4f15238edd 100644 --- a/inference-engine/thirdparty/clDNN/src/include/program_helpers.h +++ b/inference-engine/thirdparty/clDNN/src/include/program_helpers.h @@ -8,7 +8,7 @@ #include "program_node.h" #include "cldnn/runtime/engine.hpp" -#include "program_impl.h" +#include "cldnn/graph/program.hpp" #include "data_inst.h" #include @@ -31,26 +31,26 @@ struct program_helpers { // // T& case -> returns container which holds T& template - static program_impl::single_element_container wrap_if_single(T& t) { - return program_impl::single_element_container(t); + static program::single_element_container wrap_if_single(T& t) { + return program::single_element_container(t); } // helper function which creates single-element array if it's given anything // other than std::vector. // T const& case -> returns container which holds T const& template - static program_impl::single_element_container wrap_if_single(T const& t) { - return program_impl::single_element_container(t); + static program::single_element_container wrap_if_single(T const& t) { + return program::single_element_container(t); } // helper function which creates single-element array if it's given anything // other than std::vector. // T&& case -> returns container which holds new instance of T created by moving given param template - static program_impl::single_element_container wrap_if_single(T&& t) { + static program::single_element_container wrap_if_single(T&& t) { static_assert(meta::always_false::value, "Wrapping temporary object into single_element_container is an error (requires valid reference)"); - return program_impl::single_element_container(t); + return program::single_element_container(t); } // helper function which creates single-element array if it's given anything @@ -131,7 +131,7 @@ struct program_helpers { // and overload match and optimize methods. template struct pattern_match_optimization { - pattern_match_optimization(program_impl& prog) + pattern_match_optimization(program& prog) : prog(prog) {} @@ -154,9 +154,9 @@ struct pattern_match_optimization { return optimize(node); } - program_impl& get_program() { return prog; } + program& get_program() { return prog; } - program_impl& prog; + program& prog; }; // Class for pattern-match optimizations that provides support for matching @@ -205,15 +205,15 @@ bool run_node_optimizations(program_node& node, Opt&& opt, Rest&&... rest) { } // Runs pattern-match optimizations `Opts` on `node`. -// Optimizations should have constructor with single argument `program_impl&`. +// Optimizations should have constructor with single argument `program&`. template -bool run_node_optimizations(program_impl& p, program_node& node) { +bool run_node_optimizations(program& p, program_node& node) { return run_node_optimizations(node, Opts(p)...); } // Runs specified pattern-match optimizations on whole program, in processing order. template -void run_node_optimizations(program_impl& p, Opts&&... opts) { +void run_node_optimizations(program& p, Opts&&... opts) { auto it = p.get_processing_order().begin(); while (it != p.get_processing_order().end()) { auto node = *it++; @@ -222,7 +222,7 @@ void run_node_optimizations(program_impl& p, Opts&&... opts) { } template -void run_node_optimizations(program_impl& p) { +void run_node_optimizations(program& p) { run_node_optimizations(p, Opts(p)...); } diff --git a/inference-engine/thirdparty/clDNN/src/include/program_impl.h b/inference-engine/thirdparty/clDNN/src/include/program_impl.h deleted file mode 100644 index df45537f00ad91..00000000000000 --- a/inference-engine/thirdparty/clDNN/src/include/program_impl.h +++ /dev/null @@ -1,339 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cldnn/graph/program.hpp" -#include "cldnn/runtime/engine.hpp" -#include "cldnn/runtime/stream.hpp" -#include "runtime/kernels_cache.hpp" - -#include -#include -#include -#include -#include -#include -#include - -namespace kernel_selector { -class TuningCache; -} // namespace kernel_selector - -namespace cldnn { - -struct topology_impl; -struct primitive_impl; -struct program_node; -class layout_optimizer; -class pass_manager; -class base_pass; -class program_impl_wrapper; - -struct gpu_program_state { - kernels_cache _kernels_cache; - - gpu_program_state(engine& engine) : _kernels_cache(engine) {} -}; - -/* - cldnn_program implementation -*/ -struct program_impl { - using ptr = std::shared_ptr; - using cptr = std::shared_ptr; - friend class calculate_prior_boxes; // to be removed when possible - friend class graph_initializations; // to be removed when possible - friend class prepare_padding; // to be removed when possible - friend class propagate_constants; // to be removed when possible - friend class pre_replace_deconv; // to be removed when possible - friend class prepare_primitive_fusing; // to be removed when possible - friend class prepare_quantization; // to be removed when possible - friend class prepare_conv_eltw_fusing; // to be removed when possible - friend class reorder_inputs; // to be removed when possible - friend class remove_redundant_reorders; // to be removed when possible - friend class program_impl_wrapper; // this class is intended to extend the interface of program_impl for - // the usage within tests_core_internal project only -public: - struct nodes_ordering { - public: - typedef std::list list_of_nodes; - typedef list_of_nodes::const_iterator const_iterator; - typedef list_of_nodes::const_reverse_iterator const_reverse_iterator; - typedef list_of_nodes::iterator node_iterator; - typedef list_of_nodes::reverse_iterator node_reverse_iterator; - const_iterator begin() const { return _processing_order.begin(); } - const_iterator end() const { return _processing_order.end(); } - const_reverse_iterator rbegin() const { return _processing_order.rbegin(); } - const_reverse_iterator rend() const { return _processing_order.rend(); } - - void calc_processing_order_visit(program_node* node); - void calc_processing_order(program_impl& p); - int32_t get_processing_number(program_node* node) const { - return get_processing_number(get_processing_iterator(*node)); - } - // int32_t get_processing_number(const_iterator iter) const { return 1+(int32_t)std::distance(begin(), iter); } - int32_t get_processing_number(node_iterator iter) const { - return 1 + (int32_t)std::distance(_processing_order.begin(), const_iterator(iter)); - } - void calculate_BFS_processing_order(); - size_t size() { return _processing_order.size(); } - bool is_correct(program_node* node); - - node_iterator get_processing_iterator(program_node& node) const { return processing_order_iterators.at(&node); } - void clear() { - processing_order_iterators.clear(); - _processing_order.clear(); - } - - void insert(program_node* key_node, program_node* node) { - node_iterator _where = processing_order_iterators.at(key_node); - processing_order_iterators[node] = _processing_order.insert(_where, node); - } - - void insert_next(program_node* key_node, program_node* node) { - node_iterator _where = std::next(processing_order_iterators.at(key_node)); - processing_order_iterators[node] = _processing_order.insert(_where, node); - } - - void erase(program_node* key_node) { - node_iterator i = processing_order_iterators.at(key_node); - processing_order_iterators.erase(key_node); - _processing_order.erase(i); - } - - private: - list_of_nodes _processing_order; - std::map processing_order_iterators; - }; - - template - struct single_element_container { - explicit single_element_container(T& t) : elem(&t) {} - constexpr size_t size() const { return 1; } - single_element_container begin() const { return single_element_container(elem); } - single_element_container end() const { return single_element_container(nullptr); } - single_element_container& operator++() { - elem = nullptr; - return *this; - } - bool operator!=(single_element_container const& sec) { return elem != sec.elem; } - - T operator*() { return *elem; } - - private: - explicit single_element_container(T* t) : elem(t) {} - - T* elem; - }; - - typedef std::vector primitives_info; - typedef std::vector> graph_optimizer_info; - typedef std::pair> optimized_info; - - program_impl(engine& engine_ref, - topology_impl const& topology, - build_options const& options, - bool is_internal, - bool no_optimizations = false, - bool is_body_program = false); - /* constructor used to build a program from subset of nodes of other program (used in propagate_constants) */ - program_impl(engine& engine_ref, - std::set> const& nodes, - build_options const& options, - bool is_internal); - ~program_impl(); - engine& get_engine() const { return _engine; } - const build_options& get_options() const { return options; } - std::list& get_inputs() { - return inputs; - } // ToDo: redesign trim to ouptut pass to make it const as_well as get_engine and get options - std::vector& get_outputs() { - return outputs; - } // ToDo: redesign reorder-inputs pass to make it const as_well as get_engine and get options - bool is_loop_body() const { return is_body_program; } - bool is_debug_build() const { return options.get()->enabled(); } - const nodes_ordering& get_processing_order() const; - nodes_ordering& get_processing_order(); - uint32_t get_prog_id() { return prog_id; } - stream& get_stream() { return *_stream; } - const std::list& get_optimized_out() const { return optimized_out; } - const std::list& get_optimized() const { return optimized; } - bool has_node(const primitive_id& prim) const { return nodes_map.count(prim) > 0; } - program_node& get_node(primitive_id const& id); - program_node const& get_node(primitive_id const& id) const; - std::shared_ptr get_node_ptr(const primitive_id& prim) { return nodes_map.at(prim); } - std::shared_ptr get_node_ptr(const primitive_id& prim) const { return nodes_map.at(prim); } - - // returns already existing program_node for given primitive 'prim' (lookup in 'nodes_map') - // if it was previously created, otherwise creates and then returns program_node - program_node& get_or_create(std::shared_ptr prim); - - // Inserts given program_node 'node' as an intermediate node between 'next' and it's - // dependency at 'prev_idx' index. - void add_intermediate(program_node& node, - program_node& next, - size_t prev_idx, - bool connect_int_node_with_old_dep = true, - bool move_usrs_of_prev_to_node = false); - - // Gets or creates program_node for given primitive 'prim' and inserts it as an intermediate - // node between 'next' and it's dependency at 'prev_idx' index. - void add_intermediate(std::shared_ptr prim, - program_node& next, - size_t prev_idx, - bool connect_int_node_with_old_dep = true, - bool move_usrs_of_prev_to_node = false); - - // Inserts given program_node 'node' as an intermediate node between 'next' and it's - // dependency prev - void add_intermediate(program_node& node, - program_node& next, - program_node& prev, - bool connect_int_node_with_old_dep = true, - bool move_usrs_of_prev_to_node = false); - - // removes a node from the graph and deletes it afterwards, - // prereq: node cannot be marked as output and has to have exactly one dependency - // returns if 'node' has been extracted and removed successfully - bool extract_and_remove(program_node& node); - - // Fuses two nodes into fused_node and removes peer_node from graph - void fuse_nodes(program_node& fused_node, program_node& peer_node, std::map>* fusing_history); - - // returns if 'node' has been removed - bool remove_if_dangling(program_node& node); - - void mark_if_constant(program_node& node); - // mark if the node is in data flow assuming that all dependencies are marked properly - void mark_if_data_flow(program_node& node); - // Reverses connection - user becomes dependency. - - void remove_nodes(std::vector& to_remove); - void dump_program(const char* stage, - bool with_full_info, - std::function const& filter = nullptr) const; - - const primitives_info& get_primitives_info() const; - const graph_optimizer_info& get_optimizer_passes_info() const; - void save_pass_info(std::string pass_name); - - void add_optimized_primitive_info(primitive_id optimized_primitive_id, std::vector replaced_with_ids = {}); - - void reset_program(); - uint32_t get_id() const { return prog_id; } - - static ptr build_program(engine& engine, - const topology_impl& topology, - const build_options& options, - bool is_internal = false, - bool no_optimizations = false, - bool is_body_program = false); - static ptr build_program(engine& engine, - const std::set>& nodes, - const build_options& options, - bool is_internal); - static void init_primitives(); - void compile(); - void init_kernels(); - kernel_id add_kernel(const std::shared_ptr kernel_sring); - kernel::ptr get_kernel(kernel_id id); - - void load_tuning_cache(); - std::shared_ptr get_tuning_cache() const { return tuning_cache; } - -private: - uint32_t prog_id = 0; - engine& _engine; - stream::ptr _stream; - gpu_program_state program_state; - build_options options; - std::list inputs; - std::vector outputs; - nodes_ordering processing_order; - std::unique_ptr pm; - std::shared_ptr tuning_cache; - bool is_body_program; - - - std::map> nodes_map; - std::list optimized_out; - - std::list optimized; - primitives_info prim_info; - graph_optimizer_info optimizer_passes_info; - - primitives_info get_current_stage_info() const; - /* - ** High-level functions, in order of usage - */ - /* build nodes internal structure based on topology */ - void prepare_nodes(topology_impl const& topology); - /* build nodes internal structure based on the subset of nodes of other program (used in propagate_constants) */ - void prepare_nodes(std::set> const& nodes); - void add_node_dependencies(program_node* node_ptr); - void copy_node_dependencies(program_node* dest, program_node* src); - void build_program(bool is_internal); - void init_graph(); - void set_options(); - void set_layout_optimizer_attributes(layout_optimizer& lo); - - void apply_opt_pass(base_pass& pass); - - template - typename std::enable_if::value && - std::is_constructible::value>::type - apply_opt_pass(Args&&... args) { - auto pass = Pass(std::forward(args)...); - apply_opt_pass(pass); - } - - void run_graph_compilation(); - void pre_optimize_graph(bool is_internal); - void post_optimize_graph(bool is_internal); - void cleanup(); - void transfer_memory_to_device(); - - /* - ** Analysis functions - */ - // TODO: Remove once we will get full support for input/output padding in all primitive implementations. - bool analyze_output_size_handling_need(); - - /* - ** Optimization functions - */ - void apply_needed_padding(program_node& node, program_node& prev_node, const padding& needed_padding); - - /* - ** Memory pool functions - */ - void prepare_memory_dependencies(); - std::string get_memory_dependencies_string() const; - - /* - ** Utilities - */ - void add_split_outputs(); - // mark if the node is constant assuming that all dependencies are marked properly - void reverse_connection(program_node& dep_node, program_node& user_node); - - void add_connection(program_node& prev, program_node& next); - - void remove_connection(program_node& prev, program_node& next); - - void remove_all_connections(program_node& node); - - void rename(program_node& node, primitive_id const& new_id); - void swap_names(program_node& node1, program_node& node2); - void replace_all_usages(program_node& old_node, program_node& new_node); - - // old_node - node which will be replaced - // new_node - node which will replace the old one - void replace(program_node& old_node, program_node& new_node); -}; - -} // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/include/program_node.h b/inference-engine/thirdparty/clDNN/src/include/program_node.h index d0be0db6039b6f..2b38d85d966a60 100644 --- a/inference-engine/thirdparty/clDNN/src/include/program_node.h +++ b/inference-engine/thirdparty/clDNN/src/include/program_node.h @@ -20,7 +20,7 @@ namespace cldnn { -struct program_impl; +struct program; struct primitive_impl; class reorder_inputs; class graph_initializations; @@ -56,7 +56,7 @@ struct fused_primitive_desc { to API level where all primitives store only ids of related ones. */ struct program_node { - friend struct program_impl; // to be removed when possible + friend struct program; // to be removed when possible friend class compile_graph; // to be removed when possible friend class graph_initializations; // to be removed when possible friend class pre_replace_deconv; // to be removed when possible @@ -70,7 +70,7 @@ struct program_node { template friend struct typed_program_node; - program_node(std::shared_ptr prim, program_impl& prog); + program_node(std::shared_ptr prim, program& prog); program_node(program_node const&) = delete; @@ -89,8 +89,8 @@ struct program_node { return type() == PType::type_id(); } - program_impl& get_program() { return myprog; } - program_impl& get_program() const { return myprog; } + program& get_program() { return myprog; } + program& get_program() const { return myprog; } primitive_impl* get_selected_impl() const { return selected_impl.get(); } void set_selected_impl(std::unique_ptr impl); @@ -316,7 +316,7 @@ struct program_node { std::string unique_id; std::shared_ptr desc; - program_impl& myprog; + program& myprog; std::unique_ptr selected_impl; @@ -373,7 +373,7 @@ struct typed_program_node_base : public program_node { friend class cldnn::graph_initializations; friend class cldnn::pre_replace_deconv; friend class cldnn::prepare_quantization; - friend struct cldnn::program_impl; + friend struct cldnn::program; friend class cldnn::reorder_inputs; public: diff --git a/inference-engine/thirdparty/clDNN/src/include/proposal_inst.h b/inference-engine/thirdparty/clDNN/src/include/proposal_inst.h index 3c67afe4003cfa..8ebbd259e6835c 100644 --- a/inference-engine/thirdparty/clDNN/src/include/proposal_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/proposal_inst.h @@ -67,7 +67,7 @@ class typed_primitive_inst : public typed_primitive_inst_base& get_anchors() const { return _anchors; } diff --git a/inference-engine/thirdparty/clDNN/src/include/pyramid_roi_align_inst.h b/inference-engine/thirdparty/clDNN/src/include/pyramid_roi_align_inst.h index 829f5228f61897..afda56773429ab 100644 --- a/inference-engine/thirdparty/clDNN/src/include/pyramid_roi_align_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/pyramid_roi_align_inst.h @@ -15,7 +15,7 @@ struct typed_program_node : public typed_program_node_base; public: - typed_program_node(std::shared_ptr prim, program_impl& prog) : parent(prim, prog) {} + typed_program_node(std::shared_ptr prim, program& prog) : parent(prim, prog) {} program_node& input() const { return get_dependency(0); } // program_node& boxes() const { return get_dependency(0); } @@ -34,7 +34,7 @@ class typed_primitive_inst : public typed_primitive_inst_base public: static layout calc_output_layout(pyramid_roi_align_node const& node); static std::string to_string(pyramid_roi_align_node const& node); - typed_primitive_inst(network_impl& network, pyramid_roi_align_node const& node); + typed_primitive_inst(network& network, pyramid_roi_align_node const& node); memory& input() const { return dep_memory(0); } memory& P2() const { return dep_memory(1); } diff --git a/inference-engine/thirdparty/clDNN/src/include/quantize_inst.h b/inference-engine/thirdparty/clDNN/src/include/quantize_inst.h index 1d680ecb3cce20..a3ef5c7695b73c 100644 --- a/inference-engine/thirdparty/clDNN/src/include/quantize_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/quantize_inst.h @@ -114,7 +114,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/reduce_inst.h b/inference-engine/thirdparty/clDNN/src/include/reduce_inst.h index 678f861a2a8694..f822682ef47e18 100644 --- a/inference-engine/thirdparty/clDNN/src/include/reduce_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/reduce_inst.h @@ -31,7 +31,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(reduce_node const& node); public: - typed_primitive_inst(network_impl& network, reduce_node const& desc); + typed_primitive_inst(network& network, reduce_node const& desc); }; using reduce_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/region_yolo_inst.h b/inference-engine/thirdparty/clDNN/src/include/region_yolo_inst.h index 0b6a24068cccc8..f98ab0facfa9c9 100644 --- a/inference-engine/thirdparty/clDNN/src/include/region_yolo_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/region_yolo_inst.h @@ -21,7 +21,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/reorder_inst.h b/inference-engine/thirdparty/clDNN/src/include/reorder_inst.h index ce851e482aebb5..85d301e5b137a9 100644 --- a/inference-engine/thirdparty/clDNN/src/include/reorder_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/reorder_inst.h @@ -18,7 +18,7 @@ struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; public: - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -51,7 +51,7 @@ class typed_primitive_inst : public typed_primitive_inst_base static std::string to_string(reorder_node const& node); public: - typed_primitive_inst(network_impl& network, reorder_node const& node); + typed_primitive_inst(network& network, reorder_node const& node); memory::ptr mean_nv12_memory() const { return dep_memory_ptr(2); } memory::ptr mean_memory() const { return dep_memory_ptr(1); } diff --git a/inference-engine/thirdparty/clDNN/src/include/reorg_yolo_inst.h b/inference-engine/thirdparty/clDNN/src/include/reorg_yolo_inst.h index 43efd38a9b5180..09d60784629139 100644 --- a/inference-engine/thirdparty/clDNN/src/include/reorg_yolo_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/reorg_yolo_inst.h @@ -21,7 +21,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/resample_inst.h b/inference-engine/thirdparty/clDNN/src/include/resample_inst.h index 6bb8de03b27351..c7081b7577f54b 100644 --- a/inference-engine/thirdparty/clDNN/src/include/resample_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/resample_inst.h @@ -6,7 +6,6 @@ #pragma once #include "cldnn/primitives/resample.hpp" #include "primitive_inst.h" -#include "topology_impl.h" #include #include @@ -15,7 +14,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -37,7 +36,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/reshape_inst.h b/inference-engine/thirdparty/clDNN/src/include/reshape_inst.h index 32adce5518613a..4974836facf1e9 100644 --- a/inference-engine/thirdparty/clDNN/src/include/reshape_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/reshape_inst.h @@ -16,7 +16,7 @@ namespace cldnn { template <> struct typed_program_node : public typed_program_node_base { using parent = typed_program_node_base; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } @@ -46,7 +46,7 @@ class typed_primitive_inst : public typed_primitive_inst_base static std::string to_string(reshape_node const& node); public: - typed_primitive_inst(network_impl& network, reshape_node const& node); + typed_primitive_inst(network& network, reshape_node const& node); private: void on_execute() override; diff --git a/inference-engine/thirdparty/clDNN/src/include/reverse_sequence_inst.h b/inference-engine/thirdparty/clDNN/src/include/reverse_sequence_inst.h index 60ba5b3dd4e297..a532814fc34376 100644 --- a/inference-engine/thirdparty/clDNN/src/include/reverse_sequence_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/reverse_sequence_inst.h @@ -31,7 +31,7 @@ class typed_primitive_inst : public typed_primitive_inst_base< static std::string to_string(reverse_sequence_node const& node); public: - typed_primitive_inst(network_impl& network, reverse_sequence_node const& desc); + typed_primitive_inst(network& network, reverse_sequence_node const& desc); }; using reverse_sequence_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/scale_inst.h b/inference-engine/thirdparty/clDNN/src/include/scale_inst.h index a25fb49be994e7..6d0a581816a480 100644 --- a/inference-engine/thirdparty/clDNN/src/include/scale_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/scale_inst.h @@ -21,7 +21,7 @@ struct typed_program_node : public typed_program_node_base { public: using parent::parent; - typed_program_node(const std::shared_ptr prim, program_impl& prog) : parent(prim, prog) { + typed_program_node(const std::shared_ptr prim, program& prog) : parent(prim, prog) { support_padding_all(true); } program_node& input() const { return get_dependency(0); } @@ -46,7 +46,7 @@ class typed_primitive_inst : public typed_primitive_inst_base { static std::string to_string(scale_node const& node); public: - typed_primitive_inst(network_impl& network, scale_node const& desc); + typed_primitive_inst(network& network, scale_node const& desc); memory::ptr scale_memory() const { return dep_memory_ptr(1); } memory::ptr bias_memory() const { return dep_memory_ptr(2); } diff --git a/inference-engine/thirdparty/clDNN/src/include/scatter_elements_update_inst.h b/inference-engine/thirdparty/clDNN/src/include/scatter_elements_update_inst.h index f70bed68bee509..00f994cada0475 100644 --- a/inference-engine/thirdparty/clDNN/src/include/scatter_elements_update_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/scatter_elements_update_inst.h @@ -30,7 +30,7 @@ class typed_primitive_inst : public typed_primitive_ins static std::string to_string(scatter_elements_update_node const& node); public: - typed_primitive_inst(network_impl& network, scatter_elements_update_node const& desc); + typed_primitive_inst(network& network, scatter_elements_update_node const& desc); }; using scatter_elements_update_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/scatter_nd_update_inst.h b/inference-engine/thirdparty/clDNN/src/include/scatter_nd_update_inst.h index acf3ee9c6c010d..725fb42a26f358 100644 --- a/inference-engine/thirdparty/clDNN/src/include/scatter_nd_update_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/scatter_nd_update_inst.h @@ -30,7 +30,7 @@ class typed_primitive_inst : public typed_primitive_inst_base static std::string to_string(scatter_nd_update_node const& node); public: - typed_primitive_inst(network_impl& network, scatter_nd_update_node const& desc); + typed_primitive_inst(network& network, scatter_nd_update_node const& desc); }; using scatter_nd_update_inst = typed_primitive_inst; diff --git a/inference-engine/thirdparty/clDNN/src/include/scatter_update_inst.h b/inference-engine/thirdparty/clDNN/src/include/scatter_update_inst.h index 1c9b7934f25aa1..b02bfd5156896d 100644 --- a/inference-engine/thirdparty/clDNN/src/include/scatter_update_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/scatter_update_inst.h @@ -31,7 +31,7 @@ class typed_primitive_inst : public typed_primitive_inst_base; diff --git a/inference-engine/thirdparty/clDNN/src/include/select_inst.h b/inference-engine/thirdparty/clDNN/src/include/select_inst.h index 4adde4e8c604e5..3ed53f20a16889 100644 --- a/inference-engine/thirdparty/clDNN/src/include/select_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/select_inst.h @@ -30,7 +30,7 @@ class typed_primitive_inst { public: static layout calc_output_layout(select_node const& node); static std::string to_string(select_node const& node); - typed_primitive_inst(network_impl& network, select_node const& node); + typed_primitive_inst(network& network, select_node const& node); }; using select_inst = typed_primitive_inst