Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
do not use executor for checking subgraph backend name
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Kumar Srivastava committed Sep 24, 2020
1 parent 2b055b7 commit 3b0b9dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/executor/graph_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2061,25 +2061,26 @@ Executor *Executor::Bind(nnvm::Symbol symbol,
const std::vector<OpReqType> &grad_req_type,
const std::vector<NDArray> &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<NDArray> tmp_in_args = in_args;
std::vector<NDArray> tmp_arg_grad_store = arg_grad_store;
std::vector<OpReqType> tmp_grad_req_type = grad_req_type;
std::vector<NDArray> 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<Executor*>(shared_exec));
return exec;
Expand Down

0 comments on commit 3b0b9dc

Please sign in to comment.