From 9cc4c25e481e96760eda7ee553220f2492122303 Mon Sep 17 00:00:00 2001 From: Sungeun Kim Date: Thu, 9 Nov 2023 20:46:50 +0900 Subject: [PATCH] [GPU] print datashape of input for benchmark_app (#20943) * print datashape of input for benchmark_app --- .../intel_gpu/runtime/debug_configuration.hpp | 1 + src/plugins/intel_gpu/src/graph/network.cpp | 22 +++++++++++++++++++ .../src/runtime/debug_configuration.cpp | 3 +++ 3 files changed, 26 insertions(+) diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp index 0e6269641e0..0a5fb7513ee 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp @@ -100,6 +100,7 @@ public: int verbose_color; // Print verbose color int list_layers; // Print list layers int print_multi_kernel_perf; // Print execution time of each kernel in multi-kernel primitimive + int print_input_data_shapes; // Print the input data_shape for benchmark_app. int disable_usm; // Disable usm usage int disable_onednn; // Disable onednn for discrete GPU (no effect for integrated GPU) int disable_onednn_opt_post_ops; // Disable onednn optimize post operators diff --git a/src/plugins/intel_gpu/src/graph/network.cpp b/src/plugins/intel_gpu/src/graph/network.cpp index 2aaca0c73b2..cd5d0124cd1 100644 --- a/src/plugins/intel_gpu/src/graph/network.cpp +++ b/src/plugins/intel_gpu/src/graph/network.cpp @@ -1378,6 +1378,28 @@ void network::execute_impl(const std::vector& events) { } } + // print '-data_shape' option for benchmark_app + GPU_DEBUG_IF(debug_config->print_input_data_shapes == 1) { + std::stringstream data_shape_str; + auto add_string = [&data_shape_str](std::string str) { + data_shape_str << ((data_shape_str.rdbuf()->in_avail() == 0) ? " -data_shape " : ",") << str; + }; + + for (auto& inst : _exec_order) { + auto name = inst->id(); + auto pos = name.find(':'); + auto type = name.substr(0, pos); + name.erase(0, pos + 1); + if (inst->is_input() && type == "parameter") { + add_string(name + inst->get_output_layout().get_partial_shape().to_string()); + } + } + + GPU_DEBUG_COUT << "[program:" << std::setw(2) << ((get_program() != nullptr) ? get_program()->get_id() : 0) + << "|network:" << std::setw(2) << get_id() << "|iter:" << std::setw(4) << curr_iter << "] benchmark_app cmd: " + << data_shape_str.str() << std::endl; + } + // Store events only in case of OOO queue or enabled Profiling auto store_events = is_out_of_order_queue || _enable_profiling; if (store_events) { diff --git a/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp b/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp index eb7324cb7b5..55f166c4880 100644 --- a/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp +++ b/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp @@ -108,6 +108,7 @@ static void print_help_messages() { message_list.emplace_back("OV_GPU_VerboseColor", "Print verbose color"); message_list.emplace_back("OV_GPU_ListLayers", "Print layers names"); message_list.emplace_back("OV_GPU_PrintMultiKernelPerf", "Print execution time of each kernel in multi-kernel primitimive"); + message_list.emplace_back("OV_GPU_PrintInputDataShapes", "Print data_shapes of input layers for benchmark_app."); message_list.emplace_back("OV_GPU_DisableUsm", "Disable usm usage"); message_list.emplace_back("OV_GPU_DisableOnednn", "Disable onednn for discrete GPU (no effect for integrated GPU)"); message_list.emplace_back("OV_GPU_DisableOnednnOptPostOps", "Disable onednn optimize post operators"); @@ -173,6 +174,7 @@ debug_configuration::debug_configuration() , verbose_color(0) , list_layers(0) , print_multi_kernel_perf(0) + , print_input_data_shapes(0) , disable_usm(0) , disable_onednn(0) , disable_onednn_opt_post_ops(0) @@ -206,6 +208,7 @@ debug_configuration::debug_configuration() get_gpu_debug_env_var("VerboseColor", verbose_color); get_gpu_debug_env_var("ListLayers", list_layers); get_gpu_debug_env_var("PrintMultiKernelPerf", print_multi_kernel_perf); + get_gpu_debug_env_var("PrintInputDataShapes", print_input_data_shapes); get_gpu_debug_env_var("DisableUsm", disable_usm); get_gpu_debug_env_var("DumpGraphs", dump_graphs); get_gpu_debug_env_var("DumpSources", dump_sources);