diff --git a/inference-engine/src/cldnn_engine/cldnn_program.cpp b/inference-engine/src/cldnn_engine/cldnn_program.cpp index 42e727017c8e13..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)); diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp index 2ec406a9f30d35..7ac6b11e9db6e3 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp @@ -52,7 +52,7 @@ class primitive_inst; struct network { public: using ptr = std::shared_ptr; - explicit network(program::ptr program, stream::ptr stream, bool is_internal = false, bool is_primary_stream = false); + explicit network(program::ptr program, stream::ptr stream, bool is_internal = false, bool is_primary_stream = true); network(engine& engine, const topology& topo, const build_options& options = build_options(), diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp index b9c01a3cb0a2f2..ee98838c740b85 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/graph/program.hpp @@ -64,7 +64,6 @@ struct program { 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)); } 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/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 8fae64b2f1b927..483471830283ea 100644 --- a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp @@ -3,8 +3,8 @@ // #include "kernels_factory.hpp" +#include "kernels_cache.hpp" #include "ocl/ocl_engine.hpp" -#include "cldnn/runtime/kernels_cache.hpp" #include "cldnn/runtime/debug_configuration.hpp" #include @@ -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/api/cldnn/runtime/kernels_cache.hpp b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.hpp similarity index 100% rename from inference-engine/thirdparty/clDNN/api/cldnn/runtime/kernels_cache.hpp rename to inference-engine/thirdparty/clDNN/runtime/kernels_cache.hpp 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/include/condition_inst.h b/inference-engine/thirdparty/clDNN/src/include/condition_inst.h index 79ad8d7a80c550..9906d4113e93a5 100644 --- a/inference-engine/thirdparty/clDNN/src/include/condition_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/condition_inst.h @@ -26,15 +26,15 @@ struct typed_program_node : public typed_program_node_base void set(const program_node& node) { add_or_change_input_layout(node); _program = program::build_program(node.get_program().get_engine(), - _topology, - node.get_program().get_options(), - true); // rebuild program + _topology, + node.get_program().get_options(), + true); // rebuild program } program::ptr get() const { return _program; } private: topology _topology; - program::ptr _program = (program::ptr) nullptr; + program::ptr _program = nullptr; void add_or_change_input_layout(const program_node& node) { auto layout = node.get_dependency(0).get_output_layout(); 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/kernel_runner.cpp b/inference-engine/thirdparty/clDNN/src/kernel_runner.cpp index 59d2850af9b6b3..8f937863b52685 100644 --- a/inference-engine/thirdparty/clDNN/src/kernel_runner.cpp +++ b/inference-engine/thirdparty/clDNN/src/kernel_runner.cpp @@ -5,7 +5,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include "kernel_runner.h" -#include "cldnn/runtime/kernels_cache.hpp" +#include "runtime/kernels_cache.hpp" #include "cldnn/runtime/stream.hpp" #include "weight_bias_params.h" #include "kernel_selector_helper.h" diff --git a/inference-engine/thirdparty/clDNN/src/network.cpp b/inference-engine/thirdparty/clDNN/src/network.cpp index 28f3d425c89135..49bd69d7da34a6 100644 --- a/inference-engine/thirdparty/clDNN/src/network.cpp +++ b/inference-engine/thirdparty/clDNN/src/network.cpp @@ -218,6 +218,18 @@ network::network(program::ptr program, stream::ptr stream, bool is_internal, boo validate_primitives(); } +network::network(engine& engine, + const topology& topo, + const build_options& options, + bool is_internal) + : network(program::build_program(engine, topo, options, is_internal), engine.create_stream(), is_internal) {} + +network::network(engine& engine, + const std::set>& nodes, + const build_options& options, + bool is_internal) + : network(program::build_program(engine, nodes, options, is_internal), engine.create_stream(), is_internal) {} + network::network(program::ptr program, uint16_t stream_id) : network(program, program->get_engine().create_stream(), false, stream_id ==0) {} @@ -248,18 +260,6 @@ network::ptr network::build_network(engine& engine, return std::make_shared(engine, nodes, options, is_internal); } -network::network(engine& engine, - const topology& topo, - const build_options& options, - bool is_internal) - : network(program::build_program(engine, topo, options, is_internal), engine.create_stream(), is_internal) {} - -network::network(engine& engine, - const std::set>& nodes, - const build_options& options, - bool is_internal) - : network(program::build_program(engine, nodes, options, is_internal), engine.create_stream(), is_internal) {} - void network::validate_primitives() { for (auto const& prim : _exec_order) { bool valid = prim->validate(); diff --git a/inference-engine/thirdparty/clDNN/src/program.cpp b/inference-engine/thirdparty/clDNN/src/program.cpp index 9379f54de2167b..dca186ab8f2c4d 100644 --- a/inference-engine/thirdparty/clDNN/src/program.cpp +++ b/inference-engine/thirdparty/clDNN/src/program.cpp @@ -5,7 +5,11 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include "cldnn/runtime/error_handler.hpp" -#include "cldnn/runtime/kernels_cache.hpp" +#include "cldnn/runtime/memory.hpp" +#include "cldnn/runtime/engine.hpp" +#include "cldnn/runtime/debug_configuration.hpp" +#include "cldnn/graph/program.hpp" + #include "kernel_selector_helper.h" #include "device_cache_reader.h" #include "auto_tuner.h" @@ -13,7 +17,6 @@ #include "pass_manager.h" #include "primitive_type.h" #include "program_dump_graph.h" -#include "cldnn/graph/program.hpp" #include "sliding_window_utils.h" #include "program_helpers.h" @@ -57,13 +60,11 @@ #include "loop_inst.h" #include "to_string_utils.h" #include "runtime/cldnn_itt.hpp" +#include "runtime/kernels_cache.hpp" #include "impls/ocl/register.hpp" #include "impls/cpu/register.hpp" #include "impls/common/register.hpp" -#include "cldnn/runtime/memory.hpp" -#include "cldnn/runtime/engine.hpp" - #include "kernel_base.h" #include @@ -401,6 +402,11 @@ void program::set_options() { throw std::invalid_argument("Engine must be created with profiling enabled in tune_and_cache mode!"); } + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(!debug_config->dump_graphs.empty()) { + options.set_option(cldnn::build_option::graph_dumps_dir(debug_config->dump_graphs)); + } + if (!options.get()->forcing.empty()) { options.set_option(build_option::optimize_data(true)); }