diff --git a/paddle/fluid/memory/allocation/npu_pinned_allocator.cc b/paddle/fluid/memory/allocation/npu_pinned_allocator.cc index 951564972580d..9178825efa9e1 100644 --- a/paddle/fluid/memory/allocation/npu_pinned_allocator.cc +++ b/paddle/fluid/memory/allocation/npu_pinned_allocator.cc @@ -39,7 +39,7 @@ void NPUPinnedAllocator::ProcessEventsAndFree() { } Allocation *NPUPinnedAllocator::AllocateImpl(size_t size) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mtx_); ProcessEventsAndFree(); void *ptr; int error = posix_memalign(&ptr, kAlignment, size); @@ -51,7 +51,7 @@ Allocation *NPUPinnedAllocator::AllocateImpl(size_t size) { } void NPUPinnedAllocator::FreeImpl(Allocation *allocation) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mtx_); void *ptr = allocation->ptr(); auto iter = npu_events_.find(allocation); aclrtEvent event = iter->second; @@ -67,14 +67,14 @@ void NPUPinnedAllocator::FreeImpl(Allocation *allocation) { } uint64_t NPUPinnedAllocator::ReleaseImpl(const platform::Place &place) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mtx_); // Empty implementation return static_cast(0); } void NPUPinnedAllocator::RecordEvent(Allocation *allocation, aclrtStream stream) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mtx_); aclrtEvent event = nullptr; PADDLE_ENFORCE_NPU_SUCCESS(aclrtCreateEvent(&event)); PADDLE_ENFORCE_NPU_SUCCESS(aclrtRecordEvent(event, stream));