Browse Source

chore(mgb): add no_force_inplace option to ComputingGraph

GitOrigin-RevId: 350c90fb86
tags/v1.0.0-rc1
Megvii Engine Team 4 years ago
parent
commit
968f74ce88
3 changed files with 13 additions and 1 deletions
  1. +1
    -0
      imperative/src/impl/proxy_graph.cpp
  2. +11
    -0
      src/core/include/megbrain/graph/cg.h
  3. +1
    -1
      src/opr/impl/dnn/batch_norm.cpp

+ 1
- 0
imperative/src/impl/proxy_graph.cpp View File

@@ -376,6 +376,7 @@ public:

ProxyGraphImpl(ProxyGraph* owner) : m_owner(owner) {
options().imperative_proxy_graph = true;
options().no_force_inplace = true;
options().log_level = 0;
m_var_receiver_info.dev_value = 1;
m_var_receiver_info.allow_empty_value = 1;


+ 11
- 0
src/core/include/megbrain/graph/cg.h View File

@@ -464,6 +464,17 @@ class ComputingGraph : public std::enable_shared_from_this<ComputingGraph>,

bool imperative_proxy_graph = false;

/*!
* Request that operators should not force update their inputs.
*
* THIS FLAG IS RESERVED FOR INTERNAL USE
*
* When this flag is set, operators like AddUpdate and BatchNorm
* will still attempt to inplace update their inputs, but failing
* to do so will not be considered as an error.
*/
bool no_force_inplace = false;

//! add extra deps for the comp seq if a specific var is dependent
ThinHashMap<VarNode*, VarNodeArray> extra_vardeps;



+ 1
- 1
src/opr/impl/dnn/batch_norm.cpp View File

@@ -40,7 +40,7 @@ BatchNormForward::BatchNormForward(VarNode *x,
Super{x->owner_graph(), config, "batch_norm",
{x, scale, bias, mean, variance}}
{
if(owner_graph()->options().imperative_proxy_graph) {
if(owner_graph()->options().no_force_inplace) {
m_force_inplace = false;
}



Loading…
Cancel
Save