[GPU] New debug config: dry_run (#7689)

Enabling dry_run will shorten runtime of any application by exiting just
after graph compilation.
This commit is contained in:
Mingyu Kim 2021-09-29 17:09:52 +09:00 committed by GitHub
parent 4fd59f72ea
commit ee93823b3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 4 deletions

View File

@ -4,6 +4,7 @@
#include <cldnn/graph/network.hpp> #include <cldnn/graph/network.hpp>
#include <cldnn/runtime/profiling.hpp> #include <cldnn/runtime/profiling.hpp>
#include "cldnn/runtime/debug_configuration.hpp"
#include "cldnn_graph.h" #include "cldnn_graph.h"
#include "simple_math.h" #include "simple_math.h"
@ -82,6 +83,13 @@ void CLDNNGraph::Build() {
} }
UpdateImplementationsMap(); UpdateImplementationsMap();
GPU_DEBUG_GET_INSTANCE(debug_config);
GPU_DEBUG_IF(!debug_config->dry_run_path.empty()) {
CNNNetwork net(GetExecGraphInfo());
net.serialize(debug_config->dry_run_path);
exit(0);
}
} }
std::shared_ptr<cldnn::network> CLDNNGraph::BuildNetwork(std::shared_ptr<cldnn::program> program) { std::shared_ptr<cldnn::network> CLDNNGraph::BuildNetwork(std::shared_ptr<cldnn::program> program) {

View File

@ -32,6 +32,7 @@ public:
std::string dump_sources; // Dump opencl sources 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_path; // Enable dumping intermediate buffers and set the dest path
std::string dump_layers; // Dump intermediate buffers of specified layers only, separated by space std::string dump_layers; // Dump intermediate buffers of specified layers only, separated by space
std::string dry_run_path; // Dry run and serialize execution graph into the specified path
int dump_layers_dst_only; // Dump only output of layers int dump_layers_dst_only; // Dump only output of layers
static const debug_configuration *get_instance(); static const debug_configuration *get_instance();
}; };

View File

@ -103,6 +103,7 @@ debug_configuration::debug_configuration()
, dump_layers_path(std::string()) , dump_layers_path(std::string())
, dump_layers(std::string()) , dump_layers(std::string())
, dump_layers_dst_only(0) , dump_layers_dst_only(0)
, dry_run_path(std::string())
, disable_onednn(0) { , disable_onednn(0) {
#ifdef GPU_DEBUG_CONFIG #ifdef GPU_DEBUG_CONFIG
get_common_debug_env_var("Verbose", verbose); get_common_debug_env_var("Verbose", verbose);
@ -114,6 +115,7 @@ debug_configuration::debug_configuration()
get_gpu_debug_env_var("DumpLayers", dump_layers); get_gpu_debug_env_var("DumpLayers", dump_layers);
get_gpu_debug_env_var("DumpLayersDstOnly", dump_layers_dst_only); get_gpu_debug_env_var("DumpLayersDstOnly", dump_layers_dst_only);
get_gpu_debug_env_var("DisableOnednn", disable_onednn); get_gpu_debug_env_var("DisableOnednn", disable_onednn);
get_gpu_debug_env_var("DryRunPath", dry_run_path);
if (dump_layers_path.length() > 0 && !disable_usm) { if (dump_layers_path.length() > 0 && !disable_usm) {
disable_usm = 1; disable_usm = 1;

View File

@ -9,7 +9,6 @@
#include "primitive_inst.h" #include "primitive_inst.h"
#include "cldnn/graph/program.hpp" #include "cldnn/graph/program.hpp"
#include "cldnn/runtime/error_handler.hpp" #include "cldnn/runtime/error_handler.hpp"
#include "cldnn/runtime/debug_configuration.hpp"
#include "kernel_selector_helper.h" #include "kernel_selector_helper.h"
#include "cldnn/graph/network.hpp" #include "cldnn/graph/network.hpp"
#include "register.hpp" #include "register.hpp"

View File

@ -423,9 +423,17 @@ void program::build_program(bool is_internal) {
{ pre_optimize_graph(is_internal); } { pre_optimize_graph(is_internal); }
run_graph_compilation(); run_graph_compilation();
{ post_optimize_graph(is_internal); } { post_optimize_graph(is_internal); }
GPU_DEBUG_GET_INSTANCE(debug_config);
#ifdef GPU_DEBUG_CONFIG
if (debug_config->dry_run_path.empty()) {
#else
{
#endif
prepare_memory_dependencies(); prepare_memory_dependencies();
compile(); compile();
init_kernels(); init_kernels();
}
if (!is_internal) { if (!is_internal) {
prim_info = get_current_stage_info(); prim_info = get_current_stage_info();