Skip to content

Commit

Permalink
Accelerate inference period in op Cache method (#43857)
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyIsFunny authored Jul 19, 2022
1 parent 2a2bc0b commit a8680f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions paddle/fluid/framework/operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,11 @@ void OperatorWithKernel::RunImpl(const Scope& scope,
RuntimeContext ctx(Inputs(), Outputs(), scope);
RunImpl(scope, place, &ctx);
pre_scope_ = cur_scope;
} else if (run_phi_kernel_ && impl_ != nullptr && !need_prepare_data_ &&
!need_prepare_phi_data_) {
if (!all_kernels_must_compute_runtime_shape_)
this->Info().infer_shape_(impl_->getRuntimeInferShapeContext());
(*pt_kernel_)(impl_->getKernelContext());
} else {
if (runtime_ctx_.get() == nullptr || pre_scope_ != cur_scope) {
std::lock_guard<std::mutex> lock(cache_update_mutex_);
Expand Down

0 comments on commit a8680f5

Please sign in to comment.