Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiu committed Aug 9, 2021
1 parent 2a05e47 commit 2d6d013
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions paddle/fluid/memory/allocation/npu_pinned_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void NPUPinnedAllocator::ProcessEventsAndFree() {
}

Allocation *NPUPinnedAllocator::AllocateImpl(size_t size) {
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(mtx_);
ProcessEventsAndFree();
void *ptr;
int error = posix_memalign(&ptr, kAlignment, size);
Expand All @@ -51,7 +51,7 @@ Allocation *NPUPinnedAllocator::AllocateImpl(size_t size) {
}

void NPUPinnedAllocator::FreeImpl(Allocation *allocation) {
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(mtx_);
void *ptr = allocation->ptr();
auto iter = npu_events_.find(allocation);
aclrtEvent event = iter->second;
Expand All @@ -67,14 +67,14 @@ void NPUPinnedAllocator::FreeImpl(Allocation *allocation) {
}

uint64_t NPUPinnedAllocator::ReleaseImpl(const platform::Place &place) {
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(mtx_);
// Empty implementation
return static_cast<uint64_t>(0);
}

void NPUPinnedAllocator::RecordEvent(Allocation *allocation,
aclrtStream stream) {
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(mtx_);
aclrtEvent event = nullptr;
PADDLE_ENFORCE_NPU_SUCCESS(aclrtCreateEvent(&event));
PADDLE_ENFORCE_NPU_SUCCESS(aclrtRecordEvent(event, stream));
Expand Down

1 comment on commit 2d6d013

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

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

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.