diff --git a/paddle/fluid/framework/ir/runtime_context_cache_pass.cc b/paddle/fluid/framework/ir/runtime_context_cache_pass.cc index 75f3795185bf49002f26fddf03f061fb0cbeb468..67b29512c4cf3512e4b2b4b5a18ba60a3d9120dc 100644 --- a/paddle/fluid/framework/ir/runtime_context_cache_pass.cc +++ b/paddle/fluid/framework/ir/runtime_context_cache_pass.cc @@ -25,7 +25,7 @@ std::unique_ptr RuntimeContextCachePass::ApplyImpl( VLOG(3) << "Applies Runtime Context Cache strategy."; for (const Node* n : graph->Nodes()) { if (n->IsOp()) { - n->Op()->SetAttr(kEnableRuntimeContext, true); + n->Op()->SetAttr(kEnableCacheRuntimeContext, true); } } return graph; diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index ac1ad2b05e1d75b37a90cc600f52657f134caec1..ab96201b3399c9daf3cf7e132d3f088a5ab41e7d 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -876,7 +876,7 @@ std::vector* OperatorWithKernel::GetKernelConfig( RuntimeContext* OperatorWithKernel::GetRuntimeContext( const Scope& scope) const { - if (!HasAttr(kEnableRuntimeContext)) { + if (!HasAttr(kEnableCacheRuntimeContext)) { return new RuntimeContext(Inputs(), Outputs(), scope); } else { const Scope* cur_scope = &scope; diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index f0592f4f5fc7507ede137918ce7ae591cc515171..ca5f0e27b368912bc6bd1554f3b0fbf05f9a147d 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -63,12 +63,12 @@ constexpr char kZeroVarSuffix[] = "@ZERO"; constexpr char kNewGradSuffix[] = "@NEWGRAD@"; /// RuntimeContext is used to relate input/output names of Operator with -/// the corresponding variables in Scope. -/// If an Op has attribute kEnableRuntimeContext, it means that in a same Scope, -/// since the input/output names of this Op do not change in the execution, -/// RuntimeContext could be created only at the first iteration of this Op's -/// execution to save the elapsed time. -constexpr char kEnableRuntimeContext[] = "@ENABLE_RUNTIME_CONTEXT@"; +/// the corresponding variables in name scope. +/// If an Op has attribute kEnableCacheRuntimeContext, it means that in a same +/// name scope, since the input/output names of this Op do not change in the +/// execution, RuntimeContext could be created only at the first iteration of +/// this Op's execution to save the elapsed time. +constexpr char kEnableCacheRuntimeContext[] = "@ENABLE_CACHE_RUNTIME_CONTEXT@"; /// If an Op has this attribute, all its kernels should calculate output /// variable's shape in the corresponding Compute() function. And