From 3b0b9dc9d865ee0b1456e8f400f6f4a25c77b5db Mon Sep 17 00:00:00 2001 From: Rohit Kumar Srivastava Date: Thu, 24 Sep 2020 21:48:28 +0000 Subject: [PATCH] do not use executor for checking subgraph backend name --- src/executor/graph_executor.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/executor/graph_executor.cc b/src/executor/graph_executor.cc index c7febc4712f1..c7b4b0baec5f 100644 --- a/src/executor/graph_executor.cc +++ b/src/executor/graph_executor.cc @@ -2061,25 +2061,26 @@ Executor *Executor::Bind(nnvm::Symbol symbol, const std::vector &grad_req_type, const std::vector &aux_states, Executor* shared_exec) { - auto exec = new exec::GraphExecutor(symbol); + // Verbosity level: If =1 logs the name of subgaph backend + // If >1 then additional details regarding subgraph backend is logged static int verbose = dmlc::GetEnv("MXNET_SUBGRAPH_VERBOSE", 1); std::vector tmp_in_args = in_args; std::vector tmp_arg_grad_store = arg_grad_store; std::vector tmp_grad_req_type = grad_req_type; std::vector tmp_aux_states = aux_states; - if (!exec->subgraph_property().empty()) { - const auto& backend_name = exec->subgraph_property(); + const auto& backend_name = dmlc::GetEnv("MXNET_SUBGRAPH_BACKEND", exec::GetDefaultSubgraphBackend()); + if (!backend_name.empty()) { const auto& backend = op::SubgraphBackendRegistry::Get()->GetSubgraphBackend(backend_name); if (exec::SubgraphBackendCheck(backend, default_ctx, verbose)) { if (verbose) LOG(INFO) << "Subgraph backend " << backend_name << " is activated."; + // Subgraph cannot be recreated from unoptimized symbol symbol = exec::BuildSubgraph(symbol, backend, default_ctx, group2ctx, &tmp_in_args, &tmp_arg_grad_store, &tmp_grad_req_type, &tmp_aux_states, verbose); - // Subgraph cannot be recreated from unoptimized symbol - exec = new exec::GraphExecutor(symbol); } } + auto exec = new exec::GraphExecutor(symbol); exec->Init(symbol.Copy(), default_ctx, group2ctx, tmp_in_args, tmp_arg_grad_store, tmp_grad_req_type, tmp_aux_states, reinterpret_cast(shared_exec)); return exec;