Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XPU] malloc L3 cache in predictor run #5868

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lite/api/cxx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,16 @@ class LITE_API Predictor {
GenRuntimeProgram();
}
CheckInputValid();

#ifdef LITE_WITH_XPU
lite::TargetWrapperXPU::MallocL3Cache();
#endif

program_->Run();

#ifdef LITE_WITH_XPU
lite::TargetWrapperXPU::FreeL3Cache();
#endif
}

// Get offset-th col of feed inputs.
Expand Down
8 changes: 0 additions & 8 deletions lite/core/program.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,6 @@ void RuntimeProgram::Run() {
}
#endif

#ifdef LITE_WITH_XPU
lite::TargetWrapperXPU::MallocL3Cache();
#endif

int idx = -1;
auto& insts = instructions_[kRootBlockIdx];
for (auto& inst : insts) {
Expand Down Expand Up @@ -323,10 +319,6 @@ void RuntimeProgram::Run() {
<< precision_profiler_summary
<< inst_precision_profiler.GetSummaryTail();
#endif

#ifdef LITE_WITH_XPU
lite::TargetWrapperXPU::FreeL3Cache();
#endif
}

void Program::Build(const std::shared_ptr<cpp::ProgramDesc>& program_desc) {
Expand Down