Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiweibo committed Apr 5, 2022
1 parent 1888f1a commit 62b5d17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions paddle/phi/backends/gpu/gpu_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,15 @@ static void StreamCallbackFunc(gpuStream_t stream,

} // namespace internal

void DnnWorkspaceHandle::ResetWorkspace() { allocation_ = nullptr; }
void DnnWorkspaceHandle::ResetWorkspace() {
std::lock_guard<std::mutex> guard(*mtx_);
allocation_ = nullptr;
}

void DnnWorkspaceHandle::ReallocWorkspace(size_t required_workspace_bytes) {
if (required_workspace_bytes <= WorkspaceSize()) return;
// reset allocation first before re-allocate to save memory
std::lock_guard<std::mutex> guard(*mtx_);
allocation_.reset();
allocation_ = allocator_->Allocate(required_workspace_bytes);
}
Expand All @@ -168,7 +172,6 @@ inline void DnnWorkspaceHandle::RunFunc(
const std::function<void(void*)>& cudnn_func,
size_t required_workspace_bytes) {
if (required_workspace_bytes > WorkspaceSize()) {
std::lock_guard<std::mutex> guard(*mtx_);
ReallocWorkspace(required_workspace_bytes);
}
{
Expand All @@ -189,6 +192,7 @@ inline void DnnWorkspaceHandle::RunFuncSync(
}

inline size_t DnnWorkspaceHandle::WorkspaceSize() {
std::lock_guard<std::mutex> guard(*mtx_);
if (allocation_ == nullptr) {
return 0;
}
Expand Down

1 comment on commit 62b5d17

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on 62b5d17 Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #39442 Commit ID: 62b5d17 contains failed CI.

🔹 Failed: PR-CI-Windows

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-ROCM-Compile

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-Coverage

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-GpuPS

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-Inference

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-CINN

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-Build

Unknown Failed
Unknown Failed

🔹 Failed: PR-CE-Framework

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-ScienceTest

Unknown Failed
Unknown Failed

🔹 Failed: PR-CI-Static-Check

Unknown Failed
Unknown Failed

Please sign in to comment.